@strapi/typescript-utils 0.0.0-next.f7babb775ed9a7e18d8351cb7f74c63e016323c4 → 0.0.0-next.f86041c89a8c1545c6437a881dc613e98bc52bd7

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.
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const resolveConfigOptions = require('./resolve-config-options');
5
+ const isUsingTypescriptSync = require('./is-using-typescript-sync');
6
+
7
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
8
+ /**
9
+ * Gets the outDir value from config file (tsconfig)
10
+ * @param {string} dir
11
+ * @param {string | undefined} configFilename
12
+ * @returns {string | undefined}
13
+ */
14
+ module.exports = (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME) => {
15
+ return isUsingTypescriptSync(dir)
16
+ ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir
17
+ : undefined;
18
+ };
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@strapi/typescript-utils",
3
- "version": "0.0.0-next.f7babb775ed9a7e18d8351cb7f74c63e016323c4",
3
+ "version": "0.0.0-next.f86041c89a8c1545c6437a881dc613e98bc52bd7",
4
4
  "description": "Typescript support for Strapi",
5
5
  "keywords": [
6
6
  "strapi",
7
7
  "generators"
8
8
  ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git://github.com/strapi/strapi.git",
12
+ "directory": "packages/utils/typescript"
13
+ },
9
14
  "license": "SEE LICENSE IN LICENSE",
10
15
  "author": {
11
16
  "name": "Strapi Solutions SAS",
@@ -31,15 +36,17 @@
31
36
  },
32
37
  "dependencies": {
33
38
  "chalk": "4.1.2",
34
- "cli-table3": "0.6.2",
35
- "fs-extra": "10.0.0",
39
+ "cli-table3": "0.6.5",
40
+ "fs-extra": "11.2.0",
36
41
  "lodash": "4.17.21",
37
- "prettier": "2.8.4",
38
- "typescript": "5.1.3"
42
+ "prettier": "3.3.3",
43
+ "typescript": "5.4.4"
44
+ },
45
+ "devDependencies": {
46
+ "@types/fs-extra": "11.0.4"
39
47
  },
40
48
  "engines": {
41
- "node": ">=16.0.0 <=20.x.x",
49
+ "node": ">=20.0.0 <=24.x.x",
42
50
  "npm": ">=6.0.0"
43
- },
44
- "gitHead": "f7babb775ed9a7e18d8351cb7f74c63e016323c4"
51
+ }
45
52
  }
@@ -1,20 +1,19 @@
1
1
  {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
-
4
- "compilerOptions": {
5
- "module": "ES2020",
6
- "moduleResolution": "node",
7
- "lib": ["ES2020", "DOM"],
8
- "target": "ES5",
9
-
10
- "jsx": "react",
11
- "sourceMap": true,
12
- "incremental": true,
13
-
14
- "allowJs": true,
15
- "allowSyntheticDefaultImports": true,
16
- "resolveJsonModule": true,
17
- "noEmit": true,
18
- "skipLibCheck": true
19
- }
20
- }
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "useDefineForClassFields": true,
8
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
9
+ "allowJs": false,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "strict": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ }
19
+ }
@@ -1,19 +1,21 @@
1
1
  {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
-
4
- "compilerOptions": {
5
- "module": "CommonJS",
6
- "moduleResolution": "Node",
7
- "lib": ["ES2020"],
8
- "target": "ES2019",
2
+ "$schema": "https://json.schemastore.org/tsconfig",
9
3
 
10
- "strict": false,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
4
+ "compilerOptions": {
5
+ "module": "CommonJS",
6
+ "moduleResolution": "Node",
7
+ "lib": ["ES2020"],
8
+ "target": "ES2019",
13
9
 
14
- "incremental": true,
15
- "esModuleInterop": true,
16
- "resolveJsonModule": true,
17
- "noEmitOnError": true
18
- }
19
- }
10
+ "strict": false,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+
14
+ "tsBuildInfoFile": "./.tsbuildinfo",
15
+ "incremental": true,
16
+ "esModuleInterop": true,
17
+ "resolveJsonModule": true,
18
+ "noEmitOnError": true,
19
+ "noImplicitThis": true
20
+ }
21
+ }
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const fs = require('fs-extra');
5
-
6
- module.exports = async (dest) => {
7
- const tsConfig = {
8
- compilerOptions: {
9
- lib: ['es2019', 'es2020.promise', 'es2020.bigint', 'es2020.string', 'DOM'],
10
- noImplicitAny: false,
11
- module: 'es2020',
12
- target: 'es5',
13
- jsx: 'react',
14
- allowJs: true,
15
- strict: true,
16
- moduleResolution: 'node',
17
- skipLibCheck: true,
18
- esModuleInterop: true,
19
- allowSyntheticDefaultImports: true,
20
- resolveJsonModule: true,
21
- noEmit: false,
22
- incremental: true,
23
- },
24
- include: ['../../../src/admin/*', '../../../src/**/**/admin/src/*'],
25
- exclude: ['node_modules', '**/*.test.js', '*.js'],
26
- };
27
-
28
- const filePath = path.join(dest, 'admin', 'src', 'tsconfig.json');
29
-
30
- try {
31
- await fs.ensureFile(filePath);
32
-
33
- await fs.writeJSON(filePath, tsConfig, { spaces: 2 });
34
- } catch (err) {
35
- console.log(err);
36
- }
37
- };
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const createTSConfigFile = require('./create-tsconfig-file');
4
-
5
- module.exports = { createTSConfigFile };
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- const ts = require('typescript');
4
-
5
- const reportDiagnostics = require('../utils/report-diagnostics');
6
- const formatHost = require('../utils/format-host');
7
- const resolveConfigOptions = require('../utils/resolve-config-options');
8
-
9
- /**
10
- * Prints a diagnostic every time the watch status changes.
11
- * This is mainly for messages like "Starting compilation" or "Compilation completed".
12
- */
13
- const reportWatchStatusChanged = (diagnostic) => {
14
- console.info(ts.formatDiagnostic(diagnostic, formatHost));
15
- };
16
-
17
- module.exports = {
18
- run(configPath) {
19
- const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
20
-
21
- const { fileNames, options, projectReferences, watchOptions } =
22
- resolveConfigOptions(configPath);
23
-
24
- const host = ts.createWatchCompilerHost(
25
- fileNames,
26
- options,
27
- ts.sys,
28
- createProgram,
29
- reportDiagnostics,
30
- reportWatchStatusChanged,
31
- projectReferences,
32
- watchOptions
33
- );
34
-
35
- ts.createWatchProgram(host);
36
- },
37
- };