@oriflame/config-typescript 5.1.11 → 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,19 +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
- 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
+ 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;
19
20
  //# 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
  });
@@ -24,9 +18,10 @@ function getCompilerOptions({
24
18
  allowJs = false,
25
19
  skipLibCheck = false,
26
20
  sourceMaps = true,
27
- emitDeclarationOnly = false,
28
- declarationDir = 'dts',
21
+ declarationOnly = false,
22
+ declarationFolder,
29
23
  buildFolder,
24
+ includeTests,
30
25
  workspaces
31
26
  }) {
32
27
  if (workspaces) {
@@ -34,11 +29,10 @@ function getCompilerOptions({
34
29
  } // Do we need isolated modules?
35
30
 
36
31
 
37
- compilerOptions.isolatedModules = future && library;
32
+ compilerOptions.isolatedModules = future && library && !includeTests;
38
33
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
39
34
  compilerOptions.allowJs = allowJs;
40
35
  compilerOptions.skipLibCheck = skipLibCheck;
41
- compilerOptions.declaration = library || emitDeclarationOnly;
42
36
 
43
37
  if (react) {
44
38
  var _compilerOptions$lib;
@@ -54,13 +48,16 @@ function getCompilerOptions({
54
48
  };
55
49
  }
56
50
 
57
- if (!workspaces) {
58
- compilerOptions.outDir = `./${buildFolder}`;
51
+ if (!workspaces && library) {
52
+ compilerOptions.declarationDir = declarationFolder || buildFolder;
59
53
  }
60
54
 
61
- if (library && !workspaces) {
62
- compilerOptions.composite = true;
63
- compilerOptions.declarationDir = `./${declarationDir}`;
55
+ if (!workspaces) {
56
+ compilerOptions.outDir = buildFolder;
57
+ compilerOptions.rootDir = srcFolder;
58
+ compilerOptions.composite = library;
59
+ compilerOptions.declaration = library || declarationOnly;
60
+ compilerOptions.emitDeclarationOnly = declarationOnly;
64
61
  }
65
62
 
66
63
  if (sourceMaps) {
@@ -73,10 +70,10 @@ function getCompilerOptions({
73
70
 
74
71
  function getConfig(options) {
75
72
  const workspaces = options.workspaces,
76
- library = options.library,
77
73
  srcFolder = options.srcFolder,
78
74
  typesFolder = options.typesFolder,
79
- buildFolder = options.buildFolder;
75
+ includeTests = options.includeTests,
76
+ testsFolder = options.testsFolder;
80
77
 
81
78
  if (workspaces) {
82
79
  return {
@@ -84,13 +81,17 @@ function getConfig(options) {
84
81
  };
85
82
  }
86
83
 
87
- return {
88
- compilerOptions: _objectSpread(_objectSpread({}, getCompilerOptions(options)), library && {
89
- outDir: buildFolder
90
- }),
84
+ const tsconfig = {
85
+ compilerOptions: getCompilerOptions(options),
91
86
  include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
92
87
  exclude: ['**/node_modules/*']
93
88
  };
89
+
90
+ if (includeTests) {
91
+ tsconfig.include.push(`./${testsFolder}/**/*`);
92
+ }
93
+
94
+ return tsconfig;
94
95
  }
95
96
 
96
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","emitDeclarationOnly","declarationDir","buildFolder","workspaces","Object","assign","isolatedModules","useDefineForClassFields","process","env","NODE_ENV","declaration","lib","jsx","baseUrl","paths","ALIAS_PATTERN","outDir","composite","s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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,EAawB;AAC7B,MAAIA,UAAJ,EAAgB;AACdC,IAAAA,MAAM,CAACC,MAAP,CACEf,eADF,EAEGD,OAAO,CAAC,4CAAD,CAAR,CAA4EC,eAF9E;AAID,GAN4B;;;AAQ7BA,EAAAA,eAAe,CAACgB,eAAhB,GAAkCb,MAAM,IAAID,OAAV,IAAqB,CAACU,YAAxD;AACAZ,EAAAA,eAAe,CAACiB,uBAAhB,GAA0Cd,MAAM,IAAIe,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAA7E;AACApB,EAAAA,eAAe,CAACM,OAAhB,GAA0BA,OAA1B;AACAN,EAAAA,eAAe,CAACO,YAAhB,GAA+BA,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,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.11",
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.11",
32
- "tsconfig-oriflame": "^5.1.11"
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": "9de0434681490c0e307d6de006e3a06d08c774e7"
48
+ "gitHead": "cd2e4a9fbb18cb4000f876c131b854d21f6d2bfe"
49
49
  }
package/src/index.ts CHANGED
@@ -15,10 +15,11 @@ export interface TypeScriptOptions {
15
15
  workspaces?: boolean;
16
16
  allowJs?: boolean;
17
17
  includeTests?: boolean;
18
- declarationDir?: string;
19
- emitDeclarationOnly?: boolean;
18
+ testsFolder: string;
19
+ buildFolder: string;
20
+ declarationFolder?: string;
21
+ declarationOnly?: boolean;
20
22
  skipLibCheck?: boolean;
21
- buildFolder?: string;
22
23
  }
23
24
 
24
25
  export function getCompilerOptions({
@@ -29,9 +30,10 @@ export function getCompilerOptions({
29
30
  allowJs = false,
30
31
  skipLibCheck = false,
31
32
  sourceMaps = true,
32
- emitDeclarationOnly = false,
33
- declarationDir = 'dts',
33
+ declarationOnly = false,
34
+ declarationFolder,
34
35
  buildFolder,
36
+ includeTests,
35
37
  workspaces,
36
38
  }: Partial<TypeScriptOptions>) {
37
39
  if (workspaces) {
@@ -41,11 +43,10 @@ export function getCompilerOptions({
41
43
  );
42
44
  }
43
45
  // Do we need isolated modules?
44
- compilerOptions.isolatedModules = future && library;
46
+ compilerOptions.isolatedModules = future && library && !includeTests;
45
47
  compilerOptions.useDefineForClassFields = future && process.env.NODE_ENV === 'development';
46
48
  compilerOptions.allowJs = allowJs;
47
49
  compilerOptions.skipLibCheck = skipLibCheck;
48
- compilerOptions.declaration = library || emitDeclarationOnly;
49
50
 
50
51
  if (react) {
51
52
  compilerOptions.lib = [...(compilerOptions.lib ?? []), 'dom.iterable'];
@@ -59,13 +60,16 @@ export function getCompilerOptions({
59
60
  };
60
61
  }
61
62
 
62
- if (!workspaces) {
63
- compilerOptions.outDir = `./${buildFolder}`;
63
+ if (!workspaces && library) {
64
+ compilerOptions.declarationDir = declarationFolder || buildFolder;
64
65
  }
65
66
 
66
- if (library && !workspaces) {
67
- compilerOptions.composite = true;
68
- compilerOptions.declarationDir = `./${declarationDir}`;
67
+ if (!workspaces) {
68
+ compilerOptions.outDir = buildFolder;
69
+ compilerOptions.rootDir = srcFolder;
70
+ compilerOptions.composite = library;
71
+ compilerOptions.declaration = library || declarationOnly;
72
+ compilerOptions.emitDeclarationOnly = declarationOnly;
69
73
  }
70
74
 
71
75
  if (sourceMaps) {
@@ -77,19 +81,22 @@ export function getCompilerOptions({
77
81
  }
78
82
 
79
83
  export function getConfig(options: TypeScriptOptions): TypeScriptConfig {
80
- const { workspaces, library, srcFolder, typesFolder, buildFolder } = options;
84
+ const { workspaces, srcFolder, typesFolder, includeTests, testsFolder } = options;
81
85
  if (workspaces) {
82
86
  return {
83
87
  compilerOptions: getCompilerOptions(options),
84
88
  };
85
89
  }
86
90
 
87
- return {
88
- compilerOptions: {
89
- ...getCompilerOptions(options),
90
- ...(library && { outDir: buildFolder }),
91
- },
91
+ const tsconfig = {
92
+ compilerOptions: getCompilerOptions(options),
92
93
  include: [`./${srcFolder}/**/*`, `./${typesFolder}/**/*`],
93
94
  exclude: ['**/node_modules/*'],
94
95
  };
96
+
97
+ if (includeTests) {
98
+ tsconfig.include.push(`./${testsFolder}/**/*`);
99
+ }
100
+
101
+ return tsconfig;
95
102
  }