@o3r/design 12.3.0-prerelease.47 → 12.3.0-prerelease.49

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/design",
3
- "version": "12.3.0-prerelease.47",
3
+ "version": "12.3.0-prerelease.49",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -49,6 +49,7 @@
49
49
  "o3r-css-from-design-token": "./cli/generate-css-from-design-token.cli.cjs"
50
50
  },
51
51
  "dependencies": {
52
+ "@o3r/schematics": "^12.3.0-prerelease.49",
52
53
  "jsonschema": "~1.5.0",
53
54
  "minimatch": "~10.0.0",
54
55
  "minimist": "^1.2.6",
@@ -58,10 +59,10 @@
58
59
  "peerDependencies": {
59
60
  "@angular-devkit/architect": ">=0.1900.0 <0.2000.0-0",
60
61
  "@angular-devkit/schematics": "^19.0.0",
61
- "@o3r/core": "^12.3.0-prerelease.47",
62
- "@o3r/schematics": "^12.3.0-prerelease.47",
63
- "@o3r/styling": "^12.3.0-prerelease.47",
64
- "@o3r/telemetry": "^12.3.0-prerelease.47",
62
+ "@o3r/core": "^12.3.0-prerelease.49",
63
+ "@o3r/schematics": "^12.3.0-prerelease.49",
64
+ "@o3r/styling": "^12.3.0-prerelease.49",
65
+ "@o3r/telemetry": "^12.3.0-prerelease.49",
65
66
  "chokidar": "^4.0.3",
66
67
  "globby": "^11.1.0",
67
68
  "sass": "^1.81.0"
@@ -116,13 +117,12 @@
116
117
  "@nx/eslint-plugin": "~20.8.0",
117
118
  "@nx/jest": "~20.8.0",
118
119
  "@nx/js": "~20.8.0",
119
- "@o3r/build-helpers": "^12.3.0-prerelease.47",
120
- "@o3r/core": "^12.3.0-prerelease.47",
121
- "@o3r/eslint-plugin": "^12.3.0-prerelease.47",
122
- "@o3r/schematics": "^12.3.0-prerelease.47",
123
- "@o3r/styling": "^12.3.0-prerelease.47",
124
- "@o3r/telemetry": "^12.3.0-prerelease.47",
125
- "@o3r/test-helpers": "^12.3.0-prerelease.47",
120
+ "@o3r/build-helpers": "^12.3.0-prerelease.49",
121
+ "@o3r/core": "^12.3.0-prerelease.49",
122
+ "@o3r/eslint-plugin": "^12.3.0-prerelease.49",
123
+ "@o3r/styling": "^12.3.0-prerelease.49",
124
+ "@o3r/telemetry": "^12.3.0-prerelease.49",
125
+ "@o3r/test-helpers": "^12.3.0-prerelease.49",
126
126
  "@schematics/angular": "~19.2.0",
127
127
  "@stylistic/eslint-plugin": "~3.1.0",
128
128
  "@swc/helpers": "~0.5.0",
@@ -134,7 +134,7 @@
134
134
  "angular-eslint": "~19.3.0",
135
135
  "chokidar": "^4.0.3",
136
136
  "cpy-cli": "^5.0.0",
137
- "eslint": "~9.24.0",
137
+ "eslint": "~9.25.0",
138
138
  "eslint-import-resolver-node": "~0.3.9",
139
139
  "eslint-import-resolver-typescript": "~3.10.0",
140
140
  "eslint-plugin-import": "~2.31.0",
@@ -9,5 +9,5 @@ export declare function ngAddDesignTokenFn(options: NgAddDesignTokenSchematicsSc
9
9
  * Add Design Token to an existing component
10
10
  * @param options
11
11
  */
12
- export declare const ngAddDesignToken: (options: NgAddDesignTokenSchematicsSchema) => () => Promise<Rule>;
12
+ export declare const ngAddDesignToken: (options: NgAddDesignTokenSchematicsSchema) => Rule;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/design-token-to-component/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,gCAAgC,EACjC,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAelF;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,gCAAgC,wBAWzE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/design-token-to-component/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,gCAAgC,EACjC,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAelF;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,gCAAgC,SAAsD,CAAC"}
@@ -4,6 +4,7 @@ exports.ngAddDesignToken = void 0;
4
4
  exports.ngAddDesignTokenFn = ngAddDesignTokenFn;
5
5
  const node_path_1 = require("node:path");
6
6
  const schematics_1 = require("@angular-devkit/schematics");
7
+ const schematics_2 = require("@o3r/schematics");
7
8
  /**
8
9
  * Add Design Token to an existing component
9
10
  * @param options
@@ -26,16 +27,6 @@ function ngAddDesignTokenFn(options) {
26
27
  * Add Design Token to an existing component
27
28
  * @param options
28
29
  */
29
- const ngAddDesignToken = (options) => async () => {
30
- let createOtterSchematicWrapper = (fn) => fn;
31
- try {
32
- const { createOtterSchematic: wrapper } = await Promise.resolve().then(() => require('@o3r/schematics'));
33
- createOtterSchematicWrapper = wrapper;
34
- }
35
- catch {
36
- // No @o3r/schematics detected
37
- }
38
- return createOtterSchematicWrapper(ngAddDesignTokenFn)(options);
39
- };
30
+ const ngAddDesignToken = (options) => (0, schematics_2.createOtterSchematic)(ngAddDesignTokenFn)(options);
40
31
  exports.ngAddDesignToken = ngAddDesignToken;
41
32
  //# sourceMappingURL=index.js.map
@@ -4,5 +4,5 @@ import type { ExtractTokenSchematicsSchema } from './schema';
4
4
  * Extract the token from o3r mixin sass file
5
5
  * @param options
6
6
  */
7
- export declare const extractToken: (options: ExtractTokenSchematicsSchema) => () => Promise<Rule>;
7
+ export declare const extractToken: (options: ExtractTokenSchematicsSchema) => Rule;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/extract-token/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAWpC,OAAO,KAAK,EACV,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAsGlB;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,4BAA4B,wBAWjE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/extract-token/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAWpC,OAAO,KAAK,EACV,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAsGlB;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,4BAA4B,SAAkD,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractToken = void 0;
4
4
  const node_path_1 = require("node:path");
5
+ const schematics_1 = require("@o3r/schematics");
5
6
  const public_api_1 = require("../../src/public_api");
6
7
  const patternToDetect = 'o3r.var';
7
8
  /**
@@ -93,16 +94,6 @@ function extractTokenFn(options) {
93
94
  * Extract the token from o3r mixin sass file
94
95
  * @param options
95
96
  */
96
- const extractToken = (options) => async () => {
97
- let createOtterSchematicWrapper = (fn) => fn;
98
- try {
99
- const { createOtterSchematic: wrapper } = await Promise.resolve().then(() => require('@o3r/schematics'));
100
- createOtterSchematicWrapper = wrapper;
101
- }
102
- catch {
103
- // No @o3r/schematics detected
104
- }
105
- return createOtterSchematicWrapper(extractTokenFn)(options);
106
- };
97
+ const extractToken = (options) => (0, schematics_1.createOtterSchematic)(extractTokenFn)(options);
107
98
  exports.extractToken = extractToken;
108
99
  //# sourceMappingURL=index.js.map
@@ -4,5 +4,5 @@ import type { GenerateCssSchematicsSchema } from './schema';
4
4
  * Generate CSS from Design Token files
5
5
  * @param options
6
6
  */
7
- export declare const generateCss: (options: GenerateCssSchematicsSchema) => () => Promise<Rule>;
7
+ export declare const generateCss: (options: GenerateCssSchematicsSchema) => Rule;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/generate-css/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AA2DlB;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,2BAA2B,wBAW/D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/generate-css/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EACV,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAyDlB;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,2BAA2B,SAAiD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateCss = void 0;
4
+ const schematics_1 = require("@o3r/schematics");
4
5
  const design_1 = require("@o3r/design");
5
6
  /**
6
7
  * Generate CSS from Design Token files
@@ -26,8 +27,7 @@ function generateCssFn(options) {
26
27
  determineFileToUpdate,
27
28
  logger: context.logger
28
29
  };
29
- const { globInTree } = await Promise.resolve().then(() => require('@o3r/schematics'));
30
- const files = globInTree(tree, Array.isArray(options.designTokenFilePatterns) ? options.designTokenFilePatterns : [options.designTokenFilePatterns]);
30
+ const files = (0, schematics_1.globInTree)(tree, Array.isArray(options.designTokenFilePatterns) ? options.designTokenFilePatterns : [options.designTokenFilePatterns]);
31
31
  const duplicatedToken = [];
32
32
  const tokens = (await Promise.all(files.map(async (file) => ({ file, parsed: await (0, design_1.parseDesignTokenFile)(file) }))))
33
33
  .reduce((acc, { file, parsed }) => {
@@ -49,16 +49,6 @@ function generateCssFn(options) {
49
49
  * Generate CSS from Design Token files
50
50
  * @param options
51
51
  */
52
- const generateCss = (options) => async () => {
53
- let createOtterSchematicWrapper = (fn) => fn;
54
- try {
55
- const { createOtterSchematic: wrapper } = await Promise.resolve().then(() => require('@o3r/schematics'));
56
- createOtterSchematicWrapper = wrapper;
57
- }
58
- catch {
59
- // No @o3r/schematics detected
60
- }
61
- return createOtterSchematicWrapper(generateCssFn)(options);
62
- };
52
+ const generateCss = (options) => (0, schematics_1.createOtterSchematic)(generateCssFn)(options);
63
53
  exports.generateCss = generateCss;
64
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAIlB;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAsB5D;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,KAAG,IAkBtD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAIlB;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAqB5D;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -14,21 +14,20 @@ const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
14
14
  */
15
15
  function ngAddFn(options) {
16
16
  /* ng add rules */
17
- return async (tree) => {
18
- const { getPackageInstallConfig, setupDependencies, setupSchematicsParamsForProject } = await Promise.resolve().then(() => require('@o3r/schematics'));
17
+ return (tree) => {
19
18
  const schematicsDefaultOptions = {
20
19
  useOtterDesignToken: true
21
20
  };
22
21
  return (0, schematics_1.chain)([
23
22
  (0, register_generate_css_1.registerGenerateCssBuilder)(options.projectName),
24
- setupSchematicsParamsForProject({
23
+ (0, schematics_2.setupSchematicsParamsForProject)({
25
24
  '@o3r/core:component': schematicsDefaultOptions,
26
25
  '@o3r/core:component-presenter': schematicsDefaultOptions,
27
26
  '*:*': schematicsDefaultOptions
28
27
  }, options.projectName),
29
- setupDependencies({
28
+ (0, schematics_2.setupDependencies)({
30
29
  projectName: options.projectName,
31
- dependencies: getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion)
30
+ dependencies: (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion)
32
31
  }),
33
32
  options.extractDesignToken ? (0, extract_token_1.extractToken)({ componentFilePatterns: ['**/*.scss'], includeTags: true }) : schematics_1.noop,
34
33
  options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEditorConfig)()
@@ -39,24 +38,6 @@ function ngAddFn(options) {
39
38
  * Add Otter design to an Angular Project
40
39
  * @param options
41
40
  */
42
- const ngAdd = (options) => async (_, { logger }) => {
43
- const missingSchematicDependencyMessage = 'Missing @o3r/schematics';
44
- try {
45
- const { createOtterSchematic } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(() => {
46
- throw new Error(missingSchematicDependencyMessage);
47
- });
48
- return createOtterSchematic(ngAddFn)(options);
49
- }
50
- catch (err) {
51
- if (err instanceof Error && err.message === missingSchematicDependencyMessage) {
52
- logger.warn(`[WARNING]: The run of the ng-add schematics of @o3r/design has failed, the setup of default features will not be done.
53
- The failure is due to miss of the package '@o3r/schematics'.
54
- To get benefit of the setup scripts, please run 'ng add @o3r/schematics' before.`);
55
- }
56
- else {
57
- throw err;
58
- }
59
- }
60
- };
41
+ const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options);
61
42
  exports.ngAdd = ngAdd;
62
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-task.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/register-task.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AAKpC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,cAAc,MAAM,EAAE,iBAAyB,KAAG,IAyE5F,CAAC"}
1
+ {"version":3,"file":"register-task.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/register-task.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,IAAI,EAGV,MAAM,4BAA4B,CAAC;AASpC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,cAAc,MAAM,EAAE,iBAAyB,KAAG,IAqE5F,CAAC"}
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerGenerateCssBuilder = void 0;
4
4
  const node_path_1 = require("node:path");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
+ const schematics_2 = require("@o3r/schematics");
6
7
  /**
7
8
  * Register the Design Token CSS generator
8
9
  * @param projectName Project name
9
10
  * @param taskName name of the task to generate
10
11
  */
11
12
  const registerGenerateCssBuilder = (projectName, taskName = 'generate-css') => {
12
- const registerBuilderRule = async (tree, { logger }) => {
13
- const { getWorkspaceConfig, registerBuilder } = await Promise.resolve().then(() => require('@o3r/schematics'));
14
- const workspace = getWorkspaceConfig(tree);
13
+ const registerBuilderRule = (tree, { logger }) => {
14
+ const workspace = (0, schematics_2.getWorkspaceConfig)(tree);
15
15
  const workspaceProject = projectName ? workspace?.projects[projectName] : undefined;
16
16
  const workspaceRootPath = workspaceProject?.root || '.';
17
17
  const srcBasePath = workspaceProject?.sourceRoot || node_path_1.posix.join(workspaceRootPath, 'src');
@@ -36,12 +36,11 @@ const registerGenerateCssBuilder = (projectName, taskName = 'generate-css') => {
36
36
  logger.warn(`No angular.json found, the task ${taskName} will not be created`);
37
37
  return;
38
38
  }
39
- registerBuilder(workspaceProject, taskName, taskParameters);
39
+ (0, schematics_2.registerBuilder)(workspaceProject, taskName, taskParameters);
40
40
  tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
41
41
  };
42
- const generateDesignTokenFilesRule = async (tree) => {
43
- const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
44
- const workspaceProject = projectName ? getWorkspaceConfig(tree)?.projects[projectName] : undefined;
42
+ const generateDesignTokenFilesRule = (tree) => {
43
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
45
44
  const srcBasePath = workspaceProject?.sourceRoot || (workspaceProject?.root ? node_path_1.posix.join(workspaceProject.root, 'src') : './src');
46
45
  const themeFolder = node_path_1.posix.join(srcBasePath, 'style');
47
46
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./register-generate-css/templates'), [
@@ -50,9 +49,8 @@ const registerGenerateCssBuilder = (projectName, taskName = 'generate-css') => {
50
49
  (0, schematics_1.move)(themeFolder)
51
50
  ]), schematics_1.MergeStrategy.Overwrite);
52
51
  };
53
- const generateTemplateFilesRule = async (tree) => {
54
- const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
55
- const workspaceProject = projectName ? getWorkspaceConfig(tree)?.projects[projectName] : undefined;
52
+ const generateTemplateFilesRule = (tree) => {
53
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
56
54
  const workspaceRootPath = workspaceProject?.root || '.';
57
55
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./register-generate-css/templates-workspace'), [
58
56
  (0, schematics_1.template)({}),
@@ -60,9 +58,8 @@ const registerGenerateCssBuilder = (projectName, taskName = 'generate-css') => {
60
58
  (0, schematics_1.move)(workspaceRootPath)
61
59
  ]), schematics_1.MergeStrategy.Overwrite);
62
60
  };
63
- const importTheme = async (tree, context) => {
64
- const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
65
- const workspaceProject = projectName ? getWorkspaceConfig(tree)?.projects[projectName] : undefined;
61
+ const importTheme = (tree, context) => {
62
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
66
63
  const srcBasePath = workspaceProject?.sourceRoot || (workspaceProject?.root ? node_path_1.posix.join(workspaceProject.root, 'src') : './src');
67
64
  const styleFile = node_path_1.posix.join(srcBasePath, 'styles.scss');
68
65
  if (!tree.exists(styleFile)) {