yeoman-generator 7.3.3 → 7.5.0
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/dist/actions/fs.d.ts +1 -1
- package/dist/actions/fs.js +21 -12
- package/dist/actions/help.d.ts +1 -1
- package/dist/actions/lifecycle.js +8 -7
- package/dist/actions/user.d.ts +6 -0
- package/dist/actions/user.js +6 -0
- package/dist/generator.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/util/storage.js +2 -2
- package/package.json +16 -12
- package/readme.md +1 -1
package/dist/actions/fs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CopyOptions, type MemFsEditor } from 'mem-fs-editor';
|
|
2
2
|
import type { Data as TemplateData, Options as TemplateOptions } from 'ejs';
|
|
3
3
|
import type { OverloadParameters, OverloadReturnType } from '../types-utils.js';
|
|
4
|
-
import type BaseGenerator from '../generator.js';
|
|
4
|
+
import type { BaseGenerator } from '../generator.js';
|
|
5
5
|
export type Template<D extends TemplateData, G> = {
|
|
6
6
|
/**
|
|
7
7
|
* Template file, absolute or relative to templatePath().
|
package/dist/actions/fs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint max-params: [1,
|
|
1
|
+
/* eslint max-params: [1, 6] */
|
|
2
2
|
import assert from 'node:assert';
|
|
3
3
|
function applyToFirstStringArg(customizer, args) {
|
|
4
4
|
args[0] = Array.isArray(args[0]) ? args[0].map(arg => customizer(arg)) : customizer(args[0]);
|
|
@@ -28,8 +28,7 @@ export class FsMixin {
|
|
|
28
28
|
*/
|
|
29
29
|
copyTemplate(...args) {
|
|
30
30
|
const [from, to, options = {}, ...remaining] = args;
|
|
31
|
-
|
|
32
|
-
return this.fs.copy(from, this.destinationPath(to), options, ...remaining);
|
|
31
|
+
return this.fs.copy(from, this.destinationPath(to), { fromBasePath: this.templatePath(), ...options }, ...remaining);
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
34
|
* Copy file from templates folder to destination folder.
|
|
@@ -88,8 +87,7 @@ export class FsMixin {
|
|
|
88
87
|
*/
|
|
89
88
|
copyDestination(...args) {
|
|
90
89
|
const [from, to, options = {}, ...remaining] = args;
|
|
91
|
-
|
|
92
|
-
return this.fs.copy(from, this.destinationPath(to), options, ...remaining);
|
|
90
|
+
return this.fs.copy(from, this.destinationPath(to), { fromBasePath: this.destinationPath(), ...options }, ...remaining);
|
|
93
91
|
}
|
|
94
92
|
/**
|
|
95
93
|
* Move file from destination folder to another destination folder.
|
|
@@ -97,9 +95,8 @@ export class FsMixin {
|
|
|
97
95
|
* Shortcut for this.fs!.move(this.destinationPath(from), this.destinationPath(to)).
|
|
98
96
|
*/
|
|
99
97
|
moveDestination(...args) {
|
|
100
|
-
const [from, to, options
|
|
101
|
-
|
|
102
|
-
return this.fs.move(from, this.destinationPath(to), options, ...remaining);
|
|
98
|
+
const [from, to, options, ...remaining] = args;
|
|
99
|
+
return this.fs.move(from, this.destinationPath(to), { fromBasePath: this.destinationPath(), ...options }, ...remaining);
|
|
103
100
|
}
|
|
104
101
|
/**
|
|
105
102
|
* Exists file on destination folder.
|
|
@@ -127,7 +124,10 @@ export class FsMixin {
|
|
|
127
124
|
const templatePath = this.templatePath(...source);
|
|
128
125
|
destination = Array.isArray(destination) ? destination : [destination];
|
|
129
126
|
const destinationPath = this.destinationPath(...destination);
|
|
130
|
-
this.fs.copyTpl(templatePath, destinationPath, templateData, templateOptions,
|
|
127
|
+
this.fs.copyTpl(templatePath, destinationPath, templateData, templateOptions, {
|
|
128
|
+
fromBasePath: this.templatePath(),
|
|
129
|
+
...copyOptions,
|
|
130
|
+
});
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* Copy a template from templates folder to the destination.
|
|
@@ -147,7 +147,10 @@ export class FsMixin {
|
|
|
147
147
|
const templatePath = this.templatePath(...source);
|
|
148
148
|
destination = Array.isArray(destination) ? destination : [destination];
|
|
149
149
|
const destinationPath = this.destinationPath(...destination);
|
|
150
|
-
return this.fs.copyTplAsync(templatePath, destinationPath, templateData, templateOptions,
|
|
150
|
+
return this.fs.copyTplAsync(templatePath, destinationPath, templateData, templateOptions, {
|
|
151
|
+
fromBasePath: this.templatePath(),
|
|
152
|
+
...copyOptions,
|
|
153
|
+
});
|
|
151
154
|
}
|
|
152
155
|
/**
|
|
153
156
|
* Copy templates from templates folder to the destination.
|
|
@@ -160,7 +163,10 @@ export class FsMixin {
|
|
|
160
163
|
for (const template of templates) {
|
|
161
164
|
const { templateData: eachData = templateData, source, destination } = template;
|
|
162
165
|
if (!template.when || template.when(eachData, this)) {
|
|
163
|
-
this.renderTemplate(source, destination, eachData, template.templateOptions,
|
|
166
|
+
this.renderTemplate(source, destination, eachData, template.templateOptions, {
|
|
167
|
+
fromBasePath: this.templatePath(),
|
|
168
|
+
...template.copyOptions,
|
|
169
|
+
});
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
}
|
|
@@ -178,7 +184,10 @@ export class FsMixin {
|
|
|
178
184
|
return Promise.all(templates.map(async (template) => {
|
|
179
185
|
const { templateData: eachData = templateData, source, destination } = template;
|
|
180
186
|
if (!template.when || template.when(eachData, this)) {
|
|
181
|
-
return this.renderTemplateAsync(source, destination, eachData, template.templateOptions,
|
|
187
|
+
return this.renderTemplateAsync(source, destination, eachData, template.templateOptions, {
|
|
188
|
+
fromBasePath: this.templatePath(),
|
|
189
|
+
...template.copyOptions,
|
|
190
|
+
});
|
|
182
191
|
}
|
|
183
192
|
return;
|
|
184
193
|
}));
|
package/dist/actions/help.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArgumentSpec, CliOptionSpec } from '../types.js';
|
|
2
|
-
import type BaseGenerator from '../generator.js';
|
|
2
|
+
import type { BaseGenerator } from '../generator.js';
|
|
3
3
|
export declare class HelpMixin {
|
|
4
4
|
readonly _options: Record<string, CliOptionSpec>;
|
|
5
5
|
readonly _arguments: ArgumentSpec[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname, isAbsolute, resolve as pathResolve, relative } from 'node:path';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
|
-
import {
|
|
4
|
+
import { Transform } from 'node:stream';
|
|
5
5
|
import { stat } from 'node:fs/promises';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
import { toNamespace } from '@yeoman/namespace';
|
|
@@ -431,7 +431,7 @@ export class TasksMixin {
|
|
|
431
431
|
}
|
|
432
432
|
const generatorNamespace = this.env.namespace(resolved);
|
|
433
433
|
const findGenerator = async () => {
|
|
434
|
-
const generatorImport = await import(resolved);
|
|
434
|
+
const generatorImport = await import(pathToFileURL(resolved).href);
|
|
435
435
|
const getFactory = (module) => module.createGenerator ?? module.default?.createGenerator ?? module.default?.default?.createGenerator;
|
|
436
436
|
const factory = getFactory(generatorImport);
|
|
437
437
|
if (factory) {
|
|
@@ -466,7 +466,7 @@ export class TasksMixin {
|
|
|
466
466
|
if (!generatorResolvedFile) {
|
|
467
467
|
// Resolve the generator file.
|
|
468
468
|
// Use import.resolve when stable.
|
|
469
|
-
generatorResolvedFile =
|
|
469
|
+
generatorResolvedFile = createRequire(import.meta.url).resolve(generatorFile);
|
|
470
470
|
}
|
|
471
471
|
return generatorResolvedFile;
|
|
472
472
|
}
|
|
@@ -484,11 +484,12 @@ export class TasksMixin {
|
|
|
484
484
|
filter = pendingFiles ? isFilePending : passedFilter;
|
|
485
485
|
}
|
|
486
486
|
const { env } = this;
|
|
487
|
-
await env.adapter.progress(async ({ step }) => env.sharedFs.pipeline({ filter, ...memFsPipelineOptions }, ...transforms,
|
|
488
|
-
|
|
487
|
+
await env.adapter.progress(async ({ step }) => env.sharedFs.pipeline({ filter, ...memFsPipelineOptions }, ...transforms, new Transform({
|
|
488
|
+
objectMode: true,
|
|
489
|
+
transform(file, _encoding, callback) {
|
|
489
490
|
step('Completed', relative(env.logCwd, file.path));
|
|
490
|
-
|
|
491
|
-
}
|
|
491
|
+
callback(null, file);
|
|
492
|
+
},
|
|
492
493
|
})), { disabled, name });
|
|
493
494
|
}
|
|
494
495
|
/**
|
package/dist/actions/user.d.ts
CHANGED
|
@@ -20,8 +20,14 @@ declare class GitUtil {
|
|
|
20
20
|
export declare abstract class GitMixin {
|
|
21
21
|
_git?: GitUtil;
|
|
22
22
|
get git(): GitUtil;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Will be removed in version 8.
|
|
25
|
+
* GitHub utilities.
|
|
26
|
+
*/
|
|
23
27
|
get github(): {
|
|
24
28
|
/**
|
|
29
|
+
* @deprecated Will be removed in version 8. Use 'github-username' package with `await this.git.email()` result instead.
|
|
30
|
+
*
|
|
25
31
|
* Retrieves GitHub's username from the GitHub API
|
|
26
32
|
* @return Resolved with the GitHub username or rejected if unable to
|
|
27
33
|
* get the information
|
package/dist/actions/user.js
CHANGED
|
@@ -31,9 +31,15 @@ export class GitMixin {
|
|
|
31
31
|
}
|
|
32
32
|
return this._git;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Will be removed in version 8.
|
|
36
|
+
* GitHub utilities.
|
|
37
|
+
*/
|
|
34
38
|
get github() {
|
|
35
39
|
return {
|
|
36
40
|
/**
|
|
41
|
+
* @deprecated Will be removed in version 8. Use 'github-username' package with `await this.git.email()` result instead.
|
|
42
|
+
*
|
|
37
43
|
* Retrieves GitHub's username from the GitHub API
|
|
38
44
|
* @return Resolved with the GitHub username or rejected if unable to
|
|
39
45
|
* get the information
|
package/dist/generator.js
CHANGED
|
@@ -4,7 +4,7 @@ import os from 'node:os';
|
|
|
4
4
|
import { EventEmitter } from 'node:events';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import * as _ from 'lodash-es';
|
|
7
|
-
import
|
|
7
|
+
import { lte as semverLte } from 'semver';
|
|
8
8
|
import { readPackageUpSync } from 'read-package-up';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
10
|
import minimist from 'minimist';
|
|
@@ -212,13 +212,13 @@ export class BaseGenerator extends EventEmitter {
|
|
|
212
212
|
}
|
|
213
213
|
console.warn(`It's not possible to check version with running Environment less than ${ENV_VER_WITH_VER_API}`);
|
|
214
214
|
console.warn('Some features may be missing');
|
|
215
|
-
if (
|
|
215
|
+
if (semverLte(versionToCheck, '2.8.1')) {
|
|
216
216
|
return undefined;
|
|
217
217
|
}
|
|
218
218
|
return false;
|
|
219
219
|
}
|
|
220
220
|
const runningVersion = this.env.getVersion(packageDependency);
|
|
221
|
-
if (runningVersion !== undefined &&
|
|
221
|
+
if (runningVersion !== undefined && semverLte(versionToCheck, runningVersion)) {
|
|
222
222
|
return true;
|
|
223
223
|
}
|
|
224
224
|
// Version cannot be checked
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type SimpleGit } from 'simple-git';
|
|
|
2
2
|
import { BaseGenerator } from './generator.js';
|
|
3
3
|
import type { BaseFeatures, BaseOptions } from './types.js';
|
|
4
4
|
export type * from './types.js';
|
|
5
|
+
export type * from './questions.js';
|
|
5
6
|
export type * from './util/storage.js';
|
|
6
7
|
export { default as Storage } from './util/storage.js';
|
|
7
8
|
export default class Generator<O extends BaseOptions = BaseOptions, F extends BaseFeatures = BaseFeatures> extends BaseGenerator<O, F> {
|
package/dist/util/storage.js
CHANGED
|
@@ -5,10 +5,10 @@ import sortKeys from 'sort-keys';
|
|
|
5
5
|
* Proxy handler for Storage
|
|
6
6
|
*/
|
|
7
7
|
const proxyHandler = {
|
|
8
|
-
get(storage, property,
|
|
8
|
+
get(storage, property, _receiver) {
|
|
9
9
|
return storage.get(property);
|
|
10
10
|
},
|
|
11
|
-
set(storage, property, value,
|
|
11
|
+
set(storage, property, value, _receiver) {
|
|
12
12
|
if (typeof property === 'string') {
|
|
13
13
|
storage.set(property, value);
|
|
14
14
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yeoman-generator",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "Rails-inspired generator system that provides scaffolding for your apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"development",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"doc:generate": "jsdoc -c jsdoc.json -d $npm_package_config_doc_path$DOC_FOLDER",
|
|
45
45
|
"doc:prettier": "prettier $npm_package_config_doc_path$DOC_FOLDER --write --ignore-path .prettierignore-doc",
|
|
46
46
|
"prepare": "npm run build",
|
|
47
|
-
"pretest": "eslint . && npm run build",
|
|
47
|
+
"pretest": "eslint . && prettier . --check && npm run build",
|
|
48
48
|
"test": "vitest run --coverage"
|
|
49
49
|
},
|
|
50
50
|
"config": {
|
|
@@ -52,14 +52,13 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@types/lodash-es": "^4.17.9",
|
|
55
|
-
"@types/node": ">=18.18.5",
|
|
56
55
|
"@yeoman/namespace": "^1.0.0",
|
|
57
56
|
"chalk": "^5.3.0",
|
|
58
57
|
"debug": "^4.1.1",
|
|
59
58
|
"execa": "^8.0.1",
|
|
60
|
-
"github-username": "^
|
|
59
|
+
"github-username": "^9.0.0",
|
|
61
60
|
"json-schema": "^0.4.0",
|
|
62
|
-
"latest-version": "^
|
|
61
|
+
"latest-version": "^9.0.0",
|
|
63
62
|
"lodash-es": "^4.17.21",
|
|
64
63
|
"mem-fs-editor": "^11.0.1",
|
|
65
64
|
"minimist": "^1.2.8",
|
|
@@ -77,29 +76,34 @@
|
|
|
77
76
|
"@types/semver": "^7.5.3",
|
|
78
77
|
"@types/sinon": "^17.0.1",
|
|
79
78
|
"@types/text-table": "^0.2.3",
|
|
80
|
-
"@vitest/coverage-v8": "^
|
|
81
|
-
"@yeoman/adapter": "^
|
|
79
|
+
"@vitest/coverage-v8": "^3.0.2",
|
|
80
|
+
"@yeoman/adapter": "^2.0.0",
|
|
82
81
|
"@yeoman/eslint": "^0.2.0",
|
|
83
82
|
"@yeoman/transform": "^2.0.0",
|
|
84
83
|
"cpy-cli": "^5.0.0",
|
|
85
84
|
"ejs": "^3.1.9",
|
|
86
|
-
"inquirer": "^
|
|
85
|
+
"inquirer": "^12.0.0",
|
|
87
86
|
"jsdoc": "^4.0.2",
|
|
88
|
-
"nock": "^13.3.4",
|
|
89
87
|
"prettier": "^3.0.3",
|
|
90
88
|
"prettier-plugin-packagejson": "^2.4.6",
|
|
91
89
|
"sinon": "^19.0.0",
|
|
92
|
-
"
|
|
90
|
+
"type-fest": "^4.26.1",
|
|
93
91
|
"typescript": "^5.2.2",
|
|
94
|
-
"vitest": "^
|
|
92
|
+
"vitest": "^3.0.2",
|
|
95
93
|
"yeoman-assert": "^3.1.1",
|
|
96
94
|
"yeoman-environment": "^4.4.1",
|
|
97
|
-
"yeoman-test": "^
|
|
95
|
+
"yeoman-test": "^10.0.1"
|
|
98
96
|
},
|
|
99
97
|
"peerDependencies": {
|
|
98
|
+
"@types/node": ">=18.18.5",
|
|
100
99
|
"@yeoman/types": "^1.1.1",
|
|
101
100
|
"mem-fs": "^4.0.0"
|
|
102
101
|
},
|
|
102
|
+
"peerDependenciesMeta": {
|
|
103
|
+
"@types/node": {
|
|
104
|
+
"optional": true
|
|
105
|
+
}
|
|
106
|
+
},
|
|
103
107
|
"engines": {
|
|
104
108
|
"node": "^18.17.0 || >=20.5.0"
|
|
105
109
|
},
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generator [](http://badge.fury.io/js/yeoman-generator) [](http://badge.fury.io/js/yeoman-generator) [](https://github.com/yeoman/generator/actions/workflows/integration.yml) [](https://coveralls.io/r/yeoman/generator) [](https://gitter.im/yeoman/yeoman)
|
|
2
2
|
|
|
3
3
|
> Rails-inspired generator system that provides scaffolding for your apps
|
|
4
4
|
|