create-nx-plugin 23.2.0-beta.6 → 23.2.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import yargs = require('yargs');
3
3
  import { CreateWorkspaceOptions } from 'create-nx-workspace';
4
- import type { NxCloud, PackageManager } from 'create-nx-workspace/internal';
4
+ import type { Linter, NxCloud, PackageManager } from 'create-nx-workspace/internal';
5
5
  export declare const yargsDecorator: {
6
6
  'Options:': string;
7
7
  'Examples:': string;
@@ -20,6 +20,7 @@ interface CreateNxPluginArguments extends CreateWorkspaceOptions {
20
20
  packageManager: PackageManager;
21
21
  allPrompts: boolean;
22
22
  nxCloud: NxCloud;
23
+ linter?: Linter;
23
24
  }
24
25
  export declare const commandsObject: yargs.Argv<CreateNxPluginArguments>;
25
26
  export {};
@@ -5,7 +5,6 @@ exports.commandsObject = exports.yargsDecorator = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const path_1 = require("path");
7
7
  const pc = tslib_1.__importStar(require("picocolors"));
8
- const enquirer = require("enquirer");
9
8
  const yargs = require("yargs");
10
9
  const internal_1 = require("create-nx-workspace/internal");
11
10
  const create_nx_workspace_1 = require("create-nx-workspace");
@@ -26,28 +25,18 @@ async function determinePluginName(parsedArgs) {
26
25
  if (parsedArgs.pluginName) {
27
26
  return parsedArgs.pluginName;
28
27
  }
29
- const results = await enquirer.prompt([
30
- {
31
- name: 'pluginName',
32
- message: `Plugin name `,
33
- type: 'input',
34
- validate: (s_1) => (s_1.length ? true : 'Plugin name cannot be empty'),
35
- },
36
- ]);
37
- return results.pluginName;
28
+ return (0, internal_1.textPrompt)({
29
+ message: `Plugin name `,
30
+ validate: (value) => value.length ? undefined : 'Plugin name cannot be empty',
31
+ });
38
32
  }
39
33
  async function determineCreatePackageName(parsedArgs) {
40
34
  if (parsedArgs.createPackageName) {
41
35
  return parsedArgs.createPackageName;
42
36
  }
43
- const results = await enquirer.prompt([
44
- {
45
- name: 'createPackageName',
46
- message: `Create a package which can be used by npx to create a new workspace (Leave blank to not create this package)`,
47
- type: 'input',
48
- },
49
- ]);
50
- return results.createPackageName;
37
+ return (0, internal_1.textPrompt)({
38
+ message: `Create a package which can be used by npx to create a new workspace (Leave blank to not create this package)`,
39
+ });
51
40
  }
52
41
  exports.commandsObject = yargs
53
42
  .wrap(yargs.terminalWidth())
@@ -66,6 +55,19 @@ exports.commandsObject = yargs
66
55
  .option('createPackageName', {
67
56
  describe: 'Name of the CLI package to create workspace with plugin',
68
57
  type: 'string',
58
+ })
59
+ // `choices` is load-bearing, not documentation: it rejects a typo at
60
+ // argv parse. The preset's own enum would catch it too, but only after
61
+ // the workspace has been created and installed.
62
+ .option('linter', {
63
+ describe: pc.dim(`Linter to use`),
64
+ choices: [...internal_1.LINTERS],
65
+ type: 'string',
66
+ })
67
+ .option('interactive', {
68
+ describe: pc.dim(`Enable interactive mode`),
69
+ type: 'boolean',
70
+ default: true,
69
71
  }), internal_1.withNxCloud, internal_1.withAllPrompts, internal_1.withPackageManager, internal_1.withGitOptions), async (argv) => {
70
72
  await main(argv).catch((error) => {
71
73
  const { version } = require((0, path_1.join)('create-nx-plugin', 'package.json'));
@@ -134,12 +136,14 @@ async function normalizeArgsMiddleware(argv) {
134
136
  const packageManager = await (0, internal_1.determinePackageManager)(argv);
135
137
  const defaultBase = await (0, internal_1.determineDefaultBase)(argv);
136
138
  const nxCloud = await (0, internal_1.determineNxCloud)(argv);
139
+ const linter = await (0, internal_1.determineLinterOptions)(argv);
137
140
  Object.assign(argv, {
138
141
  pluginName,
139
142
  createPackageName,
140
143
  nxCloud,
141
144
  packageManager,
142
145
  defaultBase,
146
+ linter,
143
147
  });
144
148
  }
145
149
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-plugin",
3
- "version": "23.2.0-beta.6",
3
+ "version": "23.2.0-beta.8",
4
4
  "private": false,
5
5
  "description": "This package is used to scaffold a brand-new workspace used to develop an Nx plugin, and sets up a pre-configured plugin with the specified name. The new plugin is created with a default generator, executor, and e2e app.",
6
6
  "repository": {
@@ -37,10 +37,9 @@
37
37
  "homepage": "https://nx.dev",
38
38
  "dependencies": {
39
39
  "picocolors": "^1.1.0",
40
- "enquirer": "~2.3.6",
41
40
  "tslib": "^2.3.0",
42
41
  "yargs": "^17.6.2",
43
- "create-nx-workspace": "23.2.0-beta.6"
42
+ "create-nx-workspace": "23.2.0-beta.8"
44
43
  },
45
44
  "publishConfig": {
46
45
  "access": "public"