Skip to content

Commit

Permalink
Dropped clean-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
timocov committed Jun 30, 2020
1 parent c827abf commit 1930d3f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ package-lock.json
package-lock.json.*

!.mocharc.js
!scripts/clean-package-json.js
!tests/test-cases/**/output.js
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@types/mocha": "~7.0.2",
"@types/node": "~13.13.4",
"chai": "~4.2.0",
"clean-publish": "~1.1.2",
"mocha": "~8.0.1",
"npm-run-all": "~4.1.5",
"rimraf": "~3.0.2",
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 @@ mkdir -p dist/
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 1930d3f

Please sign in to comment.