Skip to content

Commit

Permalink
Move clean script out of next-js example to /examples
Browse files Browse the repository at this point in the history
This way the example directory contains pretty much only this relevant to the example logic itself.
  • Loading branch information
davidstraka2 committed Jan 24, 2020
1 parent 58c34b2 commit 9e4d654
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 16 deletions.
8 changes: 0 additions & 8 deletions examples/next-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ npm start

Local dev server ready on `http://localhost:3000`.

### Clean

Delete any reproducible files.

```shell
npm run clean
```

### Dev server

Start local dev server **without** installing/checking dependencies and making
Expand Down
2 changes: 0 additions & 2 deletions examples/next-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"private": true,
"scripts": {
"clean": "node scripts/clean.js",
"dev-server": "next",
"make-spritesheets": "node scripts/make-spritesheets.js",
"postinstall": "npm run make-spritesheets",
Expand All @@ -14,7 +13,6 @@
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.12.0",
"fs-extra": "^8.1.0",
"iconlist": "^1.1.4"
}
}
32 changes: 32 additions & 0 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"private": true,
"description": "This is not meant to be used as a standalone project",
"scripts": {
"clean": "node scripts/clean.js",
"lint": "eslint ."
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-plugin-react": "^7.17.0"
"eslint-plugin-react": "^7.17.0",
"fs-extra": "^8.1.0"
}
}
11 changes: 6 additions & 5 deletions examples/next-js/scripts/clean.js → examples/scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ const fs = require('fs-extra');

const clean = async () => {
const promises = [];
/** rm -rf {{path}}; path is relative to demo package root */
/** rm -rf {{path}}; path is relative to this package root */
const rm = path => promises.push(fs.remove(path));

rm('node_modules/');
rm('.next/');
rm('public/static/icons/');
rm('tmp/');
// Clean next-js example
rm('next-js/node_modules/');
rm('next-js/.next/');
rm('next-js/public/static/icons/');
rm('next-js/tmp/');

await Promise.all(promises);
console.log('Clean finished.');
Expand Down

0 comments on commit 9e4d654

Please sign in to comment.