mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +00:00
[cli] Replace update-notifier dependency with built in (#8090)
This PR replaces the `update-notifier` dependency with a custom implementation. There are a few reasons: the dependency is quite large, it requires ESM in order to update, and can sometimes suggest an update to an older version. For example:  - Related to #8038 Co-authored-by: Chris Barber <chris.barber@vercel.com> Co-authored-by: Chris Barber <chris@cb1inc.com> Co-authored-by: Sean Massa <EndangeredMassa@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import cpy from 'cpy';
|
||||
import execa from 'execa';
|
||||
import { join } from 'path';
|
||||
import { remove, writeFile } from 'fs-extra';
|
||||
import { remove, readJSON, writeFile } from 'fs-extra';
|
||||
|
||||
const dirRoot = join(__dirname, '..');
|
||||
const distRoot = join(dirRoot, 'dist');
|
||||
@@ -43,15 +43,15 @@ async function main() {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
const pkg = await readJSON(join(dirRoot, 'package.json'));
|
||||
const dependencies = Object.keys(pkg?.dependencies ?? {});
|
||||
// Do the initial `ncc` build
|
||||
console.log();
|
||||
const args = [
|
||||
'ncc',
|
||||
'build',
|
||||
'--external',
|
||||
'update-notifier',
|
||||
'src/index.ts',
|
||||
];
|
||||
console.log('Dependencies:', dependencies);
|
||||
const externs = [];
|
||||
for (const dep of dependencies) {
|
||||
externs.push('--external', dep);
|
||||
}
|
||||
const args = ['ncc', 'build', 'src/index.ts', ...externs];
|
||||
await execa('yarn', args, { stdio: 'inherit', cwd: dirRoot });
|
||||
|
||||
// `ncc` has some issues with `@vercel/fun`'s runtime files:
|
||||
@@ -78,6 +78,10 @@ async function main() {
|
||||
// Band-aid to bundle stuff that `ncc` neglects to bundle
|
||||
await cpy(join(dirRoot, 'src/util/projects/VERCEL_DIR_README.txt'), distRoot);
|
||||
await cpy(join(dirRoot, 'src/util/dev/builder-worker.js'), distRoot);
|
||||
await cpy(
|
||||
join(dirRoot, 'src/util/get-latest-version/get-latest-worker.js'),
|
||||
distRoot
|
||||
);
|
||||
|
||||
console.log('Finished building Vercel CLI');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user