-
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca02cba
commit acfed93
Showing
1 changed file
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,10 +35,10 @@ const internalContentFiles = [ | |
const allInternalContent = [...internalContentDirs, ...internalContentFiles]; | ||
|
||
const runCommand = { | ||
pnpm: 'pnpm', | ||
npm: 'npx', | ||
yarn: 'yarn', | ||
bun: 'bun', | ||
pnpm: 'pnpm create next-app@latest', | ||
npm: 'npx create-next-app@latest', | ||
yarn: 'yarn create next-app@latest', | ||
bun: 'bun create next-app@latest', | ||
}; | ||
|
||
program | ||
|
@@ -57,23 +57,36 @@ program | |
|
||
log(chalk.green('Creating new next-forge project...')); | ||
execSync( | ||
`${runCommand[packageManager]} create next-app@latest ${projectName} --example "${url}" --disable-git`, | ||
`${runCommand[packageManager]} ${projectName} --example "${url}" --disable-git`, | ||
execSyncOpts | ||
); | ||
process.chdir(projectDir); | ||
|
||
if (packageManager === 'bun') { | ||
log(chalk.green('Configuring Bun workspaces...')); | ||
if (packageManager !== 'pnpm') { | ||
const packageJsonPath = join(projectDir, 'package.json'); | ||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); | ||
|
||
log(chalk.green('Updating package manager configuration...')); | ||
|
||
if (packageManager === 'bun') { | ||
packageJson.packageManager = '[email protected]'; | ||
} else if (packageManager === 'npm') { | ||
packageJson.packageManager = '[email protected]'; | ||
} else if (packageManager === 'yarn') { | ||
packageJson.packageManager = '[email protected]'; | ||
} | ||
|
||
log(chalk.green('Updating workspace config...')); | ||
packageJson.workspaces = ['apps/*', 'packages/*']; | ||
packageJson.packageManager = '[email protected]'; | ||
|
||
writeFileSync( | ||
packageJsonPath, | ||
`${JSON.stringify(packageJson, null, 2)}\n` | ||
); | ||
|
||
log(chalk.green('Removing pnpm configuration...')); | ||
rmSync('pnpm-lock.yaml', { force: true }); | ||
rmSync('pnpm-workspace.yaml', { force: true }); | ||
} | ||
|
||
log(chalk.green('Deleting internal content...')); | ||
|
@@ -98,12 +111,6 @@ program | |
} | ||
} | ||
|
||
if (packageManager !== 'pnpm') { | ||
log(chalk.green('Removing pnpm lockfile and workspace config...')); | ||
rmSync('pnpm-lock.yaml', { force: true }); | ||
rmSync('pnpm-workspace.yaml', { force: true }); | ||
} | ||
|
||
log(chalk.green('Installing dependencies...')); | ||
execSync(`${packageManager} install`, execSyncOpts); | ||
|
||
|