yeoman-generator 8.1.1 → 8.2.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.
@@ -22,7 +22,20 @@ export declare class HelpMixin {
22
22
  *
23
23
  * @param description
24
24
  */
25
- desc(this: BaseGenerator, description: string): BaseGenerator<Record<any, any>, import("../types.js").BaseOptions, import("../types.js").BaseFeatures, Record<any, any>, Record<any, any>, Record<any, any>>;
25
+ desc(this: BaseGenerator, description: string): BaseGenerator<Record<any, any>, import("../types.js").BaseOptions, {
26
+ unique?: true | "argument" | "namespace" | undefined;
27
+ tasksMatchingPriority?: boolean | undefined;
28
+ taskPrefix?: string | undefined;
29
+ skipParseOptions?: boolean | undefined;
30
+ disableInGeneratorOptionsSupport?: boolean | undefined;
31
+ customPriorities?: import("../types.js").Priority[] | undefined;
32
+ inheritTasks?: boolean | undefined;
33
+ configTransform?: import("../types.js").StorageTransform<Record<string, any>> | undefined;
34
+ uniqueBy?: string | undefined;
35
+ uniqueGlobally?: boolean | undefined;
36
+ customCommitTask?: (() => Promise<void> | void) | undefined;
37
+ customInstallTask?: (boolean | import("@yeoman/types").InstallTask | "ask") | undefined;
38
+ }, Record<any, any>, Record<any, any>, Record<any, any>>;
26
39
  /**
27
40
  * Get help text for arguments
28
41
  * @returns Text of options in formatted table
@@ -145,6 +145,19 @@ export declare abstract class TasksMixin {
145
145
  */
146
146
  queueTransformStream(this: BaseGeneratorImpl, options?: GeneratorPipelineOptions & {
147
147
  priorityToQueue?: string;
148
- }, ...transforms: Array<FileTransform<MemFsEditorFile>>): BaseGeneratorImpl<Record<any, any>, BaseOptions, import("../types.js").BaseFeatures, Record<any, any>, Record<any, any>, Record<any, any>>;
148
+ }, ...transforms: Array<FileTransform<MemFsEditorFile>>): BaseGeneratorImpl<Record<any, any>, BaseOptions, {
149
+ unique?: true | "argument" | "namespace" | undefined;
150
+ tasksMatchingPriority?: boolean | undefined;
151
+ taskPrefix?: string | undefined;
152
+ skipParseOptions?: boolean | undefined;
153
+ disableInGeneratorOptionsSupport?: boolean | undefined;
154
+ customPriorities?: Priority[] | undefined;
155
+ inheritTasks?: boolean | undefined;
156
+ configTransform?: import("../types.js").StorageTransform<Record<string, any>> | undefined;
157
+ uniqueBy?: string | undefined;
158
+ uniqueGlobally?: boolean | undefined;
159
+ customCommitTask?: (() => Promise<void> | void) | undefined;
160
+ customInstallTask?: (boolean | import("@yeoman/types").InstallTask | "ask") | undefined;
161
+ }, Record<any, any>, Record<any, any>, Record<any, any>>;
149
162
  }
150
163
  export {};
package/dist/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { type SimpleGit } from 'simple-git';
1
+ import { CheckRepoActions, CleanOptions, type SimpleGit, type SimpleGitOptions } 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
5
  export type * from './questions.js';
6
6
  export type * from './util/storage.js';
7
7
  export { default as Storage } from './util/storage.js';
8
+ type SimpleGitWithConstants = SimpleGit & {
9
+ CheckRepoActions: typeof CheckRepoActions;
10
+ CleanOptions: typeof CleanOptions;
11
+ };
8
12
  export default class Generator<C extends Record<any, any> = Record<any, any>, O extends BaseOptions = BaseOptions, F extends BaseFeatures = BaseFeatures> extends BaseGenerator<C, O, F> {
9
- _simpleGit?: SimpleGit;
10
- constructor(...args: any[]);
11
- get simpleGit(): SimpleGit;
13
+ constructor(arguments_?: string[], options?: O, features?: F);
14
+ get simpleGit(): SimpleGitWithConstants;
15
+ createSimpleGit(options?: Partial<SimpleGitOptions>): SimpleGitWithConstants;
12
16
  }
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import process from 'node:process';
2
- import { simpleGit } from 'simple-git';
2
+ import { CheckRepoActions, CleanOptions, simpleGit } from 'simple-git';
3
3
  import { BaseGenerator } from './generator.js';
4
- import { DESTINATION_ROOT_CHANGE_EVENT } from './constants.js';
5
4
  export { default as Storage } from './util/storage.js';
6
5
  export default class Generator extends BaseGenerator {
7
- _simpleGit;
8
- constructor(...args) {
9
- super(...args);
6
+ constructor(arguments_, options, features) {
7
+ super(arguments_, options, features);
10
8
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
9
  // @ts-expect-error
12
10
  this._queues = {};
@@ -20,15 +18,17 @@ export default class Generator extends BaseGenerator {
20
18
  }
21
19
  }
22
20
  get simpleGit() {
23
- if (!this._simpleGit) {
24
- this._simpleGit = simpleGit({ baseDir: this.destinationPath() }).env({
25
- ...process.env,
26
- LANG: 'en',
27
- });
28
- this.on(DESTINATION_ROOT_CHANGE_EVENT, () => {
29
- this._simpleGit = undefined;
30
- });
31
- }
32
- return this._simpleGit;
21
+ return this.createSimpleGit();
22
+ }
23
+ createSimpleGit(options) {
24
+ const git = simpleGit({ baseDir: this.destinationPath(), ...options }).env({
25
+ HOME: process.env.HOME,
26
+ PATH: process.env.PATH,
27
+ LANG: 'C',
28
+ LC_ALL: 'C',
29
+ });
30
+ git.CheckRepoActions = CheckRepoActions;
31
+ git.CleanOptions = CleanOptions;
32
+ return git;
33
33
  }
34
34
  }
package/dist/types.d.ts CHANGED
@@ -7,13 +7,15 @@ import type {
7
7
  } from '@yeoman/types';
8
8
  import type { PipelineOptions } from 'mem-fs';
9
9
  import type { MemFsEditorFile } from 'mem-fs-editor';
10
- import type { JsonValue } from 'type-fest';
10
+ import type { JsonValue, Merge } from 'type-fest';
11
11
  import type Storage from './util/storage.js';
12
12
  import type Generator from './index.js';
13
13
 
14
14
  export type StorageValue = JsonValue;
15
15
  export type GeneratorPipelineOptions = PipelineOptions<MemFsEditorFile> & ProgressOptions & { pendingFiles?: boolean };
16
16
 
17
+ export type StorageTransform<A extends Record<string, any>> = (content: A, name?: string) => A;
18
+
17
19
  /**
18
20
  * Queue options.
19
21
  */
@@ -75,40 +77,43 @@ export type Task<TaskContext = any> = TaskOptions & {
75
77
  taskName: string;
76
78
  };
77
79
 
78
- export type BaseFeatures = FeaturesApi & {
79
- /** The Generator instance unique identifier. The Environment will ignore duplicated identifiers. */
80
- uniqueBy?: string;
81
-
82
- /** UniqueBy calculation method */
83
- unique?: true | 'argument' | 'namespace';
80
+ // Use Merge to override local features by official features from @yeoman/types when they are available.
81
+ export type BaseFeatures = Merge<
82
+ {
83
+ /** UniqueBy calculation method */
84
+ unique?: true | 'argument' | 'namespace';
84
85
 
85
- /** Only queue methods that matches a priority. */
86
- tasksMatchingPriority?: boolean;
86
+ /** Only queue methods that matches a priority. */
87
+ tasksMatchingPriority?: boolean;
87
88
 
88
- /** Tasks methods starts with prefix. Allows api methods (non tasks) without prefix. */
89
- taskPrefix?: string;
89
+ /** Tasks methods starts with prefix. Allows api methods (non tasks) without prefix. */
90
+ taskPrefix?: string;
90
91
 
91
- /** Provides a custom install task. Environment built-in task will not be executed */
92
- customInstallTask?: boolean | ((...args: any[]) => void | Promise<void>);
92
+ // Provided by @yeoman/types since v1.11.0
93
+ /** Provides a custom install task. Environment built-in task will not be executed */
94
+ customInstallTask?: boolean | ((...args: any[]) => void | Promise<void>);
93
95
 
94
- /** Provides a custom commit task. */
95
- customCommitTask?: boolean | ((...args: any[]) => void | Promise<void>);
96
+ // Provided by @yeoman/types since v1.11.0
97
+ /** Provides a custom commit task. */
98
+ customCommitTask?: boolean | ((...args: any[]) => void | Promise<void>);
96
99
 
97
- /** Disable args/options parsing. Whenever options/arguments are provided parsed like using commander based parsing. */
98
- skipParseOptions?: boolean;
100
+ /** Disable args/options parsing. Whenever options/arguments are provided parsed like using commander based parsing. */
101
+ skipParseOptions?: boolean;
99
102
 
100
- /** Disable args/options support. Whenever options/arguments are provided parsed like using commander based parsing. */
101
- disableInGeneratorOptionsSupport?: boolean;
103
+ /** Disable args/options support. Whenever options/arguments are provided parsed like using commander based parsing. */
104
+ disableInGeneratorOptionsSupport?: boolean;
102
105
 
103
- /** Custom priorities for more fine tuned workflows. */
104
- customPriorities?: Priority[];
106
+ /** Custom priorities for more fine tuned workflows. */
107
+ customPriorities?: Priority[];
105
108
 
106
- /** Inherit tasks from parent prototypes, implies tasksMatchingPriority */
107
- inheritTasks?: boolean;
109
+ /** Inherit tasks from parent prototypes, implies tasksMatchingPriority */
110
+ inheritTasks?: boolean;
108
111
 
109
- /** Transform the configuration before reading. */
110
- configTransform?: (config: any) => any;
111
- };
112
+ /** Transform the configuration before reading. */
113
+ configTransform?: StorageTransform<Record<string, any>>;
114
+ },
115
+ FeaturesApi
116
+ >;
112
117
 
113
118
  export type BaseOptions = OptionsApi & {
114
119
  destinationRoot?: string;
@@ -1,7 +1,6 @@
1
1
  import type { Get } from 'type-fest';
2
2
  import type { MemFsEditor } from 'mem-fs-editor';
3
- import type { StorageValue } from '../types.js';
4
- type TransformConfig<A extends Record<string, any>> = (content: A, name?: string) => A;
3
+ import type { StorageTransform, StorageValue } from '../types.js';
5
4
  export type StorageOptions = {
6
5
  name?: string;
7
6
  /**
@@ -23,7 +22,7 @@ export type StorageOptions = {
23
22
  /**
24
23
  * Transform the content of the storage when reading it. This can be used to sanitize or modify the data before it is returned.
25
24
  */
26
- transform?: TransformConfig<Record<string, any>>;
25
+ transform?: StorageTransform<Record<string, any>>;
27
26
  };
28
27
  /**
29
28
  * Storage instances handle a json file where Generator authors can store data.
@@ -87,7 +86,9 @@ declare class Storage<StorageRecord extends Record<string, any> = Record<string,
87
86
  * @param key The key under which the value is stored.
88
87
  * @return The stored value. Any JSON valid type could be returned
89
88
  */
90
- get<const Key extends keyof StorageRecord>(key: Key): StorageRecord[Key];
89
+ get<const Key extends keyof StorageRecord>(key: Key, { raw }?: {
90
+ raw?: boolean;
91
+ }): StorageRecord[Key];
91
92
  /**
92
93
  * Get a stored value from a lodash path
93
94
  * @param path The path under which the value is stored.
@@ -6,7 +6,7 @@ import sortKeys from 'sort-keys';
6
6
  */
7
7
  const proxyHandler = {
8
8
  get(storage, property, _receiver) {
9
- return storage.get(property);
9
+ return storage.get(property, { raw: true });
10
10
  },
11
11
  set(storage, property, value, _receiver) {
12
12
  if (typeof property === 'string') {
@@ -19,7 +19,7 @@ const proxyHandler = {
19
19
  return Reflect.ownKeys(storage._store);
20
20
  },
21
21
  has(storage, prop) {
22
- return storage.get(prop) !== undefined;
22
+ return storage.get(prop, { raw: true }) !== undefined;
23
23
  },
24
24
  getOwnPropertyDescriptor(storage, key) {
25
25
  return {
@@ -171,7 +171,10 @@ class Storage {
171
171
  * @param key The key under which the value is stored.
172
172
  * @return The stored value. Any JSON valid type could be returned
173
173
  */
174
- get(key) {
174
+ get(key, { raw } = {}) {
175
+ if (raw) {
176
+ return this._store[key];
177
+ }
175
178
  return this.transformedStore()[key];
176
179
  }
177
180
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-generator",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "Rails-inspired generator system that provides scaffolding for your apps",
5
5
  "keywords": [
6
6
  "development",
@@ -45,53 +45,52 @@
45
45
  "doc:prettier": "prettier $npm_package_config_doc_path$DOC_FOLDER --write --ignore-path .prettierignore-doc",
46
46
  "fix": "eslint . --fix && prettier . --write",
47
47
  "prepare": "npm run build",
48
- "pretest": "eslint . && prettier . --check && npm run build",
48
+ "pretest": "eslint . && prettier . --check && npm run build && tsc -p tsconfig.spec.json",
49
49
  "test": "vitest run --coverage"
50
50
  },
51
51
  "config": {
52
52
  "doc_path": "../yeoman-generator-doc/"
53
53
  },
54
54
  "dependencies": {
55
- "@types/debug": "^4.1.12",
55
+ "@types/debug": "^4.1.13",
56
56
  "@types/lodash-es": "^4.17.12",
57
- "@yeoman/namespace": "^1.0.1",
57
+ "@yeoman/namespace": "^2.1.0",
58
58
  "chalk": "^5.6.2",
59
59
  "debug": "^4.4.3",
60
60
  "execa": "^9.6.1",
61
61
  "latest-version": "^9.0.0",
62
- "lodash-es": "^4.17.23",
63
- "mem-fs-editor": "^12.0.2",
62
+ "lodash-es": "^4.18.1",
63
+ "mem-fs-editor": "^12.0.4",
64
64
  "minimist": "^1.2.8",
65
65
  "read-package-up": "^12.0.0",
66
66
  "semver": "^7.7.4",
67
- "simple-git": "^3.32.3",
67
+ "simple-git": "^3.36.0",
68
68
  "sort-keys": "^6.0.0",
69
69
  "text-table": "^0.2.0",
70
- "type-fest": "^5.4.4"
70
+ "type-fest": "^5.6.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/ejs": "^3.1.5",
74
74
  "@types/minimist": "^1.2.5",
75
- "@types/picomatch": "^4.0.2",
75
+ "@types/node": "^24.12.2",
76
+ "@types/picomatch": "^4.0.3",
76
77
  "@types/semver": "^7.7.1",
77
- "@types/sinon": "^21.0.0",
78
78
  "@types/text-table": "^0.2.5",
79
- "@vitest/coverage-v8": "^4.0.18",
79
+ "@typescript-eslint/parser": "^8.59.1",
80
+ "@vitest/coverage-v8": "^4.1.5",
80
81
  "@yeoman/adapter": "^4.0.2",
81
- "@yeoman/eslint": "1.0.0",
82
- "@yeoman/transform": "^2.1.0",
83
- "@yeoman/types": "^1.10.3",
82
+ "@yeoman/eslint": "1.1.0",
83
+ "@yeoman/transform": "^2.1.1",
84
+ "@yeoman/types": "^1.11.0",
84
85
  "cpy-cli": "^7.0.0",
85
- "ejs": "^5.0.1",
86
- "eslint": "9.39.3",
86
+ "ejs": "^5.0.2",
87
+ "eslint": "10.2.1",
87
88
  "jsdoc": "^4.0.5",
88
- "prettier": "3.8.1",
89
- "prettier-plugin-packagejson": "3.0.0",
90
- "sinon": "^21.0.1",
91
- "typescript": "5.9.3",
92
- "vitest": "^4.0.18",
93
- "yeoman-assert": "^3.1.1",
94
- "yeoman-environment": "^6.0.0",
89
+ "prettier": "3.8.3",
90
+ "prettier-plugin-packagejson": "3.0.2",
91
+ "typescript": "6.0.3",
92
+ "vitest": "^4.1.5",
93
+ "yeoman-environment": "^6.0.1",
95
94
  "yeoman-test": "^11.3.1"
96
95
  },
97
96
  "peerDependencies": {