Skip to content

Commit

Permalink
fix(build.sh): fix bug release
Browse files Browse the repository at this point in the history
  • Loading branch information
haloivanid committed Aug 10, 2023
1 parent 856afe7 commit 502a200
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "npm run build"
"addChannelCmd": "npm run build"
}
]
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@haloivanid/ingress-prime-stat",
"description": "A lightweight conversion for Ingress Prime stat in TypeScript",
"readme": "README.md",
"version": "1.0.0",
"version": "1.2.0",
"main": "src/main.ts",
"author": "haloivanid <[email protected]>",
"repository": {
Expand Down
15 changes: 12 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/bin/sh

#preparation
# preparation
npx rimraf ./lib

#build tsc
# build tsc
npx tsc -p tsconfig.json
npx terser ./lib/main.js -c -m -o ./lib/main.js

#postbuild process
# copy readme
cp ./README.md ./lib/README.md

# post build process
node ./scripts/pkg-builder.js

# check if the package was writen
if [ ! -f "./lib/package.json" ]; then
echo "package.json was created"
exit 1
fi
2 changes: 1 addition & 1 deletion scripts/pkg-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ if (Object.keys(devDependencies).length) {
newPkgJson.devDependencies = devDependencies;
}

fs.writeFileSync(path.join(rootDir, 'lib', 'package.json'), JSON.stringify(newPkgJson, null, 2));
fs.writeFile(path.join(rootDir, 'lib', 'package.json'), JSON.stringify(newPkgJson, null, 2), () => null);

0 comments on commit 502a200

Please sign in to comment.