mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 08:25:32 +00:00
Create publish script and document.
This commit is contained in:
parent
a9428ff8d4
commit
09615db5cc
3 changed files with 39 additions and 4 deletions
6
developer/js/.npmignore
Normal file
6
developer/js/.npmignore
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Ignore files required only in development.
|
||||
build.sh
|
||||
source/*
|
||||
tests/*
|
||||
*.js.map
|
||||
tsconfig.json
|
||||
|
|
@ -21,9 +21,10 @@ display_usage ( ) {
|
|||
echo " $0 -help"
|
||||
echo
|
||||
echo " -help displays this screen and exits"
|
||||
echo " -test runs unit tests after building"
|
||||
echo " -version version sets the package version before building"
|
||||
echo " -tier tier also sets the package version tier (alpha, beta, stable) before building"
|
||||
echo " -test runs unit tests after building"
|
||||
echo " -publish-to-npm publishes the current version to the npm package index"
|
||||
echo " -tier tier also sets the package version tier and npm tag (alpha, beta, stable) before building or publishing"
|
||||
echo " If version has 4 components, only first three are used."
|
||||
}
|
||||
|
||||
|
|
@ -34,6 +35,7 @@ install_dependencies=1
|
|||
publish_version=
|
||||
publish_tier=
|
||||
lastkey=
|
||||
should_publish=0
|
||||
|
||||
# Process command-line arguments
|
||||
while [[ $# -gt 0 ]] ; do
|
||||
|
|
@ -54,6 +56,9 @@ while [[ $# -gt 0 ]] ; do
|
|||
-tier)
|
||||
lastkey=$key
|
||||
;;
|
||||
-publish-to-npm)
|
||||
should_publish=1
|
||||
;;
|
||||
*)
|
||||
echo "$0: invalid option: $key"
|
||||
display_usage
|
||||
|
|
@ -122,3 +127,17 @@ echo "Typescript compilation successful."
|
|||
if (( run_tests )); then
|
||||
npm test || fail "Tests failed"
|
||||
fi
|
||||
|
||||
if (( should_publish )); then
|
||||
# Note: In either case, npm publish MUST be given --access public to publish
|
||||
# a package in the @keymanapp scope on the public npm package index.
|
||||
#
|
||||
# See `npm help publish` for more details.
|
||||
if [ -z "$publish_tier" ] ; then
|
||||
# Publish a stable release (npm tag: latest)
|
||||
npm publish --access public || fail "Could not publish stable release."
|
||||
else
|
||||
# Publish a pre-release (npm tag: alpha or beta)
|
||||
npm publish --access public --tag "$publish_tier" || fail "Could not publish $publish_tier release."
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,23 +4,33 @@ npm packages
|
|||
This is a guide for how the various Keyman `npm` packages are developed
|
||||
and published.
|
||||
|
||||
`npm` packages are published on the CI (continuous integration) server.
|
||||
Currently, we're using TeamCity for this.
|
||||
|
||||
Packages are **never** published from a developer's machine.
|
||||
|
||||
|
||||
For CI developers
|
||||
-----------------
|
||||
|
||||
### In general
|
||||
|
||||
Before publishing, a package must be **built** and **tested**.
|
||||
Before publishing, a package must be **built** and **tested** on the CI
|
||||
server.
|
||||
|
||||
This is typically done with:
|
||||
|
||||
./build.sh -test
|
||||
|
||||
Once the build succeeds and tests pass, the version is set in
|
||||
Once the build succeeds and the tests pass, the version is set in
|
||||
`package.json`:
|
||||
|
||||
./build.sh -version 12.0.${BUILD_NUMBER} -tier ${tier}
|
||||
|
||||
Now you can publish! Use the following script for this (again, **only on the CI server**!)
|
||||
|
||||
./build.sh -publish-to-npm -tier ${tier}
|
||||
|
||||
It is then uploaded to the npm package directory. **Ensure that the
|
||||
compiled sources are included in the tarball**. For example,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue