@oriflame/config-typescript 5.1.8 → 5.1.12-alpha.2

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 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
- 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;
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, 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,8 @@ function getCompilerOptions({
18
18
  allowJs = false,
19
19
  skipLibCheck = false,
20
20
  sourceMaps = true,
21
+ emitDeclarationOnly = false,
22
+ declarationDir = 'dts',
21
23
  workspaces
22
24
  }) {
23
25
  if (workspaces) {
@@ -29,6 +31,7 @@ function getCompilerOptions({
29
31
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
30
32
  compilerOptions.allowJs = allowJs;
31
33
  compilerOptions.skipLibCheck = skipLibCheck;
34
+ compilerOptions.declaration = library || emitDeclarationOnly;
32
35
 
33
36
  if (react) {
34
37
  var _compilerOptions$lib;
@@ -44,17 +47,44 @@ function getCompilerOptions({
44
47
  };
45
48
  }
46
49
 
50
+ if (!workspaces) {
51
+ compilerOptions.outDir = `./${declarationDir}`;
52
+ }
53
+
54
+ compilerOptions.composite = library && !workspaces;
55
+
47
56
  if (sourceMaps) {
48
57
  compilerOptions.sourceMap = true;
58
+ compilerOptions.declarationMap = true;
49
59
  }
50
60
 
51
61
  return compilerOptions;
52
62
  }
53
63
 
54
64
  function getConfig(options) {
55
- return {
56
- compilerOptions: getCompilerOptions(options)
65
+ const workspaces = options.workspaces,
66
+ srcFolder = options.srcFolder,
67
+ typesFolder = options.typesFolder,
68
+ includeTests = options.includeTests,
69
+ testsFolder = options.testsFolder;
70
+
71
+ if (workspaces) {
72
+ return {
73
+ compilerOptions: getCompilerOptions(options)
74
+ };
75
+ }
76
+
77
+ const tsconfig = {
78
+ compilerOptions: getCompilerOptions(options),
79
+ include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
80
+ exclude: ['**/node_modules/*']
57
81
  };
82
+
83
+ if (includeTests) {
84
+ tsconfig.include.push(`./${testsFolder}/**/*`);
85
+ }
86
+
87
+ return tsconfig;
58
88
  }
59
89
 
60
90
  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,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A,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;;;;;"}
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","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","declaration","lib","jsx","baseUrl","paths","ALIAS_PATTERN","outDir","composite","sourceMap","declarationMap","getConfig","options","typesFolder","includeTests","testsFolder","tsconfig","include","exclude","push"],"mappings":";;;;;;AAGA,MAAMA,MAAM,GAAGC,OAAO,CAAC,iCAAD,CAAtB;;AAEA,MAAMC,eAAe,GAAGF,MAAM,CAACE,eAA/B;AAkBO,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,mBAAmB,GAAG,KARW;AASjCC,EAAAA,cAAc,GAAG,KATgB;AAUjCC,EAAAA;AAViC,CAA5B,EAWwB;AAC7B,MAAIA,UAAJ,EAAgB;AACdC,IAAAA,MAAM,CAACC,MAAP,CACEb,eADF,EAEGD,OAAO,CAAC,4CAAD,CAAR,CAA4EC,eAF9E;AAID,GAN4B;;;AAQ7BA,EAAAA,eAAe,CAACc,eAAhB,GAAkCX,MAAM,IAAID,OAA5C;AACAF,EAAAA,eAAe,CAACe,uBAAhB,GAA0CZ,MAAM,IAAIa,OA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AAED,QAAMI,QAAQ,GAAG;AACflC,IAAAA,eAAe,EAAEC,kBAAkB,CAAC6B,OAAD,CADpB;AAEfK,IAAAA,OAAO,EAAE,CAAE,KAAI9B,SAAU,OAAhB,EAAyB,KAAI0B,WAAY,OAAzC,CAFM;AAGfK,IAAAA,OAAO,EAAE,CAAC,mBAAD;AAHM,GAAjB;;AAMA,MAAIJ,YAAJ,EAAkB;AAChBE,IAAAA,QAAQ,CAACC,OAAT,CAAiBE,IAAjB,CAAuB,KAAIJ,WAAY,OAAvC;AACD;;AAED,SAAOC,QAAP;AACD;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oriflame/config-typescript",
3
- "version": "5.1.8",
3
+ "version": "5.1.12-alpha.2+1274a120",
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.8",
32
- "tsconfig-oriflame": "^5.1.8"
31
+ "@oriflame/lumos-common": "^5.1.12-alpha.2+1274a120",
32
+ "tsconfig-oriflame": "^5.1.12-alpha.2+1274a120"
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": "6dbae8edee867621a47fac248ca1c366b8e0c37a"
48
+ "gitHead": "1274a120ad7daebb9919f8bd705df65fcf81a588"
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,8 @@ export function getCompilerOptions({
25
29
  allowJs = false,
26
30
  skipLibCheck = false,
27
31
  sourceMaps = true,
32
+ emitDeclarationOnly = false,
33
+ declarationDir = 'dts',
28
34
  workspaces,
29
35
  }: Partial<TypeScriptOptions>) {
30
36
  if (workspaces) {
@@ -38,6 +44,7 @@ export function getCompilerOptions({
38
44
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
39
45
  compilerOptions.allowJs = allowJs;
40
46
  compilerOptions.skipLibCheck = skipLibCheck;
47
+ compilerOptions.declaration = library || emitDeclarationOnly;
41
48
 
42
49
  if (react) {
43
50
  compilerOptions.lib = [...(compilerOptions.lib ?? []), 'dom.iterable'];
@@ -51,15 +58,37 @@ export function getCompilerOptions({
51
58
  };
52
59
  }
53
60
 
61
+ if (!workspaces) {
62
+ compilerOptions.outDir = `./${declarationDir}`;
63
+ }
64
+
65
+ compilerOptions.composite = library && !workspaces;
66
+
54
67
  if (sourceMaps) {
55
68
  compilerOptions.sourceMap = true;
69
+ compilerOptions.declarationMap = true;
56
70
  }
57
71
 
58
72
  return compilerOptions;
59
73
  }
60
74
 
61
75
  export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
62
- return {
76
+ const { workspaces, srcFolder, typesFolder, includeTests, testsFolder } = options;
77
+ if (workspaces) {
78
+ return {
79
+ compilerOptions: getCompilerOptions(options),
80
+ };
81
+ }
82
+
83
+ const tsconfig = {
63
84
  compilerOptions: getCompilerOptions(options),
85
+ include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
86
+ exclude: ['**/node_modules/*'],
64
87
  };
88
+
89
+ if (includeTests) {
90
+ tsconfig.include.push(`./${testsFolder}/**/*`);
91
+ }
92
+
93
+ return tsconfig;
65
94
  }