yeoman-environment 4.0.0-beta.0 → 4.0.0-beta.1
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/commit.js +3 -0
- package/dist/composed-store.d.ts +1 -1
- package/dist/composed-store.js +4 -1
- package/dist/environment-base.js +16 -8
- package/dist/package-manager.js +1 -0
- package/package.json +1 -1
package/dist/commit.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { createConflicterTransform, createYoResolveTransform, forceYoFiles } from '@yeoman/conflicter';
|
|
2
|
+
import createdLogger from 'debug';
|
|
2
3
|
import { create as createMemFsEditor } from 'mem-fs-editor';
|
|
3
4
|
// eslint-disable-next-line n/file-extension-in-import
|
|
4
5
|
import { isFilePending } from 'mem-fs-editor/state';
|
|
5
6
|
// eslint-disable-next-line n/file-extension-in-import
|
|
6
7
|
import { createCommitTransform } from 'mem-fs-editor/transform';
|
|
8
|
+
const debug = createdLogger('yeoman:environment:commit');
|
|
7
9
|
/**
|
|
8
10
|
* Commits the MemFs to the disc.
|
|
9
11
|
* @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream().
|
|
10
12
|
* @return {Promise}
|
|
11
13
|
*/
|
|
12
14
|
export const commitSharedFsTask = ({ adapter, conflicterOptions, sharedFs, stream, }) => {
|
|
15
|
+
debug('Running commitSharedFsTask');
|
|
13
16
|
const fs = createMemFsEditor(sharedFs);
|
|
14
17
|
stream = stream ?? fs.store.stream({ filter: file => isFilePending(file) });
|
|
15
18
|
return fs.commit([
|
package/dist/composed-store.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ export declare class ComposedStore {
|
|
|
13
13
|
getGenerators(): Record<string, BaseGenerator>;
|
|
14
14
|
addGenerator(generator: any): {
|
|
15
15
|
uniqueBy: any;
|
|
16
|
+
identifier: any;
|
|
16
17
|
added: boolean;
|
|
17
18
|
generator: BaseGenerator | undefined;
|
|
18
|
-
identifier?: undefined;
|
|
19
19
|
} | {
|
|
20
20
|
identifier: any;
|
|
21
21
|
added: boolean;
|
package/dist/composed-store.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import { toNamespace } from '@yeoman/namespace';
|
|
3
|
+
import createdLogger from 'debug';
|
|
4
|
+
const debug = createdLogger('yeoman:environment:composed-store');
|
|
3
5
|
const uniqueFeatureValues = ['customCommitTask', 'customInstallTask'];
|
|
4
6
|
export class ComposedStore {
|
|
5
7
|
log;
|
|
@@ -41,7 +43,7 @@ export class ComposedStore {
|
|
|
41
43
|
const generatorRoot = generator.destinationRoot();
|
|
42
44
|
const uniqueByMap = uniqueGlobally ? this.uniqueGloballyMap : this.getUniqueByPathMap(generatorRoot);
|
|
43
45
|
if (uniqueByMap.has(uniqueBy)) {
|
|
44
|
-
return { uniqueBy, added: false, generator: uniqueByMap.get(uniqueBy) };
|
|
46
|
+
return { uniqueBy, identifier, added: false, generator: uniqueByMap.get(uniqueBy) };
|
|
45
47
|
}
|
|
46
48
|
uniqueByMap.set(uniqueBy, generator);
|
|
47
49
|
for (const featureName of uniqueFeatureValues) {
|
|
@@ -49,6 +51,7 @@ export class ComposedStore {
|
|
|
49
51
|
if (feature) {
|
|
50
52
|
const existingFeature = this.uniqueFeatures.get(feature);
|
|
51
53
|
if (typeof existingFeature !== 'function') {
|
|
54
|
+
debug(`Feature ${featureName} provided by ${uniqueBy}`);
|
|
52
55
|
this.uniqueFeatures.set(featureName, feature);
|
|
53
56
|
}
|
|
54
57
|
else if (typeof feature === 'function') {
|
package/dist/environment-base.js
CHANGED
|
@@ -526,12 +526,14 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
526
526
|
* would be killed if an error is thrown to environment.
|
|
527
527
|
* Make sure to not rely on that behavior.
|
|
528
528
|
*/
|
|
529
|
-
this.on('error', error => {
|
|
530
|
-
reject(error);
|
|
529
|
+
this.on('error', async (error) => {
|
|
531
530
|
this.runLoop.pause();
|
|
531
|
+
await this.adapter.onIdle?.();
|
|
532
|
+
reject(error);
|
|
532
533
|
this.adapter.close();
|
|
533
534
|
});
|
|
534
|
-
this.once('end', () => {
|
|
535
|
+
this.once('end', async () => {
|
|
536
|
+
await this.adapter.onIdle?.();
|
|
535
537
|
resolve();
|
|
536
538
|
this.adapter.close();
|
|
537
539
|
});
|
|
@@ -568,13 +570,15 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
568
570
|
const queueCommit = () => {
|
|
569
571
|
debug('Queueing conflicts task');
|
|
570
572
|
this.queueTask('environment:conflicts', async () => {
|
|
573
|
+
debug('Running conflicts');
|
|
571
574
|
const { customCommitTask = () => commitSharedFsTask(this) } = this.composedStore;
|
|
572
|
-
if (typeof customCommitTask
|
|
573
|
-
|
|
574
|
-
return;
|
|
575
|
+
if (typeof customCommitTask === 'function') {
|
|
576
|
+
await customCommitTask();
|
|
575
577
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
+
else {
|
|
579
|
+
debug('Ignoring commit, custom commit was provided');
|
|
580
|
+
}
|
|
581
|
+
debug('Adding queueCommit listener');
|
|
578
582
|
this.sharedFs.once('change', queueCommit);
|
|
579
583
|
}, {
|
|
580
584
|
once: 'write memory fs to disk',
|
|
@@ -602,6 +606,10 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
602
606
|
nodePackageManager,
|
|
603
607
|
customInstallTask,
|
|
604
608
|
});
|
|
609
|
+
memFs.once('change', file => {
|
|
610
|
+
if (file === join(this.cwd, 'package.json'))
|
|
611
|
+
this.queuePackageManagerInstall();
|
|
612
|
+
});
|
|
605
613
|
}, { once: 'package manager install' });
|
|
606
614
|
}
|
|
607
615
|
/**
|
package/dist/package-manager.js
CHANGED
|
@@ -15,6 +15,7 @@ const debug = createdLogger('yeoman:environment:package-manager');
|
|
|
15
15
|
|
|
16
16
|
*/
|
|
17
17
|
export async function packageManagerInstallTask({ memFs, packageJsonLocation, customInstallTask, adapter, nodePackageManager, skipInstall, }) {
|
|
18
|
+
debug('Running packageManagerInstallTask');
|
|
18
19
|
packageJsonLocation = resolve(packageJsonLocation);
|
|
19
20
|
/**
|
|
20
21
|
* @private
|