File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 3333 - run : echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
3434 env :
3535 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
36- - run : pnpm lerna publish -y --create-release github --ignore-scripts --no-verify-access
36+ - run : pnpm lerna publish -y --create-release github
3737 env :
3838 HUSKY : 0
3939 GH_TOKEN : ${{ secrets.GH_TOKEN }}
Original file line number Diff line number Diff line change 1111 "main" : " dist/index.cjs" ,
1212 "module" : " dist/index.js" ,
1313 "types" : " dist/index.d.ts" ,
14+ "scripts" : {
15+ "version" : " ./scripts/update-constants-file.sh"
16+ },
1417 "files" : [
1518 " dist"
1619 ],
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ echo " Updating version in constants.ts"
6+
7+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
8+ PACKAGE_PATH=" ${SCRIPT_DIR} /../package.json"
9+ CONSTANTS_PATH=" ${SCRIPT_DIR} /../src/scw/constants.ts"
10+
11+ # Search for the new version
12+ NEW_VERSION=$( node -e " console.log(require('${PACKAGE_PATH} ').version);" )
13+ [ -z " ${NEW_VERSION} " ] && echo " New version cannot be found, abording" && exit 1
14+ echo " Found version: ${NEW_VERSION} "
15+
16+ # Replace the old version with the new one
17+ OLD_LINE_EXP=" \(^export const version.*$\)"
18+ NEW_LINE=" export const version = 'v${NEW_VERSION} '"
19+ NEW_FILE=$( cat " ${CONSTANTS_PATH} " | sed -e " s/${OLD_LINE_EXP} /${NEW_LINE} /" )
20+ if [[ " $NEW_FILE " != * " $NEW_LINE " * ]]; then
21+ echo " New file content doesn't contain expected version:"
22+ echo " ${NEW_FILE} "
23+ exit 2
24+ fi
25+
26+ # Copy content to file
27+ echo " ${NEW_FILE} " > " ${CONSTANTS_PATH} "
28+ echo " Updated version in constants file"
29+
30+ # Add change to commit
31+ git add " ${CONSTANTS_PATH} "
You can’t perform that action at this time.
0 commit comments