Compare commits

..

20 Commits

Author SHA1 Message Date
Vercel Release Bot
06113d3e39 Version Packages (#9962)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-16 15:53:57 -05:00
Luc Leray
5150f21404 [vc dev] Fix serverless function size limit condition (#9961)
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-05-16 14:17:00 -05:00
Sean Massa
eb6bb98406 empty push test 2023-05-16 11:49:25 -05:00
Vercel Release Bot
d8e3b6e738 Version Packages (#9950)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-05-16 11:48:06 -05:00
Luc Leray
25da051d62 [vc dev] Skip 50MB zip size limit for Python (#9944)
Do not apply the 50MB zip size limit for Python serverless function during `vc dev`.

Related to internal PR: https://github.com/vercel/api/pull/19279
2023-05-16 15:58:04 +00:00
Vercel Release Bot
f57af66dc2 [tests] Upgrade Turbo to version 1.9.4 (#9952)
This auto-generated PR updates Turbo to version 1.9.4
2023-05-16 03:21:01 +00:00
Nathan Rajlich
b2f71d5352 Remove "Required PR Label" workflow (#9958)
Changesets enforces this, so no need for this extra workflow anymore.
2023-05-15 14:38:30 -07:00
Lee Robinson
6115f0d74a Update README (#9951)
To be more clear about what Vercel is actually providing you, as a developer.
2023-05-13 20:32:46 +00:00
Nathan Rajlich
14c877e468 [cli] Sort keys in vc env pull (#9949)
Makes sense to have the output be deterministic. Alphabetical sort seems like a logical choice.
2023-05-12 22:08:59 +00:00
Nathan Rajlich
d80732d74f [release] Promote vercel CLI release to "latest" (#9942)
It's possible that changesets will promote a release to latest that is
not the Vercel CLI release. This script ensures that a `vercel@` release
is always the latest after a publish happens.
2023-05-11 13:40:34 -07:00
Vercel Release Bot
b739c1845c Version Packages (#9939)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-11 10:46:10 -05:00
Sean Massa
e9f0fcf397 [cli] remove vc rollback beta label (#9928)
Remove the "beta" label from `vc rollback`.
2023-05-11 15:16:48 +00:00
Sean Massa
924a20a0fc [tests] make prettier ignore .changeset (#9938) 2023-05-11 09:50:14 -05:00
Nathan Rajlich
fc3b74d06f Add id-token: write permissions to enable npm publish provenance (#9936)
Was previously added in https://github.com/vercel/vercel/pull/9583, was
missed in the changesets switchover.
2023-05-10 16:24:28 -07:00
Vercel Release Bot
380ed38c71 Version Packages (#9935)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## vercel@29.2.1

### Patch Changes

-   Updated dependencies \[[`6d5983eaa`](6d5983eaae)]:
    -   @vercel/remix-builder@1.8.8

## @vercel/remix-builder@1.8.8

### Patch Changes

-   Upgrade `@remix-run/dev` to v1.16.0-patch.1 to fix erroneous "not found in your node_modules" warning ([#9930](https://github.com/vercel/vercel/pull/9930))
2023-05-10 22:55:42 +00:00
Nathan Rajlich
e228cdd373 Add @svitejs/changesets-changelog-github-compact to package.json (#9934)
Forgot to add the package in #9933 :doh:
2023-05-10 14:47:42 -07:00
Nathan Rajlich
9bd92535d6 Use Svelte's changelog generator and don't delete CHANGELOG.md (#9933)
Partial revert of #9932, since apparently [that didn't
work](https://github.com/vercel/vercel/actions/runs/4941266637/jobs/8833725828).

We can investigate that more later, but this gets it working again
properly at least.

Also use Svelte's changelog generator, since it includes the PR numbers
which Sean wanted.
2023-05-10 14:41:19 -07:00
Nathan Rajlich
5825e30700 Create release PR as "Vercel Bot" and remove CHANGELOG.md files (#9932)
* Have changesets create the release PR as "Vercel Bot", so that the
tests run.
* Remove the `CHANGELOG.md` files. They are redundant with the GH
Releases which contain the same information.
2023-05-10 13:58:29 -07:00
Vercel Release Bot
6d5983eaae [remix] Upgrade @remix-run/dev to version 1.16.0-patch.1 (#9930)
This auto-generated PR updates @remix-run/dev to version 1.16.0-patch.1
2023-05-10 20:20:15 +00:00
Nathan Rajlich
2fd59a3b5a Use changesets instead of lerna (#9914)
`changesets` will improve our release workflow, since we will no longer need to manually curate and publish the changelog and GitHub Release. Instead, you simply merge the publish PR that the changesets GH action maintains as we push commits to `main`.
2023-05-10 19:35:17 +00:00
27 changed files with 748 additions and 2930 deletions

8
.changeset/README.md Normal file
View File

@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

14
.changeset/config.json Normal file
View File

@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": [
"@svitejs/changesets-changelog-github-compact",
{ "repo": "vercel/vercel" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@@ -1,72 +1,72 @@
name: Publish
name: Release
on:
push:
branches:
- main
tags:
- '!*'
env:
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish:
name: Publish
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [[ -z "$tag" ]];
then
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16
- name: install npm@9
run: npm i -g npm@9
- name: install pnpm@8.3.1
run: npm i -g pnpm@8.3.1
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm install
- name: Build
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Packages
run: pnpm build
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Publish
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm publish-from-github
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm version:prepare
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
NPM_CONFIG_PROVENANCE: 'true'
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Trigger Update
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
- name: Set latest Release to `vercel` (if a Publish Happened)
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-latest-release.js')
await script({ github, context })
- name: Trigger Update (if a Publish Happened)
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}

View File

@@ -1,26 +0,0 @@
name: Required PR Label
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check PR Labels
uses: actions/github-script@v6
with:
script: |
let missing = false;
const labels = context.payload.pull_request.labels.map(l => l.name);
if (labels.filter(l => l.startsWith('area:')).length === 0) {
console.error('::error::Missing label: Please add at least one "area" label.');
missing = true;
}
if (labels.filter(l => l.startsWith('semver:')).length !== 1) {
console.error('::error::Missing label: Please add exactly one "semver" label.');
missing = true;
}
if (missing) {
process.exit(1);
}
console.log('::notice::Success: This pull request has correct labels, thanks!');

View File

@@ -12,6 +12,7 @@ packages/gatsby-plugin-vercel-analytics
node_modules
dist
pnpm-lock.yaml
.changeset
.vscode
.DS_Store
.next

View File

@@ -19,9 +19,7 @@
## Vercel
Vercel is the platform for frontend developers, providing the speed and reliability innovators need to create at the moment of inspiration.
We enable teams to iterate quickly and develop, preview, and ship delightful user experiences. Vercel has zero-configuration support for 35+ frontend frameworks and integrates with your headless content, commerce, or database of choice.
Vercel's frontend cloud gives developers frameworks, workflows, and infrastructure to build a faster, more personalized web.
## Deploy

View File

@@ -4,10 +4,9 @@
"private": true,
"license": "Apache-2.0",
"packageManager": "pnpm@8.3.1",
"dependencies": {
"lerna": "5.6.2"
},
"devDependencies": {
"@changesets/cli": "2.26.1",
"@svitejs/changesets-changelog-github-compact": "1.1.0",
"@types/node": "14.18.33",
"@typescript-eslint/eslint-plugin": "5.21.0",
"@typescript-eslint/parser": "5.21.0",
@@ -32,16 +31,10 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "29.1.0",
"typescript": "4.9.5",
"turbo": "1.9.3"
"turbo": "1.9.4",
"typescript": "4.9.5"
},
"scripts": {
"lerna": "lerna",
"version": "pnpm install && git add pnpm-lock.yaml",
"bootstrap": "lerna bootstrap",
"publish-stable": "echo 'Run `pnpm changelog` for instructions'",
"publish-from-github": "./utils/publish.sh",
"changelog": "node utils/changelog.js",
"build": "node utils/gen.js && turbo --no-update-notifier run build",
"vercel-build": "pnpm build && pnpm run pack && cd api && node -r ts-eager/register ./_lib/script/build.ts",
"pre-commit": "lint-staged",
@@ -53,7 +46,9 @@
"lint": "eslint . --cache --ext .ts,.js",
"prettier-check": "prettier --check .",
"prepare": "husky install",
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
"pack": "cd utils && node -r ts-eager/register ./pack.ts",
"version:prepare": "changeset version && pnpm install --no-frozen-lockfile",
"release": "changeset publish"
},
"lint-staged": {
"./{*,{api,packages,test,utils}/**/*}.{js,ts}": [

27
packages/cli/CHANGELOG.md Normal file
View File

@@ -0,0 +1,27 @@
# vercel
## 29.3.2
### Patch Changes
- [vc dev] Fix serverless function size limit condition ([#9961](https://github.com/vercel/vercel/pull/9961))
## 29.3.1
### Patch Changes
- Sort environment variables alphabetically in `vercel env pull` ([#9949](https://github.com/vercel/vercel/pull/9949))
- Skip 50MB zip size limit for Python ([#9944](https://github.com/vercel/vercel/pull/9944))
## 29.3.0
### Minor Changes
- [cli] remove `vc rollback` beta label ([#9928](https://github.com/vercel/vercel/pull/9928))
## 29.2.1
### Patch Changes
- Updated dependencies [[`6d5983eaa`](https://github.com/vercel/vercel/commit/6d5983eaaefe3fd2204f49c3228718ac64a452e3)]:
- @vercel/remix-builder@1.8.8

View File

@@ -10,9 +10,7 @@
## Usage
Vercel is the platform for frontend developers, providing the speed and reliability innovators need to create at the moment of inspiration.
We enable teams to iterate quickly and develop, preview, and ship delightful user experiences. Vercel has zero-configuration support for 35+ frontend frameworks and integrates with your headless content, commerce, or database of choice.
Vercel's frontend cloud gives developers frameworks, workflows, and infrastructure to build a faster, more personalized web.
To install the latest version of Vercel CLI, run this command:

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "29.2.0",
"version": "29.3.2",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -39,7 +39,7 @@
"@vercel/node": "2.14.2",
"@vercel/python": "3.1.60",
"@vercel/redwood": "1.1.15",
"@vercel/remix-builder": "1.8.7",
"@vercel/remix-builder": "1.8.8",
"@vercel/ruby": "1.3.76",
"@vercel/static-build": "1.3.30"
},

View File

@@ -25,7 +25,7 @@ export const help = () => `
login [email] Logs into your account or creates a new one
logout Logs out of your account
pull [path] Pull your Project Settings from the cloud
rollback [url|id] Quickly revert back to a previous deployment [beta]
rollback [url|id] Quickly revert back to a previous deployment
switch [scope] Switches between teams and your personal account
${chalk.dim('Advanced')}

View File

@@ -122,8 +122,9 @@ export default async function pull(
const contents =
CONTENTS_PREFIX +
Object.entries(records)
.map(([key, value]) => `${key}="${escapeValue(value)}"`)
Object.keys(records)
.sort()
.map(key => `${key}="${escapeValue(records[key])}"`)
.join('\n') +
'\n';

View File

@@ -157,7 +157,8 @@ const main = async () => {
const targetOrSubcommand = argv._[2];
const subSubCommand = argv._[3];
const betaCommands: string[] = ['rollback'];
// If empty, leave this code here for easy adding of beta commands later
const betaCommands: string[] = [];
if (betaCommands.includes(targetOrSubcommand)) {
console.log(
`${chalk.grey(

View File

@@ -337,7 +337,10 @@ export async function executeBuild(
// Enforce the lambda zip size soft watermark
const maxLambdaBytes = bytes('50mb');
for (const asset of Object.values(result.output)) {
if (asset.type === 'Lambda') {
if (
asset.type === 'Lambda' &&
!(typeof asset.runtime === 'string' && asset.runtime.startsWith('python'))
) {
const size = asset.zipBuffer.length;
if (size > maxLambdaBytes) {
throw new LambdaSizeExceededError(size, maxLambdaBytes);

View File

@@ -31,6 +31,16 @@ const envs: ProjectEnvVariable[] = [
updatedAt: 1557241361455,
createdAt: 1557241361455,
},
{
type: 'encrypted',
id: '781dt89g8r2h789g',
key: 'ANOTHER',
value: 'one',
target: ['preview'],
configurationId: null,
updatedAt: 1557241361455,
createdAt: 1557241361455,
},
{
type: 'encrypted',
id: 'r124t6frtu25df16',

View File

@@ -1,5 +1,6 @@
import fs from 'fs-extra';
import path from 'path';
import { parse } from 'dotenv';
import env from '../../../src/commands/env';
import { setupUnitFixture } from '../../helpers/setup-unit-fixture';
import { client } from '../../mocks/client';
@@ -103,6 +104,13 @@ describe('env', () => {
expect(rawDevEnv).toContain(
'BRANCH_ENV_VAR="env var for a specific branch"'
);
const parsed = parse(rawDevEnv);
const keys = Object.keys(parsed);
expect(keys).toHaveLength(3);
expect(keys[0]).toEqual('ANOTHER');
expect(keys[1]).toEqual('BRANCH_ENV_VAR');
expect(keys[2]).toEqual('REDIS_CONNECTION_STRING');
});
it('should handle alternate filename', async () => {

View File

@@ -0,0 +1,7 @@
# @vercel/remix-builder
## 1.8.8
### Patch Changes
- Upgrade `@remix-run/dev` to v1.16.0-patch.1 to fix erroneous "not found in your node_modules" warning ([#9930](https://github.com/vercel/vercel/pull/9930))

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "1.8.7",
"version": "1.8.8",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -20,7 +20,7 @@
"defaults"
],
"dependencies": {
"@remix-run/dev": "npm:@vercel/remix-run-dev@1.16.0",
"@remix-run/dev": "npm:@vercel/remix-run-dev@1.16.0-patch.1",
"@vercel/build-utils": "6.7.2",
"@vercel/nft": "0.22.5",
"@vercel/static-config": "2.0.17",

3101
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

112
utils/changelog.js vendored
View File

@@ -1,112 +0,0 @@
const { join } = require('path');
const { execSync } = require('child_process');
const fetch = require('node-fetch');
const parseCommits = require('./changelog/parse');
const filterLog = require('./changelog/filter');
const groupLog = require('./changelog/group');
process.chdir(join(__dirname, '..'));
async function getLatestStableTag() {
const headers = {};
const token = process.env.GITHUB_TOKEN;
if (token) {
headers['authorization'] = `token ${token}`;
}
const res = await fetch(
'https://api.github.com/repos/vercel/vercel/releases/latest',
{
headers,
}
);
const result = await res.json();
if (!result.tag_name) {
const message = result.message || JSON.stringify(result);
throw new Error(`Failed to fetch releases from github: ${message}`);
}
return result.tag_name;
}
function serializeLog(groupedLog) {
const serialized = [];
for (let area of Object.keys(groupedLog)) {
if (serialized.length) {
// only push a padding-line above area if we already have content
serialized.push('');
}
serialized.push(`### ${area}`);
serialized.push('');
for (let line of groupedLog[area]) {
serialized.push(`- ${line}`);
}
}
return serialized;
}
function generateLog(tagName) {
const logLines = execSync(
`git log --pretty=format:"%s [%an] &&& %H" ${tagName}...HEAD`
)
.toString()
.trim()
.split('\n');
const commits = parseCommits(logLines);
const filteredCommits = filterLog(commits);
const groupedLog = groupLog(filteredCommits);
return serializeLog(groupedLog);
}
function findUniqPackagesAffected(tagName) {
const pkgs = new Set(
execSync(`git diff --name-only ${tagName}...HEAD`)
.toString()
.trim()
.split('\n')
.filter(line => line.startsWith('packages/'))
.map(line => line.split('/')[1])
.map(pkgName => {
try {
return require(`../packages/${pkgName}/package.json`).name;
} catch {
// Failed to read package.json (perhaps the pkg was deleted)
}
})
.filter(s => Boolean(s))
);
if (pkgs.size === 0) {
pkgs.add('vercel');
}
return pkgs;
}
async function main() {
const tagName = await getLatestStableTag();
if (!tagName) {
throw new Error('Unable to find last GitHub Release tag.');
}
const log = generateLog(tagName);
const formattedLog = log.join('\n') || 'NO CHANGES DETECTED';
console.log(`Changes since the last stable release (${tagName}):`);
console.log(`\n${formattedLog}\n`);
const pkgs = findUniqPackagesAffected(tagName);
const pub = Array.from(pkgs).join(',');
console.log('To publish a stable release, execute the following:');
console.log(
`\npnpx lerna version --message "Publish Stable" --exact --no-private --force-publish=${pub}\n`
);
}
main().catch(console.error);

View File

@@ -1,31 +0,0 @@
/**
* Filters out "Revert" commits as well as the commits they revert, if found.
*/
function filterReverts(commits) {
const revertCommits = commits.filter(commit => commit.revertsHashes.length);
const commitHashes = commits.map(commit => commit.hash);
let hashesToRemove = [];
revertCommits.forEach(revertCommit => {
const allFound = revertCommit.revertsHashes.every(hash => {
return commitHashes.includes(hash);
});
if (allFound) {
hashesToRemove = [
...hashesToRemove,
...revertCommit.revertsHashes,
revertCommit.hash,
];
}
});
return commits.filter(commit => !hashesToRemove.includes(commit.hash));
}
function normalizeLog(commits) {
commits = commits.filter(line => !line.subject.startsWith('Publish '));
return filterReverts(commits);
}
module.exports = normalizeLog;

View File

@@ -1,14 +0,0 @@
function groupLog(commits) {
const grouped = {};
for (let commit of commits) {
for (let area of commit.areas) {
grouped[area] = grouped[area] || [];
grouped[area].push(commit.subject);
}
}
return grouped;
}
module.exports = groupLog;

View File

@@ -1,55 +0,0 @@
const { execSync } = require('child_process');
const REVERT_MESSAGE_COMMIT_PATTERN = /This reverts commit ([^.^ ]+)/;
const AREA_PATTERN = /\[([^\]]+)\]/g;
function getCommitMessage(hash) {
return execSync(`git log --format=%B -n 1 ${hash}`).toString().trim();
}
function parseRevertCommit(message) {
// EX: This reverts commit 6dff0875f5f361decdb95ad70a400195006c6bba.
// EX: This reverts commit 6dff0875f5f361decdb95ad70a400195006c6bba (#123123).
const fullMessageLines = message
.trim()
.split('\n')
.filter(line => line.startsWith('This reverts commit'));
return fullMessageLines.map(
line => line.match(REVERT_MESSAGE_COMMIT_PATTERN)[1]
);
}
function parseAreas(subject) {
const areaChunk = subject.split(' ')[0] || '';
const areas = areaChunk.match(AREA_PATTERN);
if (!areas) {
return ['UNCATEGORIZED'];
}
return areas.map(area => area.substring(1, area.length - 1));
}
function parseCommits(logLines) {
const commits = [];
logLines.forEach(line => {
let [subject, hash] = line.split(' &&& ');
subject = subject.trim();
const message = getCommitMessage(hash);
const revertsHashes = parseRevertCommit(message);
const areas = parseAreas(subject);
commits.push({
hash,
areas,
subject,
message,
revertsHashes,
});
});
return commits;
}
module.exports = parseCommits;

36
utils/publish.sh vendored
View File

@@ -1,36 +0,0 @@
#!/bin/bash
set -euo pipefail
# `yarn` overwrites this value to use the yarn registry, which we
# can't publish to. Unset so that the default npm registry is used.
unset npm_config_registry
if [ -z "$NPM_TOKEN" ]; then
echo "NPM_TOKEN not found. Did you forget to assign the GitHub Action secret?"
exit 1
fi
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "Logged in to npm as: $(npm whoami)"
echo "Version of npm is: $(npm --version)"
dist_tag=""
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [ -z "$tag" ]; then
echo "Not a tagged commit, skipping publish"
exit 0
fi
if [[ "$tag" =~ -canary ]]; then
echo "Publishing canary release"
dist_tag="--dist-tag canary"
else
echo "Publishing stable release"
fi
pnpm run lerna publish from-git $dist_tag --no-verify-access --yes
# always update canary dist-tag as we no longer publish canary versions separate
node ./utils/update-canary-tag.js

View File

@@ -1,32 +0,0 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const changedFiles = execSync('git diff HEAD~ --name-only')
.toString()
.split('\n')
.map(file => file.trim());
const changedPackageVersions = new Map();
for (const file of changedFiles) {
if (file.match(/packages\/.+\/package.json/)) {
const packageData = JSON.parse(
fs.readFileSync(path.join(__dirname, '..', file), 'utf8')
);
changedPackageVersions.set(packageData.name, packageData.version);
}
}
for (const [package, version] of changedPackageVersions) {
if (version.includes('canary')) {
console.log(
`skipping ${package}@${version} as it is already a canary version`
);
} else {
console.log(
execSync(`npm dist-tag add ${package}@${version} canary`).toString()
);
console.log(`updated canary dist-tag for ${package}@${version}`);
}
}

24
utils/update-latest-release.js vendored Normal file
View File

@@ -0,0 +1,24 @@
module.exports = async ({ github, context }) => {
const { owner, repo } = context.repo;
const response = await github.repos.listReleases({ owner, repo });
function isVercelCliRelease(release) {
return release.tag_name.startsWith('vercel@');
}
const latestRelease = response.data[0];
if (isVercelCliRelease(latestRelease)) {
console.log(`Latest release is "${latestRelease.tag_name}" - skipping`);
return;
}
const latestVercelRelease = response.data.find(isVercelCliRelease);
console.log(`Promoting "${latestVercelRelease.tag_name}" to latest release`);
await github.repos.updateRelease({
owner,
repo,
release_id: latestVercelRelease.id,
make_latest: true,
});
};

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env node
/**
* Updates the `package.json` file to contain the legacy "now" `name` field.
* The provided argument should be a tag containing the new name.
*/
const fs = require('fs');
const { join } = require('path');
const npa = require('npm-package-arg');
const parsed = npa(process.argv[2]);
// Find the correct directory for this package
const packagesDir = join(__dirname, '..', 'packages');
const packageDir = fs.readdirSync(packagesDir).find(p => {
if (p.startsWith('.')) return false;
try {
const pkg = JSON.parse(
fs.readFileSync(join(packagesDir, p, 'package.json'), 'utf8')
);
return pkg.name === parsed.name;
} catch (err) {
console.error(err);
}
});
if (!packageDir) {
throw new Error(`Could not find the package directory for "${parsed.name}"`);
}
const pkgJsonPath = join(packagesDir, packageDir, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
const vcName = pkg.name;
const version = pkg.version;
if (pkg.name === '@vercel/client') {
// The legacy name for `@vercel/client` is `now-client` (global scope)
pkg.name = 'now-client';
} else {
pkg.name = pkg.name.replace('vercel', 'now');
if (pkg.bin && pkg.bin.vercel) {
// The legacy "bin" for Now CLI is "now"
pkg.bin = { now: pkg.bin.vercel };
}
}
const nowName = pkg.name;
console.error(`Updated package name: "${vcName}" -> "${nowName}"`);
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.
const IFS = '|';
console.log([packageDir, vcName, nowName, version].join(IFS));