Skip to content

Commit

Permalink
chore: auto-sync package manager versions (#88)
Browse files Browse the repository at this point in the history
* chore: auto-sync package manager versions

* Disables nock

* Removes check for newline
  • Loading branch information
arcanis authored Feb 7, 2022
1 parent e86da78 commit 1d41c48
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 90 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,4 @@ jobs:
- run: yarn install --immutable
- run: yarn build # We need the stubs to run the tests
- run: yarn eslint
- run: NOCK_ENV=replay yarn jest
shell: bash
- run: yarn jest
54 changes: 54 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Version Sync

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: 'Update the package manager versions'
run: |
LATEST_NPM=$(curl https://registry.npmjs.org/npm | jq '.["dist-tags"].latest')
LATEST_PNPM=$(curl https://registry.npmjs.org/pnpm | jq '.["dist-tags"].latest')
LATEST_YARN=$(curl https://registry.npmjs.org/yarn | jq '.["dist-tags"].latest')
LATEST_BERRY=$(curl https://repo.yarnpkg.com/tags | jq '.latest.stable')
jq < config.json > config.json.new '. * '"{
definitions: {
npm: {
default: $LATEST_NPM,
},
pnpm: {
default: $LATEST_PNPM,
},
yarn: {
default: $LATEST_YARN,
transparent: {
default: $LATEST_BERRY,
},
},
},
}"
rm config.json
mv config.json.new config.json
if [[ ! -z "$(git status --porcelain)" ]]; then
git config user.email '[email protected]'
git config user.name 'Node.js GitHub Bot'
git add config.json
git commit -m 'chore: update package manager versions'
git push
fi
190 changes: 103 additions & 87 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,94 +1,110 @@
{
"definitions": {
"npm": {
"default": "7.20.1",
"transparent": {
"commands": [
["npm", "init"],
["npx"]
]
},
"ranges": {
"*": {
"url": "https://registry.npmjs.org/npm/-/npm-{}.tgz",
"bin": {
"npm": "./bin/npm-cli.js",
"npx": "./bin/npx-cli.js"
},
"registry": {
"type": "npm",
"package": "npm"
}
}
}
"definitions": {
"npm": {
"default": "8.4.0",
"transparent": {
"commands": [
[
"npm",
"init"
],
[
"npx"
]
]
},
"ranges": {
"*": {
"url": "https://registry.npmjs.org/npm/-/npm-{}.tgz",
"bin": {
"npm": "./bin/npm-cli.js",
"npx": "./bin/npx-cli.js"
},
"registry": {
"type": "npm",
"package": "npm"
}
}
}
},
"pnpm": {
"default": "6.29.1",
"transparent": {
"commands": [
[
"pnpm",
"init"
],
[
"pnpx"
]
]
},
"ranges": {
"<6.0.0": {
"url": "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
"bin": {
"pnpm": "./bin/pnpm.js",
"pnpx": "./bin/pnpx.js"
},
"registry": {
"type": "npm",
"package": "pnpm"
}
},
"pnpm": {
"default": "6.11.0",
"transparent": {
"commands": [
["pnpm", "init"],
["pnpx"]
]
},
"ranges": {
"<6.0.0": {
"url": "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
"bin": {
"pnpm": "./bin/pnpm.js",
"pnpx": "./bin/pnpx.js"
},
"registry": {
"type": "npm",
"package": "pnpm"
}
},
">=6.0.0": {
"url": "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
"bin": {
"pnpm": "./bin/pnpm.cjs",
"pnpx": "./bin/pnpx.cjs"
},
"registry": {
"type": "npm",
"package": "pnpm"
}
}
}
">=6.0.0": {
"url": "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
"bin": {
"pnpm": "./bin/pnpm.cjs",
"pnpx": "./bin/pnpx.cjs"
},
"registry": {
"type": "npm",
"package": "pnpm"
}
}
}
},
"yarn": {
"default": "1.22.17",
"transparent": {
"default": "3.1.1",
"commands": [
[
"yarn",
"dlx"
]
]
},
"ranges": {
"<2.0.0": {
"url": "https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz",
"bin": {
"yarn": "./bin/yarn.js",
"yarnpkg": "./bin/yarn.js"
},
"registry": {
"type": "npm",
"package": "yarn"
}
},
"yarn": {
"default": "1.22.15",
"transparent": {
"default": "3.0.0",
"commands": [
["yarn", "dlx"]
]
},
"ranges": {
"<2.0.0": {
"url": "https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz",
"bin": {
"yarn": "./bin/yarn.js",
"yarnpkg": "./bin/yarn.js"
},
"registry": {
"type": "npm",
"package": "yarn"
}
},
">=2.0.0": {
"name": "yarn",
"url": "https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",
"bin": ["yarn", "yarnpkg"],
"registry": {
"type": "url",
"url": "https://repo.yarnpkg.com/tags",
"fields": {
"tags": "latest",
"versions": "tags"
}
}
}
">=2.0.0": {
"name": "yarn",
"url": "https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",
"bin": [
"yarn",
"yarnpkg"
],
"registry": {
"type": "url",
"url": "https://repo.yarnpkg.com/tags",
"fields": {
"tags": "latest",
"versions": "tags"
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ it(`should expose its root to spawned processes`, async () => {

await expect(runCli(cwd, [`npm`, `run`, `env`])).resolves.toMatchObject({
exitCode: 0,
stdout: expect.stringContaining(`COREPACK_ROOT=${npath.dirname(__dirname)}\n`),
stdout: expect.stringContaining(`COREPACK_ROOT=${npath.dirname(__dirname)}`),
});
});
});
Expand Down

0 comments on commit 1d41c48

Please sign in to comment.