-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update local development to Node.js v20 update minimum engine to Node.js v18 update dependency manager to Yarn v4 replace ts-node with tsx replace babel+webpack with microbundle remove old config files update CI and create npm publish job on GitHub Actions
- Loading branch information
Showing
17 changed files
with
7,097 additions
and
2,369 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,59 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
########################################################################## | ||
# Build | ||
########################################################################## | ||
|
||
build: | ||
name: Build [Node.js ${{ matrix.node-version }}] | ||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 22.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install | ||
run: | | ||
corepack enable | ||
yarn install | ||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
########################################################################## | ||
# Release precheck | ||
########################################################################## | ||
|
||
release_precheck: | ||
name: 'Release (precheck)' | ||
needs: build | ||
if: | | ||
github.ref_name == 'master' && | ||
startsWith(github.event.head_commit.message, 'chore(release)') | ||
uses: ./.github/workflows/release.yml | ||
secrets: inherit |
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,71 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
NPM_CARTODB_AUTH_TOKEN: | ||
required: true | ||
workflow_dispatch: | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
CI: true | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Read version from 'package.json'; git tags are lost on a merged PR. | ||
- name: Read package version | ||
id: version | ||
run: echo "PKG_VERSION=v$(npm pkg get version | xargs)" >> $GITHUB_OUTPUT | ||
|
||
- name: Set up Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
# Determine whether to tag the release as 'latest' or 'alpha'. | ||
- name: Assign dist tag | ||
id: dist-tag | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const version = '${{ steps.version.outputs.PKG_VERSION }}' | ||
console.log(`version: ${version}`) | ||
if (version.match(/^v\d+\.\d+\.\d+$/)) { | ||
distTag = 'latest' | ||
} else if (version.match(/^v\d+\.\d+\.\d+/)) { | ||
distTag = 'alpha' | ||
} else { | ||
core.setFailed('Version must follow SemVer convention. Aborting.'); | ||
} | ||
console.log(`npm dist tag: ${distTag}`) | ||
return distTag | ||
- name: Install | ||
run: | | ||
corepack enable | ||
yarn install | ||
# Build. Tests are run automatically by `yarn prepublish`. | ||
- name: Build | ||
run: yarn build | ||
|
||
- name: Configure yarn to publish packages | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }} | ||
run: | | ||
yarn config set npmPublishRegistry "https://registry.npmjs.org/" | ||
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}" | ||
- name: Publish | ||
env: | ||
DIST_TAG: ${{ steps.dist-tag.outputs.result }} | ||
run: yarn npm publish --tag ${DIST_TAG} |
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 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 @@ | ||
nodeLinker: node-modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {execSync} from 'node:child_process'; | ||
import {readFile} from 'node:fs/promises'; | ||
import {resolve} from 'node:path'; | ||
import {valid} from 'semver'; | ||
|
||
/** | ||
* Utility for committing and tagging a release commit in | ||
* git, called as part of the `yarn postversion` script. | ||
*/ | ||
|
||
// Read and validate pkg.version. | ||
const pkgJSON = await readFile(resolve('./package.json'), 'utf-8'); | ||
const version = 'v' + JSON.parse(pkgJSON).version; | ||
if (!valid(version)) { | ||
throw new Error(`Invalid version, "${version}"`); | ||
} | ||
|
||
// Check out a branch if cutting a version from 'main'. | ||
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); | ||
if (branch === 'main') { | ||
execSync(`git checkout -b 'release/${version}'`); | ||
} | ||
|
||
// Commit and tag. | ||
execSync('git add -u'); | ||
execSync(`git commit -m 'chore(release): ${version}'`); | ||
execSync(`git tag -a ${version} -m ${version}`); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.