@oriflame/config-typescript 5.1.11 → 5.1.12-alpha.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/dts/index.d.ts CHANGED
@@ -1,19 +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
- typesFolder: string;
9
- workspaces?: boolean;
10
- allowJs?: boolean;
11
- includeTests?: boolean;
12
- declarationDir?: string;
13
- emitDeclarationOnly?: boolean;
14
- skipLibCheck?: boolean;
15
- buildFolder?: string;
16
- }
17
- export declare function getCompilerOptions({ library, future, react, srcFolder, allowJs, skipLibCheck, sourceMaps, emitDeclarationOnly, declarationDir, buildFolder, workspaces, }: Partial<TypeScriptOptions>): import("@beemo/driver-typescript").CompilerOptions;
18
- 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, includeTests, workspaces, }: Partial<TypeScriptOptions>): import("@beemo/driver-typescript").CompilerOptions;
18
+ export declare function getConfig(options: TypeScriptOptions): TypeScriptConfig;
19
19
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,11 +1,5 @@
1
1
  'use strict';
2
2
 
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
3
  Object.defineProperty(exports, '__esModule', {
10
4
  value: true
11
5
  });
@@ -26,7 +20,7 @@ function getCompilerOptions({
26
20
  sourceMaps = true,
27
21
  emitDeclarationOnly = false,
28
22
  declarationDir = 'dts',
29
- buildFolder,
23
+ includeTests,
30
24
  workspaces
31
25
  }) {
32
26
  if (workspaces) {
@@ -34,7 +28,7 @@ function getCompilerOptions({
34
28
  } // Do we need isolated modules?
35
29
 
36
30
 
37
- compilerOptions.isolatedModules = future && library;
31
+ compilerOptions.isolatedModules = future && library && !includeTests;
38
32
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
39
33
  compilerOptions.allowJs = allowJs;
40
34
  compilerOptions.skipLibCheck = skipLibCheck;
@@ -54,15 +48,17 @@ function getCompilerOptions({
54
48
  };
55
49
  }
56
50
 
57
- if (!workspaces) {
58
- compilerOptions.outDir = `./${buildFolder}`;
51
+ if (!workspaces && library) {
52
+ compilerOptions.declarationDir = declarationDir;
59
53
  }
60
54
 
61
- if (library && !workspaces) {
62
- compilerOptions.composite = true;
63
- compilerOptions.declarationDir = `./${declarationDir}`;
55
+ if (!workspaces) {
56
+ compilerOptions.outDir = declarationDir;
57
+ compilerOptions.rootDir = srcFolder;
64
58
  }
65
59
 
60
+ compilerOptions.composite = library && !workspaces;
61
+
66
62
  if (sourceMaps) {
67
63
  compilerOptions.sourceMap = true;
68
64
  compilerOptions.declarationMap = true;
@@ -73,10 +69,10 @@ function getCompilerOptions({
73
69
 
74
70
  function getConfig(options) {
75
71
  const workspaces = options.workspaces,
76
- library = options.library,
77
72
  srcFolder = options.srcFolder,
78
73
  typesFolder = options.typesFolder,
79
- buildFolder = options.buildFolder;
74
+ includeTests = options.includeTests,
75
+ testsFolder = options.testsFolder;
80
76
 
81
77
  if (workspaces) {
82
78
  return {
@@ -84,13 +80,17 @@ function getConfig(options) {
84
80
  };
85
81
  }
86
82
 
87
- return {
88
- compilerOptions: _objectSpread(_objectSpread({}, getCompilerOptions(options)), library && {
89
- outDir: buildFolder
90
- }),
83
+ const tsconfig = {
84
+ compilerOptions: getCompilerOptions(options),
91
85
  include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
92
86
  exclude: ['**/node_modules/*']
93
87
  };
88
+
89
+ if (includeTests) {
90
+ tsconfig.include.push(`./${testsFolder}/**/*`);
91
+ }
92
+
93
+ return tsconfig;
94
94
  }
95
95
 
96
96
  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","emitDeclarationOnly","declarationDir","buildFolder","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","declaration","lib","jsx","baseUrl","paths","ALIAS_PATTERN","outDir","composite","sourceMap","declarationMap","getConfig","options","typesFolder","include","exclude"],"mappings":";;;;;;AAGA,MAAMA,MAAM,GAAGC,OAAO,CAAC,iCAAD,CAAtB;;AAEA,MAAMC,eAAe,GAAGF,MAAM,CAACE,eAA/B;AAkBO,SAASC,kBA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AADF,KAAxB;AAGD;;AAED,MAAI,CAACO,UAAL,EAAiB;AACfZ,IAAAA,eAAe,CAAC0B,MAAhB,GAA0B,KAAIf,WAAY,EAA1C;AACD;;AAED,MAAIT,OAAO,IAAI,CAACU,UAAhB,EAA4B;AAC1BZ,IAAAA,eAAe,CAAC2B,SAAhB,GAA4B,IAA5B;AACA3B,IAAAA,eAAe,CAACU,cAAhB,GAAkC,KAAIA,cAAe,EAArD;AACD;;AAED,MAAIF,UAAJ,EAAgB;AACdR,IAAAA,eAAe,CAAC4B,SAAhB,GAA4B,IAA5B;AACA5B,IAAAA,eAAe,CAAC6B,cAAhB,GAAiC,IAAjC;AACD;;AAED,SAAO7B,eAAP;AACD;AAEM,SAAS8B,SAAT,CAAmBC,OAAnB,EAAiE;AACtE,QAAM;AAAEnB,IAAAA,UAAF;AAAcV,IAAAA,OAAd;AAAuBG,IAAAA,SAAvB;AAAkC2B,IAAAA,WAAlC;AAA+CrB,IAAAA;AAA/C,MAA+DoB,OAArE;;AACA,MAAInB,UAAJ,EAAgB;AACd,WAAO;AACLZ,MAAAA,eAAe,EAAEC,kBAAkB,CAAC8B,OAAD;AAD9B,KAAP;AAGD;;AAED,SAAO;AACL/B,IAAAA,eAAe,EAAE,EACf,GAAGC,kBAAkB,CAAC8B,OAAD,CADN;AAEf,UAAI7B,OAAO,IAAI;AAAEwB,QAAAA,MAAM,EAAEf;AAAV,OAAf;AAFe,KADZ;AAKLsB,IAAAA,OAAO,EAAE,CAAE,KAAI5B,SAAU,OAAhB,EAAyB,KAAI2B,WAAY,OAAzC,CALJ;AAMLE,IAAAA,OAAO,EAAE,CAAC,mBAAD;AANJ,GAAP;AAQD;;;;;"}
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","rootDir","composite","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;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,YAViC;AAWjCC,EAAAA;AAXiC,CAA5B,EAYwB;AAC7B,MAAIA,UAAJ,EAAgB;AACdC,IAAAA,MAAM,CAACC,MAAP,CACEd,eADF,EAEGD,OAAO,CAAC,4CAAD,CAAR,CAA4EC,eAF9E;AAID,GAN4B;;;AAQ7BA,EAAAA,eAAe,CAACe,eAAhB,GAAkCZ,MAAM,IAAID,OAAV,IAAqB,CAACS,YAAxD;AACAX,EAAAA,eAAe,CAACgB,uBAAhB,GAA0Cb,MAAM,IAAIc,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAA7E;AACAnB,EAAAA,eAAe,CAACM,OAAhB,GAA0BA,OAA1B;AACAN,EAAAA,eAAe,CAACO,YAAhB,GAA+BA,YAA/B;AACAP,EAAAA,eAAe,CAACoB,WAAhB,GAA8BlB,OAAO,IAAIO,mBAAzC;;AAEA,MAAIL,KAAJ,EAAW;AACTJ,IAAAA,eAAe,CAACqB,GAAhB,GAAsB,CAAC,IAAIrB,eAAe,CAACqB,GAAhB,IAAuB,EAA3B,CAAD,EA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A,OAAO,EAAE,CAAC,mBAAD;AAHM,GAAjB;;AAMA,MAAI1B,YAAJ,EAAkB;AAChBwB,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.11",
3
+ "version": "5.1.12-alpha.6+7ad8f2ff",
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.11",
32
- "tsconfig-oriflame": "^5.1.11"
31
+ "@oriflame/lumos-common": "^5.1.12-alpha.6+7ad8f2ff",
32
+ "tsconfig-oriflame": "^5.1.12-alpha.6+7ad8f2ff"
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": "9de0434681490c0e307d6de006e3a06d08c774e7"
48
+ "gitHead": "7ad8f2ff2ecf20b1227078cc0e992f354a01788c"
49
49
  }
package/src/index.ts CHANGED
@@ -15,10 +15,10 @@ export interface TypeScriptOptions {
15
15
  workspaces?: boolean;
16
16
  allowJs?: boolean;
17
17
  includeTests?: boolean;
18
+ testsFolder: string;
18
19
  declarationDir?: string;
19
20
  emitDeclarationOnly?: boolean;
20
21
  skipLibCheck?: boolean;
21
- buildFolder?: string;
22
22
  }
23
23
 
24
24
  export function getCompilerOptions({
@@ -31,7 +31,7 @@ export function getCompilerOptions({
31
31
  sourceMaps = true,
32
32
  emitDeclarationOnly = false,
33
33
  declarationDir = 'dts',
34
- buildFolder,
34
+ includeTests,
35
35
  workspaces,
36
36
  }: Partial<TypeScriptOptions>) {
37
37
  if (workspaces) {
@@ -41,7 +41,7 @@ export function getCompilerOptions({
41
41
  );
42
42
  }
43
43
  // Do we need isolated modules?
44
- compilerOptions.isolatedModules = future && library;
44
+ compilerOptions.isolatedModules = future && library && !includeTests;
45
45
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
46
46
  compilerOptions.allowJs = allowJs;
47
47
  compilerOptions.skipLibCheck = skipLibCheck;
@@ -59,15 +59,17 @@ export function getCompilerOptions({
59
59
  };
60
60
  }
61
61
 
62
- if (!workspaces) {
63
- compilerOptions.outDir = `./${buildFolder}`;
62
+ if (!workspaces && library) {
63
+ compilerOptions.declarationDir = declarationDir;
64
64
  }
65
65
 
66
- if (library && !workspaces) {
67
- compilerOptions.composite = true;
68
- compilerOptions.declarationDir = `./${declarationDir}`;
66
+ if (!workspaces) {
67
+ compilerOptions.outDir = declarationDir;
68
+ compilerOptions.rootDir = srcFolder;
69
69
  }
70
70
 
71
+ compilerOptions.composite = library && !workspaces;
72
+
71
73
  if (sourceMaps) {
72
74
  compilerOptions.sourceMap = true;
73
75
  compilerOptions.declarationMap = true;
@@ -77,19 +79,22 @@ export function getCompilerOptions({
77
79
  }
78
80
 
79
81
  export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
80
- const { workspaces, library, srcFolder, typesFolder, buildFolder } = options;
82
+ const { workspaces, srcFolder, typesFolder, includeTests, testsFolder } = options;
81
83
  if (workspaces) {
82
84
  return {
83
85
  compilerOptions: getCompilerOptions(options),
84
86
  };
85
87
  }
86
88
 
87
- return {
88
- compilerOptions: {
89
- ...getCompilerOptions(options),
90
- ...(library && { outDir: buildFolder }),
91
- },
89
+ const tsconfig = {
90
+ compilerOptions: getCompilerOptions(options),
92
91
  include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
93
92
  exclude: ['**/node_modules/*'],
94
93
  };
94
+
95
+ if (includeTests) {
96
+ tsconfig.include.push(`./${testsFolder}/**/*`);
97
+ }
98
+
99
+ return tsconfig;
95
100
  }