From ef8ffa5411bd3b9ec698cb118cbac41cfc922a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=92=E6=98=9F?= <979054461@qq.com> Date: Fri, 18 Feb 2022 14:40:55 +0800 Subject: [PATCH] =?UTF-8?q?chore(release):=20vsce=20=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=8F=91=E5=B8=83npm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/release.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index 198ddcde..32d200d5 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -12,14 +12,14 @@ const skipTests = args.skipTests; const skipBuild = args.skipBuild; const packages = fs .readdirSync(path.resolve(__dirname, '../packages')) - .filter(p => !p.endsWith('.ts') && !p.startsWith('.')); + .filter((p) => !p.endsWith('.ts') && !p.startsWith('.')); const versionIncrements = ['patch', 'minor', 'major', 'prepatch', 'preminor', 'premajor', 'prerelease']; -const inc = i => semver.inc(currentVersion, i, preId); -const bin = name => path.resolve(__dirname, '../node_modules/.bin/' + name); +const inc = (i) => semver.inc(currentVersion, i, preId); +const bin = (name) => path.resolve(__dirname, '../node_modules/.bin/' + name); const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts }); -const getPkgRoot = pkg => path.resolve(__dirname, '../packages/' + pkg); +const getPkgRoot = (pkg) => path.resolve(__dirname, '../packages/' + pkg); async function main() { let targetVersion = args._[0]; @@ -30,7 +30,7 @@ async function main() { type: 'select', name: 'release', message: 'Select release type', - choices: versionIncrements.map(i => `${i} (${inc(i)})`).concat(['custom']) + choices: versionIncrements.map((i) => `${i} (${inc(i)})`).concat(['custom']) }); if (release === 'custom') { @@ -94,7 +94,10 @@ async function main() { const releaseTag = Array.isArray(semver.prerelease(targetVersion)) ? semver.prerelease(targetVersion)[0] : 'latest'; for (const pkg of packages) { - await publish(pkg, releaseTag); + /** vsce 不需要发布npm */ + if (pkg !== 'vscode-pont') { + await publish(pkg, releaseTag); + } } // push to GitHub @@ -109,7 +112,7 @@ function updateVersions(version) { // 1. update root package.json updatePackage(path.resolve(__dirname, '..'), version); // 2. update all packages - packages.forEach(p => updatePackage(getPkgRoot(p), version)); + packages.forEach((p) => updatePackage(getPkgRoot(p), version)); } function updatePackage(pkgRoot, version) { @@ -117,7 +120,7 @@ function updatePackage(pkgRoot, version) { const pkg = readPkg(pkgRoot); pkg.version = version; if (pkg.dependencies) { - Object.keys(pkg.dependencies).forEach(dep => { + Object.keys(pkg.dependencies).forEach((dep) => { if (packages.includes(dep)) { pkg.dependencies[dep] = version; } @@ -141,6 +144,6 @@ async function publish(pkgName, releaseTag) { } } -main().catch(err => { +main().catch((err) => { console.error(err); });