@oriflame/config-typescript 4.3.0 → 5.0.6
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/LICENSE +1 -1
- package/README.md +2 -107
- package/dts/index.d.ts +15 -0
- package/lib/index.js +57 -64
- package/lib/index.js.map +1 -0
- package/package.json +28 -9
- package/src/index.ts +30 -67
- package/CHANGELOG.md +0 -1208
- package/lib/index.d.ts +0 -20
- package/lib/index.d.ts.map +0 -1
- package/tsconfig.json +0 -22
- package/tsconfig.options.json +0 -20
- package/tsconfig.tsbuildinfo +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,108 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oriflame/config-typescript
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Primarily used in union with the [Lumos](https://www.npmjs.com/package/@oriflame/lumos) CLI.
|
|
5
|
-
|
|
6
|
-
## Extending config
|
|
7
|
-
|
|
8
|
-
**Update package.json:**
|
|
9
|
-
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"lumos": {
|
|
13
|
-
"typescript": {
|
|
14
|
-
"allowSyntheticDefaultImports": true
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**Create file in configs folder:**
|
|
21
|
-
|
|
22
|
-
`configs/typescript.js`
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
module.exports = {
|
|
26
|
-
allowSyntheticDefaultImports: true,
|
|
27
|
-
};
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Settings
|
|
31
|
-
|
|
32
|
-
### Main settings
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
export interface TypeScriptOptions {
|
|
36
|
-
buildFolder: string;
|
|
37
|
-
includeTests?: boolean;
|
|
38
|
-
library?: boolean;
|
|
39
|
-
future?: boolean;
|
|
40
|
-
node?: boolean;
|
|
41
|
-
react?: boolean;
|
|
42
|
-
srcFolder: string;
|
|
43
|
-
testsFolder: string;
|
|
44
|
-
typesFolder: string;
|
|
45
|
-
workspaces?: string[];
|
|
46
|
-
emitDeclarationOnly?: boolean;
|
|
47
|
-
allowJs?: boolean;
|
|
48
|
-
skipLibCheck?: boolean;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Default values
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
{
|
|
56
|
-
library = false,
|
|
57
|
-
future = false,
|
|
58
|
-
node = false,
|
|
59
|
-
react = false,
|
|
60
|
-
emitDeclarationOnly = false,
|
|
61
|
-
srcFolder = 'src',
|
|
62
|
-
allowJs = false,
|
|
63
|
-
skipLibCheck = false,
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Settings
|
|
68
|
-
|
|
69
|
-
- library
|
|
70
|
-
- Optimized build for library
|
|
71
|
-
- future
|
|
72
|
-
- Sets target to next version
|
|
73
|
-
- node
|
|
74
|
-
- Optimized build for node
|
|
75
|
-
- emitDeclarationOnly
|
|
76
|
-
- Only emits d.ts files
|
|
77
|
-
- srcFolder
|
|
78
|
-
- Path to source folder
|
|
79
|
-
- allowJs
|
|
80
|
-
- Enables javascript in typescript
|
|
81
|
-
- skipLibCheck
|
|
82
|
-
- Skips library check
|
|
83
|
-
|
|
84
|
-
### CLI Options
|
|
85
|
-
|
|
86
|
-
- `--[no-]clean`
|
|
87
|
-
- clean the target `outDir` before transpiling. Defaults to `true`.
|
|
88
|
-
- `--reference-workspaces` / `--reference-workspaces=<string>`
|
|
89
|
-
- automatically generate project references based on workspace dependency graph. Defaults to
|
|
90
|
-
`false`.
|
|
91
|
-
- `--emitDeclarationOnly`
|
|
92
|
-
- emit d.ts files only
|
|
93
|
-
- `--noEmit`
|
|
94
|
-
- include tests
|
|
95
|
-
- `--buildFolder=<string>`
|
|
96
|
-
- sets build folder
|
|
97
|
-
- `--srcFolder=<string>`
|
|
98
|
-
- sets src folder
|
|
99
|
-
- `--testsFolder=<string>`
|
|
100
|
-
- sets tests folder
|
|
101
|
-
- `--typesFolder=<string>`
|
|
102
|
-
- sets types folder
|
|
103
|
-
|
|
104
|
-
**Example:**
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
lumos typescript --emitDeclarationOnly --typesFolder=types
|
|
108
|
-
```
|
|
3
|
+
Documentation was moved to [Lumos package](https://github.com/Oriflame/lumos/tree/master/packages/lumos)
|
package/dts/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
workspaces?: boolean;
|
|
9
|
+
allowJs?: boolean;
|
|
10
|
+
skipLibCheck?: boolean;
|
|
11
|
+
buildFolder?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getCompilerOptions({ library, future, react, srcFolder, allowJs, skipLibCheck, sourceMaps, workspaces, }: Partial<TypeScriptOptions>): import("@beemo/driver-typescript").CompilerOptions;
|
|
14
|
+
export declare function getConfig(options: TypeScriptOptions): TypeScriptConfig;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,69 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const lumosCommon = require('@oriflame/lumos-common');
|
|
8
|
+
|
|
9
|
+
const config = require('tsconfig-oriflame/tsconfig.json');
|
|
10
|
+
|
|
11
|
+
const compilerOptions = config.compilerOptions;
|
|
12
|
+
|
|
13
|
+
function getCompilerOptions({
|
|
14
|
+
library = false,
|
|
15
|
+
future = false,
|
|
16
|
+
react = false,
|
|
17
|
+
srcFolder = 'src',
|
|
18
|
+
allowJs = false,
|
|
19
|
+
skipLibCheck = false,
|
|
20
|
+
sourceMaps = true,
|
|
21
|
+
workspaces
|
|
22
|
+
}) {
|
|
23
|
+
if (workspaces) {
|
|
24
|
+
Object.assign(compilerOptions, require('tsconfig-oriflame/tsconfig.workspaces.json').compilerOptions);
|
|
25
|
+
} // Do we need isolated modules?
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
compilerOptions.isolatedModules = future && library;
|
|
29
|
+
compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
|
|
30
|
+
compilerOptions.allowJs = allowJs;
|
|
31
|
+
compilerOptions.skipLibCheck = skipLibCheck;
|
|
32
|
+
|
|
33
|
+
if (react) {
|
|
34
|
+
var _compilerOptions$lib;
|
|
35
|
+
|
|
36
|
+
compilerOptions.lib = [...((_compilerOptions$lib = compilerOptions.lib) !== null && _compilerOptions$lib !== void 0 ? _compilerOptions$lib : []), 'dom.iterable'];
|
|
37
|
+
compilerOptions.jsx = 'react-jsx';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!library) {
|
|
41
|
+
compilerOptions.baseUrl = '.';
|
|
42
|
+
compilerOptions.paths = {
|
|
43
|
+
[`${lumosCommon.ALIAS_PATTERN}/*`]: [`./${srcFolder}/*`]
|
|
29
44
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[`${lumos_common_1.ALIAS_PATTERN}/*`]: [`./${srcFolder}/*`],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return options;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (sourceMaps) {
|
|
48
|
+
compilerOptions.sourceMap = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return compilerOptions;
|
|
41
52
|
}
|
|
42
|
-
|
|
53
|
+
|
|
43
54
|
function getConfig(options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
exclude: ['**/node_modules/*'],
|
|
48
|
-
};
|
|
49
|
-
if (options.includeTests) {
|
|
50
|
-
config.include.push(`./${options.testsFolder}/**/*`);
|
|
51
|
-
}
|
|
52
|
-
if (options.library) {
|
|
53
|
-
config.compilerOptions.declarationDir = `./${options.buildFolder}`;
|
|
54
|
-
}
|
|
55
|
-
config.compilerOptions.outDir = `./${options.buildFolder}`;
|
|
56
|
-
return config;
|
|
55
|
+
return {
|
|
56
|
+
compilerOptions: getCompilerOptions(options)
|
|
57
|
+
};
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
exports.getCompilerOptions = getCompilerOptions;
|
|
58
61
|
exports.getConfig = getConfig;
|
|
59
|
-
|
|
60
|
-
const config = {
|
|
61
|
-
compilerOptions: getCompilerOptions(options),
|
|
62
|
-
files: [],
|
|
63
|
-
references: [],
|
|
64
|
-
};
|
|
65
|
-
config.compilerOptions.composite = true;
|
|
66
|
-
config.compilerOptions.declarationMap = true;
|
|
67
|
-
return config;
|
|
68
|
-
}
|
|
69
|
-
exports.getConfigWithProjectRefs = getConfigWithProjectRefs;
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +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;AAcO,SAASC,kBAAT,CAA4B;AACjCC,EAAAA,OAAO,GAAG,KADuB;AAEjCC,EAAAA,MAAM,GAAG,KAFwB;AAGjCC,EAAAA,KAAK,GAAG,KAHyB;AAIjCC,EAAAA,SAAS,GAAG,KAJqB;AAKjCC,EAAAA,OAAO,GAAG,KALuB;AAMjCC,EAAAA,YAAY,GAAG,KANkB;AAOjCC,EAAAA,UAAU,GAAG,IAPoB;AAQjCC,EAAAA;AARiC,CAA5B,EASwB;AAC7B,MAAIA,UAAJ,EAAgB;AACdC,IAAAA,MAAM,CAACC,MAAP,CACEX,eADF,EAEGD,OAAO,CAAC,4CAAD,CAAR,CAA4EC,eAF9E;AAID,GAN4B;;;AAQ7BA,EAAAA,eAAe,CAACY,eAAhB,GAAkCT,MAAM,IAAID,OAA5C;AACAF,EAAAA,eAAe,CAACa,uBAAhB,GAA0CV,MAAM,IAAIW,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAA7E;AACAhB,EAAAA,eAAe,CAACM,OAAhB,GAA0BA,OAA1B;AACAN,EAAAA,eAAe,CAACO,YAAhB,GAA+BA,YAA/B;;AAEA,MAAIH,KAAJ,EAAW;AACTJ,IAAAA,eAAe,CAACiB,GAAhB,GAAsB,CAAC,IAAIjB,eAAe,CAACiB,GAAhB,IAAuB,EAA3B,CAAD,EAAiC,cAAjC,CAAtB;AACAjB,IAAAA,eAAe,CAACkB,GAAhB,GAAsB,WAAtB;AACD;;AAED,MAAI,CAAChB,OAAL,EAAc;AACZF,IAAAA,eAAe,CAACmB,OAAhB,GAA0B,GAA1B;AACAnB,IAAAA,eAAe,CAACoB,KAAhB,GAAwB;AACtB,OAAE,GAAEC,yBAAc,IAAlB,GAAwB,CAAE,KAAIhB,SAAU,IAAhB;AADF,KAAxB;AAGD;;AAED,MAAIG,UAAJ,EAAgB;AACdR,IAAAA,eAAe,CAACsB,SAAhB,GAA4B,IAA5B;AACD;;AAED,SAAOtB,eAAP;AACD;AAEM,SAASuB,SAAT,CAAmBC,OAAnB,EAAiE;AACtE,SAAO;AACLxB,IAAAA,eAAe,EAAEC,kBAAkB,CAACuB,OAAD;AAD9B,GAAP;AAGD;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oriflame/config-typescript",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Reusable
|
|
3
|
+
"version": "5.0.6",
|
|
4
|
+
"description": "Reusable typescript config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lumos",
|
|
7
7
|
"config",
|
|
8
8
|
"typescript"
|
|
9
9
|
],
|
|
10
|
-
"main": "lib/index.js",
|
|
10
|
+
"main": "./lib/index.js",
|
|
11
|
+
"types": "./dts/index.d.ts",
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
14
|
"url": "git@github.com:Oriflame/lumos.git"
|
|
@@ -18,13 +19,31 @@
|
|
|
18
19
|
"access": "public"
|
|
19
20
|
},
|
|
20
21
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
22
|
+
"node": ">=12.17.0",
|
|
23
|
+
"npm": ">=6.13.0"
|
|
22
24
|
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dts/**/*.d.ts",
|
|
27
|
+
"lib/**/*.{js,map}",
|
|
28
|
+
"src/**/*.{ts,tsx,json}"
|
|
29
|
+
],
|
|
23
30
|
"dependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
"@oriflame/lumos-common": "^5.0.6",
|
|
32
|
+
"tsconfig-oriflame": "^5.0.6"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@beemo/core": "^2.1.3",
|
|
36
|
+
"@beemo/driver-typescript": "^2.1.1",
|
|
37
|
+
"typescript": "^4.5.4"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@beemo/core": "^2.1.2",
|
|
41
|
+
"@beemo/driver-typescript": "^2.1.0",
|
|
42
|
+
"typescript": "^4.5.4"
|
|
43
|
+
},
|
|
44
|
+
"packemon": {
|
|
45
|
+
"format": "lib",
|
|
46
|
+
"platform": "node"
|
|
28
47
|
},
|
|
29
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "72ec8d41e2e5e538729c9384a13ce6d00b18dccb"
|
|
30
49
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,102 +1,65 @@
|
|
|
1
|
-
import { TypeScriptConfig } from '@beemo/driver-typescript';
|
|
1
|
+
import type { TypeScriptConfig } from '@beemo/driver-typescript';
|
|
2
2
|
import { ALIAS_PATTERN } from '@oriflame/lumos-common';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const config = require('tsconfig-oriflame/tsconfig.json') as TypeScriptConfig;
|
|
5
|
+
|
|
6
|
+
const compilerOptions = config.compilerOptions!;
|
|
7
|
+
|
|
5
8
|
export interface TypeScriptOptions {
|
|
6
|
-
|
|
7
|
-
includeTests?: boolean;
|
|
9
|
+
sourceMaps?: boolean;
|
|
8
10
|
library?: boolean;
|
|
9
11
|
future?: boolean;
|
|
10
|
-
node?: boolean;
|
|
11
12
|
react?: boolean;
|
|
12
13
|
srcFolder: string;
|
|
13
|
-
|
|
14
|
-
typesFolder: string;
|
|
15
|
-
workspaces?: string[];
|
|
16
|
-
emitDeclarationOnly?: boolean;
|
|
14
|
+
workspaces?: boolean;
|
|
17
15
|
allowJs?: boolean;
|
|
18
16
|
skipLibCheck?: boolean;
|
|
17
|
+
buildFolder?: string;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export function getCompilerOptions({
|
|
22
21
|
library = false,
|
|
23
22
|
future = false,
|
|
24
|
-
node = false,
|
|
25
23
|
react = false,
|
|
26
|
-
emitDeclarationOnly = false,
|
|
27
24
|
srcFolder = 'src',
|
|
28
25
|
allowJs = false,
|
|
29
26
|
skipLibCheck = false,
|
|
27
|
+
sourceMaps = true,
|
|
28
|
+
workspaces,
|
|
30
29
|
}: Partial<TypeScriptOptions>) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
noImplicitReturns: true,
|
|
43
|
-
pretty: true,
|
|
44
|
-
strict: true,
|
|
45
|
-
target: future || node ? 'es2018' : 'es2015',
|
|
46
|
-
// We want to resolve json modules
|
|
47
|
-
resolveJsonModule: true,
|
|
48
|
-
experimentalDecorators: true,
|
|
49
|
-
// Use define in development for spec accuracy,
|
|
50
|
-
// but omit in production for smaller file sizes.
|
|
51
|
-
useDefineForClassFields: future && process.env.NODE_ENV === 'development',
|
|
52
|
-
allowJs,
|
|
53
|
-
skipLibCheck,
|
|
54
|
-
};
|
|
30
|
+
if (workspaces) {
|
|
31
|
+
Object.assign(
|
|
32
|
+
compilerOptions,
|
|
33
|
+
(require('tsconfig-oriflame/tsconfig.workspaces.json') as TypeScriptConfig).compilerOptions,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
// Do we need isolated modules?
|
|
37
|
+
compilerOptions.isolatedModules = future && library;
|
|
38
|
+
compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
|
|
39
|
+
compilerOptions.allowJs = allowJs;
|
|
40
|
+
compilerOptions.skipLibCheck = skipLibCheck;
|
|
55
41
|
|
|
56
42
|
if (react) {
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
compilerOptions.lib = [...(compilerOptions.lib ?? []), 'dom.iterable'];
|
|
44
|
+
compilerOptions.jsx = 'react-jsx';
|
|
59
45
|
}
|
|
60
46
|
|
|
61
47
|
if (!library) {
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
compilerOptions.baseUrl = '.';
|
|
49
|
+
compilerOptions.paths = {
|
|
64
50
|
[`${ALIAS_PATTERN}/*`]: [`./${srcFolder}/*`],
|
|
65
51
|
};
|
|
66
52
|
}
|
|
67
53
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
|
|
72
|
-
const config = {
|
|
73
|
-
compilerOptions: getCompilerOptions(options),
|
|
74
|
-
include: [`./${options.srcFolder}/**/*`, `./${options.typesFolder}/**/*`],
|
|
75
|
-
exclude: ['**/node_modules/*'],
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
if (options.includeTests) {
|
|
79
|
-
config.include.push(`./${options.testsFolder}/**/*`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (options.library) {
|
|
83
|
-
config.compilerOptions.declarationDir = `./${options.buildFolder}`;
|
|
54
|
+
if (sourceMaps) {
|
|
55
|
+
compilerOptions.sourceMap = true;
|
|
84
56
|
}
|
|
85
57
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return config;
|
|
58
|
+
return compilerOptions;
|
|
89
59
|
}
|
|
90
60
|
|
|
91
|
-
export function
|
|
92
|
-
|
|
61
|
+
export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
|
|
62
|
+
return {
|
|
93
63
|
compilerOptions: getCompilerOptions(options),
|
|
94
|
-
files: [],
|
|
95
|
-
references: [],
|
|
96
64
|
};
|
|
97
|
-
|
|
98
|
-
config.compilerOptions.composite = true;
|
|
99
|
-
config.compilerOptions.declarationMap = true;
|
|
100
|
-
|
|
101
|
-
return config;
|
|
102
65
|
}
|