Skip to content

Commit ba625ae

Browse files
committed
chore(repo,clerk-sdk-node,edge): Fix publish snippets and version hook
1 parent badd656 commit ba625ae

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

docs/PUBLISH.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This script will use `lerna version` to check which packages need to be updated
88

99
The command will guide you through the version changes that are detected and will:
1010
- Bump the package versions.
11+
- Run the `version` hook updating the version info files.
1112
- Create new tags and a "release" commit.
1213
- Push the commit and tags to the origin.
1314

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
"scripts": {
3131
"lint-fix": "eslint . --ext .ts",
3232
"bump": "lerna version --conventional-commits",
33+
"prerelease": "lerna run build",
3334
"release": "lerna publish from-git",
3435
"build": "lerna run build",
3536
"test": "lerna run test",
36-
"prepare": "husky install"
37+
"prepare": "husky install",
38+
"version": "./scripts/version-info.sh"
3739
},
3840
"engines": {
3941
"node": ">=16.8.0",

packages/edge/scripts/info.cjs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const packageJson = require('../package.json');
22
const fs = require('fs');
33
const path = require('path');
4-
const executablePath = process.cwd();
54

65
fs.writeFileSync(
7-
path.resolve(executablePath + '/src/info.ts'),
6+
path.resolve(__dirname, '../src/info.ts'),
87
`
98
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
109
export const LIB_VERSION="${packageJson.version}";

packages/sdk-node/scripts/info.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const packageJson = require('../package.json');
22
const fs = require('fs');
33
const path = require('path');
4-
const executablePath = process.cwd();
54

65
fs.writeFileSync(
7-
path.resolve(executablePath + '/src/info.ts'),
6+
path.resolve(__dirname, '../src/info.ts'),
87
`
98
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
109
export const LIB_VERSION="${packageJson.version}";

scripts/version-info.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# For TS packages required to pull package version info.
4+
# Runs on Lerna `version` hook, which is after versions have been bumped accordingly.
5+
6+
# Move to the project root
7+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
cd $SCRIPT_DIR/..
9+
10+
# Run required version scripts (TODO: centralize)
11+
node ./packages/sdk-node/scripts/info.js && git add ./packages/sdk-node/src/info.ts
12+
node ./packages/edge/scripts/info.cjs && git add ./packages/edge/src/info.ts

0 commit comments

Comments
 (0)