Skip to content

Commit

Permalink
fix(core): fix release script to require environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bahdcoder committed Sep 26, 2021
1 parent d952332 commit b9f74c9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26,164 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"build": "yarn lerna run build",
"dev": "yarn lerna run dev",
"prettier": "yarn prettier",
"before:release": "node scripts/prepublish.js",
"release": "./scripts/release.sh",
"commit": "yarn git-cz",
"setup": "yarn && yarn build && cd examples/blog && yarn && cd ../typescript && yarn"
Expand Down
6 changes: 4 additions & 2 deletions packages/create-tensei-app/schematics/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@

import { CliState } from '../contracts'

const TENSEI_PACKAGE_VERSION = process.env.TENSEI_PACKAGE_VERSION || 'latest'

export const packages: {
[K in CliState['boilerplate']]: {
[pkg: string]: { version: string }
}
} = {
graphql: {
'@tensei/graphql': {
version: '^0.9.0'
version: TENSEI_PACKAGE_VERSION
}
},
rest: {
'@tensei/rest': {
version: '^0.9.0'
version: TENSEI_PACKAGE_VERSION
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,20 @@ const task: TaskFn = async (_, logger, { pkg, client, boilerplate, debug }) => {
pkg.install(pkgName, boilerPlatePackages[pkgName].version, false)
})

const TENSEI_PACKAGE_VERSION = process.env.TENSEI_PACKAGE_VERSION || 'latest'

/**
* Required dependencies for all projects
*/
pkg.install('@mikro-orm/sqlite', '^4.4.0', false)
pkg.install('@tensei/core', 'latest', false)
pkg.install('@tensei/auth', 'latest', false)
pkg.install('@tensei/core', TENSEI_PACKAGE_VERSION, false)
pkg.install('@tensei/auth', TENSEI_PACKAGE_VERSION, false)

/**
* Required dev dependencies
*/
pkg.install('typescript', '~4.3')
pkg.install('@tensei/cli', '^0.9.0')
pkg.install('@tensei/cli', TENSEI_PACKAGE_VERSION)

/**
* Displaying a spinner, since install packages takes
Expand Down
41 changes: 0 additions & 41 deletions scripts/prepublish.js

This file was deleted.

11 changes: 9 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
set -e
set -u

if [[ -z "${TENSEI_PACKAGE_VERSION}" ]]; then
echo "You must set the TENSEI_PACKAGE_VERSION environment variable before publishing a release."
exit 1
else
echo "Publishing version ${TENSEI_PACKAGE_VERSION}"
fi

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

0 comments on commit b9f74c9

Please sign in to comment.