@ojiepermana/angular 21.3.3 → 21.3.4
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/generator/api/README.md
CHANGED
|
@@ -207,11 +207,14 @@ import { GCSService } from '@my-scope/sdk/storage/gcs'; // splitDepth: 'tag'
|
|
|
207
207
|
|
|
208
208
|
## Output modes
|
|
209
209
|
|
|
210
|
-
| Mode | What it emits
|
|
211
|
-
| ---------------------- |
|
|
212
|
-
| `standalone` | A plain folder (no `ng-package.json`).
|
|
213
|
-
| `library` | Split-by-domain output
|
|
214
|
-
| `secondary-entrypoint` | Standalone output **plus** a minimal `ng-package.json` pointing at `public-api.ts`, plus nested `ng-package.json` files for split-by-domain secondary entrypoints.
|
|
210
|
+
| Mode | What it emits | Use when… |
|
|
211
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
212
|
+
| `standalone` | A plain folder (no `ng-package.json`). | You consume the SDK via path alias / `tsconfig.paths` inside the same app. |
|
|
213
|
+
| `library` | Split-by-domain output plus package metadata and nested `ng-package.json` manifests for secondary entrypoints. | You want a buildable/publishable Angular package with efficient deep imports. |
|
|
214
|
+
| `secondary-entrypoint` | Standalone output **plus** a minimal `ng-package.json` pointing at `public-api.ts`, plus nested `ng-package.json` files for split-by-domain secondary entrypoints. | You drop the folder inside an existing library so ng-packagr picks it up as a subpath. |
|
|
215
|
+
|
|
216
|
+
In `library` mode, output also includes `tsconfig.lib.json` and `tsconfig.lib.prod.json`.
|
|
217
|
+
`ng-package.dest` defaults to `dist/<output-folder-name>`.
|
|
215
218
|
|
|
216
219
|
## Feature flags
|
|
217
220
|
|
|
@@ -24,7 +24,7 @@ function writeLibrary(files, ir, target, workspaceRoot, outputDir) {
|
|
|
24
24
|
const normalizedFiles = rewriteCrossEntrypointImports(files, target, workspaceRoot, outputDir);
|
|
25
25
|
const ngPackage = {
|
|
26
26
|
$schema: toPosixPath((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'node_modules/ng-packagr/ng-package.schema.json'))),
|
|
27
|
-
dest:
|
|
27
|
+
dest: resolveLibraryDestPath(workspaceRoot, outputDir),
|
|
28
28
|
lib: { entryFile: 'public-api.ts' },
|
|
29
29
|
};
|
|
30
30
|
const pkg = {
|
|
@@ -46,6 +46,7 @@ function writeLibrary(files, ir, target, workspaceRoot, outputDir) {
|
|
|
46
46
|
path: 'package.json',
|
|
47
47
|
content: (0, template_1.finalize)(JSON.stringify(pkg, null, 2)),
|
|
48
48
|
},
|
|
49
|
+
...createLibraryTsConfigFiles(workspaceRoot, outputDir),
|
|
49
50
|
{
|
|
50
51
|
path: 'README.md',
|
|
51
52
|
content: (0, template_1.finalize)(`# ${target.packageName}\n\nGenerated SDK for **${ir.title}** v${ir.version}.\n\nThis folder was generated by the local SDK generator. Do not edit by hand.\n`),
|
|
@@ -222,8 +223,49 @@ function collectSecondaryEntrypointDirs(files) {
|
|
|
222
223
|
}
|
|
223
224
|
return [...dirs].sort();
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
226
|
+
function resolveLibraryDestPath(workspaceRoot, outputDir) {
|
|
227
|
+
const outputFolderName = (0, node_path_1.basename)(outputDir) || 'sdk';
|
|
228
|
+
return toPosixPath((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'dist', outputFolderName)));
|
|
229
|
+
}
|
|
230
|
+
function createLibraryTsConfigFiles(workspaceRoot, outputDir) {
|
|
231
|
+
const rootTsConfig = toPosixPath((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'tsconfig.json')));
|
|
232
|
+
const outDir = toPosixPath((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'out-tsc/lib')));
|
|
233
|
+
const distDir = toRecursiveGlob((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'dist')));
|
|
234
|
+
const nodeModulesDir = toRecursiveGlob((0, node_path_1.relative)(outputDir, (0, node_path_1.resolve)(workspaceRoot, 'node_modules')));
|
|
235
|
+
const tsconfigLib = {
|
|
236
|
+
extends: rootTsConfig,
|
|
237
|
+
compilerOptions: {
|
|
238
|
+
outDir,
|
|
239
|
+
declaration: true,
|
|
240
|
+
declarationMap: true,
|
|
241
|
+
types: [],
|
|
242
|
+
},
|
|
243
|
+
include: ['public-api.ts', '**/public-api.ts'],
|
|
244
|
+
exclude: ['**/*.spec.ts', distDir, nodeModulesDir],
|
|
245
|
+
};
|
|
246
|
+
const tsconfigLibProd = {
|
|
247
|
+
extends: './tsconfig.lib.json',
|
|
248
|
+
compilerOptions: {
|
|
249
|
+
declarationMap: false,
|
|
250
|
+
},
|
|
251
|
+
angularCompilerOptions: {
|
|
252
|
+
compilationMode: 'partial',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
return [
|
|
256
|
+
{
|
|
257
|
+
path: 'tsconfig.lib.json',
|
|
258
|
+
content: (0, template_1.finalize)(JSON.stringify(tsconfigLib, null, 2)),
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
path: 'tsconfig.lib.prod.json',
|
|
262
|
+
content: (0, template_1.finalize)(JSON.stringify(tsconfigLibProd, null, 2)),
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
function toRecursiveGlob(value) {
|
|
267
|
+
const normalized = toPosixPath(value).replace(/\/+$/, '');
|
|
268
|
+
return normalized === '.' ? './**' : `${normalized}/**`;
|
|
227
269
|
}
|
|
228
270
|
function toPosixPath(value) {
|
|
229
271
|
return value.split('\\').join('/');
|