mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
ba4eec7b23
* remove @pyra/eslint-config * wip * wip * convert shirt-shop-api * convert shirt-shop * convert snippets * convert next-13 * convert next-14 * convert next-15 * eslint configs * upgrade prettier * use eslint v9 * run prettier * resolve type-check * adjust eslint * drop Next.js v13 * fix next-14 Avoid accidentally using implicitly installed eslint v8 * update lockfile * rm @eslint/eslintrc * add @next/eslint-plugin-next * biome * biome fixes * wip * apply formatting * tabs * rm prettier * spaces * fix svelte * update lockfile * single quotes * format all * rm eslint-disable comments * upgrade playwright * upgrade publint * upgrade playwright ci workflow * try chromium headless * try adding executablePath
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { execSync } from 'child_process';
|
|
import fs from 'fs/promises';
|
|
|
|
function install(command) {
|
|
return execSync(command, { stdio: 'inherit' });
|
|
}
|
|
|
|
/**
|
|
* This script installs the dependencies for the project.
|
|
*
|
|
* You do not need this script in your own project and can simply delete it,
|
|
* and delete `vercel.json`.
|
|
*
|
|
* We have it in this repository so we can use `workspace:*` dependencies during
|
|
* development in github.com/vercel/flags and replace them with the real dependencies
|
|
* when the repository is cloned.
|
|
*/
|
|
async function main() {
|
|
if (process.env.VERCEL_PROJECT_ID === 'prj_6Km3AvCCo0QgJSoEb3cFQwwB9x0Y') {
|
|
// pnpm is necessary when installing for the vercel/flags monorepo
|
|
install('pnpm install');
|
|
return;
|
|
}
|
|
|
|
const packageJson = JSON.parse(await fs.readFile('./package.json', 'utf8'));
|
|
const templatePackageJson = { ...packageJson };
|
|
|
|
// Replace workspace dependencies with real versions
|
|
for (const [dep, version] of Object.entries(
|
|
templatePackageJson.dependencies || {},
|
|
)) {
|
|
if (version.startsWith('workspace:')) {
|
|
// Replace workspace dependencies with "latest" versions
|
|
templatePackageJson.dependencies[dep] = 'latest';
|
|
}
|
|
}
|
|
|
|
await fs.writeFile('./package.json', JSON.stringify(templatePackageJson));
|
|
|
|
// npm is necessary when installing for a template project
|
|
install('npm install --legacy-peer-deps');
|
|
}
|
|
|
|
main();
|