@nu-art/build-and-install 0.400.9 → 0.400.12
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 +3 -3
- package/v3/units/Unit_TypescriptLib.d.ts +3 -2
- package/v3/units/Unit_TypescriptLib.js +20 -10
- package/v3/units/firebase/Unit_FirebaseHostingApp.js +1 -1
- package/v3/units/index.d.ts +1 -0
- package/v3/units/index.js +1 -0
- package/v3/units/types.d.ts +41 -0
- package/v3/units/types.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/build-and-install",
|
|
3
|
-
"version": "0.400.
|
|
3
|
+
"version": "0.400.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"chokidar": "^3.6.0",
|
|
34
|
-
"@nu-art/ts-common": "0.400.
|
|
35
|
-
"@nu-art/commando": "0.400.
|
|
34
|
+
"@nu-art/ts-common": "0.400.12",
|
|
35
|
+
"@nu-art/commando": "0.400.12"
|
|
36
36
|
},
|
|
37
37
|
"unitConfig": {
|
|
38
38
|
"type": "typescript-lib"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TypedMap } from '@nu-art/ts-common';
|
|
1
|
+
import { RecursivePartial, TypedMap } from '@nu-art/ts-common';
|
|
2
2
|
import { UnitPhaseImplementor } from '../core/types.js';
|
|
3
3
|
import { Unit_PackageJson, Unit_PackageJson_Config } from './Unit_PackageJson.js';
|
|
4
4
|
import { Phase_CheckCyclicImports, Phase_Compile, Phase_Lint, Phase_PreCompile, Phase_PrintDependencyTree, Phase_Publish, Phase_Test, Phase_ToESM } from '../phase/index.js';
|
|
5
|
+
import { TsConfig } from './types.js';
|
|
5
6
|
export type Unit_TypescriptLib_Config = Unit_PackageJson_Config & {
|
|
6
7
|
customESLintConfig: boolean;
|
|
7
8
|
customTSConfig: boolean;
|
|
@@ -40,7 +41,7 @@ export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Un
|
|
|
40
41
|
lint(): Promise<void>;
|
|
41
42
|
private resolveESLintConfig;
|
|
42
43
|
protected deriveTSConfigPaths(): TypedMap<string[]>;
|
|
43
|
-
protected resolveTSConfig(srcFolder: string, sourceFolderType: string): Promise<void>;
|
|
44
|
+
protected resolveTSConfig(srcFolder: string, sourceFolderType: string, tsConfigOverride?: RecursivePartial<TsConfig>): Promise<void>;
|
|
44
45
|
publish(): Promise<void>;
|
|
45
46
|
convertToESM(): Promise<void>;
|
|
46
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import { copyFileSync, existsSync, promises as _fs, readdirSync, statSync } from 'fs';
|
|
3
|
-
import { __stringify, arrayToMap, BadImplementationException, ImplementationMissingException, LogLevel, NotImplementedYetException } from '@nu-art/ts-common';
|
|
3
|
+
import { __stringify, arrayToMap, BadImplementationException, ImplementationMissingException, LogLevel, merge, NotImplementedYetException } from '@nu-art/ts-common';
|
|
4
4
|
import { CONST_BaiConfig, CONST_FirebaseJSON, CONST_FirebaseRC, CONST_PackageJSON, CONST_PackageJSONTemplate, CONST_TS_CONFIG } from '../../core/consts.js';
|
|
5
5
|
import { CommandoException } from '@nu-art/commando/shell/core/CliError';
|
|
6
6
|
import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
|
|
@@ -328,7 +328,7 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
|
|
|
328
328
|
return dependencies;
|
|
329
329
|
}, {});
|
|
330
330
|
}
|
|
331
|
-
async resolveTSConfig(srcFolder, sourceFolderType) {
|
|
331
|
+
async resolveTSConfig(srcFolder, sourceFolderType, tsConfigOverride) {
|
|
332
332
|
const entryPath = pathResolve(srcFolder, sourceFolderType);
|
|
333
333
|
if (!statSync(entryPath).isDirectory()) {
|
|
334
334
|
return this.logError(`Unexpected non-directory entry in src/: ${sourceFolderType}`);
|
|
@@ -343,15 +343,25 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
|
|
|
343
343
|
// const defaultTsConfigTemplate = pathResolve(baiDefaultsPath, `tsconfig-${entry}.json`);
|
|
344
344
|
const projectDefaultTsConfig = pathResolve(this.runtimeContext.parentUnit.config.fullPath, this.runtimeContext.baiConfig.files?.typescript?.tsConfig?.[sourceFolderType] ?? `tsconfig-${sourceFolderType}.json`);
|
|
345
345
|
if (existsSync(projectDefaultTsConfig)) {
|
|
346
|
-
this.logDebug(`
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
346
|
+
this.logDebug(`Reading and merging project-level default tsconfig for source: ${sourceFolderType}`);
|
|
347
|
+
// Read the template JSON file
|
|
348
|
+
const templateConfig = await FileSystemUtils.file.read.json(projectDefaultTsConfig);
|
|
349
|
+
// Build the override config with conditional sourceMap settings
|
|
350
|
+
const overrideConfig = {
|
|
351
|
+
...tsConfigOverride,
|
|
352
|
+
compilerOptions: {
|
|
353
|
+
...tsConfigOverride?.compilerOptions,
|
|
354
|
+
...(this.runtimeContext.runtimeParams.publish ? {} : {
|
|
355
|
+
sourceMap: true,
|
|
356
|
+
sourceRoot: entryPath
|
|
357
|
+
})
|
|
358
|
+
}
|
|
353
359
|
};
|
|
354
|
-
|
|
360
|
+
// Merge template with override
|
|
361
|
+
const mergedConfig = merge(templateConfig, overrideConfig);
|
|
362
|
+
// Write the merged config
|
|
363
|
+
await FileSystemUtils.file.write.json(tsConfigPath, mergedConfig);
|
|
364
|
+
return;
|
|
355
365
|
}
|
|
356
366
|
// if (existsSync(defaultTsConfigTemplate)) {
|
|
357
367
|
// this.logDebug(`Copying default tsconfig for source: ${entry}`);
|
|
@@ -25,7 +25,7 @@ export class Unit_FirebaseHostingApp extends Unit_TypescriptLib {
|
|
|
25
25
|
await this.resolveHostingRuntimeConfig();
|
|
26
26
|
}
|
|
27
27
|
async compile() {
|
|
28
|
-
await this.resolveTSConfig(resolve(this.config.fullPath, './src'), 'main');
|
|
28
|
+
await this.resolveTSConfig(resolve(this.config.fullPath, './src'), 'main', { compilerOptions: { declaration: false } });
|
|
29
29
|
await this.clearOutputDir();
|
|
30
30
|
await this.createAppVersionFile();
|
|
31
31
|
await this.compileImpl();
|
package/v3/units/index.d.ts
CHANGED
package/v3/units/index.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TypedMap } from '@nu-art/ts-common';
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript compiler options type based on tsconfig.json schema
|
|
4
|
+
*/
|
|
5
|
+
export type TsConfigCompilerOptions = {
|
|
6
|
+
module?: string;
|
|
7
|
+
moduleResolution?: string;
|
|
8
|
+
target?: string;
|
|
9
|
+
jsx?: string;
|
|
10
|
+
allowJs?: boolean;
|
|
11
|
+
lib?: string[];
|
|
12
|
+
noEmit?: boolean;
|
|
13
|
+
sourceMap?: boolean;
|
|
14
|
+
sourceRoot?: string;
|
|
15
|
+
declaration?: boolean;
|
|
16
|
+
resolveJsonModule?: boolean;
|
|
17
|
+
esModuleInterop?: boolean;
|
|
18
|
+
experimentalDecorators?: boolean;
|
|
19
|
+
allowSyntheticDefaultImports?: boolean;
|
|
20
|
+
noUnusedLocals?: boolean;
|
|
21
|
+
strict?: boolean;
|
|
22
|
+
paths?: TypedMap<string[]>;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
rootDir?: string;
|
|
25
|
+
outDir?: string;
|
|
26
|
+
include?: string[];
|
|
27
|
+
exclude?: string[];
|
|
28
|
+
extends?: string;
|
|
29
|
+
compilerOptions?: TsConfigCompilerOptions;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Full TypeScript configuration type
|
|
34
|
+
*/
|
|
35
|
+
export type TsConfig = {
|
|
36
|
+
compilerOptions?: TsConfigCompilerOptions;
|
|
37
|
+
include?: string[];
|
|
38
|
+
exclude?: string[];
|
|
39
|
+
extends?: string;
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|