Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
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_NPM=$(curl https://registry.npmjs.org/npm/latest | jq '.version + "+sha1." + .dist.shasum')
LATEST_PNPM=$(curl https://registry.npmjs.org/pnpm/latest | jq '.version + "+sha1." + .dist.shasum')
LATEST_YARN=$(curl https://registry.npmjs.org/yarn/latest | jq '.version + "+sha1." + .dist.shasum')
LATEST_CNPM=$(curl https://registry.npmmirror.com/cnpm/latest | jq '.version + "+sha1." + .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 '. * '"{
Expand Down
38 changes: 38 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,44 @@
}
}
},
"cnpm": {
"default": "9.3.2+sha1.05a307b7c1d34a368b8d30ff159dfd0533c8c328",
"fetchLatestFrom": {
"type": "url",
"url": "https://registry.npmmirror.com/cnpm",
"fields": {
"tags": "latest",
"versions": "tags"
}
},
"transparent": {
"commands": [
[
"cnpm",
"sync"
]
]
},
"ranges": {
"*": {
"url": "https://cdn.npmmirror.com/packages/cnpm/{}/cnpm-{}.tgz",
"bin": {
"cnpm": "./bin/cnpm"
},
"commands": {
"use": ["cnpm", "install"]
},
"registry": {
"type": "url",
"url": "https://registry.npmmirror.com/cnpm",
"fields": {
"versions": "versions",
"tags": "dist-tags"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably provide mentioned for the npm package, see #339

Suggested change
}
},
"npmRegistry": {
"type": "npm",
"package": "cnpm"
},

}
}
},
"pnpm": {
"default": "8.10.2+sha1.e0b68270e89c817ff88b7be62466a2128c53af02",
"fetchLatestFrom": {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"pnpm": "./dist/pnpm.js",
"pnpx": "./dist/pnpx.js",
"yarn": "./dist/yarn.js",
"yarnpkg": "./dist/yarnpkg.js"
"yarnpkg": "./dist/yarnpkg.js",
"cnpm": "./dist/cnpm.js"
},
"executableFiles": [
"./dist/npm.js",
Expand All @@ -92,7 +93,8 @@
"./shims/yarn",
"./shims/yarn.ps1",
"./shims/yarnpkg",
"./shims/yarnpkg.ps1"
"./shims/yarnpkg.ps1",
"./dist/cnpm.js"
]
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion sources/corepackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function installVersion(installTarget: string, locator: Locator, {s
};
}

const defaultNpmRegistryURL = spec.url.replace(`{}`, version);
const defaultNpmRegistryURL = spec.url.replaceAll(`{}`, version);
const url = process.env.COREPACK_NPM_REGISTRY ?
defaultNpmRegistryURL.replace(
npmRegistryUtils.DEFAULT_NPM_REGISTRY_URL,
Expand Down
1 change: 1 addition & 0 deletions sources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum SupportedPackageManagers {
Npm = `npm`,
Pnpm = `pnpm`,
Yarn = `yarn`,
Cnpm = `cnpm`,
Comment on lines 5 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ASCII/alphabetical order

Suggested change
Npm = `npm`,
Pnpm = `pnpm`,
Yarn = `yarn`,
Cnpm = `cnpm`,
Cnpm = `cnpm`,
Npm = `npm`,
Pnpm = `pnpm`,
Yarn = `yarn`,

}

export const SupportedPackageManagerSet = new Set<SupportedPackageManagers>(
Expand Down
Loading