@atls/code-schematics 2.0.29 → 2.1.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.
Files changed (64) hide show
  1. package/dist/exceptions/index.d.ts +1 -0
  2. package/dist/exceptions/index.js +1 -0
  3. package/dist/exceptions/schematic-workflow.d.ts +3 -0
  4. package/dist/exceptions/schematic-workflow.js +5 -0
  5. package/dist/generated/index.d.ts +1 -0
  6. package/dist/generated/index.js +1 -0
  7. package/dist/generated/raijin-schematic-export.d.ts +43 -0
  8. package/dist/generated/raijin-schematic-export.js +59 -0
  9. package/dist/generated/schematic-factory-export.d.ts +1 -1
  10. package/dist/generated/schematic-factory-export.js +1 -1
  11. package/dist/getters/index.d.ts +2 -2
  12. package/dist/getters/index.js +2 -2
  13. package/dist/getters/{stream-report-callback.getter.js → stream-report-callback.js} +7 -10
  14. package/dist/helpers/index.d.ts +5 -3
  15. package/dist/helpers/index.js +5 -3
  16. package/dist/helpers/raijin.d.ts +2 -0
  17. package/dist/helpers/raijin.js +6 -0
  18. package/dist/helpers/{run-schematics.helper.js → run-schematics.js} +1 -1
  19. package/dist/helpers/schematic-result.d.ts +1 -0
  20. package/dist/helpers/schematic-result.js +6 -0
  21. package/dist/helpers/{write-tmp-schematic.helper.d.ts → write-tmp-schematic.d.ts} +1 -1
  22. package/dist/helpers/{write-tmp-schematic.helper.js → write-tmp-schematic.js} +3 -3
  23. package/dist/schematic/project/{project.factory.js → factory.js} +1 -1
  24. package/dist/schematic/project/index.d.ts +1 -1
  25. package/dist/schematic/project/index.js +1 -1
  26. package/dist/schematic/rules/index.d.ts +1 -1
  27. package/dist/schematic/rules/index.js +1 -1
  28. package/dist/schematic/rules/tsconfig.update.d.ts +6 -0
  29. package/dist/schematic/rules/tsconfig.update.js +3 -0
  30. package/dist/scripts/exceptions/index.d.ts +1 -1
  31. package/dist/scripts/exceptions/index.js +1 -1
  32. package/dist/scripts/getters/{esbuild-config.getter.js → esbuild-config.js} +1 -1
  33. package/dist/scripts/getters/index.d.ts +4 -4
  34. package/dist/scripts/getters/index.js +4 -4
  35. package/dist/scripts/index.d.ts +1 -1
  36. package/dist/scripts/index.js +1 -1
  37. package/dist/scripts/schematic-factory-build.js +15 -0
  38. package/dist/scripts/{schematic-smoke.script.js → schematic-smoke.js} +1 -1
  39. package/package.json +4 -4
  40. package/dist/schematic/rules/update-ts-config.rule.d.ts +0 -2
  41. package/dist/schematic/rules/update-ts-config.rule.js +0 -7
  42. package/dist/scripts/schematic-factory-build.script.js +0 -10
  43. /package/dist/getters/{stream-report-callback.getter.d.ts → stream-report-callback.d.ts} +0 -0
  44. /package/dist/getters/{stream-report-options.getter.d.ts → stream-report-options.d.ts} +0 -0
  45. /package/dist/getters/{stream-report-options.getter.js → stream-report-options.js} +0 -0
  46. /package/dist/helpers/{events-log.helper.d.ts → events-log.d.ts} +0 -0
  47. /package/dist/helpers/{events-log.helper.js → events-log.js} +0 -0
  48. /package/dist/helpers/{prepare-tmp-dir.helper.d.ts → prepare-tmp-dir.d.ts} +0 -0
  49. /package/dist/helpers/{prepare-tmp-dir.helper.js → prepare-tmp-dir.js} +0 -0
  50. /package/dist/helpers/{run-schematics.helper.d.ts → run-schematics.d.ts} +0 -0
  51. /package/dist/schematic/project/{project.factory.d.ts → factory.d.ts} +0 -0
  52. /package/dist/scripts/exceptions/{undefined-build-result.exception.d.ts → undefined-build-result.d.ts} +0 -0
  53. /package/dist/scripts/exceptions/{undefined-build-result.exception.js → undefined-build-result.js} +0 -0
  54. /package/dist/scripts/getters/{cjs-content.getter.d.ts → cjs-content.d.ts} +0 -0
  55. /package/dist/scripts/getters/{cjs-content.getter.js → cjs-content.js} +0 -0
  56. /package/dist/scripts/getters/{encoded-content.getter.d.ts → encoded-content.d.ts} +0 -0
  57. /package/dist/scripts/getters/{encoded-content.getter.js → encoded-content.js} +0 -0
  58. /package/dist/scripts/getters/{esbuild-config.getter.d.ts → esbuild-config.d.ts} +0 -0
  59. /package/dist/scripts/getters/{generated-file-content.getter.d.ts → generated-file-content.d.ts} +0 -0
  60. /package/dist/scripts/getters/{generated-file-content.getter.js → generated-file-content.js} +0 -0
  61. /package/dist/scripts/{schematic-build.script.d.ts → schematic-build.d.ts} +0 -0
  62. /package/dist/scripts/{schematic-build.script.js → schematic-build.js} +0 -0
  63. /package/dist/scripts/{schematic-factory-build.script.d.ts → schematic-factory-build.d.ts} +0 -0
  64. /package/dist/scripts/{schematic-smoke.script.d.ts → schematic-smoke.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- export * from './stream-report-options.getter.js';
2
- export * from './stream-report-callback.getter.js';
1
+ export * from './stream-report-options.js';
2
+ export * from './stream-report-callback.js';
@@ -1,2 +1,2 @@
1
- export * from "./stream-report-options.getter.js";
2
- export * from "./stream-report-callback.getter.js";
1
+ export * from "./stream-report-options.js";
2
+ export * from "./stream-report-callback.js";
@@ -3,18 +3,15 @@ import { xfs } from '@yarnpkg/fslib';
3
3
  import { runSchematicHelper } from '../helpers/index.js';
4
4
  import { writeTmpSchematicHelper } from '../helpers/index.js';
5
5
  import { prepareTmpDir } from '../helpers/index.js';
6
+ import { ensureSchematicSucceeded } from '../helpers/index.js';
6
7
  export const getStreamReportCallback = async (options) => {
7
8
  const streamReportCallback = async (report) => {
8
- try {
9
- const tmpDir = await xfs.mktempPromise();
10
- const collectionPath = ppath.join(tmpDir, 'collection.json');
11
- await writeTmpSchematicHelper(tmpDir);
12
- await prepareTmpDir(tmpDir);
13
- await runSchematicHelper('project', options, collectionPath);
14
- }
15
- catch (error) {
16
- console.error(error);
17
- }
9
+ const tmpDir = await xfs.mktempPromise();
10
+ const collectionPath = ppath.join(tmpDir, 'collection.json');
11
+ const { cwd } = options;
12
+ await writeTmpSchematicHelper(tmpDir, cwd);
13
+ await prepareTmpDir(tmpDir);
14
+ ensureSchematicSucceeded(await runSchematicHelper('project', options, collectionPath));
18
15
  };
19
16
  return streamReportCallback;
20
17
  };
@@ -1,3 +1,5 @@
1
- export * from './run-schematics.helper.js';
2
- export * from './write-tmp-schematic.helper.js';
3
- export * from './prepare-tmp-dir.helper.js';
1
+ export * from './run-schematics.js';
2
+ export * from './write-tmp-schematic.js';
3
+ export * from './prepare-tmp-dir.js';
4
+ export * from './raijin.js';
5
+ export * from './schematic-result.js';
@@ -1,3 +1,5 @@
1
- export * from "./run-schematics.helper.js";
2
- export * from "./write-tmp-schematic.helper.js";
3
- export * from "./prepare-tmp-dir.helper.js";
1
+ export * from "./run-schematics.js";
2
+ export * from "./write-tmp-schematic.js";
3
+ export * from "./prepare-tmp-dir.js";
4
+ export * from "./raijin.js";
5
+ export * from "./schematic-result.js";
@@ -0,0 +1,2 @@
1
+ export declare const writeRaijinFiles: (_cwd: string, baseDir: string) => Promise<void>;
2
+ export declare const getRaijinCompilerOptions: (_cwd: string) => Promise<object>;
@@ -0,0 +1,6 @@
1
+ import tsconfig from '@atls/config-typescript';
2
+ import { writeFiles as writeGeneratedRaijinFiles } from '../generated/raijin-schematic-export.js';
3
+ export const writeRaijinFiles = async (_cwd, baseDir) => {
4
+ await writeGeneratedRaijinFiles(baseDir);
5
+ };
6
+ export const getRaijinCompilerOptions = async (_cwd) => tsconfig.compilerOptions;
@@ -1,6 +1,6 @@
1
1
  import { UnsuccessfulWorkflowExecution } from '@angular-devkit/schematics';
2
2
  import { NodeWorkflow } from '@angular-devkit/schematics/tools';
3
- import { eventsLogHelper } from './events-log.helper.js';
3
+ import { eventsLogHelper } from './events-log.js';
4
4
  export const runSchematicHelper = async (schematicName, options, collectionPath) => {
5
5
  const dryRun = false;
6
6
  const debug = true;
@@ -0,0 +1 @@
1
+ export declare const ensureSchematicSucceeded: (exitCode: 0 | 1) => void;
@@ -0,0 +1,6 @@
1
+ import { SchematicWorkflowException } from '../exceptions/index.js';
2
+ export const ensureSchematicSucceeded = (exitCode) => {
3
+ if (exitCode !== 0) {
4
+ throw new SchematicWorkflowException(exitCode);
5
+ }
6
+ };
@@ -1,2 +1,2 @@
1
1
  import type { PortablePath } from '@yarnpkg/fslib';
2
- export declare const writeTmpSchematicHelper: (tmpDir: PortablePath) => Promise<void>;
2
+ export declare const writeTmpSchematicHelper: (tmpDir: PortablePath, cwd?: string) => Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { mkdir } from 'node:fs/promises';
2
2
  import { ppath } from '@yarnpkg/fslib';
3
3
  import { writeSchematicFactory } from '../generated/index.js';
4
- export const writeTmpSchematicHelper = async (tmpDir) => {
5
- const { writeFiles } = await import('@atls/code-runtime');
6
- await writeFiles(tmpDir);
4
+ import { writeRaijinFiles } from './raijin.js';
5
+ export const writeTmpSchematicHelper = async (tmpDir, cwd = process.cwd()) => {
6
+ await writeRaijinFiles(cwd, tmpDir);
7
7
  const projectDir = ppath.join(tmpDir, 'project');
8
8
  await mkdir(projectDir, { recursive: true });
9
9
  await writeSchematicFactory(ppath.join(projectDir, 'project.factory.cjs'));
@@ -37,7 +37,7 @@ export const main = (options) => {
37
37
  const state = {};
38
38
  return chain([
39
39
  captureGitIgnoreContentRule(state),
40
- updateTsConfigRule,
40
+ updateTsConfigRule(options),
41
41
  mergeWith(generateCommonSource(options), MergeStrategy.Overwrite),
42
42
  mergeWith(generateProjectSpecificSource(options), MergeStrategy.Overwrite),
43
43
  mergeGitIgnoreContentRule(state),
@@ -1 +1 @@
1
- export * from './project.factory.js';
1
+ export * from './factory.js';
@@ -1 +1 @@
1
- export * from "./project.factory.js";
1
+ export * from "./factory.js";
@@ -1 +1 @@
1
- export * from './update-ts-config.rule.js';
1
+ export * from './tsconfig.update.js';
@@ -1 +1 @@
1
- export * from "./update-ts-config.rule.js";
1
+ export * from "./tsconfig.update.js";
@@ -0,0 +1,6 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ interface UpdateTsConfigRuleOptions extends Record<string, string | undefined> {
3
+ cwd?: string;
4
+ }
5
+ export declare const updateTsConfigRule: (_options: UpdateTsConfigRuleOptions) => Rule;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ import tsconfig from '@atls/config-typescript';
2
+ import { updateTsConfigInTree } from '../utils/tsconfig.utils.js';
3
+ export const updateTsConfigRule = (_options) => async () => updateTsConfigInTree(tsconfig.compilerOptions);
@@ -1 +1 @@
1
- export * from './undefined-build-result.exception.js';
1
+ export * from './undefined-build-result.js';
@@ -1 +1 @@
1
- export * from "./undefined-build-result.exception.js";
1
+ export * from "./undefined-build-result.js";
@@ -10,7 +10,7 @@ export const getEsbuildConfig = () => {
10
10
  platform: 'node',
11
11
  sourcemap: false,
12
12
  target: 'esnext',
13
- external: ['node:*', '@atls/code-runtime'],
13
+ external: ['node:*'],
14
14
  plugins: [
15
15
  pnpPlugin({
16
16
  onResolve: async (args) => {
@@ -1,4 +1,4 @@
1
- export * from './esbuild-config.getter.js';
2
- export * from './cjs-content.getter.js';
3
- export * from './encoded-content.getter.js';
4
- export * from './generated-file-content.getter.js';
1
+ export * from './esbuild-config.js';
2
+ export * from './cjs-content.js';
3
+ export * from './encoded-content.js';
4
+ export * from './generated-file-content.js';
@@ -1,4 +1,4 @@
1
- export * from "./esbuild-config.getter.js";
2
- export * from "./cjs-content.getter.js";
3
- export * from "./encoded-content.getter.js";
4
- export * from "./generated-file-content.getter.js";
1
+ export * from "./esbuild-config.js";
2
+ export * from "./cjs-content.js";
3
+ export * from "./encoded-content.js";
4
+ export * from "./generated-file-content.js";
@@ -1 +1 @@
1
- export * from './schematic-build.script.js';
1
+ export * from './schematic-build.js';
@@ -1 +1 @@
1
- export * from "./schematic-build.script.js";
1
+ export * from "./schematic-build.js";
@@ -0,0 +1,15 @@
1
+ import { join } from 'node:path';
2
+ import { esbuildBuildStep } from './build-steps/index.js';
3
+ import { generateSchematic } from './schematic-build.js';
4
+ const raijinSchematicDir = join(import.meta.dirname, '../../../../yarn/raijin/src/runtime/schematic');
5
+ const raijinSchematicOutputFile = join(import.meta.dirname, '../generated/raijin-schematic-export.ts');
6
+ try {
7
+ await esbuildBuildStep();
8
+ await generateSchematic(raijinSchematicDir, raijinSchematicOutputFile);
9
+ }
10
+ catch (e) {
11
+ const error = e;
12
+ console.error('SchematicFactory build error!');
13
+ console.error(error.message);
14
+ }
15
+ console.info('SchematicFactory build successed');
@@ -9,7 +9,7 @@ const helperScanRoots = [
9
9
  'scripts/raijin',
10
10
  'README.md',
11
11
  'README_EN.md',
12
- 'code/code-schematics/src/scripts/schematic-smoke.script.ts',
12
+ 'code/code-schematics/src/scripts/schematic-smoke.ts',
13
13
  'docs/README.md',
14
14
  'docs/README.ru.md',
15
15
  'docs/raijin/README.md',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/code-schematics",
3
- "version": "2.0.29",
3
+ "version": "2.1.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,19 +17,19 @@
17
17
  "scripts": {
18
18
  "build": "yarn run build:schematic-factory && yarn run build:library",
19
19
  "build:library": "yarn library build",
20
- "build:schematic-factory": "yarn node ./src/scripts/schematic-factory-build.script.ts",
20
+ "build:schematic-factory": "yarn node ./src/scripts/schematic-factory-build.ts",
21
21
  "prepack": "yarn run build",
22
22
  "postpack": "rm -rf dist",
23
- "smoke:schematic": "yarn node ./src/scripts/schematic-smoke.script.ts"
23
+ "smoke:schematic": "yarn node ./src/scripts/schematic-smoke.ts"
24
24
  },
25
25
  "dependencies": {
26
26
  "@angular-devkit/core": "19.1.5",
27
27
  "@angular-devkit/schematics": "19.1.5",
28
+ "@atls/config-typescript": "2.0.3",
28
29
  "js-yaml": "4.1.0",
29
30
  "strip-json-comments": "3.1.1"
30
31
  },
31
32
  "devDependencies": {
32
- "@atls/code-runtime": "2.1.34",
33
33
  "@types/node": "24.12.2",
34
34
  "@yarnpkg/cli": "4.14.1",
35
35
  "@yarnpkg/core": "4.7.0",
@@ -1,2 +0,0 @@
1
- import { updateTsConfigInTree } from '../utils/tsconfig.utils.js';
2
- export declare const updateTsConfigRule: () => Promise<ReturnType<typeof updateTsConfigInTree>>;
@@ -1,7 +0,0 @@
1
- import { updateTsConfigInTree } from '../utils/tsconfig.utils.js';
2
- export const updateTsConfigRule = async () => {
3
- const { tsConfig } = await import('@atls/code-runtime');
4
- return updateTsConfigInTree({
5
- ...tsConfig.compilerOptions,
6
- });
7
- };
@@ -1,10 +0,0 @@
1
- import { esbuildBuildStep } from './build-steps/index.js';
2
- try {
3
- await esbuildBuildStep();
4
- }
5
- catch (e) {
6
- const error = e;
7
- console.error('SchematicFactory build error!');
8
- console.error(error.message);
9
- }
10
- console.info('SchematicFactory build successed');