@ng-prism/core 22.0.0-beta.0 → 22.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AA4H/E,wBAAgB,OAAO,IAAI,IAAI,CAgB9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAsK/E,wBAAgB,OAAO,IAAI,IAAI,CAiB9B"}
@@ -46,7 +46,7 @@ function rewriteMainTs(tree, context, workspace, prismProject) {
46
46
  }
47
47
  function addTsConfigMapping(tree) {
48
48
  addTsConfigPath(tree, 'tsconfig.json', 'prism-manifest/*', [
49
- '.ng-prism/*/prism-manifest.ts',
49
+ './.ng-prism/*/prism-manifest.ts',
50
50
  ]);
51
51
  }
52
52
  function ensureNgPrismGitignoreEntry(tree) {
@@ -70,6 +70,38 @@ function deleteLegacyManifest(tree, workspace, prismProject) {
70
70
  tree.delete(manifestPath);
71
71
  }
72
72
  }
73
+ function addCacheIncludeToTsconfigApp(tree, workspace, prismProject) {
74
+ const project = workspace.projects?.[prismProject];
75
+ const projectRoot = project?.root ?? `projects/${prismProject}`;
76
+ const path = `${projectRoot}/tsconfig.app.json`;
77
+ const buffer = tree.read(path);
78
+ if (!buffer)
79
+ return;
80
+ const sourceText = buffer.toString('utf-8');
81
+ let parsed;
82
+ try {
83
+ parsed = JSON.parse(sourceText);
84
+ }
85
+ catch {
86
+ return;
87
+ }
88
+ const include = Array.isArray(parsed.include)
89
+ ? parsed.include
90
+ : [];
91
+ const includeEntry = `../../.ng-prism/${prismProject}/**/*.ts`;
92
+ const includeChanged = !include.includes(includeEntry);
93
+ const nextInclude = includeChanged ? [...include, includeEntry] : include;
94
+ const compilerOptions = { ...(parsed.compilerOptions ?? {}) };
95
+ const hasRootDir = typeof compilerOptions['rootDir'] === 'string';
96
+ const rootDirChanged = !hasRootDir;
97
+ if (!hasRootDir) {
98
+ compilerOptions['rootDir'] = '../..';
99
+ }
100
+ if (!includeChanged && !rootDirChanged)
101
+ return;
102
+ const next = { ...parsed, compilerOptions, include: nextInclude };
103
+ tree.overwrite(path, JSON.stringify(next, null, 2) + '\n');
104
+ }
73
105
  function removeGitignoreEntry(tree, prismProject) {
74
106
  const path = '.gitignore';
75
107
  const buffer = tree.read(path);
@@ -94,6 +126,7 @@ export function migrate() {
94
126
  for (const prismProject of prismProjects) {
95
127
  rewriteMainTs(tree, context, workspace, prismProject);
96
128
  addTsConfigMapping(tree);
129
+ addCacheIncludeToTsconfigApp(tree, workspace, prismProject);
97
130
  deleteLegacyManifest(tree, workspace, prismProject);
98
131
  removeGitignoreEntry(tree, prismProject);
99
132
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiWtD,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAWvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAqWtD,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAWvD"}
@@ -77,10 +77,14 @@ function addPrismAppProject(options) {
77
77
  extends: '../../tsconfig.json',
78
78
  compilerOptions: {
79
79
  outDir: '../../out-tsc/app',
80
+ rootDir: '../..',
80
81
  types: [],
81
82
  },
82
83
  files: ['src/main.ts'],
83
- include: ['src/**/*.d.ts'],
84
+ include: [
85
+ 'src/**/*.d.ts',
86
+ `../../.ng-prism/${prismProjectName}/**/*.ts`,
87
+ ],
84
88
  };
85
89
  tree.create(tsconfigAppPath, JSON.stringify(tsconfigApp, null, 2) + '\n');
86
90
  }
@@ -186,13 +190,13 @@ function addTsConfigPaths(options) {
186
190
  const project = workspace.projects[options.project];
187
191
  const sourceRoot = project.sourceRoot ?? `${project.root}/src`;
188
192
  addTsConfigPath(tree, tsConfigPath, 'ng-prism.config', [
189
- 'ng-prism.config.ts',
193
+ './ng-prism.config.ts',
190
194
  ]);
191
195
  addTsConfigPath(tree, tsConfigPath, options.project, [
192
- `${sourceRoot}/public-api.ts`,
196
+ `./${sourceRoot}/public-api.ts`,
193
197
  ]);
194
198
  addTsConfigPath(tree, tsConfigPath, 'prism-manifest/*', [
195
- '.ng-prism/*/prism-manifest.ts',
199
+ './.ng-prism/*/prism-manifest.ts',
196
200
  ]);
197
201
  return tree;
198
202
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "22.0.0-beta.0",
3
+ "version": "22.0.0-beta.1",
4
4
  "description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
5
5
  "keywords": [
6
6
  "ng-prism",