Skip to content

Commit

Permalink
fix boot
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Pircher <[email protected]>
  • Loading branch information
patricklx committed Mar 25, 2024
1 parent cf2024e commit 9fd2033
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 92 deletions.
20 changes: 13 additions & 7 deletions carbon-components-ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
},
"dependencies": {
"ember-resize-modifier": "^0.6.0",
"@ascua/maths": "^0.0.237",
"@ember/jquery": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/render-modifiers": "^2.1.0",
"@ascua/arrays": "^0.0.237",
"@ascua/maths": "^0.0.237",
"@babel/core": "^7.24.0",
"@babel/plugin-syntax-decorators": "^7.22.5",
"@carbon/charts": "^1.11.2",
Expand All @@ -51,6 +47,9 @@
"@carbon/styles": "^1.31.2",
"@carbon/themes": "^11.20.0",
"@carbon/type": "^11.19.0",
"@ember/jquery": "^2.0.0",
"@ember/render-modifiers": "^2.1.0",
"@ember/string": "^3.1.1",
"@embroider/addon-shim": "^1.8.7",
"@eslint/js": "^8.41.0",
"@gavant/glint-template-types": "^0.3.3",
Expand All @@ -59,6 +58,7 @@
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/node": "^18.15.2",
"astroturf": "^1.2.0",
"broccoli-sass-source-maps": "^4.1.0",
"d3": "^7.8.5",
"d3-array": "^3.2.2",
Expand Down Expand Up @@ -90,6 +90,7 @@
"ember-power-calendar-moment": "^0.2.0",
"ember-power-select": "^7.1.0",
"ember-ref-modifier": "^1.0.0",
"ember-resize-modifier": "^0.6.0",
"ember-simple-mu-resolver": "^0.1.11",
"ember-template-imports": "^3.4.2",
"ember-template-lint-plugin-prettier": "^4.2.0",
Expand All @@ -103,11 +104,11 @@
"rollup-plugin-astroturf": "^0.1.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-root-import": "^1.0.0",
"rollup-plugin-styles": "^4.0.0",
"spark-md5": "^3.0.1",
"synckit": "^0.8.5",
"ts-node": "^10.9.1",
"yam": "^1.0.0",
"astroturf": "^1.2.0"
"yam": "^1.0.0"
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
Expand Down Expand Up @@ -276,6 +277,11 @@
"types": "./declarations/*.d.ts",
"default": "./dist/*.js"
},
"./styles": {
"import": "./dist/styles/index.scss",
"require": "./dist/styles/index.scss",
"scss": "./dist/styles/index.scss"
},
"./addon-main.js": "./addon-main.cjs"
},
"typesVersions": {
Expand Down
2 changes: 1 addition & 1 deletion carbon-components-ember/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
addon.keepAssets(['styles/**/*.scss']),

// Remove leftover build artifacts when starting a new build.
addon.clean({}),
//addon.clean({}),

rootImport({
// Will first look in `client/src/*` and then `common/src/*`.
Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions carbon-components-ember/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,5 @@ $ember-power-select-multiple-option-line-height: 1.45 !default;
}
}

@import "../ember-power-select";
@import "../ember-basic-dropdown";
@import "ember-power-select";
@import "ember-basic-dropdown";
1 change: 1 addition & 0 deletions doc-app/app/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'carbon-components-ember/styles';
16 changes: 13 additions & 3 deletions doc-app/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import './setup-config';
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'doc-app/config/environment';
import { RSVP } from '@ember/-internals/runtime';
import Ember from 'ember';

window.define('doc-app/config/environment', () => config);
import './app.scss';
window.define('rsvp', () => RSVP);
window.define('ember', () => Ember);

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;

init(properties: object | undefined) {
super.init(properties);
loadInitializers(App, config.modulePrefix);
}
}

loadInitializers(App, config.modulePrefix);

import.meta.hot.on('vite:beforeUpdate', (options) => {
options.updates = options.updates.filter(
(u) => !u.path.startsWith(`/assets/${config.modulePrefix}.js`),
);
});
1 change: 0 additions & 1 deletion doc-app/app/pods/docs/components/accordion/route.gts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class RouteComponent extends Component {
</Accordion>
{{/let}}
</demo.example>
<demo.snippet @name='accordion-simple.hbs' />
</Demo>
</template>
}
Expand Down
5 changes: 5 additions & 0 deletions doc-app/app/setup-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import config from 'doc-app/config/environment';

window.define('doc-app/config/environment', () => ({
default: config
}));
5 changes: 0 additions & 5 deletions doc-app/app/styles/app.scss

This file was deleted.

9 changes: 4 additions & 5 deletions doc-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint:js:fix": "eslint . --fix",
"start": "vite --force",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test"
"test:ember": "ember b"
},
"devDependencies": {
"vite": "^5.1.6",
Expand All @@ -32,10 +32,10 @@
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.0",
"@embroider/compat": "3.4.6-unstable.f30e685",
"@embroider/core": "3.4.6-unstable.f30e685",
"@embroider/compat": "3.4.6-unstable.bac2415",
"@embroider/core": "3.4.6-unstable.bac2415",
"@embroider/test-setup": "^3.0.1",
"@embroider/vite": "0.2.1-unstable.f30e685",
"@embroider/vite": "0.2.1-unstable.bac2415",
"@embroider/webpack": "^3.2.2",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
Expand Down Expand Up @@ -82,7 +82,6 @@
"stylelint-prettier": "^3.0.0",
"tracked-built-ins": "^3.1.1",
"webpack": "^5.90.3",
"ember-template-imports": "^4.1.0",
"ember-routable-component": "^0.2.0"
},
"engines": {
Expand Down
53 changes: 51 additions & 2 deletions doc-app/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,56 @@ import {
optimizeDeps,
compatPrebuild,
} from "@embroider/vite";
import { resolve } from "path";
import { resolve, join } from "path";
import { existsSync } from "fs";
import { babel } from "@rollup/plugin-babel";
import { hmr } from 'ember-vite-hmr';
import { ResolverLoader } from '@embroider/core';
import { RollupModuleRequest } from '@embroider/vite/src/request';

const root = "node_modules/.embroider/rewritten-app";

const resolverLoader = new ResolverLoader(process.cwd());

const pathsImporter = () => {
const addons = [];
for (const engine of resolverLoader.resolver.options.engines) {
for (const activeAddon of engine.activeAddons) {
const stylesFolder = join(activeAddon.root, '_app_styles_');
if (existsSync(stylesFolder)) {
addons.push(stylesFolder);
} else {
addons.push(activeAddon.root);
}
}
}
async function search(url) {
if (existsSync(url)) {
return null;
}
for (const p of addons) {
let newPath = join(p, url);
if (!newPath.endsWith('.scss') && !newPath.endsWith('.sass') && !newPath.endsWith('.css')) {
newPath += '.scss';
}
if (existsSync(newPath)) {
return {
file: newPath
};
}
}
return null
}
return (url, prev, done) => {
search(url).then(done).catch(e => done(null));
};
};

const sassOptions = {
alias: [],
importer: [pathsImporter()]
}

export default defineConfig({
root,
// esbuild in vite does not support decorators
Expand All @@ -36,7 +80,12 @@ export default defineConfig({
extensions: [".gjs", ".js", ".hbs", ".ts", ".gts"],
}),
],
optimizeDeps: Object.assign(optimizeDeps(), { exclude: ['carbon-components-ember', '@embroider/macros'] }),
css: {
preprocessorOptions: {
scss: sassOptions
}
},
optimizeDeps: Object.assign(optimizeDeps(), { exclude: ['@embroider/macros'] }),
server: {
port: 4200,
watch: {
Expand Down
Loading

0 comments on commit 9fd2033

Please sign in to comment.