Skip to content

Commit

Permalink
Merge pull request #86 from universal-ember/fix-watching
Browse files Browse the repository at this point in the history
Fix app watching -- Copy content from #82
  • Loading branch information
NullVoxPopuli authored Jul 3, 2024
2 parents d40df03 + c841781 commit 3637439
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 202 deletions.
32 changes: 32 additions & 0 deletions docs-app/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const path = require('path');
const fs = require('fs');

module.exports = async function (defaults) {
const { readPackageUpSync } = await import('read-package-up');

const app = new EmberApp(defaults, {
// Add options here
trees: {
app: (() => {
let sideWatch = require('@embroider/broccoli-side-watch');

let paths = ['kolay', '@universal-ember/kolay-ui'].map((libraryName) => {
let entry = require.resolve(libraryName);
let { packageJson, path: packageJsonPath } = readPackageUpSync({ cwd: entry });
let packagePath = path.dirname(packageJsonPath);

console.debug(
`Side-watching ${libraryName} from ${packagePath}, which started in ${entry}`
);

let toWatch = packageJson.files
.map((f) => path.join(packagePath, f))
.filter((p) => {
if (!fs.existsSync(p)) return false;
if (!fs.lstatSync(p).isDirectory()) return false;

return !p.endsWith('/src');
});

return toWatch;
});

return sideWatch('app', { watching: paths.flat() });
})(),
},
'ember-cli-babel': {
enableTypeScriptTransform: true,
},
Expand Down
2 changes: 2 additions & 0 deletions docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.0",
"@ember/test-waiters": "^3.1.0",
"@embroider/broccoli-side-watch": "0.0.2-unstable.ba9fd29",
"@embroider/compat": "^3.4.8",
"@embroider/core": "^3.4.8",
"@embroider/webpack": "^4.0.0",
Expand Down Expand Up @@ -79,6 +80,7 @@
"prettier-plugin-ember-template-tag": "^2.0.0",
"qunit": "^2.20.0",
"qunit-dom": "^3.2.0",
"read-package-up": "^11.0.0",
"stylelint": "^16.4.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-prettier": "^5.0.0",
Expand Down
Loading

0 comments on commit 3637439

Please sign in to comment.