Skip to content

Commit

Permalink
fix(build): fix bug release
Browse files Browse the repository at this point in the history
  • Loading branch information
haloivanid committed Aug 10, 2023
1 parent 58fa051 commit cabe994
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 40 deletions.
5 changes: 2 additions & 3 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
[
"@semantic-release/exec",
{
"publishCmd": "npm run build"
"prepareCmd": "./scripts/build.sh ${nextRelease.version}"
}
]
],
"pkgRoot": "lib"
]
}
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# [1.1.0](https://github.com/haloivanid/ingress-prime-stat/compare/v1.0.0...v1.1.0) (2023-08-10)
# 1.0.0 (2023-08-10)


### Features

* **main:** add validation stat ([f58e02d](https://github.com/haloivanid/ingress-prime-stat/commit/f58e02d2ad4c5d03effdf72bfd10d88247851e62))
* **main.ts:** add main code ([a44a5fa](https://github.com/haloivanid/ingress-prime-stat/commit/a44a5fa1b8b395448ef984c07ac6bd0bb09e7836))
* **main.ts:** add to string and from object function ([705c19d](https://github.com/haloivanid/ingress-prime-stat/commit/705c19d3efc24f0e90cc45ae50536d88d9c43888))
7 changes: 0 additions & 7 deletions lib/CHANGELOG.md

This file was deleted.

20 changes: 0 additions & 20 deletions lib/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"yarn": ">=1.22.19"
},
"scripts": {
"build": "./scripts/build.sh",
"build": "tsc -p tsconfig.json",
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/main.ts",
"test": "jest",
"lint": "eslint --ext .ts src --fix",
Expand Down
24 changes: 20 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
#!/bin/sh

#preparation
version=$1

# preparation
npx rimraf ./lib

#build tsc
npx tsc -p tsconfig.json
# build tsc
npm run build

# post build process
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

cd ./lib || exit 1
npm pkg set version="$version"
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 cabe994

Please sign in to comment.