@o3r/core 10.3.0-prerelease.9 → 10.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/core",
3
- "version": "10.3.0-prerelease.9",
3
+ "version": "10.4.0-prerelease.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,11 +22,11 @@
22
22
  "@angular/forms": "~17.3.0",
23
23
  "@angular/platform-browser-dynamic": "~17.3.0",
24
24
  "@angular/router": "~17.3.0",
25
- "@ngrx/entity": "~17.1.0",
26
- "@ngrx/store": "~17.1.0",
27
- "@nrwl/devkit": "~18.2.0",
28
- "@nx/angular": "~18.2.0",
29
- "@o3r/telemetry": "^10.3.0-prerelease.9",
25
+ "@ngrx/entity": "~17.2.0",
26
+ "@ngrx/store": "~17.2.0",
27
+ "@nrwl/devkit": "~18.3.0",
28
+ "@nx/angular": "~18.3.0",
29
+ "@o3r/telemetry": "^10.4.0-prerelease.0",
30
30
  "@schematics/angular": "~17.3.0",
31
31
  "chokidar": "^3.5.2",
32
32
  "globby": "^11.1.0",
@@ -64,24 +64,24 @@
64
64
  }
65
65
  },
66
66
  "dependencies": {
67
- "@o3r/schematics": "^10.3.0-prerelease.9",
67
+ "@o3r/schematics": "^10.4.0-prerelease.0",
68
68
  "tslib": "^2.6.2",
69
69
  "uuid": "^9.0.0"
70
70
  },
71
71
  "generatorDependencies": {
72
72
  "@angular-eslint/eslint-plugin": "~17.3.0",
73
73
  "@angular/material": "~17.3.0",
74
- "@ngrx/router-store": "~17.1.0",
75
- "@ngrx/effects": "~17.1.0",
76
- "@ngrx/store-devtools": "~17.1.0",
77
- "@o3r/store-sync": "^10.3.0-prerelease.9",
74
+ "@ngrx/router-store": "~17.2.0",
75
+ "@ngrx/effects": "~17.2.0",
76
+ "@ngrx/store-devtools": "~17.2.0",
77
+ "@o3r/store-sync": "^10.4.0-prerelease.0",
78
78
  "@types/jest": "~29.5.2",
79
- "nx": "~18.2.0",
79
+ "nx": "~18.3.0",
80
80
  "@typescript-eslint/parser": "^7.2.0",
81
81
  "@stylistic/eslint-plugin-ts": "^1.5.4",
82
82
  "cpy-cli": "^5.0.0",
83
83
  "eslint": "^8.57.0",
84
- "@nx/eslint-plugin": "~18.2.0",
84
+ "@nx/eslint-plugin": "~18.3.0",
85
85
  "jsonc-eslint-parser": "~2.4.0",
86
86
  "eslint-import-resolver-node": "^0.3.9",
87
87
  "eslint-plugin-jest": "~27.9.0",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/component/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8F,IAAI,EAAoD,MAAM,4BAA4B,CAAC;AA0BhM,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAiQ5C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,iEAAwE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/component/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8F,IAAI,EAAoD,MAAM,4BAA4B,CAAC;AA0BhM,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAmQ5C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,iEAAwE,CAAC"}
@@ -143,14 +143,17 @@ function ngGenerateComponentContainerFn(options) {
143
143
  let specSourceFile = ts.createSourceFile(o3rSpecPath, tree.readText(o3rSpecPath), ts.ScriptTarget.ES2020, true);
144
144
  const recorder = tree.beginUpdate(o3rSpecPath);
145
145
  const lastImport = [...specSourceFile.statements].reverse().find((statement) => ts.isImportDeclaration(statement));
146
- const changes = [new change_1.InsertChange(o3rSpecPath, lastImport?.getEnd() || 0, `
146
+ const changes = [
147
+ (0, ast_utils_1.insertImport)(specSourceFile, o3rSpecPath, 'Component', '@angular/core'),
148
+ new change_1.InsertChange(o3rSpecPath, lastImport?.getEnd() || 0, `
147
149
  @Component({
148
150
  template: '',
149
151
  selector: '${properties.presenterComponentSelector}',
150
152
  standalone: true
151
153
  })
152
154
  class Mock${properties.presenterComponentName} {}
153
- `)];
155
+ `)
156
+ ];
154
157
  (0, change_1.applyToUpdateRecorder)(recorder, changes);
155
158
  tree.commitUpdate(recorder);
156
159
  specSourceFile = ts.createSourceFile(o3rSpecPath, tree.readText(o3rSpecPath), ts.ScriptTarget.ES2020, true);
@@ -14,13 +14,13 @@ const shouldOtterLinterBeInstalled = async (context) => {
14
14
  try {
15
15
  require.resolve(`${linterPackageName}/package.json`);
16
16
  if (context.interactive) {
17
- useOtterLinter = await (0, prompt_1.askConfirmation)(`You already have eslint installed. Would you like to add otter config rules for eslint ?
17
+ useOtterLinter = await (0, prompt_1.askConfirmation)(`You already have ESLint installed. Would you like to add otter config rules for ESLint?
18
18
  Otherwise, you can add them later via this command: ng add @o3r/eslint-config-otter`, true);
19
19
  }
20
20
  }
21
21
  catch {
22
- context.logger.info(`eslint package not installed. Skipping otter linter phase !
23
- You can add otter linter config rules later to the project via this command: ng add @o3r/eslint-config-otter`);
22
+ context.logger.info(`ESLint package not installed. Skipping Otter linter phase!
23
+ You can add Otter linter config rules later to the project via this command: ng add @o3r/eslint-config-otter`);
24
24
  }
25
25
  return useOtterLinter;
26
26
  };
@@ -24,7 +24,6 @@
24
24
  "scope": {
25
25
  "type": "string",
26
26
  "description": "Page scope (e.g. booking, servicing, ssci, etc.)",
27
- "x-prompt": "Page scope (e.g. booking, servicing, ssci, etc.)?",
28
27
  "default": ""
29
28
  },
30
29
  "appRoutingModulePath": {
@@ -59,7 +59,7 @@ function updateAdditionalModules(options, dependenciesSetupConfig) {
59
59
  if ((0, ast_utils_1.isImported)(sourceFile, 'StoreDevtoolsModule', ngrxStoreDevtoolsDep) || (0, ast_utils_1.isImported)(sourceFile, 'additionalModules', '../environments/environment')) {
60
60
  return tree;
61
61
  }
62
- const addImportToModuleFile = (name, file, moduleFunction) => additionalRules.push((0, utility_1.addRootImport)(options.projectName, ({ code, external }) => code `${external(name, file)}${moduleFunction}`));
62
+ const addImportToModuleFile = (name, file, moduleFunction) => additionalRules.push((0, utility_1.addRootImport)(options.projectName, ({ code, external }) => code `\n${external(name, file)}${moduleFunction}`));
63
63
  addImportToModuleFile('additionalModules', '../environments/environment');
64
64
  return (0, schematics_1.chain)(additionalRules)(tree, context);
65
65
  };
@@ -2,6 +2,5 @@ export * from './o3r-basic-updates/index';
2
2
  export * from './additional-modules/index';
3
3
  export * from './customization-environment/index';
4
4
  export * from './otter-environment/index';
5
- export * from './playwright/index';
6
5
  export * from './store/index';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC"}
@@ -5,6 +5,5 @@ tslib_1.__exportStar(require("./o3r-basic-updates/index"), exports);
5
5
  tslib_1.__exportStar(require("./additional-modules/index"), exports);
6
6
  tslib_1.__exportStar(require("./customization-environment/index"), exports);
7
7
  tslib_1.__exportStar(require("./otter-environment/index"), exports);
8
- tslib_1.__exportStar(require("./playwright/index"), exports);
9
8
  tslib_1.__exportStar(require("./store/index"), exports);
10
9
  //# sourceMappingURL=index.js.map
@@ -79,7 +79,7 @@ function updateStore(options, projectType) {
79
79
  }
80
80
  let recorder = tree.beginUpdate(moduleFilePath);
81
81
  const { moduleIndex } = (0, schematics_2.getModuleIndex)(sourceFile, sourceFileContent);
82
- const addImportToModuleFile = (name, file, moduleFunction) => additionalRules.push((0, utility_1.addRootImport)(options.projectName, ({ code, external }) => code `${external(name, file)}${moduleFunction}`));
82
+ const addImportToModuleFile = (name, file, moduleFunction) => additionalRules.push((0, utility_1.addRootImport)(options.projectName, ({ code, external }) => code `\n${external(name, file)}${moduleFunction}`));
83
83
  const insertImportToModuleFile = (name, file, isDefault) => recorder = (0, schematics_2.insertImportToModuleFile)(name, file, sourceFile, recorder, moduleFilePath, isDefault);
84
84
  const insertBeforeModule = (line) => recorder = (0, schematics_2.insertBeforeModule)(line, sourceFileContent, recorder, moduleIndex);
85
85
  addImportToModuleFile('EffectsModule', '@ngrx/effects', '.forRoot([])');
@@ -1,10 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { NgAddPackageOptions } from '@o3r/schematics';
3
- /**
4
- * Add Playwright to Otter application
5
- * @param options @see RuleFactory.options
6
- * @param options.projectName
7
- * @param rootPath @see RuleFactory.rootPath
8
- */
9
- export declare function updatePlaywright(rootPath: string, options?: NgAddPackageOptions): Rule;
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePlaywright = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const schematics_2 = require("@o3r/schematics");
7
- const dependencies_1 = require("@schematics/angular/utility/dependencies");
8
- const path = require("node:path");
9
- const fs = require("node:fs");
10
- /**
11
- * Add Playwright to Otter application
12
- * @param options @see RuleFactory.options
13
- * @param options.projectName
14
- * @param rootPath @see RuleFactory.rootPath
15
- */
16
- function updatePlaywright(rootPath, options = {}) {
17
- const ownPackageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json');
18
- const ownPackageJson = JSON.parse(fs.readFileSync(ownPackageJsonPath, { encoding: 'utf-8' }));
19
- return (tree, context) => {
20
- // update gitignore
21
- if (tree.exists('/.gitignore')) {
22
- let gitignore = tree.read('/.gitignore').toString();
23
- if (!gitignore.includes('dist*') && !gitignore.includes('/dist-e2e-playwright') && !gitignore.includes('/playwright-reports')) {
24
- gitignore +=
25
- `
26
- # Playwright
27
- /dist-e2e-playwright
28
- /playwright-reports
29
- `;
30
- tree.overwrite('/.gitignore', gitignore);
31
- }
32
- }
33
- // register scripts
34
- if (tree.exists('/package.json')) {
35
- const packageJson = JSON.parse(tree.read('/package.json').toString());
36
- packageJson.scripts ||= {};
37
- packageJson.scripts['test:playwright'] ||= 'playwright test --config=e2e-playwright/playwright-config.ts';
38
- packageJson.scripts['test:playwright:sanity'] ||= 'playwright test --config=e2e-playwright/playwright-config.sanity.ts';
39
- tree.overwrite('/package.json', JSON.stringify(packageJson, null, 2));
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
- });
54
- // generate files
55
- if (!tree.exists('/e2e-playwright/playwright-config.ts')) {
56
- const name = 'my-scenario';
57
- const scenarioName = core_1.strings.capitalize(core_1.strings.camelize(name));
58
- const sanity = 'my-sanity';
59
- const sanityName = core_1.strings.capitalize(core_1.strings.camelize(sanity));
60
- const templateSource = (0, schematics_1.apply)((0, schematics_1.url)((0, schematics_2.getTemplateFolder)(rootPath, __dirname)), [
61
- (0, schematics_1.template)({
62
- ...core_1.strings,
63
- name,
64
- scenarioName,
65
- sanity,
66
- sanityName
67
- }),
68
- (0, schematics_1.renameTemplateFiles)()
69
- ]);
70
- return (0, schematics_1.chain)([
71
- ngAddRules,
72
- (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite)
73
- ])(tree, context);
74
- }
75
- return ngAddRules(tree, context);
76
- };
77
- }
78
- exports.updatePlaywright = updatePlaywright;
79
- //# sourceMappingURL=index.js.map
@@ -1,12 +0,0 @@
1
- import {PlaywrightTestConfig} from '@playwright/test';
2
- import * as path from 'node:path';
3
-
4
- import {default as defaultConfig} from './playwright-config';
5
-
6
- const config: PlaywrightTestConfig = {
7
- ...defaultConfig,
8
- testDir: path.join(__dirname, 'sanity'),
9
- testMatch: /.*\.e2e\.ts$/
10
- };
11
-
12
- export default config;
@@ -1,34 +0,0 @@
1
- import { adjustPath } from '@o3r/testing/tools/path-replacement';
2
- import type { PlaywrightTestConfig } from '@playwright/test';
3
- import * as path from 'node:path';
4
-
5
- adjustPath('playwright');
6
-
7
- const FIVE_MINUTES = 1_000 * 60 * 5;
8
-
9
- const reportsFolder = path.join(__dirname, '..', 'playwright-reports');
10
-
11
- const config: PlaywrightTestConfig = {
12
- testDir: path.join(__dirname, '..', 'e2e-playwright'),
13
- testMatch: /.*\.e2e-playwright-spec.ts$/,
14
- reporter: [
15
- ['list'],
16
- ['junit', {outputFile: path.join(reportsFolder, 'junit', 'reporter.xml')}],
17
- ['html', {open: 'never', outputFolder: path.join(reportsFolder, 'html')}]
18
- ],
19
- retries: process.env.CI ? 3 : 0,
20
- forbidOnly: !!process.env.CI,
21
- timeout: FIVE_MINUTES,
22
- use: {
23
- ignoreHTTPSErrors: true,
24
- screenshot: 'only-on-failure',
25
- trace: 'retain-on-failure'
26
- },
27
- projects: [
28
- {name: 'Chromium', use: {browserName: 'chromium'}},
29
- {name: 'Webkit', use: {browserName: 'webkit'}},
30
- {name: 'Firefox', use: {browserName: 'firefox'}}
31
- ]
32
- };
33
-
34
- export default config;
@@ -1,7 +0,0 @@
1
- import { expect, test } from '@playwright/test';
2
-
3
- test.describe.serial('Empty <%= classify(sanityName) %> test', () => {
4
- test('Empty test', ({ page }) => {
5
- expect(page).toBeDefined();
6
- });
7
- });
@@ -1,19 +0,0 @@
1
- import { expect, test } from '@playwright/test';
2
- import { BaseScenario } from '../utils';
3
-
4
- export class <%= classify(scenarioName) %> extends BaseScenario {
5
- protected <%= camelize(scenarioName) %>() {
6
- test.describe.serial('Empty <%= classify(scenarioName) %> tests', () => {
7
- test('Empty test', async ({ page }) => {
8
- await page.goto(this.targetUrl);
9
- await expect(page).toHaveTitle('TestApp');
10
- });
11
- });
12
- }
13
-
14
- public performFlow() {
15
- this.<%= camelize(scenarioName) %>();
16
- }
17
- }
18
-
19
- new <%= classify(scenarioName) %>().run();
@@ -1,29 +0,0 @@
1
- import { test } from '@playwright/test';
2
-
3
- /**
4
- * Interface to define the interface of a flow test
5
- */
6
- export interface Flow {
7
- /**
8
- * Run the flow
9
- */
10
- performFlow(): void;
11
- }
12
-
13
- /**
14
- * Base scenario for e2e scenarios.
15
- * Init the fetch manager and call `performFlow` method.
16
- * E2E Booking flows should inherit from this class.
17
- */
18
- export abstract class BaseScenario implements Flow {
19
-
20
- public targetUrl = process.env.PLAYWRIGHT_TARGET_URL || 'http://localhost:4200/';
21
-
22
- public abstract performFlow();
23
-
24
- public run() {
25
- test.describe.serial(this.constructor.name, () => {
26
- this.performFlow();
27
- });
28
- }
29
- }
@@ -1 +0,0 @@
1
- export * from './base-scenario';