@nx/workspace
Advanced tools
Comparing version 19.6.0-canary.20240809-d3747e0 to 19.6.0-canary.20240813-c72ba9b
{ | ||
"name": "@nx/workspace", | ||
"version": "19.6.0-canary.20240809-d3747e0", | ||
"version": "19.6.0-canary.20240813-c72ba9b", | ||
"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": "19.6.0-canary.20240809-d3747e0", | ||
"@nx/devkit": "19.6.0-canary.20240813-c72ba9b", | ||
"chalk": "^4.1.0", | ||
@@ -70,4 +70,4 @@ "enquirer": "~2.3.6", | ||
"yargs-parser": "21.1.1", | ||
"nx": "19.6.0-canary.20240809-d3747e0", | ||
"@nrwl/workspace": "19.6.0-canary.20240809-d3747e0" | ||
"nx": "19.6.0-canary.20240813-c72ba9b", | ||
"@nrwl/workspace": "19.6.0-canary.20240813-c72ba9b" | ||
}, | ||
@@ -74,0 +74,0 @@ "publishConfig": { |
@@ -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 @@ } |
@@ -10,2 +10,119 @@ "use strict"; | ||
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) { | ||
@@ -19,3 +136,2 @@ if (!options.name) { | ||
options = normalizeOptions(options); | ||
createReadme(tree, options); | ||
createFiles(tree, options); | ||
@@ -30,2 +146,3 @@ const nxJson = createNxJson(tree, options); | ||
: null; | ||
await createReadme(tree, options, token); | ||
const [packageMajor] = packageManagerVersion.split('.'); | ||
@@ -113,8 +230,21 @@ if (options.packageManager === 'pnpm' && +packageMajor >= 7) { | ||
} | ||
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 | ||
@@ -124,2 +254,4 @@ ? 'dev' | ||
name, | ||
nxCloud, | ||
nxCloudOnboardingUrl, | ||
}); | ||
@@ -126,0 +258,0 @@ } |
@@ -30,4 +30,5 @@ import { PackageManager, Tree } from '@nx/devkit'; | ||
isCustomPreset: boolean; | ||
nxCloudToken?: string; | ||
} | ||
export declare function newGenerator(tree: Tree, opts: Schema): Promise<() => Promise<void>>; | ||
export default newGenerator; |
@@ -13,3 +13,3 @@ "use strict"; | ||
validateOptions(options, tree); | ||
await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, options); | ||
options.nxCloudToken = await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, options); | ||
(0, generate_preset_1.addPresetDependencies)(tree, options); | ||
@@ -16,0 +16,0 @@ await (0, devkit_1.formatFiles)(tree); |
@@ -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; | ||
} |
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
225553
4867
+ Added@nrwl/devkit@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nrwl/tao@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nrwl/workspace@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/devkit@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-darwin-arm64@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-darwin-x64@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-freebsd-x64@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-linux-arm64-gnu@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-linux-arm64-musl@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-linux-x64-gnu@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-linux-x64-musl@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-win32-arm64-msvc@19.6.0-canary.20240813-c72ba9b(transitive)
+ Added@nx/nx-win32-x64-msvc@19.6.0-canary.20240813-c72ba9b(transitive)
+ Addednx@19.6.0-canary.20240813-c72ba9b(transitive)
- Removed@nrwl/devkit@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nrwl/tao@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nrwl/workspace@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/devkit@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-darwin-arm64@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-darwin-x64@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-freebsd-x64@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-linux-arm64-gnu@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-linux-arm64-musl@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-linux-x64-gnu@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-linux-x64-musl@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-win32-arm64-msvc@19.6.0-canary.20240809-d3747e0(transitive)
- Removed@nx/nx-win32-x64-msvc@19.6.0-canary.20240809-d3747e0(transitive)
- Removednx@19.6.0-canary.20240809-d3747e0(transitive)