Skip to content

Commit

Permalink
chore(main): release 0.23.0 (nodejs#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and elrrrrrrr committed Dec 14, 2023
0 parents commit 98a002f
Show file tree
Hide file tree
Showing 153 changed files with 11,595 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome!

# Mark this as the root editorconfig file
root = true

# Base ruleset for all files
[*]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

# Override rules for markdown
[*.md]
# trailing whitespace is significant in markdown -> do not remove
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.yarn
dist
shims
.pnp.*
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
`@yarnpkg`,
],
};
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
YARN_ENABLE_GLOBAL_CACHE: false

jobs:
chore:
name: "Testing chores"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Get the Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v3
with:
path: ${{steps.yarn-cache-dir-path.outputs.dir}}
key: ${{runner.os}}-yarn-${{hashFiles('**/yarn.lock')}}
restore-keys: |
${{runner.os}}-yarn-
- run: corepack yarn install --immutable

- name: "Check for type errors"
run: corepack yarn typecheck

- name: "Check for linting errors"
run: corepack yarn lint

build-and-test:
strategy:
fail-fast: false
matrix:
node:
- 18
- 20
platform:
- ubuntu-latest
- macos-latest
- windows-latest

name: "${{matrix.platform}} w/ Node.js ${{matrix.node}}.x"
runs-on: ${{matrix.platform}}

steps:
- uses: actions/checkout@v3

- name: "Use Node.js ${{matrix.node}}.x"
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}.x

- name: Get the Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v3
with:
path: ${{steps.yarn-cache-dir-path.outputs.dir}}
key: ${{runner.os}}-yarn-${{hashFiles('**/yarn.lock')}}
restore-keys: |
${{runner.os}}-yarn-
- run: corepack yarn install --immutable
- run: corepack yarn build # We need the stubs to run the tests

- run: corepack yarn test
env:
NOCK_ENV: replay
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish releases

on:
push:
branches: [main]

env:
YARN_ENABLE_GLOBAL_CACHE: false

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_tag: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: corepack
bump-minor-pre-major: true # TODO: remove this when releasing v1.0.0.

npm-publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Get the Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v3
with:
path: ${{steps.yarn-cache-dir-path.outputs.dir}}
key: ${{runner.os}}-yarn-${{hashFiles('**/yarn.lock')}}
restore-keys: |
${{runner.os}}-yarn-
- name: Publish to the npm registry
run: |
corepack yarn install --immutable
corepack yarn npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- run: corepack yarn pack --out corepack.tgz
- name: Add Corepack package archive to GitHub release
run: gh release upload ${{ needs.release-please.outputs.release_tag }} corepack.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Version Sync

on:
workflow_dispatch:
schedule:
# Run once a week at 00:05 UTC on Friday.
- cron: 5 0 * * 5

jobs:
fetch-latest-versions:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: "Update the package manager versions"
run: |
LATEST_BERRY_VERSION=$(curl https://repo.yarnpkg.com/tags | jq -r '.latest.stable')
LATEST_NPM=$(curl https://registry.npmjs.org/npm | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_PNPM=$(curl https://registry.npmjs.org/pnpm | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_YARN=$(curl https://registry.npmjs.org/yarn | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_BERRY=$(jq -n '$version + "+sha224." + $checksum' --arg version "$LATEST_BERRY_VERSION" --arg checksum "$(curl https://repo.yarnpkg.com/"$LATEST_BERRY_VERSION"/packages/yarnpkg-cli/bin/yarn.js | openssl dgst -sha224 | cut -d' ' -f2)")
git --no-pager show HEAD:config.json | jq '. * '"{
definitions: {
npm: {
default: $LATEST_NPM,
},
pnpm: {
default: $LATEST_PNPM,
},
yarn: {
default: $LATEST_YARN,
transparent: {
default: $LATEST_BERRY,
},
},
},
}" > config.json
- uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5 # v1.9.2
# Creates a PR or update the Action's existing PR, or
# no-op if the base branch is already up-to-date.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: This is an automated update of package manager versions
branch: actions/tools-update-config.json
commit-message: "feat: update package manager versions"
title: "feat: update package manager versions"
81 changes: 81 additions & 0 deletions .github/workflows/update-nock-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Update Nock files

on:
workflow_dispatch:
inputs:
pr_id:
description: PR ID
type: number
required: true

env:
YARN_ENABLE_GLOBAL_CACHE: false

jobs:
build-and-update-nock-files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: refs/pull/${{ inputs.pr_id }}/head

- name: Install Node
uses: actions/setup-node@v3
with:
# Let's use the oldest version supported to be sure the V8
# serialization is compatible with all supported versions.
node-version: 18.x

- name: Get the Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v3
with:
path: ${{steps.yarn-cache-dir-path.outputs.dir}}
key: ${{runner.os}}-yarn-${{hashFiles('**/yarn.lock')}}
restore-keys: |
${{runner.os}}-yarn-
- run: corepack yarn install --immutable
- run: corepack yarn build # We need the stubs to run the tests

- name: Remove old Nock files to avoid conflicts
run: rm -r tests/nock

- run: corepack yarn test
env:
NOCK_ENV: record

- name: Check if anything has changed
id: contains-changes
run: echo "result=$(git --no-pager diff --quiet -- tests/nock || echo "yes")" >> $GITHUB_OUTPUT
shell: bash

- name: Commit changes
if: ${{ steps.contains-changes.outputs.result == 'yes' }}
run: |
git add tests/nock/
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git commit -m "update Nock files"
- name: Push changes
if: ${{ steps.contains-changes.outputs.result == 'yes' }}
run: >
gh api
-H "Accept: application/vnd.github+json"
/repos/${{ github.repository }}/pulls/${{ inputs.pr_id }}
--jq '"git push " + .head.repo.clone_url + " HEAD:refs/heads/" + .head.ref' | sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload `tests/nock` in case of failure
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.contains-changes.outputs.result == 'yes' }}
with:
name: nock
path: |
tests/nock
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.yarn/*
!/.yarn/cache
!/.yarn/patches
!/.yarn/releases
!/.yarn/sdks
/.pnp.*

/dist
/package.tgz

/shims
/coverage
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint"
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
6 changes: 6 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "eslint",
"version": "8.40.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}
5 changes: 5 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!

integrations:
- vscode
Loading

0 comments on commit 98a002f

Please sign in to comment.