Skip to content

Commit 3637439

Browse files
Merge pull request #86 from universal-ember/fix-watching
Fix app watching -- Copy content from #82
2 parents d40df03 + c841781 commit 3637439

File tree

3 files changed

+103
-202
lines changed

3 files changed

+103
-202
lines changed

docs-app/ember-cli-build.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
'use strict';
22

33
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4+
const path = require('path');
5+
const fs = require('fs');
46

57
module.exports = async function (defaults) {
8+
const { readPackageUpSync } = await import('read-package-up');
9+
610
const app = new EmberApp(defaults, {
711
// Add options here
12+
trees: {
13+
app: (() => {
14+
let sideWatch = require('@embroider/broccoli-side-watch');
15+
16+
let paths = ['kolay', '@universal-ember/kolay-ui'].map((libraryName) => {
17+
let entry = require.resolve(libraryName);
18+
let { packageJson, path: packageJsonPath } = readPackageUpSync({ cwd: entry });
19+
let packagePath = path.dirname(packageJsonPath);
20+
21+
console.debug(
22+
`Side-watching ${libraryName} from ${packagePath}, which started in ${entry}`
23+
);
24+
25+
let toWatch = packageJson.files
26+
.map((f) => path.join(packagePath, f))
27+
.filter((p) => {
28+
if (!fs.existsSync(p)) return false;
29+
if (!fs.lstatSync(p).isDirectory()) return false;
30+
31+
return !p.endsWith('/src');
32+
});
33+
34+
return toWatch;
35+
});
36+
37+
return sideWatch('app', { watching: paths.flat() });
38+
})(),
39+
},
840
'ember-cli-babel': {
941
enableTypeScriptTransform: true,
1042
},

docs-app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@ember/string": "^3.1.1",
3535
"@ember/test-helpers": "^3.3.0",
3636
"@ember/test-waiters": "^3.1.0",
37+
"@embroider/broccoli-side-watch": "0.0.2-unstable.ba9fd29",
3738
"@embroider/compat": "^3.4.8",
3839
"@embroider/core": "^3.4.8",
3940
"@embroider/webpack": "^4.0.0",
@@ -79,6 +80,7 @@
7980
"prettier-plugin-ember-template-tag": "^2.0.0",
8081
"qunit": "^2.20.0",
8182
"qunit-dom": "^3.2.0",
83+
"read-package-up": "^11.0.0",
8284
"stylelint": "^16.4.0",
8385
"stylelint-config-standard": "^36.0.0",
8486
"stylelint-prettier": "^5.0.0",

0 commit comments

Comments
 (0)