yeoman-environment 4.0.0-alpha.4 → 4.0.0-alpha.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-environment",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "Handles the lifecyle and bootstrapping of generators in a specific environment",
5
5
  "keywords": [
6
6
  "development",
package/dist/adapter.d.ts DELETED
@@ -1,54 +0,0 @@
1
- export default TerminalAdapter;
2
- declare class TerminalAdapter {
3
- /**
4
- * `TerminalAdapter` is the default implementation of `Adapter`, an abstraction
5
- * layer that defines the I/O interactions.
6
- *
7
- * It provides a CLI interaction
8
- *
9
- * @constructor
10
- * @param {Object} [options]
11
- * @param {Console} [options.console]
12
- */
13
- constructor(options?: {
14
- console?: Console | undefined;
15
- } | undefined);
16
- promptModule: any;
17
- console: Console;
18
- log: {
19
- (message: any, ctx: any, ...args: any[]): any;
20
- write(...args: any[]): any;
21
- writeln(...args: any[]): any;
22
- ok(...args: any[]): any;
23
- error(...args: any[]): any;
24
- table(options: any): string;
25
- };
26
- tracker: any;
27
- get _colorDiffAdded(): import("chalk").ChalkInstance;
28
- get _colorDiffRemoved(): import("chalk").ChalkInstance;
29
- _colorLines(name: any, string: any): any;
30
- close(): void;
31
- /**
32
- * Prompt a user for one or more questions and pass
33
- * the answer(s) to the provided callback.
34
- *
35
- * It shares its interface with `Base.prompt`
36
- *
37
- * (Defined inside the constructor to keep interfaces separated between
38
- * instances)
39
- *
40
- * @param {Object|Object[]} questions
41
- * @param {Object} [answers] Answers to be passed to inquirer
42
- * @return {Object} promise answers
43
- */
44
- prompt(questions: Object | Object[], answers?: Object | undefined, cb: any): Object;
45
- promptUi: any;
46
- /**
47
- * Shows a color-based diff of two strings
48
- *
49
- * @param {string} actual
50
- * @param {string} expected
51
- * @param {Array} changes returned by diff.
52
- */
53
- diff(actual: string, expected: string, changes: any[]): string;
54
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,8 +0,0 @@
1
- export declare const printGroupedGenerator: (generators: any) => void;
2
- /**
3
- * @param {string} generatorNamespace
4
- * @param {*} options
5
- * @param {*} command
6
- * @returns
7
- */
8
- export declare const environmentAction: (this: any, generatorNamespace: string, options: any, command: any) => Promise<any>;
package/dist/command.d.ts DELETED
@@ -1,24 +0,0 @@
1
- export default commandMixin;
2
- declare function commandMixin(cls: any): {
3
- new (): {
4
- [x: string]: any;
5
- /**
6
- * Generate a command for the generator and execute.
7
- *
8
- * @param {string} generatorNamespace
9
- * @param {string[]} args
10
- */
11
- execute(generatorNamespace: string, args?: string[]): Promise<any>;
12
- };
13
- [x: string]: any;
14
- addEnvironmentOptions(command?: YeomanCommand): YeomanCommand;
15
- /**
16
- * Load Generator options into a commander instance.
17
- *
18
- * @param {Command} command - Command to load options
19
- * @param {Generator} generator - Generator
20
- * @return {Command} return command
21
- */
22
- addGeneratorOptions(command: Command, generator: Generator): Command;
23
- };
24
- import YeomanCommand from './util/command.js';
@@ -1,25 +0,0 @@
1
- export default composability;
2
- declare namespace composability {
3
- function requireGenerator(namespace: any): Promise<any>;
4
- /**
5
- * Install generators at the custom local repository and register.
6
- *
7
- * @param {Object} packages - packages to install key(packageName): value(versionRange).
8
- * @return {Boolean} - true if the install succeeded.
9
- */
10
- function installLocalGenerators(packages: Object): boolean;
11
- /**
12
- * Lookup and register generators from the custom local repository.
13
- *
14
- * @param {String[]} [packagesToLookup='generator-*'] - packages to lookup.
15
- */
16
- function lookupLocalPackages(packagesToLookup?: string[] | undefined): void;
17
- /**
18
- * Resolve a package name with version.
19
- *
20
- * @param {string} packageName - package to resolve.
21
- * @param {string} [packageVersion] - version or range to resolve.
22
- * @param {string[]} Array of key, value pairs.
23
- */
24
- function resolvePackage(packageName: string, packageVersion?: string | undefined): Promise<any[] | undefined>;
25
- }
@@ -1,409 +0,0 @@
1
- export default Environment;
2
- declare class Environment {
3
- static get UNKNOWN_NAMESPACE(): string;
4
- static get UNKNOWN_RESOLVED(): string;
5
- static get queues(): string[];
6
- static get lookups(): string[];
7
- /**
8
- * Make sure the Environment present expected methods if an old version is
9
- * passed to a Generator.
10
- * @param {Environment} env
11
- * @return {Environment} The updated env
12
- */
13
- static enforceUpdate(env: Environment): Environment;
14
- /**
15
- * Prepare a commander instance for cli support.
16
- *
17
- * @param {Class} GeneratorClass - Generator to create Command
18
- * @return {Command} Return a Command instance
19
- */
20
- static prepareCommand(GeneratorClass: Class, command?: YeomanCommand): Command;
21
- /**
22
- * Prepare a commander instance for cli support.
23
- *
24
- * @param {Command} command - Command to be prepared
25
- * @param {Class} GeneratorClass - Generator to create Command
26
- * @return {Command} return command
27
- */
28
- static prepareGeneratorCommand(command: Command, GeneratorClass: Class, namespace: any): Command;
29
- /**
30
- * Factory method to create an environment instance. Take same parameters as the
31
- * Environment constructor.
32
- *
33
- * @deprecated
34
- * @param {string[]} [args] - arguments.
35
- * @param {object} [options] - Environment options.
36
- * @param {Adapter} [adapter] - Terminal adapter.
37
- *
38
- * @return {Environment} a new Environment instance
39
- */
40
- static createEnv(args?: string[] | undefined, options?: object | undefined, adapter?: any): Environment;
41
- /**
42
- * Factory method to create an environment instance. Take same parameters as the
43
- * Environment constructor.
44
- *
45
- * @param {String} version - Version of the Environment
46
- * @param {...any} args - Same arguments as {@link Environment}#createEnv.
47
- * @return {Environment} a new Environment instance
48
- */
49
- static createEnvWithVersion(version: string, ...args: any[]): Environment;
50
- /**
51
- * Convert a generators namespace to its name
52
- *
53
- * @param {String} namespace
54
- * @return {String}
55
- */
56
- static namespaceToName(namespace: string): string;
57
- /**
58
- * Lookup for a specific generator.
59
- *
60
- * @param {String} namespace
61
- * @param {Object} [options]
62
- * @param {Boolean} [options.localOnly=false] - Set true to skip lookups of
63
- * globally-installed generators.
64
- * @param {Boolean} [options.packagePath=false] - Set true to return the package
65
- * path instead of generators file.
66
- * @param {Boolean} [options.singleResult=true] - Set false to return multiple values.
67
- * @return {String} generator
68
- */
69
- static lookupGenerator(namespace: string, options?: {
70
- localOnly?: boolean | undefined;
71
- packagePath?: boolean | undefined;
72
- singleResult?: boolean | undefined;
73
- } | undefined): string;
74
- /**
75
- * @classdesc `Environment` object is responsible of handling the lifecyle and bootstrap
76
- * of generators in a specific environment (your app).
77
- *
78
- * It provides a high-level API to create and run generators, as well as further
79
- * tuning where and how a generator is resolved.
80
- *
81
- * An environment is created using a list of `arguments` and a Hash of
82
- * `options`. Usually, this is the list of arguments you get back from your CLI
83
- * options parser.
84
- *
85
- * An optional adapter can be passed to provide interaction in non-CLI environment
86
- * (e.g. IDE plugins), otherwise a `TerminalAdapter` is instantiated by default
87
- *
88
- * @constructor
89
- * @implements {import('@yeoman/types').BaseEnvironment}
90
- * @mixes env/resolver
91
- * @mixes env/composability
92
- * @param {String|Array} args
93
- * @param {Object} opts
94
- * @param {Boolean} [opts.experimental]
95
- * @param {Object} [opts.sharedOptions]
96
- * @param {Console} [opts.console]
97
- * @param {Stream} [opts.stdin]
98
- * @param {Stream} [opts.stdout]
99
- * @param {Stream} [opts.stderr]
100
- * @param {TerminalAdapter} [adapter] - A TerminalAdapter instance or another object
101
- * implementing this adapter interface. This is how
102
- * you'd interface Yeoman with a GUI or an editor.
103
- */
104
- constructor(options: any, adapter?: TerminalAdapter | undefined);
105
- options: any;
106
- adapter: TerminalAdapter;
107
- cwd: string;
108
- logCwd: any;
109
- store: Store;
110
- command: any;
111
- runLoop: any;
112
- sharedFs: any;
113
- fs: import("mem-fs-editor").MemFsEditor<import("mem-fs-editor").VinylMemFsEditorFile>;
114
- lookups: string[];
115
- aliases: any[];
116
- sharedOptions: any;
117
- repository: YeomanRepository;
118
- _generatorsForPath: {};
119
- _generators: {};
120
- _composeStore: {};
121
- enableConflicterIgnore: boolean;
122
- /**
123
- * Load options passed to the Generator that should be used by the Environment.
124
- *
125
- * @param {Object} options
126
- */
127
- loadEnvironmentOptions(options: Object): Partial<Object>;
128
- /**
129
- * Load options passed to the Environment that should be forwarded to the Generator.
130
- *
131
- * @param {Object} options
132
- */
133
- loadSharedOptions(options: Object): Partial<Object>;
134
- /**
135
- * @deprecated
136
- * Error handler taking `err` instance of Error.
137
- *
138
- * The `error` event is emitted with the error object, if no `error` listener
139
- * is registered, then we throw the error.
140
- *
141
- * @param {Object} err
142
- * @return {Error} err
143
- */
144
- error(error: any): Error;
145
- /**
146
- * Outputs the general help and usage. Optionally, if generators have been
147
- * registered, the list of available generators is also displayed.
148
- *
149
- * @param {String} name
150
- */
151
- help(name?: string): string;
152
- /**
153
- * Registers a specific `generator` to this environment. This generator is stored under
154
- * provided namespace, or a default namespace format if none if available.
155
- *
156
- * @param {String} name - Filepath to the a generator or a npm package name
157
- * @param {String} namespace - Namespace under which register the generator (optional)
158
- * @param {String} packagePath - PackagePath to the generator npm package (optional)
159
- * @return {Object} environment - This environment
160
- */
161
- register(name: string, namespace: string, packagePath: string): Object;
162
- /**
163
- * Register a stubbed generator to this environment. This method allow to register raw
164
- * functions under the provided namespace. `registerStub` will enforce the function passed
165
- * to extend the Base generator automatically.
166
- *
167
- * @param {Function} Generator - A Generator constructor or a simple function
168
- * @param {String} namespace - Namespace under which register the generator
169
- * @param {String} [resolved] - The file path to the generator
170
- * @param {String} [packagePath] - The generator's package path
171
- * @return {this}
172
- */
173
- registerStub(Generator: Function, namespace: string, resolved?: string | undefined, packagePath?: string | undefined): this;
174
- /**
175
- * Returns the list of registered namespace.
176
- * @return {Array}
177
- */
178
- namespaces(): any[];
179
- /**
180
- * Returns the environment or dependency version.
181
- * @param {String} packageName - Module to get version.
182
- * @return {String} Environment version.
183
- */
184
- getVersion(packageName: string): string;
185
- /**
186
- * Returns stored generators meta
187
- * @return {Object}
188
- */
189
- getGeneratorsMeta(): Object;
190
- /**
191
- * Returns stored generators meta
192
- * @param {string} namespace
193
- * @return {any}
194
- */
195
- getGeneratorMeta(namespace: string): any;
196
- /**
197
- * Get registered generators names
198
- *
199
- * @return {Array}
200
- */
201
- getGeneratorNames(): any[];
202
- /**
203
- * Verify if a package namespace already have been registered.
204
- *
205
- * @param {String} [packageNS] - namespace of the package.
206
- * @return {boolean} - true if any generator of the package has been registered
207
- */
208
- isPackageRegistered(packageNS?: string | undefined): boolean;
209
- /**
210
- * Get all registered packages namespaces.
211
- *
212
- * @return {Array} - array of namespaces.
213
- */
214
- getRegisteredPackages(): any[];
215
- /**
216
- * Get last added path for a namespace
217
- *
218
- * @param {String} - namespace
219
- * @return {String} - path of the package
220
- */
221
- getPackagePath(namespace: any): string;
222
- /**
223
- * Get paths for a namespace
224
- *
225
- * @param {String} - namespace
226
- * @return {Array} - array of paths.
227
- */
228
- getPackagePaths(namespace: any): any[];
229
- /**
230
- * Get a single generator from the registered list of generators. The lookup is
231
- * based on generator's namespace, "walking up" the namespaces until a matching
232
- * is found. Eg. if an `angular:common` namespace is registered, and we try to
233
- * get `angular:common:all` then we get `angular:common` as a fallback (unless
234
- * an `angular:common:all` generator is registered).
235
- *
236
- * @param {String} namespaceOrPath
237
- * @return {import('@yeoman/api').BaseGenerator|Promise<import('@yeoman/api').BaseGenerator>|null} - the generator registered under the namespace
238
- */
239
- get(namespaceOrPath: string): any | Promise<any> | null;
240
- /**
241
- * Get a generator by path instead of namespace.
242
- * @param {String} path
243
- * @return {Generator|null} - the generator found at the location
244
- */
245
- getByPath(path: string): Generator | null;
246
- /**
247
- * Find generator's class constructor.
248
- * @private
249
- * @param {Object} Generator - Object containing the class.
250
- * @return {Function} Generator's constructor.
251
- */
252
- private _findGeneratorClass;
253
- /**
254
- * Create is the Generator factory. It takes a namespace to lookup and optional
255
- * hash of options, that lets you define `arguments` and `options` to
256
- * instantiate the generator with.
257
- *
258
- * An error is raised on invalid namespace.
259
- *
260
- * @param {String} namespaceOrPath
261
- * @param {Array} [args]
262
- * @param {Object} [options]
263
- * @return {Generator} The instantiated generator
264
- */
265
- create(namespaceOrPath: string, args?: any[] | undefined, options?: Object | undefined): Generator;
266
- /**
267
- * Instantiate a Generator with metadatas
268
- *
269
- * @param {Class<Generator>} generator Generator class
270
- * @param {Array} [args] Arguments to pass the instance
271
- * @param {Object} [options] Options to pass the instance
272
- * @return {Generator} The instantiated generator
273
- */
274
- instantiate(Generator: any, args?: any[] | undefined, options?: Object | undefined): Generator;
275
- /**
276
- * Compose with the generator.
277
- *
278
- * @param {String} namespaceOrPath
279
- * @param {Array} [args]
280
- * @param {Object} [options]
281
- * @param {Boolean} [schedule]
282
- * @return {Generator} The instantiated generator or the singleton instance.
283
- */
284
- composeWith(generator: any, args?: any[] | undefined, options?: Object | undefined, schedule?: boolean | undefined): Generator;
285
- /**
286
- * @private
287
- */
288
- private getGeneratorsForPath;
289
- /**
290
- * @private
291
- */
292
- private getGenerator;
293
- /**
294
- * @private
295
- */
296
- private getAllGenerators;
297
- /**
298
- * @private
299
- */
300
- private setGenerator;
301
- /**
302
- * Queue generator run (queue itself tasks).
303
- *
304
- * @param {Generator} generator Generator instance
305
- * @param {boolean} [schedule=false] Whether to schedule the generator run.
306
- * @return {Generator} The generator or singleton instance.
307
- */
308
- queueGenerator(generator: Generator, schedule?: boolean | undefined): Generator;
309
- /**
310
- * Tries to locate and run a specific generator. The lookup is done depending
311
- * on the provided arguments, options and the list of registered generators.
312
- *
313
- * When the environment was unable to resolve a generator, an error is raised.
314
- *
315
- * @param {String|Array} args
316
- * @param {Object} [options]
317
- */
318
- run(args: string | any[], options?: Object | undefined, done: any): Promise<any>;
319
- /**
320
- * Start Environment queue
321
- * @param {Object} options - Conflicter options.
322
- */
323
- start(options: Object): Promise<any>;
324
- conflicter: Conflicter | undefined;
325
- /**
326
- * Convenience method to run the generator with callbackWrapper.
327
- * See https://github.com/yeoman/environment/pull/101
328
- *
329
- * @param {Object} generator
330
- */
331
- runGenerator(generator: Object): Promise<any>;
332
- compatibilityMode: string | boolean | undefined;
333
- _rootGenerator: any;
334
- /**
335
- * Get the first generator that was queued to run in this environment.
336
- *
337
- * @return {Generator} generator queued to run in this environment.
338
- */
339
- rootGenerator(): Generator;
340
- /**
341
- * Given a String `filepath`, tries to figure out the relative namespace.
342
- *
343
- * ### Examples:
344
- *
345
- * this.namespace('backbone/all/index.js');
346
- * // => backbone:all
347
- *
348
- * this.namespace('generator-backbone/model');
349
- * // => backbone:model
350
- *
351
- * this.namespace('backbone.js');
352
- * // => backbone
353
- *
354
- * this.namespace('generator-mocha/backbone/model/index.js');
355
- * // => mocha:backbone:model
356
- *
357
- * @param {String} filepath
358
- * @param {Array} lookups paths
359
- */
360
- namespace(filepath: string, lookups?: any[]): string;
361
- /**
362
- * Resolve a module path
363
- * @param {String} moduleId - Filepath or module name
364
- * @return {String} - The resolved path leading to the module
365
- */
366
- resolveModulePath(moduleId: string): string;
367
- /**
368
- * Apply transform streams to file in MemFs.
369
- * @param {Transform[]} transformStreams - transform streams to be applied.
370
- * @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream().
371
- * @return {Promise<void>}
372
- */
373
- applyTransforms(transformStreams: Transform[], options?: {}): Promise<void>;
374
- /**
375
- * Commits the MemFs to the disc.
376
- * @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream().
377
- * @return {Promise}
378
- */
379
- commitSharedFs(stream?: any): Promise<any>;
380
- /**
381
- * Queue environment's commit task.
382
- */
383
- queueConflicter(): void;
384
- /**
385
- * Queue environment's package manager install task.
386
- */
387
- queuePackageManagerInstall(): void;
388
- /**
389
- * Queue tasks
390
- * @param {string} priority
391
- * @param {(...args: any[]) => void | Promise<void>} task
392
- * @param {{ once?: string, startQueue?: boolean }} [options]
393
- */
394
- queueTask(priority: string, task: (...args: any[]) => void | Promise<void>, options?: {
395
- once?: string | undefined;
396
- startQueue?: boolean | undefined;
397
- } | undefined): Promise<any>;
398
- /**
399
- * Add priority
400
- * @param {string} priority
401
- * @param {string} [before]
402
- */
403
- addPriority(priority: string, before?: string | undefined): void;
404
- }
405
- import TerminalAdapter from './adapter.js';
406
- import Store from './store.js';
407
- import YeomanRepository from './util/repository.js';
408
- import Conflicter from './util/conflicter.js';
409
- import YeomanCommand from './util/command.js';
@@ -1,39 +0,0 @@
1
- export default generatorFeaturesMixin;
2
- declare function generatorFeaturesMixin(cls: any): {
3
- new (): {
4
- [x: string]: any;
5
- /**
6
- * @private
7
- * Get generators features.
8
- * @return {Object} Namespace, features map.
9
- */
10
- getGeneratorsFeatures(): Object;
11
- /**
12
- * @private
13
- * Get generators feature.
14
- * @param {string} featureName.
15
- * @return {Object} Namespace, features map.
16
- */
17
- getGeneratorsFeature(featureName: any): Object;
18
- /**
19
- * @private
20
- * Find for commit tasks.
21
- * @param {string} featureName.
22
- * @return {boolean | Function}
23
- */
24
- getGeneratorUniqueFunctionFeature(featureName: any): boolean | Function;
25
- /**
26
- * @private
27
- * Find for commit tasks.
28
- * @return {boolean | Function}
29
- */
30
- findGeneratorCustomCommitTask(): boolean | Function;
31
- /**
32
- * @private
33
- * Find for commit tasks.
34
- * @return {boolean | Function}
35
- */
36
- findGeneratorCustomInstallTask(): boolean | Function;
37
- };
38
- [x: string]: any;
39
- };
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { default as TerminalAdapter } from './adapter.js';
2
- export { default as Conflicter } from './util/conflicter.js';
3
- export { default as createLogger } from './util/log.js';
4
- export { default } from './environment.js';
@@ -1,36 +0,0 @@
1
- export default composability;
2
- declare namespace composability {
3
- /**
4
- * Get a generator only by namespace.
5
- * @private
6
- * @param {YeomanNamespace|String} namespace
7
- * @return {Generator|null} - the generator found at the location
8
- */
9
- function getByNamespace(namespace: any): Generator<any, any, any> | null;
10
- /**
11
- * Lookup and register generators from the custom local repository.
12
- *
13
- * @private
14
- * @param {YeomanNamespace[]} namespacesToLookup - namespaces to lookup.
15
- * @return {Object[]} List of generators
16
- */
17
- function lookupLocalNamespaces(namespacesToLookup: YeomanNamespace[]): Object[];
18
- /**
19
- * Search for generators or sub generators by namespace.
20
- *
21
- * @private
22
- * @param {boolean|Object} [options] options passed to lookup. Options singleResult,
23
- * filePatterns and packagePatterns can be overridden
24
- * @return {Array|Object} List of generators
25
- */
26
- function lookupNamespaces(namespaces: any, options?: boolean | Object | undefined): Object | any[];
27
- /**
28
- * Load or install namespaces based on the namespace flag
29
- *
30
- * @private
31
- * @param {String|Array} - namespaces
32
- * @return {boolean} - true if every required namespace was found.
33
- */
34
- function prepareEnvironment(namespaces: any): boolean;
35
- function createCompose(destinationRoot: any, options?: {}): any;
36
- }
@@ -1,32 +0,0 @@
1
- export default packageManagerMixin;
2
- declare function packageManagerMixin(cls: any): {
3
- new (): {
4
- [x: string]: any;
5
- /**
6
- * @private
7
- * Get the destination package.json file.
8
- * @return {Vinyl | undefined} a Vinyl file.
9
- */
10
- getDestinationPackageJson(): Vinyl | undefined;
11
- /**
12
- * @private
13
- * Get the destination package.json commit status.
14
- * @return {boolean} package.json commit status.
15
- */
16
- isDestinationPackageJsonCommitted(): boolean;
17
- /**
18
- * @private
19
- * Detect the package manager based on files or use the passed one.
20
- * @return {string} package manager.
21
- */
22
- detectPackageManager(): string;
23
- /**
24
- * Executes package manager install.
25
- * - checks if package.json was committed.
26
- * - uses a preferred package manager or try to detect.
27
- * @return {Promise<boolean>} Promise true if the install execution suceeded.
28
- */
29
- packageManagerInstallTask(): Promise<boolean>;
30
- };
31
- [x: string]: any;
32
- };
@@ -1,146 +0,0 @@
1
- export default resolver;
2
- declare namespace resolver {
3
- export { packageLookup };
4
- /**
5
- * Search for generators and their sub generators.
6
- *
7
- * A generator is a `:lookup/:name/index.js` file placed inside an npm package.
8
- *
9
- * Defaults lookups are:
10
- * - ./
11
- * - generators/
12
- * - lib/generators/
13
- *
14
- * So this index file `node_modules/generator-dummy/lib/generators/yo/index.js` would be
15
- * registered as `dummy:yo` generator.
16
- *
17
- * @param {boolean|Object} [options]
18
- * @param {boolean} [options.localOnly = false] - Set true to skip lookups of
19
- * globally-installed generators.
20
- * @param {string|Array} [options.packagePaths] - Paths to look for generators.
21
- * @param {string|Array} [options.npmPaths] - Repository paths to look for generators packages.
22
- * @param {string|Array} [options.filePatterns='*\/index.js'] - File pattern to look for.
23
- * @param {string|Array} [options.packagePatterns='generator-*'] - Package pattern to look for.
24
- * @param {boolean} [options.singleResult=false] - Set true to stop lookup on the first match.
25
- * @param {Number} [options.globbyDeep] - Deep option to be passed to globby.
26
- * @return {Object[]} List of generators
27
- */
28
- export function lookup(options?: boolean | Object | undefined): Object[];
29
- /**
30
- * Try registering a Generator to this environment.
31
- *
32
- * @private
33
- *
34
- * @param {String} generatorReference A generator reference, usually a file path.
35
- * @param {String} [packagePath] - Generator's package path.
36
- * @param {String} [namespace] - namespace of the generator.
37
- * @return {boolean} true if the generator have been registered.
38
- */
39
- export function _tryRegistering(generatorReference: string, packagePath?: string | undefined, namespace?: string | undefined): boolean;
40
- /**
41
- * Get the npm lookup directories (`node_modules/`)
42
- *
43
- * @deprecated
44
- *
45
- * @param {boolean|Object} [options]
46
- * @param {boolean} [options.localOnly = false] - Set true to skip lookups of
47
- * globally-installed generators.
48
- * @param {boolean} [options.filterPaths = false] - Remove paths that don't ends
49
- * with a supported path (don't touch at NODE_PATH paths).
50
- * @return {Array} lookup paths
51
- */
52
- export function getNpmPaths(options?: boolean | Object | undefined): any[];
53
- /**
54
- * Get or create an alias.
55
- *
56
- * Alias allows the `get()` and `lookup()` methods to search in alternate
57
- * filepath for a given namespaces. It's used for example to map `generator-*`
58
- * npm package to their namespace equivalent (without the generator- prefix),
59
- * or to default a single namespace like `angular` to `angular:app` or
60
- * `angular:all`.
61
- *
62
- * Given a single argument, this method acts as a getter. When both name and
63
- * value are provided, acts as a setter and registers that new alias.
64
- *
65
- * If multiple alias are defined, then the replacement is recursive, replacing
66
- * each alias in reverse order.
67
- *
68
- * An alias can be a single String or a Regular Expression. The finding is done
69
- * based on .match().
70
- *
71
- * @param {String|RegExp} match
72
- * @param {String} value
73
- *
74
- * @example
75
- *
76
- * env.alias(/^([a-zA-Z0-9:\*]+)$/, 'generator-$1');
77
- * env.alias(/^([^:]+)$/, '$1:app');
78
- * env.alias(/^([^:]+)$/, '$1:all');
79
- * env.alias('foo');
80
- * // => generator-foo:all
81
- */
82
- export function alias(match: string | RegExp, value: string): any;
83
- }
84
- declare namespace packageLookup {
85
- /**
86
- * Search for npm packages.
87
- *
88
- * @private
89
- * @method
90
- *
91
- * @param {boolean|Object} [options]
92
- * @param {boolean} [options.localOnly = false] - Set true to skip lookups of
93
- * globally-installed generators.
94
- * @param {string|Array} [options.packagePaths] - Paths to look for generators.
95
- * @param {string|Array} [options.npmPaths] - Repository paths to look for generators packages.
96
- * @param {string|Array} [options.filePatterns='*\/index.js'] - File pattern to look for.
97
- * @param {string|Array} [options.packagePatterns='lookup'] - Package pattern to look for.
98
- * @param {boolean} [options.reverse = false] - Set true reverse npmPaths/packagePaths order
99
- * @param {function} [find] Executed for each match, return true to stop lookup.
100
- */
101
- function sync(options?: boolean | Object | undefined, find?: Function | undefined): {
102
- filePath: import("@nodelib/fs.scandir").Entry;
103
- packagePath: any;
104
- }[];
105
- /**
106
- * Search npm for every available generators.
107
- * Generators are npm packages who's name start with `generator-` and who're placed in the
108
- * top level `node_module` path. They can be installed globally or locally.
109
- *
110
- * @method
111
- * @private
112
- *
113
- * @param {String[]} searchPaths List of search paths
114
- * @param {String[]} packagePatterns Pattern of the packages
115
- * @param {Object} [globbyOptions]
116
- * @return {Array} List of the generator modules path
117
- */
118
- function findPackagesIn(searchPaths: string[], packagePatterns: string[], globbyOptions?: Object | undefined): any[];
119
- /**
120
- * Get the npm lookup directories (`node_modules/`)
121
- *
122
- * @method
123
- * @private
124
- *
125
- * @param {boolean|Object} [options]
126
- * @param {boolean} [options.localOnly = false] - Set true to skip lookups of
127
- * globally-installed generators.
128
- * @param {boolean} [options.filterPaths = false] - Remove paths that don't ends
129
- * with a supported path (don't touch at NODE_PATH paths).
130
- * @return {Array} lookup paths
131
- */
132
- function getNpmPaths(options?: boolean | Object | undefined): any[];
133
- /**
134
- * Get the local npm lookup directories
135
- * @private
136
- * @return {Array} lookup paths
137
- */
138
- function _getLocalNpmPaths(): any[];
139
- /**
140
- * Get the global npm lookup directories
141
- * Reference: https://nodejs.org/api/modules.html
142
- * @private
143
- * @return {Array} lookup paths
144
- */
145
- function _getGlobalNpmPaths(filterPaths?: boolean): any[];
146
- }
@@ -1,21 +0,0 @@
1
- export default spawnCommand;
2
- declare namespace spawnCommand {
3
- /**
4
- * Normalize a command across OS and spawn it (asynchronously).
5
- *
6
- * @param {String} command program to execute
7
- * @param {Array} args list of arguments to pass to the program
8
- * @param {object} [opt] any execa options
9
- * @return {String} spawned process reference
10
- */
11
- function spawnCommand(command: string, args: any[], opt?: object | undefined): string;
12
- /**
13
- * Normalize a command across OS and spawn it (synchronously).
14
- *
15
- * @param {String} command program to execute
16
- * @param {Array} args list of arguments to pass to the program
17
- * @param {object} [opt] any execa options
18
- * @return {String} spawn.sync result
19
- */
20
- function spawnCommandSync(command: string, args: any[], opt?: object | undefined): string;
21
- }
package/dist/store.d.ts DELETED
@@ -1,66 +0,0 @@
1
- export default Store;
2
- /**
3
- * The Generator store
4
- * This is used to store generator (npm packages) reference and instantiate them when
5
- * requested.
6
- * @constructor
7
- * @private
8
- */
9
- declare class Store {
10
- _meta: {};
11
- _packagesPaths: {};
12
- _packagesNS: any[];
13
- /**
14
- * Store a module under the namespace key
15
- * @param {String} namespace - The key under which the generator can be retrieved
16
- * @param {String|Function} generator - A generator module or a module path
17
- * @param {String} packagePath - PackagePath to the generator npm package (optional)
18
- * @param {String} [resolved] - The file path to the generator (used only if generator is a module)
19
- */
20
- add(namespace: string, generator: string | Function, resolved?: string | undefined, packagePath: string): void;
21
- _storeAsPath(namespace: any, resolvedPath: any, packagePath: any): void;
22
- _storeAsModule(namespace: any, Generator: any, resolved: any, packagePath: any): void;
23
- /**
24
- * Get the module registered under the given namespace
25
- * @param {String} namespace
26
- * @return {Module}
27
- */
28
- get(namespace: string): Module;
29
- /**
30
- * Get the module registered under the given namespace
31
- * @param {String} namespace
32
- * @return {Module}
33
- */
34
- getMeta(namespace: string): Module;
35
- /**
36
- * Returns the list of registered namespace.
37
- * @return {Array} Namespaces array
38
- */
39
- namespaces(): any[];
40
- /**
41
- * Get the stored generators meta data
42
- * @return {Object} Generators metadata
43
- */
44
- getGeneratorsMeta(): Object;
45
- /**
46
- * Store a package under the namespace key
47
- * @param {String} packageNS - The key under which the generator can be retrieved
48
- * @param {String} packagePath - The package path
49
- */
50
- addPackage(packageNS: string, packagePath: string): void;
51
- /**
52
- * Get the stored packages namespaces with paths.
53
- * @return {Object} Stored packages namespaces with paths.
54
- */
55
- getPackagesPaths(): Object;
56
- /**
57
- * Store a package ns
58
- * @param {String} packageNS - The key under which the generator can be retrieved
59
- */
60
- addPackageNS(packageNS: string): void;
61
- /**
62
- * Get the stored packages namespaces.
63
- * @return {Array} Stored packages namespaces.
64
- */
65
- getPackagesNS(): any[];
66
- }
@@ -1,2 +0,0 @@
1
- export function isBinary(filePath: any, newFileContents: any): any;
2
- export function binaryDiff(existingFilePath: any, newFileContents: any): any;
@@ -1,31 +0,0 @@
1
- declare const YeomanCommand_base: import("commander").CommandConstructor;
2
- export default class YeomanCommand extends YeomanCommand_base {
3
- createCommand(name: any): YeomanCommand;
4
- /**
5
- * Override addOption to register a negative alternative for every option.
6
- * @param {Option} option
7
- * @return {YeomanCommand} this;
8
- */
9
- addOption(option: Option): YeomanCommand;
10
- /**
11
- * Register arguments using generator._arguments structure.
12
- * @param {object[]} generatorArgs
13
- * @return {YeomanCommand} this;
14
- */
15
- addGeneratorArguments(generatorArgs?: object[]): YeomanCommand;
16
- /**
17
- * Register options using generator._options structure.
18
- * @param {object} options
19
- * @param {string} blueprintOptionDescription - description of the blueprint that adds the option
20
- * @return {YeomanCommand} this;
21
- */
22
- addGeneratorOptions(options: object): YeomanCommand;
23
- _addGeneratorOption(optionName: any, optionDefinition: any, additionalDescription?: string): any;
24
- /**
25
- * Override to reject errors instead of throwing and add command to error.
26
- * @return promise this
27
- */
28
- parseAsync(argv: any, parseOptions: any): Promise<YeomanCommand>;
29
- }
30
- import { Option } from 'commander';
31
- export {};
@@ -1,76 +0,0 @@
1
- export default Conflicter;
2
- /**
3
- * The Conflicter is a module that can be used to detect conflict between files. Each
4
- * Generator file system helpers pass files through this module to make sure they don't
5
- * break a user file.
6
- *
7
- * When a potential conflict is detected, we prompt the user and ask them for
8
- * confirmation before proceeding with the actual write.
9
- *
10
- * @constructor
11
- * @property {Boolean} force - same as the constructor argument
12
- *
13
- * @param {TerminalAdapter} adapter - The generator adapter
14
- * @param {Object} options - Conflicter options
15
- * @param {Boolean} [options.force=false] - When set to true, we won't check for conflict. (the conflicter become a passthrough)
16
- * @param {Boolean} [options.bail=false] - When set to true, we will abort on first conflict. (used for testing reproducibility)
17
- * @param {Boolean} [options.ignoreWhitespace=false] - When set to true, whitespace changes should not generate a conflict.
18
- * @param {Boolean} [options.regenerate=false] - When set to true, identical files should be written to disc.
19
- * @param {Boolean} [options.dryRun=false] - When set to true, no write operation will be executed.
20
- * @param {Boolean} [options.cwd=process.cwd()] - Path to be used as reference for relative path.
21
- * @param {string} cwd - Set cwd for relative logs.
22
- */
23
- declare class Conflicter {
24
- constructor(adapter: any, options?: {});
25
- adapter: any;
26
- force: any;
27
- bail: any;
28
- ignoreWhitespace: any;
29
- regenerate: any;
30
- dryRun: any;
31
- cwd: string;
32
- diffOptions: any;
33
- queue: any;
34
- log(file: any): void;
35
- _log(logStatus: any, ...args: any[]): void;
36
- /**
37
- * Print the file differences to console
38
- *
39
- * @param {Object} file File object respecting this interface: { path, contents }
40
- */
41
- _printDiff(file: Object, queue?: boolean): Promise<void>;
42
- /**
43
- * Detect conflicts between file contents at `filepath` with the `contents` passed to the
44
- * function
45
- *
46
- * If `filepath` points to a folder, we'll always return true.
47
- *
48
- * Based on detect-conflict module
49
- *
50
- * @param {import('vinyl')} file File object respecting this interface: { path, contents }
51
- * @return {Boolean} `true` if there's a conflict, `false` otherwise.
52
- */
53
- _detectConflict(file: import('vinyl')): boolean;
54
- /**
55
- * Check if a file conflict with the current version on the user disk
56
- *
57
- * A basic check is done to see if the file exists, if it does:
58
- *
59
- * 1. Read its content from `fs`
60
- * 2. Compare it with the provided content
61
- * 3. If identical, mark it as is and skip the check
62
- * 4. If diverged, prepare and show up the file collision menu
63
- *
64
- * @param {import('vinyl')} file - Vinyl file
65
- * @param {Object} [conflicterStatus] - Conflicter status
66
- * @return {Promise<Vinyl>} Promise the Vinyl file
67
- */
68
- checkForCollision(file: import('vinyl'), conflicterStatus?: Object | undefined): Promise<Vinyl>;
69
- /**
70
- * Actual prompting logic
71
- * @private
72
- * @param {import('vinyl')} file vinyl file object
73
- * @param {Number} counter prompts
74
- */
75
- private _ask;
76
- }
@@ -1 +0,0 @@
1
- export function requireOrImport(fileToImport: any): any;
@@ -1,12 +0,0 @@
1
- export default log;
2
- declare function log(parameters: any): {
3
- (message: any, ctx: any, ...args: any[]): any;
4
- write(...args: any[]): any;
5
- writeln(...args: any[]): any;
6
- ok(...args: any[]): any;
7
- error(...args: any[]): any;
8
- table(options: any): string;
9
- };
10
- declare namespace log {
11
- export { npmlog as tracker };
12
- }
@@ -1,80 +0,0 @@
1
- /**
2
- * Parse a namespace
3
- *
4
- * @private
5
- * @param {String} namespace
6
- * @return {Object} parsed
7
- * @return {String} parsed.complete - Complete namespace
8
- * @return {String} parsed.namespace - Namespace with format @scope/namespace:generator
9
- * @return {String} parsed.generatorHint - Package name
10
- * @return {String} parsed.id - Id of the instance.
11
- * @return {String} parsed.instanceId - Instance id with format @scope/namespace:generator#id
12
- * @return {String} parsed.method - Method id with format @scope/namespace:generator+foo+bar
13
- * @return {String} parsed.scope - Scope name
14
- * @return {String} parsed.packageNamespace - Package namespace with format @scope/namespace
15
- * @return {String} parsed.generator - Original namespace
16
- * @return {String} parsed.flags - Original namespace
17
- */
18
- export function parseNamespace(complete: any): Object;
19
- /**
20
- * Convert a namespace to a namespace object
21
- *
22
- * @private
23
- * @param {String | YeomanNamespace} namespace
24
- * @return {YeomanNamespace}
25
- */
26
- export function toNamespace(namespace: string | YeomanNamespace): YeomanNamespace;
27
- /**
28
- * Convert a package name to a namespace object
29
- *
30
- * @private
31
- * @param {String} packageName
32
- * @return {YeomanNamespace}
33
- */
34
- export function namespaceFromPackageName(packageName: string): YeomanNamespace;
35
- /**
36
- * Convert a namespace to a namespace object
37
- *
38
- * @private
39
- * @param {String | YeomanNamespace} namespace
40
- * @return {YeomanNamespace}
41
- */
42
- export function requireNamespace(namespace: string | YeomanNamespace): YeomanNamespace;
43
- /**
44
- * Test if the object is an Namespace instance.
45
- *
46
- * @private
47
- * @param {Object} namespace
48
- * @return {Boolean} True if namespace is a YeomanNamespace
49
- */
50
- export function isNamespace(namespace: Object): boolean;
51
- export class YeomanNamespace {
52
- static parse(complete: any): {
53
- complete: any;
54
- } | null;
55
- constructor(parsed: any);
56
- _original: any;
57
- scope: any;
58
- unscoped: any;
59
- generator: any;
60
- instanceId: any;
61
- semver: any;
62
- methods: any;
63
- flags: any;
64
- _update(parsed: any): void;
65
- command: any;
66
- get _scopeAddition(): string;
67
- get generatorName(): string;
68
- _semverAddition(post: any): any;
69
- get instanceName(): string;
70
- get complete(): string;
71
- get packageNamespace(): string;
72
- set namespace(arg: string);
73
- get namespace(): string;
74
- get unscopedNamespace(): string;
75
- get id(): string;
76
- get generatorHint(): string;
77
- get versionedHint(): string;
78
- with(newValues: any): YeomanNamespace;
79
- toString(): string;
80
- }
@@ -1,116 +0,0 @@
1
- export default YeomanRepository;
2
- /**
3
- * @private
4
- */
5
- declare class YeomanRepository {
6
- constructor({ repositoryPath, arboristRegistry }?: {
7
- repositoryPath?: string | undefined;
8
- arboristRegistry: any;
9
- });
10
- log: {
11
- (message: any, ctx: any, ...args: any[]): any;
12
- write(...args: any[]): any;
13
- writeln(...args: any[]): any;
14
- ok(...args: any[]): any;
15
- error(...args: any[]): any;
16
- table(options: any): string;
17
- };
18
- tracker: any;
19
- private set repositoryPath(arg);
20
- /**
21
- * @private
22
- * @property
23
- * Repository absolute path (npm --prefix).
24
- */
25
- private get repositoryPath();
26
- arboristRegistry: any;
27
- _repositoryPath: any;
28
- _nodeModulesPath: string | undefined;
29
- /**
30
- * @private
31
- * @property nodeModulesPath
32
- * Path to the repository's node_modules.
33
- */
34
- private get nodeModulesPath();
35
- /**
36
- * @private
37
- * @method
38
- * Create the repositoryPath if it doesn't exists.
39
- */
40
- private createRepositoryFolder;
41
- /**
42
- * @private
43
- * @method
44
- * Resolve the package name module path inside the [repository path]{@link repository.repositoryPath}
45
- * @param {String} packageName - Package name. If packageName is a absolute path then modulePath is joined to it.
46
- * @param {String} [modulePath] - Path to a module inside the package path.
47
- * @returns {String} Absolute module path.
48
- */
49
- private resolvePackagePath;
50
- /**
51
- * @private
52
- * @method
53
- * Remove the package from node's cache, necessary for a reinstallation.
54
- * Removes only package.json by default, it's used to version verification.
55
- * Removes only cache of the repository's packages.
56
- * @param {String} packageName - Package name.
57
- * @param {Boolean} [force=false] - If true removes every cache the package.
58
- * @throw Error if force === false and any file other the package.json is loaded.
59
- */
60
- private cleanupPackageCache;
61
- /**
62
- * @private
63
- * @param {Object} options - options to be passed to arborist reify eg: {add: { dependencies: [ pkgSpec ] }, rm: [ pkgName ]}
64
- */
65
- private reifyRepository;
66
- arb: any;
67
- /**
68
- * @private
69
- * @method
70
- * Verify if the package is installed and matches the version range.
71
- * @param {String} packageName - Package name.
72
- * @param {String} versionRange - Version range of the package.
73
- * @returns {Boolean} True if the package is installed and matches the version.
74
- * @throws Error.
75
- */
76
- private verifyInstalledVersion;
77
- /**
78
- * @private
79
- * @method
80
- * Install a package into the repository.
81
- * @param {String} packageName - Package name.
82
- * @param {String} versionRange - range Version of the package.
83
- * @returns {String} Package path.
84
- * @throws Error.
85
- */
86
- private installPackage;
87
- /**
88
- * @private
89
- * @method
90
- * Install packages.
91
- * @param {Object} packages - Packages to be installed.
92
- * @returns {Boolean}
93
- * @example
94
- * repository.installPackages({ 'yeoman-environment': '2.3.0' });
95
- */
96
- private installPackages;
97
- /**
98
- * @private
99
- * @method
100
- * Get the installed package version.
101
- * @param {String} packageName - Package name.
102
- * @returns {String|undefined} Package version or undefined.
103
- */
104
- private getPackageVersion;
105
- /**
106
- * @private
107
- * @method
108
- * Require a module from the repository.
109
- * @param {String} packageName - Package name.
110
- * @param {String} versionRange - Version range of the package.
111
- * @param {String} modulePath - Package name.
112
- * @returns {Object} Module.
113
- * @throws Error.
114
- */
115
- private requireModule;
116
- }
@@ -1,55 +0,0 @@
1
- export function parseYoAttributesFile(yoAttributeFileName: any): {
2
- [k: string]: string;
3
- };
4
- /**
5
- * Transform api should be avoided by generators without a executable.
6
- * May break between major yo versions.
7
- */
8
- export function createConflicterCheckTransform(conflicter: any, conflicterStatus: any): import("p-transform").default;
9
- /**
10
- * @private
11
- */
12
- export function getConflicterStatusForFile(conflicter: any, filePath: any, yoAttributeFileName?: string): undefined;
13
- /**
14
- * Transform api should be avoided by generators without a executable.
15
- * May break between major yo versions.
16
- *
17
- * Create a yo-resolve transform stream.
18
- * Suports pre-defined conflicter actions action based on file glob.
19
- * @param {Conflicter} conflicter - Conflicter instance
20
- * @param {string} yoResolveFileName - .yo-resolve filename
21
- * @return {Transform} A Transform https://nodejs.org/api/stream.html#stream_class_stream_transform
22
- */
23
- export function createYoResolveTransform(conflicter: Conflicter, yoResolveFileName: string): Transform;
24
- /**
25
- * Transform api should be avoided by generators without a executable.
26
- * May break between major yo versions.
27
- *
28
- * Create a force yeoman configs transform stream.
29
- * @return {Transform} A Transform https://nodejs.org/api/stream.html#stream_class_stream_transform
30
- */
31
- export function createYoRcTransform(): Transform;
32
- /**
33
- * Transform api should be avoided by generators without a executable.
34
- * May break between major yo versions.
35
- *
36
- * Create a transform to apply conflicter status.
37
- * @param {Log} logger - Log reference. See log.js
38
- * @return {Transform} A Transform https://nodejs.org/api/stream.html#stream_class_stream_transform
39
- */
40
- export function createConflicterStatusTransform(): Transform;
41
- /**
42
- * Conditional filter on pattern.
43
- *
44
- * @param {String} pattern - Minimatch pattern.
45
- * @param {Object} options - Minimatch options.
46
- */
47
- export function patternFilter(pattern: string, options: Object): import("p-transform").default;
48
- /**
49
- * Conditional spy on pattern.
50
- *
51
- * @param {Function} spy.
52
- * @param {String} pattern - Minimatch pattern.
53
- * @param {Object} options - Minimatch options.
54
- */
55
- export function patternSpy(spy: any, pattern: string, options: Object): import("p-transform").default;
@@ -1,14 +0,0 @@
1
- export { default as log } from "./log.js";
2
- /**
3
- * Create a "sloppy" copy of an initial Environment object. The focus of this method is on
4
- * performance rather than correctly deep copying every property or recreating a correct
5
- * instance. Use carefully and don't rely on `hasOwnProperty` of the copied environment.
6
- *
7
- * Every property are shared except the runLoop which is regenerated.
8
- *
9
- * @param {Environment} initialEnv - an Environment instance
10
- * @return {Environment} sloppy copy of the initial Environment
11
- */
12
- export function duplicateEnv(initialEnv: Environment): Environment;
13
- export function execaOutput(cmg: any, args: any, options: any): string | undefined;
14
- import Environment from '../environment.js';