Skip to content

Commit

Permalink
Fixed deploy script on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
timocov committed Sep 19, 2022
1 parent 1b4fa68 commit ab0d6c6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@types/mocha": "~5.2.7",
"@types/node": "~12.0.4",
"chai": "~4.2.0",
"clean-publish": "~1.1.2",
"mocha": "~6.2.2",
"ts-compiler": "npm:typescript@4.8.2",
"ts-node": "~8.4.1",
Expand Down
2 changes: 1 addition & 1 deletion prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ npm run tsc
cp -r lib/src/* dist/

echo ">> Cleaning up a package.json file..."
./node_modules/.bin/clear-package-json package.json --fields private -o package.json
node scripts/clean-package-json.js

echo "Package is ready to publish"
26 changes: 26 additions & 0 deletions scripts/clean-package-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node

/**
* This script does something like https://github.com/shashkovdanil/clean-publish does
* but it seems that clean-publish isn't supported anymore and we can't use it in CI
*/

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

function main() {
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');

const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));

delete packageJson.private;
delete packageJson.engines;
delete packageJson.devDependencies;
delete packageJson.scripts;

fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', { encoding: 'utf-8' });
}

if (require.main === module) {
main();
}

0 comments on commit ab0d6c6

Please sign in to comment.