@oriflame/config-typescript 5.1.10 → 5.1.12-alpha.5
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/dts/index.d.ts +18 -14
- package/lib/index.js +38 -3
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +37 -3
package/dts/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import type { TypeScriptConfig } from '@beemo/driver-typescript';
|
|
2
|
-
export interface TypeScriptOptions {
|
|
3
|
-
sourceMaps?: boolean;
|
|
4
|
-
library?: boolean;
|
|
5
|
-
future?: boolean;
|
|
6
|
-
react?: boolean;
|
|
7
|
-
srcFolder: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import type { TypeScriptConfig } from '@beemo/driver-typescript';
|
|
2
|
+
export interface TypeScriptOptions {
|
|
3
|
+
sourceMaps?: boolean;
|
|
4
|
+
library?: boolean;
|
|
5
|
+
future?: boolean;
|
|
6
|
+
react?: boolean;
|
|
7
|
+
srcFolder: string;
|
|
8
|
+
typesFolder: string;
|
|
9
|
+
workspaces?: boolean;
|
|
10
|
+
allowJs?: boolean;
|
|
11
|
+
includeTests?: boolean;
|
|
12
|
+
testsFolder: string;
|
|
13
|
+
declarationDir?: string;
|
|
14
|
+
emitDeclarationOnly?: boolean;
|
|
15
|
+
skipLibCheck?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function getCompilerOptions({ library, future, react, srcFolder, allowJs, skipLibCheck, sourceMaps, emitDeclarationOnly, declarationDir, includeTests, workspaces, }: Partial<TypeScriptOptions>): import("@beemo/driver-typescript").CompilerOptions;
|
|
18
|
+
export declare function getConfig(options: TypeScriptOptions): TypeScriptConfig;
|
|
15
19
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,9 @@ function getCompilerOptions({
|
|
|
18
18
|
allowJs = false,
|
|
19
19
|
skipLibCheck = false,
|
|
20
20
|
sourceMaps = true,
|
|
21
|
+
emitDeclarationOnly = false,
|
|
22
|
+
declarationDir = 'dts',
|
|
23
|
+
includeTests,
|
|
21
24
|
workspaces
|
|
22
25
|
}) {
|
|
23
26
|
if (workspaces) {
|
|
@@ -25,10 +28,11 @@ function getCompilerOptions({
|
|
|
25
28
|
} // Do we need isolated modules?
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
compilerOptions.isolatedModules = future && library;
|
|
31
|
+
compilerOptions.isolatedModules = future && library && !includeTests;
|
|
29
32
|
compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
|
|
30
33
|
compilerOptions.allowJs = allowJs;
|
|
31
34
|
compilerOptions.skipLibCheck = skipLibCheck;
|
|
35
|
+
compilerOptions.declaration = library || emitDeclarationOnly;
|
|
32
36
|
|
|
33
37
|
if (react) {
|
|
34
38
|
var _compilerOptions$lib;
|
|
@@ -44,17 +48,48 @@ function getCompilerOptions({
|
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
if (!workspaces && library) {
|
|
52
|
+
compilerOptions.declarationDir = declarationDir;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!workspaces) {
|
|
56
|
+
compilerOptions.outDir = declarationDir;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
compilerOptions.composite = library && !workspaces;
|
|
60
|
+
|
|
47
61
|
if (sourceMaps) {
|
|
48
62
|
compilerOptions.sourceMap = true;
|
|
63
|
+
compilerOptions.declarationMap = true;
|
|
49
64
|
}
|
|
50
65
|
|
|
51
66
|
return compilerOptions;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
function getConfig(options) {
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
const workspaces = options.workspaces,
|
|
71
|
+
srcFolder = options.srcFolder,
|
|
72
|
+
typesFolder = options.typesFolder,
|
|
73
|
+
includeTests = options.includeTests,
|
|
74
|
+
testsFolder = options.testsFolder;
|
|
75
|
+
|
|
76
|
+
if (workspaces) {
|
|
77
|
+
return {
|
|
78
|
+
compilerOptions: getCompilerOptions(options)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const tsconfig = {
|
|
83
|
+
compilerOptions: getCompilerOptions(options),
|
|
84
|
+
include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
|
|
85
|
+
exclude: ['**/node_modules/*']
|
|
57
86
|
};
|
|
87
|
+
|
|
88
|
+
if (includeTests) {
|
|
89
|
+
tsconfig.include.push(`./${testsFolder}/**/*`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return tsconfig;
|
|
58
93
|
}
|
|
59
94
|
|
|
60
95
|
exports.getCompilerOptions = getCompilerOptions;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":null,"names":["config","require","compilerOptions","getCompilerOptions","library","future","react","srcFolder","allowJs","skipLibCheck","sourceMaps","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","lib","jsx","baseUrl","paths","ALIAS_PATTERN","sourceMap","getConfig","options"],"mappings":";;;;;;AAGA,MAAMA,MAAM,GAAGC,OAAO,CAAC,iCAAD,CAAtB;;AAEA,MAAMC,eAAe,GAAGF,MAAM,CAACE,eAA/B;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":null,"names":["config","require","compilerOptions","getCompilerOptions","library","future","react","srcFolder","allowJs","skipLibCheck","sourceMaps","emitDeclarationOnly","declarationDir","includeTests","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","declaration","lib","jsx","baseUrl","paths","ALIAS_PATTERN","outDir","composite","sourceMap","declarationMap","getConfig","options","typesFolder","testsFolder","tsconfig","include","exclude","push"],"mappings":";;;;;;AAGA,MAAMA,MAAM,GAAGC,OA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 -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oriflame/config-typescript",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.12-alpha.5+2dc04301",
|
|
4
4
|
"description": "Reusable typescript config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lumos",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"src/**/*.{ts,tsx,json}"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@oriflame/lumos-common": "^5.1.
|
|
32
|
-
"tsconfig-oriflame": "^5.1.
|
|
31
|
+
"@oriflame/lumos-common": "^5.1.12-alpha.5+2dc04301",
|
|
32
|
+
"tsconfig-oriflame": "^5.1.12-alpha.5+2dc04301"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@beemo/core": "^2.1.3",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"format": "lib",
|
|
46
46
|
"platform": "node"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2dc04301cc72437c3effd72f6923ad485d1b2643"
|
|
49
49
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,10 +11,14 @@ export interface TypeScriptOptions {
|
|
|
11
11
|
future?: boolean;
|
|
12
12
|
react?: boolean;
|
|
13
13
|
srcFolder: string;
|
|
14
|
+
typesFolder: string;
|
|
14
15
|
workspaces?: boolean;
|
|
15
16
|
allowJs?: boolean;
|
|
17
|
+
includeTests?: boolean;
|
|
18
|
+
testsFolder: string;
|
|
19
|
+
declarationDir?: string;
|
|
20
|
+
emitDeclarationOnly?: boolean;
|
|
16
21
|
skipLibCheck?: boolean;
|
|
17
|
-
buildFolder?: string;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export function getCompilerOptions({
|
|
@@ -25,6 +29,9 @@ export function getCompilerOptions({
|
|
|
25
29
|
allowJs = false,
|
|
26
30
|
skipLibCheck = false,
|
|
27
31
|
sourceMaps = true,
|
|
32
|
+
emitDeclarationOnly = false,
|
|
33
|
+
declarationDir = 'dts',
|
|
34
|
+
includeTests,
|
|
28
35
|
workspaces,
|
|
29
36
|
}: Partial<TypeScriptOptions>) {
|
|
30
37
|
if (workspaces) {
|
|
@@ -34,10 +41,11 @@ export function getCompilerOptions({
|
|
|
34
41
|
);
|
|
35
42
|
}
|
|
36
43
|
// Do we need isolated modules?
|
|
37
|
-
compilerOptions.isolatedModules = future && library;
|
|
44
|
+
compilerOptions.isolatedModules = future && library && !includeTests;
|
|
38
45
|
compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
|
|
39
46
|
compilerOptions.allowJs = allowJs;
|
|
40
47
|
compilerOptions.skipLibCheck = skipLibCheck;
|
|
48
|
+
compilerOptions.declaration = library || emitDeclarationOnly;
|
|
41
49
|
|
|
42
50
|
if (react) {
|
|
43
51
|
compilerOptions.lib = [...(compilerOptions.lib ?? []), 'dom.iterable'];
|
|
@@ -51,15 +59,41 @@ export function getCompilerOptions({
|
|
|
51
59
|
};
|
|
52
60
|
}
|
|
53
61
|
|
|
62
|
+
if (!workspaces && library) {
|
|
63
|
+
compilerOptions.declarationDir = declarationDir;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!workspaces) {
|
|
67
|
+
compilerOptions.outDir = declarationDir;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
compilerOptions.composite = library && !workspaces;
|
|
71
|
+
|
|
54
72
|
if (sourceMaps) {
|
|
55
73
|
compilerOptions.sourceMap = true;
|
|
74
|
+
compilerOptions.declarationMap = true;
|
|
56
75
|
}
|
|
57
76
|
|
|
58
77
|
return compilerOptions;
|
|
59
78
|
}
|
|
60
79
|
|
|
61
80
|
export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
|
|
62
|
-
|
|
81
|
+
const { workspaces, srcFolder, typesFolder, includeTests, testsFolder } = options;
|
|
82
|
+
if (workspaces) {
|
|
83
|
+
return {
|
|
84
|
+
compilerOptions: getCompilerOptions(options),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const tsconfig = {
|
|
63
89
|
compilerOptions: getCompilerOptions(options),
|
|
90
|
+
include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
|
|
91
|
+
exclude: ['**/node_modules/*'],
|
|
64
92
|
};
|
|
93
|
+
|
|
94
|
+
if (includeTests) {
|
|
95
|
+
tsconfig.include.push(`./${testsFolder}/**/*`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return tsconfig;
|
|
65
99
|
}
|