Skip to content

Commit

Permalink
Re-add watch command
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmbradford committed Nov 14, 2024
1 parent cd68872 commit 42dad79
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ yarn
yarn build
```

Alternatively, to continuously watch the frontend assets and rebuild as necessary:

```
yarn
yarn watch
```

#### Viewing a sample crawl using a Python virtual environment

Run the viewer application using sample data:
Expand Down
14 changes: 12 additions & 2 deletions esbuild/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ const baseConfig = {
plugins: [],
};

const arg = process.argv.slice(2)[0];

(async function () {
const scriptsConfig = scripts(baseConfig);
const ctx = await esbuild.context(scriptsConfig);

await ctx.rebuild();
await ctx.dispose();
if (arg === 'watch') {
const ctx = await esbuild.context(scriptsConfig);
await ctx.watch();
// Not disposing context here as the user will ctrl+c to end watching.
} else {
const ctx = await esbuild.context(scriptsConfig);
await ctx.rebuild();
await ctx.dispose();
}

})();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clean": "rm -rf ./viewer/static/",
"prettier": "prettier . --check",
"prettier:fix": "prettier . --write",
"watch": "yarn build --watch"
"watch": "yarn build watch"
},
"dependencies": {
"@cfpb/cfpb-design-system": "^3.4.9",
Expand Down

0 comments on commit 42dad79

Please sign in to comment.