Skip to content

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki committed Jul 1, 2024
1 parent 34371c8 commit 3ded5ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
6 changes: 4 additions & 2 deletions packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"build": "rollup --config rollup.config.js",
"lint": "eslint src --ext .ts",
"chains:generate": "tsx ./src/scripts/codegen.ts",
"postpublish": "git reset --hard",
"prepublishOnly": "node scripts/prepublish.js"
"postpublish": "git checkout -- package.json",
"prepublishOnly": "npm run build && node scripts/prepublish.cjs",
"prepack": "npm run build && node scripts/prepublish.cjs",
"postpack": "git checkout -- package.json"
},
"peerDependencies": {
"react": "17.x || 18.x",
Expand Down
18 changes: 18 additions & 0 deletions packages/widget/scripts/prepublish.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const fs = require('fs/promises');
const path = require('path');
const packageJson = require('../package.json');
const coreVersion = require('@skip-go/core/package.json').version;

async function prepublish() {
delete packageJson.scripts;
delete packageJson.devDependencies;
packageJson.dependencies['@skip-go/core'] = coreVersion;
const targetPath = path.resolve(process.cwd(), 'package.json');
await fs.writeFile(targetPath, JSON.stringify(packageJson, null, 2), {
encoding: 'utf-8',
});
}

void prepublish();
16 changes: 0 additions & 16 deletions packages/widget/scripts/prepublish.js

This file was deleted.

0 comments on commit 3ded5ac

Please sign in to comment.