-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from huan/esm
Support ESM
- Loading branch information
Showing
27 changed files
with
315 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
const rules = { | ||
} | ||
|
||
module.exports = { | ||
extends: '@chatie', | ||
rules, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: NPM | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
# - macos-latest | ||
node: | ||
- 16 | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Test | ||
run: npm test | ||
|
||
pack: | ||
name: Pack | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Generate Version | ||
run: ./scripts/generate-version.sh | ||
|
||
- name: Pack Testing | ||
run: ./scripts/npm-pack-testing.sh | ||
|
||
publish: | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v')) | ||
name: Publish | ||
needs: [build, pack] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Generate Version | ||
run: ./scripts/generate-version.sh | ||
|
||
- name: Set Publish Config | ||
run: ./scripts/package-publish-config-tag.sh | ||
|
||
- name: Build Dist | ||
run: npm run dist | ||
|
||
- name: Check Branch | ||
id: check-branch | ||
run: | | ||
if [[ ${{ github.ref }} =~ ^refs/heads/(main|v[0-9]+\.[0-9]+.*)$ ]]; then | ||
echo ::set-output name=match::true | ||
fi # See: https://stackoverflow.com/a/58869470/1123955 | ||
- name: Is A Publish Branch | ||
if: steps.check-branch.outputs.match == 'true' | ||
run: | | ||
NAME=$(npx pkg-jq -r .name) | ||
VERSION=$(npx pkg-jq -r .version) | ||
if npx version-exists "$NAME" "$VERSION" | ||
then echo "$NAME@$VERSION exists on NPM, skipped." | ||
else npm publish | ||
fi | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Is Not A Publish Branch | ||
if: steps.check-branch.outputs.match != 'true' | ||
run: echo 'Not A Publish Branch' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
SRC_VERSION_TS_FILE='src/version.ts' | ||
|
||
[ -f ${SRC_VERSION_TS_FILE} ] || { | ||
echo ${SRC_VERSION_TS_FILE}" not found" | ||
exit 1 | ||
} | ||
|
||
VERSION=$(npx pkg-jq -r .version) | ||
|
||
cat <<_SRC_ > ${SRC_VERSION_TS_FILE} | ||
/** | ||
* This file was auto generated from scripts/generate-version.sh | ||
*/ | ||
export const VERSION: string = '${VERSION}' | ||
_SRC_ | ||
|
||
echo "$VERSION generated." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.