Skip to content

Commit

Permalink
switch to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceMaes committed Aug 18, 2024
1 parent 2951f07 commit 7853d46
Show file tree
Hide file tree
Showing 48 changed files with 2,371 additions and 1,511 deletions.
10 changes: 9 additions & 1 deletion app/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Application from '@ember/application';
import compatModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'ember-embroider-pokedex/config/environment';
import './app.css';

import './app.css'
let d = window.define;

for (const [name, module] of Object.entries(compatModules)) {
d(name, function () {
return module;
});
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
3 changes: 3 additions & 0 deletions app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from '@embroider/config-meta-loader';

export default loadConfigFromMeta('ember-embroider-pokedex');
13 changes: 9 additions & 4 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/ember-embroider-pokedex.css">
<link integrity="" rel="stylesheet" href="/@embroider/core/vendor.css">
<link integrity="" rel="stylesheet" href="/assets/ember-embroider-pokedex.css">

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand All @@ -20,8 +20,13 @@
<body class="bg-slate-50">
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/ember-embroider-pokedex.js"></script>
<script src="/@embroider/core/vendor.js"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
Expand Down
17 changes: 17 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let config;

// TODO - remove this once we have the better solution for injecting stage1 babel config into a real config file
// this is needed because there are things (like ember-composible-helpers) that are now finding our babel config during
// their stage1 build and historically they will never (99% of the time) have found any babel config.
// we might need to keep something like this so that prebuild will never apply babel configs during stage1 i.e. a util
// function that wraps your whole babel config
if (
process.env.EMBROIDER_PREBUILD ||
process.env.EMBROIDER_TEST_SETUP_FORCE === 'classic'
) {
config = {};
} else {
config = require('./node_modules/.embroider/_babel_config_');
}

module.exports = config;
25 changes: 1 addition & 24 deletions config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
{
"schemaVersion": "1.0.0",
"packages": [
{
"name": "ember-cli",
"version": "5.10.0",
"blueprints": [
{
"name": "app",
"outputRepo": "https://github.com/ember-cli/ember-new-output",
"codemodsSource": "ember-app-codemods-manifest@1",
"isBaseBlueprint": true,
"options": [
"--no-welcome",
"--pnpm",
"--embroider",
"--ci-provider=github",
"--typescript"
]
}
]
}
]
}
{"schemaVersion":"1.0.0","packages":[{"name":"@embroider/app-blueprint","version":"0.6.0","blueprints":[{"name":"@embroider/app-blueprint","isBaseBlueprint":true,"options":["--package-manager pnpm"]}]}]}
36 changes: 2 additions & 34 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { maybeEmbroider } = require('@embroider/test-setup');

module.exports = function (defaults) {
const app = new EmberApp(defaults, {
Expand All @@ -9,44 +10,11 @@ module.exports = function (defaults) {
// Add options here
});

const { Webpack } = require('@embroider/webpack');
const {
GlimmerScopedCSSWebpackPlugin,
} = require('glimmer-scoped-css/webpack');

return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticModifiers: true,
staticComponents: true,
staticEmberSource: true,
return maybeEmbroider(app, {
skipBabel: [
{
package: 'qunit',
},
],
packagerOptions: {
webpackConfig: {
plugins: [new GlimmerScopedCSSWebpackPlugin()],
module: {
rules: [
{
test: /.css$/i,
use: [
{
loader: 'postcss-loader',
options: {
postcssOptions: {
config: 'config/postcss.config.js',
},
},
},
],
},
],
},
},
},
});
};
33 changes: 14 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "tests"
},
"scripts": {
"build": "ember build --environment=production",
"build": "vite build",
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:css": "stylelint \"**/*.css\"",
"lint:css:fix": "concurrently \"pnpm:lint:css -- --fix\"",
Expand All @@ -21,9 +21,9 @@
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "glint",
"start": "ember serve",
"start": "vite",
"test": "concurrently \"pnpm:lint\" \"pnpm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test"
"test:ember": "vite build --mode test && ember test --path dist"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -38,12 +38,16 @@
"@ember-data-types/serializer": "5.4.0-alpha.98",
"@ember-data-types/store": "5.4.0-alpha.98",
"@ember-data-types/tracking": "5.4.0-alpha.98",
"@babel/eslint-parser": "^7.24.7",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@ember/optional-features": "^2.1.0",
"@ember/string": "^4.0.0",
"@ember/test-helpers": "^3.3.1",
"@embroider/compat": "^3.6.0",
"@embroider/core": "^3.4.14",
"@embroider/webpack": "^4.0.4",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.0",
"@embroider/compat": "3.5.7-unstable.c2dff54",
"@embroider/config-meta-loader": "0.0.1-unstable.c2dff54",
"@embroider/core": "3.4.15-unstable.c2dff54",
"@embroider/test-setup": "4.0.1-unstable.c2dff54",
"@embroider/vite": "0.2.1-unstable.c2dff54",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@glint/core": "1.4.1-unstable.01b8deb",
Expand All @@ -52,26 +56,21 @@
"@glint/template": "1.4.1-unstable.01b8deb",
"@tsconfig/ember": "^3.0.8",
"@types/dom-view-transitions": "^1.0.5",
"@types/ember__polyfills": "^4.0.6",
"@types/qunit": "^2.19.10",
"@types/rsvp": "^4.0.9",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@warp-drive-types/core-types": "0.0.0-alpha.84",
"autoprefixer": "^10.0.2",
"broccoli-asset-rev": "^3.0.0",
"@rollup/plugin-babel": "^6.0.4",
"concurrently": "^8.2.2",
"ember-auto-import": "^2.7.4",
"ember-cli": "~5.10.0",
"ember-cli-app-version": "^7.0.0",
"ember-cli-babel": "^8.2.0",
"ember-cli-clean-css": "^3.0.0",
"ember-cli-dependency-checker": "^3.3.2",
"ember-cli-htmlbars": "^6.3.0",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-data-types": "5.4.0-alpha.98",
"ember-eslint-parser": "^0.5.0",
"ember-fetch": "^8.1.2",
"ember-load-initializers": "^2.1.2",
"ember-modifier": "^4.2.0",
"ember-page-title": "^8.2.3",
Expand Down Expand Up @@ -102,6 +101,7 @@
"tailwindcss": "^3.0.0",
"tracked-built-ins": "^3.3.0",
"typescript": "^5.5.4",
"vite": "^5.4.1",
"webpack": "^5.93.0"
},
"engines": {
Expand All @@ -110,11 +110,6 @@
"ember": {
"edition": "octane"
},
"ember-addon": {
"paths": [
"lib/setup-ast-transforms"
]
},
"dependencies": {
"@ember-data/adapter": "5.4.0-alpha.98",
"@ember-data/graph": "5.4.0-alpha.98",
Expand Down
Loading

0 comments on commit 7853d46

Please sign in to comment.