Skip to content

Commit

Permalink
feat: add postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
sashtje committed Sep 29, 2023
1 parent 6acf420 commit 7e20261
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ npm run start:dev or npm run start:dev:vite - to launch client and backend part
- `npm run storybook` - Running storybook
- `npm run storybook:build` - Build storybook
- `npm run prepare` - Pre-commit hooks
- `npm run postinstall` - Deleting cache in node_modules

----

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
"test:ui": "npx loki test",
"test:ui:ok": "npx loki approve",
"test:ui:ci": "npx loki --requireReference --reactUri file:./storybook-static",
"test:ui:json": "node scripts/generate-visual-json-report.js",
"test:ui:json": "node ./scripts/generate-visual-json-report.js",
"test:ui:html": "reg-cli --from .loki/report.json --report .loki/report.html",
"test:ui:report": "npm run test:ui:json && npm run test:ui:html",
"storybook": "start-storybook -p 6006 -c ./config/storybook",
"storybook:build": "build-storybook -c ./config/storybook",
"prepare": "husky install"
"prepare": "husky install",
"postinstall": "node ./scripts/clear-cache.js"
},
"keywords": [],
"author": "",
Expand Down
7 changes: 7 additions & 0 deletions scripts/clear-cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require('fs');
const path = require('path');

const cacheDir = path.resolve(__dirname, '..', 'node_modules', '.cache');
fs.rmSync(cacheDir, { recursive: true, force: true });

console.log('The cache was successfully deleted');

0 comments on commit 7e20261

Please sign in to comment.