@strapi/typescript-utils 4.2.0-alpha.9 → 4.2.0-beta.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/lib/compile.js +0 -3
- package/lib/configs/admin.json +20 -0
- package/lib/configs/server.json +18 -0
- package/lib/utils/get-config-path.js +2 -2
- package/lib/utils/index.js +4 -6
- package/lib/utils/{is-typescript-project-sync.js → is-using-typescript-sync.js} +1 -1
- package/lib/utils/{is-typescript-project.js → is-using-typescript.js} +1 -1
- package/package.json +2 -2
- package/lib/utils/copy-resources.js +0 -12
package/lib/compile.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const compilers = require('./compilers');
|
|
4
4
|
const getConfigPath = require('./utils/get-config-path');
|
|
5
|
-
const copyResources = require('./utils/copy-resources');
|
|
6
5
|
|
|
7
6
|
module.exports = async (srcDir, { watch = false } = {}) => {
|
|
8
7
|
// TODO: Use the Strapi debug logger instead or don't log at all
|
|
@@ -12,6 +11,4 @@ module.exports = async (srcDir, { watch = false } = {}) => {
|
|
|
12
11
|
const configPath = getConfigPath(srcDir);
|
|
13
12
|
|
|
14
13
|
compiler.run(configPath);
|
|
15
|
-
|
|
16
|
-
await copyResources(srcDir);
|
|
17
14
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "CommonJS",
|
|
6
|
+
"moduleResolution": "Node",
|
|
7
|
+
"lib": ["ES2020"],
|
|
8
|
+
"target": "ES2019",
|
|
9
|
+
|
|
10
|
+
"strict": false,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"noEmitOnError": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const ts = require('typescript');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
6
6
|
|
|
7
|
-
module.exports = (dir, filename =
|
|
7
|
+
module.exports = (dir, filename = DEFAULT_TS_CONFIG_FILENAME) => {
|
|
8
8
|
return ts.findConfigFile(dir, ts.sys.fileExists, filename);
|
|
9
9
|
};
|
package/lib/utils/index.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const isUsingTypeScript = require('./is-using-typescript');
|
|
4
|
+
const isUsingTypeScriptSync = require('./is-using-typescript-sync');
|
|
5
5
|
const getConfigPath = require('./get-config-path');
|
|
6
6
|
const reportDiagnostics = require('./report-diagnostics');
|
|
7
7
|
const resolveConfigOptions = require('./resolve-config-options');
|
|
8
|
-
const copyResources = require('./copy-resources');
|
|
9
8
|
const formatHost = require('./format-host');
|
|
10
9
|
|
|
11
10
|
module.exports = {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
isUsingTypeScript,
|
|
12
|
+
isUsingTypeScriptSync,
|
|
14
13
|
getConfigPath,
|
|
15
14
|
reportDiagnostics,
|
|
16
15
|
resolveConfigOptions,
|
|
17
|
-
copyResources,
|
|
18
16
|
formatHost,
|
|
19
17
|
};
|
|
@@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
|
|
5
5
|
const getConfigPath = require('./get-config-path');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Checks if `dir` is a TypeScript
|
|
8
|
+
* Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
|
|
9
9
|
* @param {string} dir
|
|
10
10
|
* @param {string | undefined} filename
|
|
11
11
|
* @returns {boolean}
|
|
@@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
|
|
5
5
|
const getConfigPath = require('./get-config-path');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Checks if `dir` is a TypeScript
|
|
8
|
+
* Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
|
|
9
9
|
* @param {string} dir
|
|
10
10
|
* @param {string | undefined} filename
|
|
11
11
|
* @returns {Promise<boolean>}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/typescript-utils",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.2",
|
|
4
4
|
"description": "Typescript support for Strapi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"node": ">=12.22.0 <=16.x.x",
|
|
33
33
|
"npm": ">=6.0.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "bff73257e7695d6f361c91dda8cc810a2bb70b6e"
|
|
36
36
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fse = require('fs-extra');
|
|
5
|
-
|
|
6
|
-
const DEFAULT_RESOURCES_PATHS = ['public', 'favicon.ico', 'package.json'];
|
|
7
|
-
|
|
8
|
-
module.exports = async (dir, resources = DEFAULT_RESOURCES_PATHS) => {
|
|
9
|
-
await Promise.all(
|
|
10
|
-
resources.map(resourceName => fse.copy(resourceName, path.join(dir, 'dist', resourceName)))
|
|
11
|
-
);
|
|
12
|
-
};
|