Skip to content

Commit b9f74c9

Browse files
committed
fix(core): fix release script to require environment variable
1 parent d952332 commit b9f74c9

File tree

6 files changed

+18
-26164
lines changed

6 files changed

+18
-26164
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"build": "yarn lerna run build",
1010
"dev": "yarn lerna run dev",
1111
"prettier": "yarn prettier",
12-
"before:release": "node scripts/prepublish.js",
1312
"release": "./scripts/release.sh",
1413
"commit": "yarn git-cz",
1514
"setup": "yarn && yarn build && cd examples/blog && yarn && cd ../typescript && yarn"

packages/create-tensei-app/schematics/packages.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99

1010
import { CliState } from '../contracts'
1111

12+
const TENSEI_PACKAGE_VERSION = process.env.TENSEI_PACKAGE_VERSION || 'latest'
13+
1214
export const packages: {
1315
[K in CliState['boilerplate']]: {
1416
[pkg: string]: { version: string }
1517
}
1618
} = {
1719
graphql: {
1820
'@tensei/graphql': {
19-
version: '^0.9.0'
21+
version: TENSEI_PACKAGE_VERSION
2022
}
2123
},
2224
rest: {
2325
'@tensei/rest': {
24-
version: '^0.9.0'
26+
version: TENSEI_PACKAGE_VERSION
2527
}
2628
}
2729
}

packages/create-tensei-app/tasks/install-dependencies/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ const task: TaskFn = async (_, logger, { pkg, client, boilerplate, debug }) => {
3131
pkg.install(pkgName, boilerPlatePackages[pkgName].version, false)
3232
})
3333

34+
const TENSEI_PACKAGE_VERSION = process.env.TENSEI_PACKAGE_VERSION || 'latest'
35+
3436
/**
3537
* Required dependencies for all projects
3638
*/
3739
pkg.install('@mikro-orm/sqlite', '^4.4.0', false)
38-
pkg.install('@tensei/core', 'latest', false)
39-
pkg.install('@tensei/auth', 'latest', false)
40+
pkg.install('@tensei/core', TENSEI_PACKAGE_VERSION, false)
41+
pkg.install('@tensei/auth', TENSEI_PACKAGE_VERSION, false)
4042

4143
/**
4244
* Required dev dependencies
4345
*/
4446
pkg.install('typescript', '~4.3')
45-
pkg.install('@tensei/cli', '^0.9.0')
47+
pkg.install('@tensei/cli', TENSEI_PACKAGE_VERSION)
4648

4749
/**
4850
* Displaying a spinner, since install packages takes

scripts/prepublish.js

-41
This file was deleted.

scripts/release.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
set -e
2+
set -u
3+
4+
if [[ -z "${TENSEI_PACKAGE_VERSION}" ]]; then
5+
echo "You must set the TENSEI_PACKAGE_VERSION environment variable before publishing a release."
6+
exit 1
7+
else
8+
echo "Publishing version ${TENSEI_PACKAGE_VERSION}"
9+
fi
210

3-
yarn before:release "$@"
411
git add .
5-
git commit -m "chore(release): publish v`node -p 'require(\"./lerna.json\").version'`"
12+
git commit -m "chore(release): publish v${TENSEI_PACKAGE_VERSION}"
613
yarn build
714
yarn lerna publish "$@"

0 commit comments

Comments
 (0)