Skip to content

Commit

Permalink
fix: update linking scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
crherman7 committed May 21, 2024
1 parent 957e2e4 commit ac90c75
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"plugin",
"rechunk.podspec"
],
"workspaces": [
"app",
"docs",
"example"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
Expand All @@ -34,17 +39,21 @@
"build": "tsup",
"dev": "tsup --watch",
"prepare": "husky",
"prerelease": "scripts/remove-workspace",
"release": "release-it",
"postrelease": "scripts/restore-workspace"
"release": "release-it"
},
"release-it": {
"git": {
"commitMessage": "chore: release v${version}",
"requireCleanWorkingDir": false
"requireCleanWorkingDir": false,
"push": false,
"commit": false
},
"github": {
"release": true
},
"hooks": {
"before:init": "scripts/remove-workspace",
"after:release": "scripts/restore-workspace && git add -A && git commit -m \"chore: release\" && git push"
}
},
"source": "src/react-native/index",
Expand Down
15 changes: 13 additions & 2 deletions scripts/restore-workspace
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#!/usr/bin/env node

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

fs.copyFileSync(
path.resolve(workingPath, 'package.json.bak'),
const workingPath = process.cwd();

const {workspaces} = JSON.parse(
fs.readFileSync(path.resolve(workingPath, 'package.json.bak'), 'utf8'),
);

const packageJson = JSON.parse(
fs.readFileSync(path.resolve(workingPath, 'package.json'), 'utf8'),
);

fs.writeFileSync(
path.resolve(workingPath, 'package.json'),
`${JSON.stringify({...packageJson, workspaces}, null, 2)}\n`,
);

fs.unlinkSync(path.resolve(workingPath, 'package.json.bak'));

0 comments on commit ac90c75

Please sign in to comment.