@nx/workspace
Advanced tools
Comparing version 0.0.0-pr-26891-048ee5a to 0.0.0-pr-26891-0a70597
{ | ||
"name": "@nx/workspace", | ||
"version": "0.0.0-pr-26891-048ee5a", | ||
"version": "0.0.0-pr-26891-0a70597", | ||
"private": false, | ||
@@ -64,3 +64,3 @@ "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.", | ||
"dependencies": { | ||
"@nx/devkit": "0.0.0-pr-26891-048ee5a", | ||
"@nx/devkit": "0.0.0-pr-26891-0a70597", | ||
"chalk": "^4.1.0", | ||
@@ -70,4 +70,4 @@ "enquirer": "~2.3.6", | ||
"yargs-parser": "21.1.1", | ||
"nx": "0.0.0-pr-26891-048ee5a", | ||
"@nrwl/workspace": "0.0.0-pr-26891-048ee5a" | ||
"nx": "0.0.0-pr-26891-0a70597", | ||
"@nrwl/workspace": "0.0.0-pr-26891-0a70597" | ||
}, | ||
@@ -77,3 +77,4 @@ "publishConfig": { | ||
}, | ||
"type": "commonjs" | ||
"type": "commonjs", | ||
"types": "./index.d.ts" | ||
} |
@@ -71,2 +71,3 @@ "use strict"; | ||
opts.prefix !== undefined ? `--prefix=${opts.prefix}` : null, | ||
opts.nxCloudToken ? `--nxCloudToken=${opts.nxCloudToken}` : null, | ||
].filter((e) => !!e); | ||
@@ -73,0 +74,0 @@ } |
import { Tree } from '@nx/devkit'; | ||
import { NormalizedSchema } from './new'; | ||
export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<void>; | ||
export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<string>; |
@@ -9,2 +9,120 @@ "use strict"; | ||
const default_base_1 = require("../../utilities/default-base"); | ||
const connect_to_nx_cloud_1 = require("nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud"); | ||
const url_shorten_1 = require("nx/src/nx-cloud/utilities/url-shorten"); | ||
// map from the preset to the name of the plugin s.t. the README can have a more | ||
// meaningful generator command. | ||
const presetToPluginMap = { | ||
[presets_1.Preset.Apps]: { | ||
learnMoreLink: 'https://nx.dev/getting-started/intro#learn-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NPM]: { | ||
generateNxReleaseInfo: true, | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/npm-workspaces-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.TS]: { | ||
generateLibCmd: '@nx/js', | ||
generateNxReleaseInfo: true, | ||
learnMoreLink: 'https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.WebComponents]: { | ||
generateAppCmd: null, | ||
learnMoreLink: 'https://nx.dev/getting-started/intro#learn-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.AngularMonorepo]: { | ||
generateAppCmd: '@nx/angular', | ||
generateLibCmd: '@nx/angular', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/angular-monorepo-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.AngularStandalone]: { | ||
generateAppCmd: '@nx/angular', | ||
generateLibCmd: '@nx/angular', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.ReactMonorepo]: { | ||
generateAppCmd: '@nx/react', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/react-monorepo-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.ReactStandalone]: { | ||
generateAppCmd: '@nx/react', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/react-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NextJsStandalone]: { | ||
generateAppCmd: '@nx/next', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/next?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.RemixMonorepo]: { | ||
generateAppCmd: '@nx/remix', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.RemixStandalone]: { | ||
generateAppCmd: '@nx/remix', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.ReactNative]: { | ||
generateAppCmd: '@nx/react-native', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/react-native?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.VueMonorepo]: { | ||
generateAppCmd: '@nx/vue', | ||
generateLibCmd: '@nx/vue', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/vue-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.VueStandalone]: { | ||
generateAppCmd: '@nx/vue', | ||
generateLibCmd: '@nx/vue', | ||
learnMoreLink: 'https://nx.dev/getting-started/tutorials/vue-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.Nuxt]: { | ||
generateAppCmd: '@nx/nuxt', | ||
generateLibCmd: '@nx/vue', | ||
learnMoreLink: 'https://nx.dev/nx-api/nuxt?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NuxtStandalone]: { | ||
generateAppCmd: '@nx/nuxt', | ||
generateLibCmd: '@nx/vue', | ||
learnMoreLink: 'https://nx.dev/nx-api/nuxt?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.Expo]: { | ||
generateAppCmd: '@nx/expo', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/expo?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NextJs]: { | ||
generateAppCmd: '@nx/next', | ||
generateLibCmd: '@nx/react', | ||
learnMoreLink: 'https://nx.dev/nx-api/next?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.Nest]: { | ||
generateAppCmd: '@nx/nest', | ||
generateLibCmd: '@nx/node', | ||
learnMoreLink: 'https://nx.dev/nx-api/nest?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.Express]: { | ||
generateAppCmd: '@nx/express', | ||
generateLibCmd: '@nx/node', | ||
learnMoreLink: 'https://nx.dev/nx-api/express?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NodeStandalone]: { | ||
generateAppCmd: '@nx/node', | ||
generateLibCmd: '@nx/node', | ||
learnMoreLink: 'https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.NodeMonorepo]: { | ||
generateAppCmd: '@nx/node', | ||
generateLibCmd: '@nx/node', | ||
learnMoreLink: 'https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
[presets_1.Preset.TsStandalone]: { | ||
generateAppCmd: null, | ||
generateLibCmd: null, | ||
generateNxReleaseInfo: true, | ||
learnMoreLink: 'https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects', | ||
}, | ||
}; | ||
async function generateWorkspaceFiles(tree, options) { | ||
@@ -18,5 +136,12 @@ if (!options.name) { | ||
options = normalizeOptions(options); | ||
createReadme(tree, options); | ||
createFiles(tree, options); | ||
createNxJson(tree, options); | ||
const nxJson = createNxJson(tree, options); | ||
const token = options.nxCloud !== 'skip' | ||
? await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, { | ||
installationSource: 'create-nx-workspace', | ||
directory: options.directory, | ||
github: options.useGitHub, | ||
}, nxJson) | ||
: null; | ||
await createReadme(tree, options, token); | ||
const [packageMajor] = packageManagerVersion.split('.'); | ||
@@ -36,3 +161,3 @@ if (options.packageManager === 'pnpm' && +packageMajor >= 7) { | ||
setUpWorkspacesInPackageJson(tree, options); | ||
await (0, devkit_1.formatFiles)(tree); | ||
return token; | ||
} | ||
@@ -78,2 +203,3 @@ function setPresetProperty(tree, options) { | ||
(0, devkit_1.writeJson)(tree, (0, path_1.join)(directory, 'nx.json'), nxJson); | ||
return nxJson; | ||
} | ||
@@ -105,8 +231,21 @@ function createFiles(tree, options) { | ||
} | ||
function createReadme(tree, { name, appName, directory, preset }) { | ||
async function createReadme(tree, { name, appName, directory, preset, nxCloud }, nxCloudToken) { | ||
const formattedNames = (0, devkit_1.names)(name); | ||
// default to an empty one for custom presets | ||
const presetInfo = presetToPluginMap[preset] ?? { | ||
package: '', | ||
generateLibCmd: null, | ||
}; | ||
const nxCloudOnboardingUrl = nxCloudToken | ||
? await (0, url_shorten_1.createNxCloudOnboardingURL)('readme', nxCloudToken) | ||
: null; | ||
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files-readme'), directory, { | ||
formattedNames, | ||
isJsStandalone: preset === presets_1.Preset.TsStandalone, | ||
isEmptyRepo: !appName, | ||
appName, | ||
generateAppCmd: presetInfo.generateAppCmd, | ||
generateLibCmd: presetInfo.generateLibCmd, | ||
generateNxReleaseInfo: presetInfo.generateNxReleaseInfo, | ||
learnMoreLink: presetInfo.learnMoreLink, | ||
serveCommand: preset === presets_1.Preset.NextJs || preset === presets_1.Preset.NextJsStandalone | ||
@@ -116,2 +255,4 @@ ? 'dev' | ||
name, | ||
nxCloud, | ||
nxCloudOnboardingUrl, | ||
}); | ||
@@ -180,2 +321,3 @@ } | ||
defaultBase, | ||
nxCloud: options.nxCloud ?? 'skip', | ||
}; | ||
@@ -182,0 +324,0 @@ } |
@@ -24,2 +24,4 @@ import { PackageManager, Tree } from '@nx/devkit'; | ||
prefix?: string; | ||
useGitHub?: boolean; | ||
nxCloud?: 'yes' | 'skip' | 'circleci' | 'github'; | ||
} | ||
@@ -29,4 +31,5 @@ export interface NormalizedSchema extends Schema { | ||
isCustomPreset: boolean; | ||
nxCloudToken?: string; | ||
} | ||
export declare function newGenerator(tree: Tree, opts: Schema): Promise<() => Promise<void>>; | ||
export default newGenerator; |
@@ -13,4 +13,5 @@ "use strict"; | ||
validateOptions(options, tree); | ||
await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, { ...options, nxCloud: undefined }); | ||
options.nxCloudToken = await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, options); | ||
(0, generate_preset_1.addPresetDependencies)(tree, options); | ||
await (0, devkit_1.formatFiles)(tree); | ||
return async () => { | ||
@@ -17,0 +18,0 @@ if (!options.skipInstall) { |
@@ -37,2 +37,3 @@ "use strict"; | ||
prefix: options.prefix, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -55,2 +56,3 @@ } | ||
prefix: options.prefix, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -70,2 +72,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -87,2 +90,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -101,2 +105,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -116,2 +121,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -130,2 +136,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -146,2 +153,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -160,2 +168,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -176,2 +185,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -222,2 +232,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -258,2 +269,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -270,2 +282,3 @@ } | ||
addPlugin, | ||
nxCloudToken: options.nxCloudToken, | ||
}); | ||
@@ -272,0 +285,0 @@ } |
@@ -22,2 +22,3 @@ import { Preset } from '../utils/presets'; | ||
prefix?: string; | ||
nxCloudToken?: string; | ||
} |
export declare const nxVersion: any; | ||
export declare const typescriptVersion = "~5.5.2"; | ||
export declare const angularCliVersion = "~18.1.0"; | ||
export declare const angularCliVersion = "~18.2.0"; |
@@ -8,2 +8,2 @@ "use strict"; | ||
// deps are not installed from workspace | ||
exports.angularCliVersion = '~18.1.0'; | ||
exports.angularCliVersion = '~18.2.0'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225548
4867
+ Added@nrwl/devkit@0.0.0-pr-26891-0a70597(transitive)
+ Added@nrwl/tao@0.0.0-pr-26891-0a70597(transitive)
+ Added@nrwl/workspace@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/devkit@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-darwin-arm64@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-darwin-x64@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-freebsd-x64@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-linux-arm64-gnu@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-linux-arm64-musl@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-linux-x64-gnu@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-linux-x64-musl@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-win32-arm64-msvc@0.0.0-pr-26891-0a70597(transitive)
+ Added@nx/nx-win32-x64-msvc@0.0.0-pr-26891-0a70597(transitive)
+ Addednx@0.0.0-pr-26891-0a70597(transitive)
- Removed@nrwl/devkit@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nrwl/tao@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nrwl/workspace@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/devkit@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-darwin-arm64@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-darwin-x64@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-freebsd-x64@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-linux-arm64-gnu@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-linux-arm64-musl@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-linux-x64-gnu@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-linux-x64-musl@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-win32-arm64-msvc@0.0.0-pr-26891-048ee5a(transitive)
- Removed@nx/nx-win32-x64-msvc@0.0.0-pr-26891-048ee5a(transitive)
- Removednx@0.0.0-pr-26891-048ee5a(transitive)
Updatednx@0.0.0-pr-26891-0a70597