Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
wendychaung committed May 2, 2023
1 parent 4ab811d commit d1b8339
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 11 deletions.
58 changes: 50 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"clean": "rimraf ./dist",
"build": "npm run clean && rollup -c",
"build": "npm run clean && rollup -c && node version.js",
"start": "react-scripts start"
},
"eslintConfig": {
Expand Down Expand Up @@ -47,10 +47,11 @@
"@babel/preset-react": "^7.18.6",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.2",
"rollup": "^2.79.1",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-dts": "^4.2.3"
"rollup-plugin-dts": "^4.2.3",
"rollup-plugin-typescript2": "^0.34.1"
}
}
15 changes: 15 additions & 0 deletions src/package.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test-web3-pay",
"version": "0.0.1",
"description": "For Test Only",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"peerDependencies": {
"ethers": "^5.7.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"license": "ISC"
}
20 changes: 20 additions & 0 deletions version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require("fs");
const PackageJson = require("./src/package.template.json");

let verArr = PackageJson.version.split(".");
verArr[2] = Number(verArr[2]) + 1;
let version = verArr.join(".")
PackageJson.version = version;

const functionStr = `${JSON.stringify(PackageJson, null, 4)}`;

fs.writeFile("./src/package.template.json", functionStr, (err, data) => {
if (err) throw err;
console.log("new version: " + version);

fs.copyFile("./src/package.template.json", "./dist/package.json", (err) => {
if (err) throw err;
console.log("copy 'src/package.template.json' to 'dist/package.json'")
})
});

0 comments on commit d1b8339

Please sign in to comment.