[tests] Deprecate "now" npm package in favor of "vercel" (#5119)

We deprecated all the `now` scoped packages in favor of the `vercel` equivalents, however the deprecation message disappears after each publish, so we must to run `npm deprecate` after `npm publish` for legacy packages.
This commit is contained in:
Steven
2020-08-28 15:39:06 -04:00
committed by GitHub
parent be24510f16
commit 57a17eb416
3 changed files with 18 additions and 5 deletions

View File

@@ -29,7 +29,8 @@ if (!packageDir) {
const pkgJsonPath = join(packagesDir, packageDir, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
const originalName = pkg.name;
const oldName = pkg.name;
const version = pkg.version;
if (pkg.name === '@vercel/client') {
// The legacy name for `@vercel/client` is `now-client` (global scope)
@@ -42,10 +43,12 @@ if (pkg.name === '@vercel/client') {
}
}
console.error(`Updated package name: "${originalName}" -> "${pkg.name}"`);
const newName = pkg.name;
console.error(`Updated package name: "${oldName}" -> "${newName}"`);
fs.writeFileSync(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
// Log the directory name to stdout for the `publish-legacy.sh`
// script to consume for the `npm publish` that happens next.
console.log(packageDir);
const IFS = '|';
console.log([packageDir, oldName, newName, version].join(IFS));