Skip to content

Commit

Permalink
fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed May 21, 2024
1 parent 17f0c6f commit e63ce96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"*.d.ts"
],
"scripts": {
"build": "node scripts/delete-playwright-cache.js && tsup",
"build": "tsup",
"build:nocache": "node scripts/delete-playwright-cache.js && tsup",
"build-storybook": "storybook build",
"build:watch": "concurrently \"tsup --watch\" \"nodemon\"",
"generate-dynamic-stories": "node scripts/generate-dynamic-stories.js",
Expand Down
12 changes: 7 additions & 5 deletions scripts/delete-playwright-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
* these changes would not be reflected in the test-runner. This script (hooked to nodemon) makes sure that
* whenever you change the csf-playwright-plugin.ts file, the cache is cleared and you actually get your changes.
*/
if (process.platform !== 'darwin') {
throw new Error('This script only works on macOS.');
}

const fs = require('fs').promises;
const path = require('path');

Expand Down Expand Up @@ -62,6 +58,10 @@ async function findPlaywrightTransformCacheDir(dirPath) {
// This is the pattern used by Playwright: /var/folders/{some-hash}/{some-other-hash}/T/playwright-transform-cache-501
// it will look like this /var/folders/sv/lg8lnv0s4gg6_rt7s6cd52qr0000gn/T/playwright-transform-cache-501
const main = async () => {
if (process.platform !== 'darwin') {
throw new Error('This script only works on macOS.');
}

let playwrightTransformPath = await getCachedPath();

if (!playwrightTransformPath) {
Expand All @@ -81,4 +81,6 @@ const main = async () => {
}
};

main();
if (process.env.CI === undefined) {
main();
}

0 comments on commit e63ce96

Please sign in to comment.