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

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,20 @@
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
+ buildFolder: string;
14
+ declarationFolder?: string;
15
+ declarationOnly?: boolean;
16
+ skipLibCheck?: boolean;
17
+ }
18
+ export declare function getCompilerOptions({ library, future, react, srcFolder, allowJs, skipLibCheck, sourceMaps, declarationOnly, declarationFolder, buildFolder, includeTests, workspaces, }: Partial<TypeScriptOptions>): import("@beemo/driver-typescript").CompilerOptions;
19
+ export declare function getConfig(options: TypeScriptOptions): TypeScriptConfig;
15
20
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -18,6 +18,10 @@ function getCompilerOptions({
18
18
  allowJs = false,
19
19
  skipLibCheck = false,
20
20
  sourceMaps = true,
21
+ declarationOnly = false,
22
+ declarationFolder,
23
+ buildFolder,
24
+ includeTests,
21
25
  workspaces
22
26
  }) {
23
27
  if (workspaces) {
@@ -25,7 +29,7 @@ function getCompilerOptions({
25
29
  } // Do we need isolated modules?
26
30
 
27
31
 
28
- compilerOptions.isolatedModules = future && library;
32
+ compilerOptions.isolatedModules = future && library && !includeTests;
29
33
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
30
34
  compilerOptions.allowJs = allowJs;
31
35
  compilerOptions.skipLibCheck = skipLibCheck;
@@ -44,17 +48,50 @@ function getCompilerOptions({
44
48
  };
45
49
  }
46
50
 
51
+ if (!workspaces && library) {
52
+ compilerOptions.declarationDir = declarationFolder || buildFolder;
53
+ }
54
+
55
+ if (!workspaces) {
56
+ compilerOptions.outDir = buildFolder;
57
+ compilerOptions.rootDir = srcFolder;
58
+ compilerOptions.composite = library;
59
+ compilerOptions.declaration = library || declarationOnly;
60
+ compilerOptions.emitDeclarationOnly = declarationOnly;
61
+ }
62
+
47
63
  if (sourceMaps) {
48
64
  compilerOptions.sourceMap = true;
65
+ compilerOptions.declarationMap = true;
49
66
  }
50
67
 
51
68
  return compilerOptions;
52
69
  }
53
70
 
54
71
  function getConfig(options) {
55
- return {
56
- compilerOptions: getCompilerOptions(options)
72
+ const workspaces = options.workspaces,
73
+ srcFolder = options.srcFolder,
74
+ typesFolder = options.typesFolder,
75
+ includeTests = options.includeTests,
76
+ testsFolder = options.testsFolder;
77
+
78
+ if (workspaces) {
79
+ return {
80
+ compilerOptions: getCompilerOptions(options)
81
+ };
82
+ }
83
+
84
+ const tsconfig = {
85
+ compilerOptions: getCompilerOptions(options),
86
+ include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
87
+ exclude: ['**/node_modules/*']
57
88
  };
89
+
90
+ if (includeTests) {
91
+ tsconfig.include.push(`./${testsFolder}/**/*`);
92
+ }
93
+
94
+ return tsconfig;
58
95
  }
59
96
 
60
97
  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;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;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":null,"names":["config","require","compilerOptions","getCompilerOptions","library","future","react","srcFolder","allowJs","skipLibCheck","sourceMaps","declarationOnly","declarationFolder","buildFolder","includeTests","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","lib","jsx","baseUrl","paths","ALIAS_PATTERN","declarationDir","outDir","rootDir","composite","declaration","emitDeclarationOnly","sourceMap","declarationMap","getConfig","options","typesFolder","testsFolder","tsconfig","include","exclude","push"],"mappings":";;;;;;AAGA,MAAMA,MAAM,GAAGC,OAAO,CAAC,iCAAD,CAAtB;;AAEA,MAAMC,eAAe,GAAGF,MAAM,CAACE,eAA/B;AAmBO,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,eAAe,GAAG,KARe;AASjCC,EAAAA,iBATiC;AAUjCC,EAAAA,WAViC;AAWjCC,EAAAA,YAXiC;AAYjCC,EAAAA;AAZiC,CAA5B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B,mBAAhB,GAAsCtB,eAAtC;AACD;;AAED,MAAID,UAAJ,EAAgB;AACdR,IAAAA,eAAe,CAACgC,SAAhB,GAA4B,IAA5B;AACAhC,IAAAA,eAAe,CAACiC,cAAhB,GAAiC,IAAjC;AACD;;AAED,SAAOjC,eAAP;AACD;AAEM,SAASkC,SAAT,CAAmBC,OAAnB,EAAiE;AACtE,QAAM;AAAEtB,IAAAA,UAAF;AAAcR,IAAAA,SAAd;AAAyB+B,IAAAA,WAAzB;AAAsCxB,IAAAA,YAAtC;AAAoDyB,IAAAA;AAApD,MAAoEF,OAA1E;;AACA,MAAItB,UAAJ,EAAgB;AACd,WAAO;AACLb,MAAAA,eAAe,EAAEC,kBAAkB,CAACkC,OAAD;AAD9B,KAAP;AAGD;;AAED,QAAMG,QAAQ,GAAG;AACftC,IAAAA,eAAe,EAAEC,kBAAkB,CAACkC,OAAD,CADpB;AAEfI,IAAAA,OAAO,EAAE,CAAE,KAAIlC,SAAU,OAAhB,EAAyB,KAAI+B,WAAY,OAAzC,CAFM;AAGfI,IAAAA,OAAO,EAAE,CAAC,mBAAD;AAHM,GAAjB;;AAMA,MAAI5B,YAAJ,EAAkB;AAChB0B,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.10+cd2e4a9f",
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.10+cd2e4a9f",
32
+ "tsconfig-oriflame": "^5.1.12-alpha.10+cd2e4a9f"
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": "cd2e4a9fbb18cb4000f876c131b854d21f6d2bfe"
49
49
  }
package/src/index.ts CHANGED
@@ -11,10 +11,15 @@ 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
+ buildFolder: string;
20
+ declarationFolder?: string;
21
+ declarationOnly?: boolean;
16
22
  skipLibCheck?: boolean;
17
- buildFolder?: string;
18
23
  }
19
24
 
20
25
  export function getCompilerOptions({
@@ -25,6 +30,10 @@ export function getCompilerOptions({
25
30
  allowJs = false,
26
31
  skipLibCheck = false,
27
32
  sourceMaps = true,
33
+ declarationOnly = false,
34
+ declarationFolder,
35
+ buildFolder,
36
+ includeTests,
28
37
  workspaces,
29
38
  }: Partial<TypeScriptOptions>) {
30
39
  if (workspaces) {
@@ -34,7 +43,7 @@ export function getCompilerOptions({
34
43
  );
35
44
  }
36
45
  // Do we need isolated modules?
37
- compilerOptions.isolatedModules = future && library;
46
+ compilerOptions.isolatedModules = future && library && !includeTests;
38
47
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
39
48
  compilerOptions.allowJs = allowJs;
40
49
  compilerOptions.skipLibCheck = skipLibCheck;
@@ -51,15 +60,43 @@ export function getCompilerOptions({
51
60
  };
52
61
  }
53
62
 
63
+ if (!workspaces && library) {
64
+ compilerOptions.declarationDir = declarationFolder || buildFolder;
65
+ }
66
+
67
+ if (!workspaces) {
68
+ compilerOptions.outDir = buildFolder;
69
+ compilerOptions.rootDir = srcFolder;
70
+ compilerOptions.composite = library;
71
+ compilerOptions.declaration = library || declarationOnly;
72
+ compilerOptions.emitDeclarationOnly = declarationOnly;
73
+ }
74
+
54
75
  if (sourceMaps) {
55
76
  compilerOptions.sourceMap = true;
77
+ compilerOptions.declarationMap = true;
56
78
  }
57
79
 
58
80
  return compilerOptions;
59
81
  }
60
82
 
61
83
  export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
62
- return {
84
+ const { workspaces, srcFolder, typesFolder, includeTests, testsFolder } = options;
85
+ if (workspaces) {
86
+ return {
87
+ compilerOptions: getCompilerOptions(options),
88
+ };
89
+ }
90
+
91
+ const tsconfig = {
63
92
  compilerOptions: getCompilerOptions(options),
93
+ include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
94
+ exclude: ['**/node_modules/*'],
64
95
  };
96
+
97
+ if (includeTests) {
98
+ tsconfig.include.push(`./${testsFolder}/**/*`);
99
+ }
100
+
101
+ return tsconfig;
65
102
  }