Skip to content

Commit e4e231f

Browse files
committed
move copy files to prepublish script
1 parent a0b75a9 commit e4e231f

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Since 20201, the _Lightning Flow Scanner_ has grown from its roots as VS Code tool to empower Salesforce Developers across six free and open-source platforms—from developer tools to native Salesforce App—delivering a unified experience for robust static analysis of Flows. Our dedicated community has shared their expertise to deepen understanding of Flow optimization. Your support can amplify our impact. Here’s how you can contribute to the [Flow Scanner](https://github.com/Flow-Scanner) project:
44

5-
- ⭐ Star your favorite repositories.
5+
- ⭐ Star or follow the project.
66
- 📢 Share our work with your network.
77
- 💬 Share feedback to help us improve.
88
- 💻 Contribute code by submitting pull requests.

packages/core/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"types": "./out/index.d.ts"
1111
}
1212
},
13-
"files": ["out", "README.md", "LICENSE.md"],
1413
"engines": {
1514
"node": "^18 || ^20 || ^22 || ^23"
1615
},
@@ -19,10 +18,10 @@
1918
"build:js": "swc src --out-dir out --copy-files --strip-leading-paths --config-file .swcrc",
2019
"build:types": "tsc -p tsconfig.types.json --declaration --emitDeclarationOnly --outDir out",
2120
"copy:media": "node -e \"require('fs').cpSync('assets/media','out/assets/media',{recursive:true,force:true}) || require('fs').mkdirSync('out/assets/media',{recursive:true})\"",
22-
"copy:root-files:out": "node -e \"['../../README.md','../../LICENSE.md','../../SECURITY.md','../../CONTRIBUTING.md','package.json'].forEach(f=>require('fs').copyFileSync(f,'out/'+f.split('/').pop()))\"",
21+
"prepare:publish": "node ../../scripts/prepare-publish.js",
2322
"copy:root-files:dist": "node -e \"['../../LICENSE.md'].forEach(f => { const n = f.split('/').pop(); if (require('fs').existsSync(f)) require('fs').copyFileSync(f, 'dist/'+n) })\"",
2423
"____main____": "__DEVELOPER COMMANDS__",
25-
"build": "npm run clean && npm run build:js && npm run build:types && npm run copy:media && npm run copy:root-files:out",
24+
"build": "npm run clean && npm run build:js && npm run build:types && npm run copy:media && npm run prepare:publish",
2625
"test": "npm run test:umd",
2726
"test:node": "jest",
2827
"test:umd": "npm run build:js && vite build && npm run copy:root-files:dist && cross-env UMD_PATH=dist/lightning-flow-scanner-core.umd.js jest",
@@ -85,4 +84,4 @@
8584
"security-scanner",
8685
"static-analysis"
8786
]
88-
}
87+
}

scripts/prepare-publish.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// packages/core/scripts/prepare-publish.js
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
// Read the source package.json
6+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
7+
8+
// Create a new package.json for publishing
9+
const publishPkg = {
10+
...pkg,
11+
// Fix paths - in the published package, files are at the root of out/
12+
main: "index.js",
13+
types: "index.d.ts",
14+
exports: {
15+
".": {
16+
import: "./index.js",
17+
types: "./index.d.ts"
18+
}
19+
},
20+
// Remove dev-only scripts
21+
scripts: undefined,
22+
devDependencies: undefined
23+
};
24+
25+
// Copy root files from monorepo root
26+
['README.md','LICENSE.md','SECURITY.md','CONTRIBUTING.md'].forEach(f => {
27+
const source = path.join('..', '..', f);
28+
const dest = path.join('out', f);
29+
if (fs.existsSync(source)) {
30+
fs.copyFileSync(source, dest);
31+
}
32+
});
33+
34+
// Write the cleaned package.json
35+
fs.writeFileSync(
36+
path.join('out', 'package.json'),
37+
JSON.stringify(publishPkg, null, 2) + '\n'
38+
);
39+
40+
console.log('✓ Prepared package for publishing in out/');

0 commit comments

Comments
 (0)