-
Notifications
You must be signed in to change notification settings - Fork 39
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 #235 from pimlicolabs/feat/alto-package
release commonjs and esm
- Loading branch information
Showing
16 changed files
with
1,717 additions
and
965 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 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/changelog-git", | ||
"commit": false, | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { | ||
"onlyUpdatePeerDependentsWhenOutOfRange": true | ||
} | ||
} |
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,5 @@ | ||
--- | ||
"@pimlico/alto": patch | ||
--- | ||
|
||
First releaseof alto bundler |
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,41 @@ | ||
name: Release (Canary) | ||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
canary: | ||
name: Release canary | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
|
||
- name: Install test dependencies | ||
run: pnpm install | ||
|
||
- name: Setup .npmrc file | ||
uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Set alto version | ||
run: | | ||
jq --arg prop "workspaces" 'del(.[$prop])' package.json > package.tmp.json && rm package.json && cp package.tmp.json package.json && rm package.tmp.json | ||
cd src | ||
npm --no-git-tag-version version 0.0.0 | ||
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S') | ||
- name: Build | ||
run: | | ||
pnpm run build:esm && jq '. + {type: "module"}' ./src/package.json > ./src/package.tmp.json && mv ./src/package.tmp.json ./src/package.json | ||
- name: Publish alto to npm | ||
run: cd src && npm publish --access public --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//') | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_PIMLICO_TOKEN }} |
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,65 @@ | ||
name: Main | ||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
|
||
test: | ||
name: Test E2E | ||
uses: ./.github/workflows/e2e.yaml | ||
secrets: inherit | ||
|
||
changesets: | ||
name: Changesets | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
with: | ||
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
- name: Create Version Pull Request | ||
uses: changesets/action@v1 | ||
with: | ||
version: pnpm run changeset:version | ||
commit: 'chore: version package' | ||
title: 'chore: version package' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Release | ||
needs: verify | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
- name: Publish to NPM | ||
uses: changesets/action@v1 | ||
with: | ||
publish: pnpm run changeset:release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_ORG_PIMLICO_TOKEN }} |
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,57 @@ | ||
name: Prune NPM tags | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
prune: | ||
name: Prune NPM tags | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'latest' | ||
|
||
- name: Setup .npmrc file | ||
uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Prune @pimlico/alto tags | ||
run: | | ||
PACKAGE_NAME=$(jq -r '.name' package.json) | ||
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME % | ||
working-directory: src | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_PIMLICO_TOKEN }} | ||
|
||
- name: Deprecate @pimlico/alto canary versions | ||
working-directory: src | ||
run: | | ||
PACKAGE_NAME=$(jq -r '.name' package.json) | ||
TWO_DAYS_AGO=$(date --date='2 days ago' +%s) | ||
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s) | ||
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \ | ||
| while read line; do | ||
VERSION=$(echo $line | jq -r '.key') | ||
TIME=$(echo $line | jq -r '.value') | ||
PUBLISH_DATE=$(date --date=$TIME +%s) | ||
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then | ||
continue # skip versions older than 4 days to reduce the number of npm deprecate calls | ||
fi | ||
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then | ||
echo "Deprecate $PACKAGE_NAME@$VERSION" | ||
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true | ||
echo "Deprecated $PACKAGE_NAME@$VERSION" | ||
fi | ||
done | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_PIMLICO_TOKEN }} |
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
Oops, something went wrong.