diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..bd3327a --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +//registry.npmjs.org/:_authToken=${NPM_TOKEN} \ No newline at end of file diff --git a/build-utils/grunt-config/run.js b/build-utils/grunt-config/run.js index c9fc981..bc129c7 100644 --- a/build-utils/grunt-config/run.js +++ b/build-utils/grunt-config/run.js @@ -4,25 +4,18 @@ module.exports = { options: { failOnError: true }, - //run typescrip compiler directly since all tools don't support latest flags + //run typescript compiler directly since all tools don't support latest flags tscEs6: { - cmd: 'npm', - args: `run tsc -- src/ts/main.ts src/ts/file-reader.ts - --noEmit false - --outDir ./build/npm/lib/ - --module es2020 - --target es2020 - --rootDir src/ts/ - --declaration true - --declarationDir ./build/npm/types - `.replace(/\n[\t ]+/g, ' ').split(' ').filter(x => x != '') + options: { + cwd: process.cwd() + }, + exec: `bash build-utils/tsc-build.sh` }, npmPublish: { options: { cwd: process.cwd() + "/build/npm" }, - cmd: 'npm', - args: ['publish'], + exec: `. ./ENV_VARS && npm publish` }, publishRelease: { options: { diff --git a/build-utils/release.sh b/build-utils/release.sh index f68b64c..a157452 100644 --- a/build-utils/release.sh +++ b/build-utils/release.sh @@ -10,6 +10,7 @@ set -e #exit on errors # check vars : "${VERSION?Need to set VERSION environment variable}" : "${GITHUB_TOKEN?Need to set GITHUB_TOKEN environment variable}" +: "${NPM_TOKEN?Need to set NPM_TOKEN environment variable}" echo "Start Github release for ${VERSION}..." diff --git a/build-utils/tsc-build.sh b/build-utils/tsc-build.sh new file mode 100644 index 0000000..f48128c --- /dev/null +++ b/build-utils/tsc-build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# tsc-build.sh +# assumes to run in repo root + +set -e #exit on errors + +# load (private) environment variables like RELEASE_KEY from non-commited file +. ./ENV_VARS + +# check vars +: "${NPM_TOKEN?Need to set NPM_TOKEN environment variable}" + +cd ./build/npm + +NPM_TOKEN=$NPM_TOKEN npm run tsc -- src/ts/main.ts src/ts/file-reader.ts \ + --noEmit false \ + --outDir ./build/npm/lib/ \ + --module es2020 \ + --target es2020 \ + --rootDir src/ts/ \ + --declaration true \ + --declarationDir ./build/npm/types \ \ No newline at end of file