Skip to content

Commit

Permalink
fix(misc): nx init should allow overriding the version of nx
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Nov 30, 2022
1 parent db85c62 commit ee65e6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/nx/src/command-line/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ import { addNxToNpmRepo } from '../nx-init/add-nx-to-npm-repo';

export async function initHandler() {
const args = process.argv.slice(2).join(' ');
const version = process.env.NX_VERSION ?? 'latest';
if (existsSync('package.json')) {
if (existsSync('angular.json')) {
// TODO(leo): remove make-angular-cli-faster
execSync(`npx --yes make-angular-cli-faster@latest ${args}`, {
execSync(`npx --yes make-angular-cli-faster@${version} ${args}`, {
stdio: [0, 1, 2],
});
} else if (isCRA()) {
// TODO(jack): remove cra-to-nx
execSync(`npx --yes cra-to-nx@latest ${args}`, {
execSync(`npx --yes cra-to-nx@${version} ${args}`, {
stdio: [0, 1, 2],
});
} else if (isMonorepo()) {
// TODO: vsavkin remove add-nx-to-monorepo
execSync(`npx --yes add-nx-to-monorepo@latest ${args}`, {
execSync(`npx --yes add-nx-to-monorepo@${version} ${args}`, {
stdio: [0, 1, 2],
});
} else {
await addNxToNpmRepo();
}
} else {
execSync(`npx --yes create-nx-workspace@latest ${args}`, {
execSync(`npx --yes create-nx-workspace@${version} ${args}`, {
stdio: [0, 1, 2],
});
}
Expand Down

1 comment on commit ee65e6a

@vercel
Copy link

@vercel vercel bot commented on ee65e6a Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx.dev
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.