@o3r/core 10.0.0-prerelease.99 → 10.1.0-prerelease.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/README.md +3 -2
- package/esm2022/messages/message.helpers.mjs +1 -1
- package/esm2022/store/async/async-entity.adapter.mjs +1 -1
- package/esm2022/store/async/async.helpers.mjs +1 -1
- package/esm2022/store/async/async.operators.mjs +1 -1
- package/esm2022/utils/deep-fill/deep-fill.mjs +1 -1
- package/esm2022/utils/rendering/rendering.helpers.mjs +1 -1
- package/fesm2022/o3r-core.mjs.map +1 -1
- package/package.json +6 -6
- package/schematics/component/container/index.js +2 -2
- package/schematics/ng-add/index.d.ts +2 -2
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +37 -27
- package/schematics/ng-add/project-setup/index.d.ts +4 -2
- package/schematics/ng-add/project-setup/index.d.ts.map +1 -1
- package/schematics/ng-add/project-setup/index.js +26 -22
- package/schematics/ng-add-create/templates/schematics/ng-add/index.ts.template +44 -15
- package/schematics/ng-add-create/templates/schematics/ng-add/schema.json.template +2 -3
- package/schematics/ng-add-create/templates/schematics/ng-add/schema.ts.template +1 -1
- package/schematics/rule-factories/additional-modules/index.d.ts +3 -2
- package/schematics/rule-factories/additional-modules/index.d.ts.map +1 -1
- package/schematics/rule-factories/additional-modules/index.js +19 -12
- package/schematics/rule-factories/otter-environment/index.js +1 -1
- package/schematics/rule-factories/playwright/index.d.ts +0 -1
- package/schematics/rule-factories/playwright/index.d.ts.map +1 -1
- package/schematics/rule-factories/playwright/index.js +16 -3
- package/schematics/rule-factories/store/index.d.ts +5 -1
- package/schematics/rule-factories/store/index.d.ts.map +1 -1
- package/schematics/rule-factories/store/index.js +28 -35
- package/schematics/shared/presets/helpers.d.ts +1 -1
- package/schematics/shared/presets/helpers.d.ts.map +1 -1
- package/schematics/shared/presets/helpers.js +23 -11
- package/schematics/shared/presets/preset.interface.d.ts +3 -1
- package/schematics/shared/presets/preset.interface.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAK/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA6EjD;;;GAGG;AACH,eAAO,MAAM,KAAK,0CAAiD,CAAC"}
|
|
@@ -2,44 +2,53 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngAdd = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const prompt_1 = require("@angular/cli/src/utilities/prompt");
|
|
6
|
-
const schematics_2 = require("@o3r/schematics");
|
|
7
5
|
const fs = require("node:fs");
|
|
8
6
|
const path = require("node:path");
|
|
9
|
-
const rxjs_1 = require("rxjs");
|
|
10
7
|
const presets_1 = require("../shared/presets");
|
|
8
|
+
const prompt_1 = require("@angular/cli/src/utilities/prompt");
|
|
9
|
+
const schematics_2 = require("@o3r/schematics");
|
|
11
10
|
const index_1 = require("./project-setup/index");
|
|
11
|
+
const schematics_3 = require("@o3r/schematics");
|
|
12
|
+
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
13
|
+
const workspacePackageName = '@o3r/workspace';
|
|
14
|
+
const o3rDevDependencies = [
|
|
15
|
+
'@o3r/schematics'
|
|
16
|
+
];
|
|
12
17
|
/**
|
|
13
18
|
* Add Otter library to an Angular Project
|
|
14
19
|
* @param options
|
|
15
20
|
*/
|
|
16
21
|
function ngAddFn(options) {
|
|
17
22
|
const corePackageJsonContent = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' }));
|
|
18
|
-
const o3rCoreVersion = corePackageJsonContent.version
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const o3rCoreVersion = corePackageJsonContent.version;
|
|
24
|
+
return () => {
|
|
25
|
+
const dependenciesSetupConfig = {
|
|
26
|
+
projectName: options.projectName,
|
|
27
|
+
dependencies: o3rDevDependencies.reduce((acc, dep) => {
|
|
28
|
+
acc[dep] = {
|
|
29
|
+
inManifest: [{
|
|
30
|
+
range: `~${o3rCoreVersion}`,
|
|
31
|
+
types: [dependencies_1.NodeDependencyType.Dev]
|
|
32
|
+
}]
|
|
33
|
+
};
|
|
34
|
+
return acc;
|
|
35
|
+
}, {}),
|
|
36
|
+
ngAddToRun: [...o3rDevDependencies]
|
|
37
|
+
};
|
|
38
|
+
if (!options.projectName) {
|
|
39
|
+
dependenciesSetupConfig.dependencies[workspacePackageName] = {
|
|
40
|
+
toWorkspaceOnly: true,
|
|
41
|
+
inManifest: [{
|
|
42
|
+
range: `~${o3rCoreVersion}`,
|
|
43
|
+
types: [dependencies_1.NodeDependencyType.Default]
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
(dependenciesSetupConfig.ngAddToRun ||= []).push(workspacePackageName);
|
|
25
47
|
}
|
|
26
|
-
|
|
27
|
-
const workingDirectory = workspaceProject?.root || '.';
|
|
28
|
-
context.addTask(new schematics_2.AddDevInstall({
|
|
29
|
-
packageName: [
|
|
30
|
-
...schematicsDependencies.map((dependency) => dependency + o3rCoreVersion)
|
|
31
|
-
].join(' '),
|
|
32
|
-
hideOutput: false,
|
|
33
|
-
quiet: false,
|
|
34
|
-
workingDirectory,
|
|
35
|
-
force: options.forceInstall
|
|
36
|
-
}));
|
|
37
|
-
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
|
38
|
-
return () => (0, schematics_1.chain)([
|
|
48
|
+
return (0, schematics_1.chain)([
|
|
39
49
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
40
50
|
(0, schematics_2.setupSchematicsDefaultParams)({ '*:ng-add': { registerDevtool: options.withDevtool } }),
|
|
41
|
-
|
|
42
|
-
options.projectName ? (0, index_1.prepareProject)(options) : (0, schematics_1.noop)(),
|
|
51
|
+
options.projectName ? (0, index_1.prepareProject)(options, dependenciesSetupConfig) : (0, schematics_1.noop)(),
|
|
43
52
|
(0, schematics_2.registerPackageCollectionSchematics)(corePackageJsonContent),
|
|
44
53
|
async (t, c) => {
|
|
45
54
|
const { preset, externalPresets, ...forwardOptions } = options;
|
|
@@ -57,8 +66,9 @@ function ngAddFn(options) {
|
|
|
57
66
|
externalPresetRunner?.rule || (0, schematics_1.noop)()
|
|
58
67
|
])(t, c);
|
|
59
68
|
},
|
|
60
|
-
(0, schematics_2.displayModuleListRule)({ packageName: options.projectName })
|
|
61
|
-
|
|
69
|
+
options.projectName ? (0, schematics_2.displayModuleListRule)({ packageName: options.projectName }) : (0, schematics_1.noop)(),
|
|
70
|
+
(0, schematics_3.setupDependencies)(dependenciesSetupConfig)
|
|
71
|
+
]);
|
|
62
72
|
};
|
|
63
73
|
}
|
|
64
74
|
/**
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Rule
|
|
1
|
+
import { type Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { type SetupDependenciesOptions } from '@o3r/schematics';
|
|
2
3
|
import type { NgAddSchematicsSchema } from '../schema';
|
|
3
4
|
/**
|
|
4
5
|
* Enable all the otter features requested by the user
|
|
5
6
|
* Install all the related dependencies and import the features inside the application
|
|
6
7
|
* @param options installation options to pass to the all the other packages' installation
|
|
8
|
+
* @param dependenciesSetupConfig
|
|
7
9
|
*/
|
|
8
|
-
export declare const prepareProject: (options: NgAddSchematicsSchema
|
|
10
|
+
export declare const prepareProject: (options: NgAddSchematicsSchema, dependenciesSetupConfig: SetupDependenciesOptions) => Rule;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/project-setup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/project-setup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAUpE,OAAO,EAML,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMvD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAa,qBAAqB,2BAA2B,wBAAwB,KAAG,IA8ClH,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareProject = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
6
5
|
const fs = require("node:fs");
|
|
7
6
|
const path = require("node:path");
|
|
8
7
|
const index_1 = require("../../rule-factories/index");
|
|
@@ -15,8 +14,9 @@ const index_2 = require("../utils/index");
|
|
|
15
14
|
* Enable all the otter features requested by the user
|
|
16
15
|
* Install all the related dependencies and import the features inside the application
|
|
17
16
|
* @param options installation options to pass to the all the other packages' installation
|
|
17
|
+
* @param dependenciesSetupConfig
|
|
18
18
|
*/
|
|
19
|
-
const prepareProject = (options) => async (tree, context) => {
|
|
19
|
+
const prepareProject = (options, dependenciesSetupConfig) => async (tree, context) => {
|
|
20
20
|
const coreSchematicsFolder = path.resolve(__dirname, '..');
|
|
21
21
|
const corePackageJsonPath = path.resolve(coreSchematicsFolder, '..', '..', 'package.json');
|
|
22
22
|
const corePackageJsonContent = JSON.parse(fs.readFileSync(corePackageJsonPath, { encoding: 'utf-8' }));
|
|
@@ -34,27 +34,31 @@ const prepareProject = (options) => async (tree, context) => {
|
|
|
34
34
|
...(installOtterLinter ? ['@o3r/eslint-config-otter'] : []),
|
|
35
35
|
...depsInfo.o3rPeerDeps
|
|
36
36
|
]));
|
|
37
|
-
const type = projectType === 'library' ? dependencies_1.NodeDependencyType.Peer : dependencies_1.NodeDependencyType.Default;
|
|
38
37
|
const projectDirectory = workspaceProject?.root;
|
|
39
|
-
const optionsAndWorkingDir = { ...options, workingDirectory: projectDirectory };
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
38
|
+
const optionsAndWorkingDir = { ...options, workingDirectory: projectDirectory, dependenciesSetupConfig };
|
|
39
|
+
internalPackagesToInstallWithNgAdd
|
|
40
|
+
.forEach((dep) => {
|
|
41
|
+
dependenciesSetupConfig.dependencies[dep] = {
|
|
42
|
+
inManifest: [{
|
|
43
|
+
range: `~${o3rCoreVersion}`,
|
|
44
|
+
types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
(dependenciesSetupConfig.ngAddToRun ||= []).push(...internalPackagesToInstallWithNgAdd);
|
|
49
|
+
const appLibRules = [
|
|
50
|
+
(0, update_builders_names_1.updateBuildersNames)(),
|
|
51
|
+
(0, update_generators_names_1.updateOtterGeneratorsNames)(),
|
|
52
|
+
(0, index_1.updateOtterEnvironmentAdapter)(optionsAndWorkingDir, coreSchematicsFolder),
|
|
53
|
+
(0, index_1.updateStore)(optionsAndWorkingDir, projectType),
|
|
54
|
+
options.enableCustomization && projectType === 'application' ? (0, index_1.updateCustomizationEnvironment)(coreSchematicsFolder, o3rCoreVersion, optionsAndWorkingDir, false) : schematics_1.noop,
|
|
55
|
+
projectType === 'application' ? (0, index_1.updateAdditionalModules)(optionsAndWorkingDir, dependenciesSetupConfig) : schematics_1.noop,
|
|
56
|
+
(0, schematics_2.removePackages)(replaced_packages_1.packagesToRemove),
|
|
57
|
+
(0, index_1.o3rBasicUpdates)(options.projectName, o3rCoreVersion, projectType),
|
|
58
|
+
// task that should run after the schematics should be after the ng-add task as they will wait for the package installation before running the other dependencies
|
|
59
|
+
!options.skipLinter && installOtterLinter ? (0, schematics_2.applyEsLintFix)() : (0, schematics_1.noop)()
|
|
60
|
+
];
|
|
61
|
+
return (0, schematics_1.chain)(appLibRules);
|
|
58
62
|
};
|
|
59
63
|
exports.prepareProject = prepareProject;
|
|
60
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,32 +1,61 @@
|
|
|
1
1
|
import { chain, noop, Rule } from '@angular-devkit/schematics';
|
|
2
|
-
import { applyEsLintFix, createSchematicWithMetricsIfInstalled, install, ngAddPackages, getO3rPeerDeps } from '@o3r/schematics';
|
|
3
2
|
import type { NgAddSchematicsSchema } from './schema';
|
|
4
3
|
import * as path from 'node:path';
|
|
4
|
+
import { type DependencyToAdd } from '@o3r/schematics';
|
|
5
|
+
|
|
6
|
+
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
5
7
|
|
|
6
8
|
const doCustomAction: Rule = (tree, _context) => {
|
|
7
9
|
// your custom code here
|
|
8
10
|
return tree;
|
|
9
11
|
};
|
|
10
12
|
|
|
13
|
+
const dependenciesToInstall = [
|
|
14
|
+
// Add the dependencies to install here
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const dependenciesToNgAdd = [
|
|
18
|
+
// Add the dependencies to install with NgAdd here
|
|
19
|
+
];
|
|
20
|
+
|
|
11
21
|
/**
|
|
12
22
|
* Add Otter <%= featureName %> to an Otter Project
|
|
13
23
|
*
|
|
14
24
|
* @param options
|
|
15
25
|
*/
|
|
16
26
|
function ngAddFn(options: NgAddSchematicsSchema): Rule {
|
|
17
|
-
return async (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
return async (tree, context) => {
|
|
28
|
+
try {
|
|
29
|
+
// use dynamic import to properly raise an exception if it is not an Otter project.
|
|
30
|
+
const { getProjectNewDependenciesTypes, getPackageInstallConfig, applyEsLintFix, install } = await import('@o3r/schematics');
|
|
31
|
+
// current package version
|
|
32
|
+
const version = JSON.stringify(fs.readFileSync(packageJsonPath)).version;
|
|
33
|
+
const dependencies = [...dependenciesToInstall, ...dependenciesToNgAdd].reduce((acc, dep) => {
|
|
34
|
+
acc[dep] = {
|
|
35
|
+
inManifest: [{
|
|
36
|
+
range: `~${version}`,
|
|
37
|
+
types: getProjectNewDependenciesTypes(workspaceProject)
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
return acc;
|
|
41
|
+
}, getPackageInstallConfig(packageJsonPath, tree, options.projectName));
|
|
42
|
+
return chain([
|
|
43
|
+
// optional custom action dedicated to this module
|
|
44
|
+
doCustomAction,
|
|
45
|
+
options.skipLinter ? noop() : applyEsLintFix(),
|
|
46
|
+
setupDependencies({
|
|
47
|
+
projectName: options.projectName,
|
|
48
|
+
dependencies,
|
|
49
|
+
ngAddToRun: dependenciesToNgAdd,
|
|
50
|
+
skipInstall: options.skipInstall
|
|
51
|
+
})
|
|
52
|
+
]);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
// If the installation is initialized in a non-Otter application, mandatory packages will be missing. We need to notify the user
|
|
55
|
+
context.logger.error(`[ERROR]: Adding <%= featureName %> has failed.
|
|
56
|
+
If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the <%= featureName %> package. Please run 'ng add @o3r/core' .
|
|
57
|
+
Otherwise, use the error message as guidance.`);
|
|
58
|
+
throw (e);
|
|
59
|
+
}
|
|
29
60
|
};
|
|
30
61
|
}
|
|
31
|
-
|
|
32
|
-
export const ngAdd = createSchematicWithMetricsIfInstalled(ngAddFn);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"title": "Add <%= featureName %> project",
|
|
5
5
|
"description": "'ng add <%= featureName %>' project",
|
|
6
6
|
"properties": {
|
|
7
|
-
"
|
|
7
|
+
"projectName": {
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "Project name",
|
|
10
10
|
"$default": {
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"skipInstall": {
|
|
20
20
|
"type": "boolean",
|
|
21
|
-
"description": "Skip the install process"
|
|
22
|
-
"default": true
|
|
21
|
+
"description": "Skip the install process"
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
24
|
"additionalProperties": true,
|
|
@@ -2,7 +2,7 @@ import type { SchematicOptionObject } from '@o3r/schematics';
|
|
|
2
2
|
|
|
3
3
|
export interface NgAddSchematicsSchema extends SchematicOptionObject {
|
|
4
4
|
/** Project name */
|
|
5
|
-
|
|
5
|
+
projectName: string | undefined;
|
|
6
6
|
|
|
7
7
|
/** Skip the linter process */
|
|
8
8
|
skipLinter: boolean;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { type SetupDependenciesOptions } from '@o3r/schematics';
|
|
2
3
|
/**
|
|
3
4
|
* Add additional modules for dev only
|
|
4
5
|
* @param options @see RuleFactory.options
|
|
5
6
|
* @param options.projectName
|
|
6
7
|
* @param options.workingDirectory the directory where to execute the rule factory
|
|
7
|
-
* @param
|
|
8
|
+
* @param dependenciesSetupConfig
|
|
8
9
|
*/
|
|
9
10
|
export declare function updateAdditionalModules(options: {
|
|
10
11
|
projectName?: string | undefined;
|
|
11
12
|
workingDirectory?: string | undefined;
|
|
12
|
-
},
|
|
13
|
+
}, dependenciesSetupConfig: SetupDependenciesOptions): Rule;
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/additional-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/additional-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AAczB;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,uBAAuB,EAAE,wBAAwB,GAAG,IAAI,CA6MrL"}
|
|
@@ -8,31 +8,38 @@ const utility_1 = require("@schematics/angular/utility");
|
|
|
8
8
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
9
9
|
const change_1 = require("@schematics/angular/utility/change");
|
|
10
10
|
const path = require("node:path");
|
|
11
|
+
const fs = require("node:fs");
|
|
12
|
+
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
11
13
|
const packageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json');
|
|
14
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
|
12
15
|
const ngrxStoreDevtoolsDep = '@ngrx/store-devtools';
|
|
13
16
|
/**
|
|
14
17
|
* Add additional modules for dev only
|
|
15
18
|
* @param options @see RuleFactory.options
|
|
16
19
|
* @param options.projectName
|
|
17
20
|
* @param options.workingDirectory the directory where to execute the rule factory
|
|
18
|
-
* @param
|
|
21
|
+
* @param dependenciesSetupConfig
|
|
19
22
|
*/
|
|
20
|
-
function updateAdditionalModules(options,
|
|
23
|
+
function updateAdditionalModules(options, dependenciesSetupConfig) {
|
|
21
24
|
/**
|
|
22
25
|
* Update package.json to add additional modules dependencies
|
|
23
26
|
* @param tree
|
|
24
|
-
* @param context
|
|
25
27
|
*/
|
|
26
|
-
const updatePackageJson = (tree
|
|
28
|
+
const updatePackageJson = (tree) => {
|
|
27
29
|
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const types = (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject);
|
|
31
|
+
dependenciesSetupConfig.dependencies.chokidar = {
|
|
32
|
+
inManifest: [{
|
|
33
|
+
range: packageJson.peerDependencies.chokidar,
|
|
34
|
+
types: [dependencies_1.NodeDependencyType.Dev]
|
|
35
|
+
}]
|
|
36
|
+
};
|
|
37
|
+
dependenciesSetupConfig.dependencies[ngrxStoreDevtoolsDep] = {
|
|
38
|
+
inManifest: [{
|
|
39
|
+
range: packageJson.generatorDependencies[ngrxStoreDevtoolsDep],
|
|
40
|
+
types
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
36
43
|
return tree;
|
|
37
44
|
};
|
|
38
45
|
/**
|
|
@@ -66,7 +66,7 @@ function updateOtterEnvironmentAdapter(options, _rootPath) {
|
|
|
66
66
|
schematics_2.OTTER_ITEM_TYPES.forEach((item) => {
|
|
67
67
|
const path = schematics_2.TYPES_DEFAULT_FOLDER[item].lib ? `modules/${scope}/${schematics_2.TYPES_DEFAULT_FOLDER[item].lib}` : null;
|
|
68
68
|
if (path) {
|
|
69
|
-
workspace.schematics[item] = {
|
|
69
|
+
workspace.schematics[`${item}*`] = {
|
|
70
70
|
path,
|
|
71
71
|
...(workspace.schematics[item] || {})
|
|
72
72
|
};
|
|
@@ -2,7 +2,6 @@ import { Rule } from '@angular-devkit/schematics';
|
|
|
2
2
|
import { NgAddPackageOptions } from '@o3r/schematics';
|
|
3
3
|
/**
|
|
4
4
|
* Add Playwright to Otter application
|
|
5
|
-
*
|
|
6
5
|
* @param options @see RuleFactory.options
|
|
7
6
|
* @param options.projectName
|
|
8
7
|
* @param rootPath @see RuleFactory.rootPath
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/playwright/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA+D,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AACtJ,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/playwright/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA+D,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AACtJ,OAAO,EAGL,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAMzB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAoE1F"}
|
|
@@ -6,14 +6,16 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
6
6
|
const schematics_2 = require("@o3r/schematics");
|
|
7
7
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
8
8
|
const path = require("node:path");
|
|
9
|
+
const fs = require("node:fs");
|
|
9
10
|
/**
|
|
10
11
|
* Add Playwright to Otter application
|
|
11
|
-
*
|
|
12
12
|
* @param options @see RuleFactory.options
|
|
13
13
|
* @param options.projectName
|
|
14
14
|
* @param rootPath @see RuleFactory.rootPath
|
|
15
15
|
*/
|
|
16
16
|
function updatePlaywright(rootPath, options = {}) {
|
|
17
|
+
const ownPackageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json');
|
|
18
|
+
const ownPackageJson = JSON.parse(fs.readFileSync(ownPackageJsonPath, { encoding: 'utf-8' }));
|
|
17
19
|
return (tree, context) => {
|
|
18
20
|
// update gitignore
|
|
19
21
|
if (tree.exists('/.gitignore')) {
|
|
@@ -36,8 +38,19 @@ function updatePlaywright(rootPath, options = {}) {
|
|
|
36
38
|
packageJson.scripts['test:playwright:sanity'] ||= 'playwright test --config=e2e-playwright/playwright-config.sanity.ts';
|
|
37
39
|
tree.overwrite('/package.json', JSON.stringify(packageJson, null, 2));
|
|
38
40
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
+
const dependencies = ['@playwright/test', 'rimraf'].reduce((acc, dep) => {
|
|
42
|
+
acc[dep] = {
|
|
43
|
+
inManifest: [{
|
|
44
|
+
range: ownPackageJson.generatorDependencies[dep],
|
|
45
|
+
types: [dependencies_1.NodeDependencyType.Dev]
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
const ngAddRules = (0, schematics_2.setupDependencies)({
|
|
51
|
+
projectName: options.projectName || undefined,
|
|
52
|
+
dependencies
|
|
53
|
+
});
|
|
41
54
|
// generate files
|
|
42
55
|
if (!tree.exists('/e2e-playwright/playwright-config.ts')) {
|
|
43
56
|
const name = 'my-scenario';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { type SetupDependenciesOptions } from '@o3r/schematics';
|
|
2
3
|
import { WorkspaceProject } from '@o3r/schematics';
|
|
3
4
|
/**
|
|
4
5
|
* Add Redux Store support
|
|
@@ -7,9 +8,12 @@ import { WorkspaceProject } from '@o3r/schematics';
|
|
|
7
8
|
* @param options.projectName
|
|
8
9
|
* @param options.workingDirectory
|
|
9
10
|
* @param projectType
|
|
11
|
+
* @param options.dependenciesSetupConfig
|
|
12
|
+
* @param options.workingDirector
|
|
10
13
|
*/
|
|
11
14
|
export declare function updateStore(options: {
|
|
12
15
|
projectName?: string | undefined;
|
|
13
|
-
|
|
16
|
+
workingDirector?: string | undefined;
|
|
17
|
+
dependenciesSetupConfig: SetupDependenciesOptions;
|
|
14
18
|
}, projectType?: WorkspaceProject['projectType']): Rule;
|
|
15
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/rule-factories/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AACjF,OAAO,EASL,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAkBnD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,uBAAuB,EAAE,wBAAwB,CAAA;CAAE,EACtI,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,IAAI,CAkIrD"}
|
|
@@ -5,18 +5,18 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
5
5
|
const schematics_2 = require("@o3r/schematics");
|
|
6
6
|
const utility_1 = require("@schematics/angular/utility");
|
|
7
7
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
8
|
-
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
9
8
|
const path = require("node:path");
|
|
10
9
|
const ts = require("typescript");
|
|
11
10
|
const fs = require("node:fs");
|
|
12
|
-
const
|
|
11
|
+
const coreSchematicsFolder = path.resolve(__dirname, '..', '..');
|
|
12
|
+
const corePackageJsonPath = path.resolve(coreSchematicsFolder, '..', 'package.json');
|
|
13
|
+
const corePackageJsonContent = JSON.parse(fs.readFileSync(corePackageJsonPath, { encoding: 'utf-8' }));
|
|
14
|
+
const o3rCoreVersion = corePackageJsonContent.version;
|
|
13
15
|
const ngrxEffectsDep = '@ngrx/effects';
|
|
14
16
|
const ngrxEntityDep = '@ngrx/entity';
|
|
15
17
|
const ngrxStoreDep = '@ngrx/store';
|
|
16
18
|
const ngrxRouterStore = '@ngrx/router-store';
|
|
17
19
|
const ngrxRouterStoreDevToolDep = '@ngrx/store-devtools';
|
|
18
|
-
// TODO Remove this explicit dependency when correctly brought by the ng-add of @o3r/store-sync
|
|
19
|
-
const fastDeepEqualDep = 'fast-deep-equal';
|
|
20
20
|
/**
|
|
21
21
|
* Add Redux Store support
|
|
22
22
|
* @param options @see RuleFactory.options
|
|
@@ -24,47 +24,40 @@ const fastDeepEqualDep = 'fast-deep-equal';
|
|
|
24
24
|
* @param options.projectName
|
|
25
25
|
* @param options.workingDirectory
|
|
26
26
|
* @param projectType
|
|
27
|
+
* @param options.dependenciesSetupConfig
|
|
28
|
+
* @param options.workingDirector
|
|
27
29
|
*/
|
|
28
30
|
function updateStore(options, projectType) {
|
|
29
31
|
const addStoreModules = (tree) => {
|
|
30
|
-
const coreSchematicsFolder = path.resolve(__dirname, '..', '..');
|
|
31
|
-
const corePackageJsonPath = path.resolve(coreSchematicsFolder, '..', 'package.json');
|
|
32
|
-
const corePackageJsonContent = JSON.parse(fs.readFileSync(corePackageJsonPath, { encoding: 'utf-8' }));
|
|
33
|
-
const o3rCoreVersion = corePackageJsonContent.version;
|
|
34
32
|
const workspaceConfig = (0, schematics_2.getWorkspaceConfig)(tree);
|
|
35
33
|
const workspaceProject = options.projectName && workspaceConfig?.projects?.[options.projectName] || undefined;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
34
|
+
const storeSyncPackageName = '@o3r/store-sync';
|
|
35
|
+
options.dependenciesSetupConfig.dependencies[storeSyncPackageName] = {
|
|
36
|
+
inManifest: [{
|
|
37
|
+
range: `~${o3rCoreVersion}`,
|
|
38
|
+
types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
(options.dependenciesSetupConfig.ngAddToRun ||= []).push(storeSyncPackageName);
|
|
45
42
|
};
|
|
46
43
|
/**
|
|
47
|
-
*
|
|
44
|
+
* Change package.json with the new dependencies
|
|
48
45
|
* @param tree
|
|
49
|
-
* @param context
|
|
50
46
|
*/
|
|
51
|
-
const updatePackageJson = (tree
|
|
52
|
-
const
|
|
53
|
-
const
|
|
47
|
+
const updatePackageJson = (tree) => {
|
|
48
|
+
const workspaceConfig = (0, schematics_2.getWorkspaceConfig)(tree);
|
|
49
|
+
const workspaceProject = options.projectName && workspaceConfig?.projects?.[options.projectName] || undefined;
|
|
50
|
+
const appDeps = [ngrxEffectsDep, ngrxRouterStore, ngrxRouterStoreDevToolDep];
|
|
54
51
|
const corePeerDeps = [ngrxEntityDep, ngrxStoreDep];
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
context.logger.warn(`Could not find generatorDependency ${dependenciesList.join(', ')} in file ${packageJsonPath}`);
|
|
65
|
-
return tree;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
52
|
+
const dependenciesList = projectType === 'application' ? [...corePeerDeps, ...appDeps] : [...corePeerDeps];
|
|
53
|
+
Object.entries((0, schematics_2.getExternalDependenciesVersionRange)(dependenciesList, corePackageJsonPath)).forEach(([dep, range]) => {
|
|
54
|
+
options.dependenciesSetupConfig.dependencies[dep] = {
|
|
55
|
+
inManifest: [{
|
|
56
|
+
range,
|
|
57
|
+
types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
|
|
58
|
+
}]
|
|
59
|
+
};
|
|
60
|
+
});
|
|
68
61
|
};
|
|
69
62
|
/**
|
|
70
63
|
* Edit main module with the translation required configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAK3D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAgCrG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultPresetRuleFactory = void 0;
|
|
4
|
-
const schematics_1 = require("@
|
|
5
|
-
const
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_2 = require("@o3r/schematics");
|
|
6
6
|
const fs = require("node:fs");
|
|
7
7
|
const path = require("node:path");
|
|
8
8
|
/**
|
|
@@ -12,18 +12,30 @@ const path = require("node:path");
|
|
|
12
12
|
*/
|
|
13
13
|
function defaultPresetRuleFactory(moduleToInstall, options = {}) {
|
|
14
14
|
return (tree, _context) => {
|
|
15
|
-
const
|
|
15
|
+
const corePackageJsonContent = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', '..', 'package.json'), { encoding: 'utf-8' }));
|
|
16
|
+
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
16
17
|
if (!moduleToInstall.length) {
|
|
17
18
|
return tree;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const dependencies = moduleToInstall.reduce((acc, dep) => {
|
|
21
|
+
acc[dep] = {
|
|
22
|
+
inManifest: [{
|
|
23
|
+
range: `~${corePackageJsonContent.version}`,
|
|
24
|
+
types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
|
|
25
|
+
}]
|
|
26
|
+
};
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
if (options.dependenciesSetupConfig) {
|
|
30
|
+
options.dependenciesSetupConfig.dependencies = {
|
|
31
|
+
...options.dependenciesSetupConfig.dependencies,
|
|
32
|
+
...dependencies
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return options.dependenciesSetupConfig ? schematics_1.noop : (0, schematics_2.setupDependencies)({
|
|
36
|
+
projectName: options.projectName,
|
|
37
|
+
dependencies,
|
|
38
|
+
ngAddToRun: moduleToInstall
|
|
27
39
|
});
|
|
28
40
|
};
|
|
29
41
|
}
|