@reactunity/scripts 0.4.1 → 0.7.0
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/bin/react-unity-scripts.js +2 -2
- package/config/eslintConfig.js +46 -0
- package/config/modules.js +14 -0
- package/config/web-inspector/Build/WebInspector.data +0 -0
- package/config/web-inspector/Build/WebInspector.framework.js +1 -1
- package/config/web-inspector/Build/WebInspector.wasm +0 -0
- package/config/web-inspector/index.html +86 -94
- package/config/webpack.config.js +9 -55
- package/lib/types/base.d.ts +8 -5
- package/package.json +24 -23
- package/scripts/init.js +1 -0
- package/scripts/lint.js +39 -0
- package/scripts/utils/verifyTypeScriptSetup.js +24 -8
|
Binary file
|
|
@@ -1,94 +1,86 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en-us">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
7
|
-
<title>dev-sample</title>
|
|
8
|
-
|
|
9
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">
|
|
10
|
-
|
|
11
|
-
<style>
|
|
12
|
-
html,
|
|
13
|
-
body {
|
|
14
|
-
font-size: 0;
|
|
15
|
-
margin: 0;
|
|
16
|
-
height: 100%;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#unity-canvas {
|
|
21
|
-
height: 100%;
|
|
22
|
-
width: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.loader-center {
|
|
26
|
-
position: absolute;
|
|
27
|
-
left: 0;
|
|
28
|
-
right: 0;
|
|
29
|
-
top: 50%;
|
|
30
|
-
height: 0;
|
|
31
|
-
overflow: visible;
|
|
32
|
-
display: block;
|
|
33
|
-
pointer-events: none;
|
|
34
|
-
user-select: none;
|
|
35
|
-
-webkit-user-select: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.loader {
|
|
39
|
-
position: absolute;
|
|
40
|
-
height: 50px;
|
|
41
|
-
top: -25px;
|
|
42
|
-
left: 50px;
|
|
43
|
-
right: 50px;
|
|
44
|
-
background: #c5cae9;
|
|
45
|
-
border-radius: 10px;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.loader-bar {
|
|
50
|
-
height: 100%;
|
|
51
|
-
background: #3f51b5;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var loader = document.querySelector("#loader-root");
|
|
89
|
-
loader.style.display = progress < 1 ? 'block' : 'none';
|
|
90
|
-
});
|
|
91
|
-
</script>
|
|
92
|
-
</body>
|
|
93
|
-
|
|
94
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en-us">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
7
|
+
<title>dev-sample</title>
|
|
8
|
+
|
|
9
|
+
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
html,
|
|
13
|
+
body {
|
|
14
|
+
font-size: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
height: 100%;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#unity-canvas {
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.loader-center {
|
|
26
|
+
position: absolute;
|
|
27
|
+
left: 0;
|
|
28
|
+
right: 0;
|
|
29
|
+
top: 50%;
|
|
30
|
+
height: 0;
|
|
31
|
+
overflow: visible;
|
|
32
|
+
display: block;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
user-select: none;
|
|
35
|
+
-webkit-user-select: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.loader {
|
|
39
|
+
position: absolute;
|
|
40
|
+
height: 50px;
|
|
41
|
+
top: -25px;
|
|
42
|
+
left: 50px;
|
|
43
|
+
right: 50px;
|
|
44
|
+
background: #c5cae9;
|
|
45
|
+
border-radius: 10px;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.loader-bar {
|
|
50
|
+
height: 100%;
|
|
51
|
+
background: #3f51b5;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
54
|
+
</head>
|
|
55
|
+
|
|
56
|
+
<body style="text-align: center">
|
|
57
|
+
<canvas id="unity-canvas"
|
|
58
|
+
style="background: #231F20"></canvas>
|
|
59
|
+
|
|
60
|
+
<div class="loader-center" id="loader-root">
|
|
61
|
+
<div class="loader">
|
|
62
|
+
<div class="loader-bar" id="loader-bar"></div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<script src="Build/WebInspector.loader.js"></script>
|
|
67
|
+
<script>
|
|
68
|
+
createUnityInstance(document.querySelector("#unity-canvas"), {
|
|
69
|
+
dataUrl: "Build/WebInspector.data",
|
|
70
|
+
frameworkUrl: "Build/WebInspector.framework.js",
|
|
71
|
+
codeUrl: "Build/WebInspector.wasm",
|
|
72
|
+
streamingAssetsUrl: "StreamingAssets",
|
|
73
|
+
companyName: "reactunity",
|
|
74
|
+
productName: "dev-sample",
|
|
75
|
+
productVersion: "0.1",
|
|
76
|
+
}, function onProgress(progress) {
|
|
77
|
+
var bar = document.querySelector("#loader-bar");
|
|
78
|
+
if (bar) bar.style.width = (progress * 100) + '%';
|
|
79
|
+
|
|
80
|
+
var loader = document.querySelector("#loader-root");
|
|
81
|
+
loader.style.display = progress < 1 ? 'block' : 'none';
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
</body>
|
|
85
|
+
|
|
86
|
+
</html>
|
package/config/webpack.config.js
CHANGED
|
@@ -19,6 +19,7 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM
|
|
|
19
19
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
20
20
|
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
|
|
21
21
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
|
22
|
+
const eslintConfig = require('./eslintConfig');
|
|
22
23
|
const paths = require('./paths');
|
|
23
24
|
const modules = require('./modules');
|
|
24
25
|
const getClientEnvironment = require('./env');
|
|
@@ -31,6 +32,7 @@ const restrictedGlobals = require('confusing-browser-globals');
|
|
|
31
32
|
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
|
|
32
33
|
// @remove-on-eject-end
|
|
33
34
|
|
|
35
|
+
|
|
34
36
|
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
|
35
37
|
const sourceMapVar = process.env.GENERATE_SOURCEMAP;
|
|
36
38
|
const shouldUseSourceMap = sourceMapVar !== 'false' && !!sourceMapVar;
|
|
@@ -58,19 +60,6 @@ const cssModuleRegex = /\.module\.css$/;
|
|
|
58
60
|
const sassRegex = /\.(scss|sass)$/;
|
|
59
61
|
const sassModuleRegex = /\.module\.(scss|sass)$/;
|
|
60
62
|
|
|
61
|
-
const hasJsxRuntime = (() => {
|
|
62
|
-
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
require.resolve('react/jsx-runtime');
|
|
68
|
-
return true;
|
|
69
|
-
} catch (e) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
})();
|
|
73
|
-
|
|
74
63
|
// This is the production and development configuration.
|
|
75
64
|
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
|
|
76
65
|
module.exports = function (webpackEnv) {
|
|
@@ -316,7 +305,7 @@ module.exports = function (webpackEnv) {
|
|
|
316
305
|
[
|
|
317
306
|
require.resolve('babel-preset-react-app'),
|
|
318
307
|
{
|
|
319
|
-
runtime: hasJsxRuntime ? 'automatic' : 'classic',
|
|
308
|
+
runtime: modules.hasJsxRuntime ? 'automatic' : 'classic',
|
|
320
309
|
absoluteRuntime: false,
|
|
321
310
|
},
|
|
322
311
|
],
|
|
@@ -494,7 +483,7 @@ module.exports = function (webpackEnv) {
|
|
|
494
483
|
loader: require.resolve('file-loader'),
|
|
495
484
|
// Exclude `js` files to keep "css" loader working as it injects
|
|
496
485
|
// its runtime that would otherwise be processed through "file" loader.
|
|
497
|
-
// Also exclude `
|
|
486
|
+
// Also exclude `json` extensions so they get processed
|
|
498
487
|
// by webpacks internal loaders.
|
|
499
488
|
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.json$/],
|
|
500
489
|
options: {
|
|
@@ -548,7 +537,10 @@ module.exports = function (webpackEnv) {
|
|
|
548
537
|
// solution that requires the user to opt into importing specific locales.
|
|
549
538
|
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
|
550
539
|
// You can remove this if you don't use Moment.js:
|
|
551
|
-
new webpack.IgnorePlugin(
|
|
540
|
+
new webpack.IgnorePlugin({
|
|
541
|
+
resourceRegExp: /^\.\/locale$/,
|
|
542
|
+
contextRegExp: /moment$/,
|
|
543
|
+
}),
|
|
552
544
|
|
|
553
545
|
// TypeScript type checking
|
|
554
546
|
useTypeScript &&
|
|
@@ -583,49 +575,11 @@ module.exports = function (webpackEnv) {
|
|
|
583
575
|
}),
|
|
584
576
|
!disableESLintPlugin &&
|
|
585
577
|
new ESLintPlugin({
|
|
586
|
-
// Plugin options
|
|
587
|
-
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
|
|
588
578
|
formatter: require.resolve('react-dev-utils/eslintFormatter'),
|
|
589
579
|
eslintPath: require.resolve('eslint'),
|
|
590
580
|
failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
|
|
591
581
|
context: paths.appSrc,
|
|
592
|
-
|
|
593
|
-
cacheLocation: path.resolve(
|
|
594
|
-
paths.appNodeModules,
|
|
595
|
-
'.cache/.eslintcache'
|
|
596
|
-
),
|
|
597
|
-
// ESLint class options
|
|
598
|
-
cwd: paths.appPath,
|
|
599
|
-
resolvePluginsRelativeTo: __dirname,
|
|
600
|
-
baseConfig: {
|
|
601
|
-
extends: [require.resolve('eslint-config-react-app')],
|
|
602
|
-
rules: {
|
|
603
|
-
...(!hasJsxRuntime && {
|
|
604
|
-
'react/react-in-jsx-scope': 'error',
|
|
605
|
-
}),
|
|
606
|
-
|
|
607
|
-
// Disable jsx-ally as it is irrelevant for us
|
|
608
|
-
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
|
|
609
|
-
'jsx-a11y/alt-text': 'off',
|
|
610
|
-
'jsx-a11y/anchor-has-content': 'off',
|
|
611
|
-
'jsx-a11y/anchor-is-valid': 'off',
|
|
612
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'off',
|
|
613
|
-
'jsx-a11y/aria-props': 'off',
|
|
614
|
-
'jsx-a11y/aria-proptypes': 'off',
|
|
615
|
-
'jsx-a11y/aria-role': 'off',
|
|
616
|
-
'jsx-a11y/aria-unsupported-elements': 'off',
|
|
617
|
-
'jsx-a11y/heading-has-content': 'off',
|
|
618
|
-
'jsx-a11y/iframe-has-title': 'off',
|
|
619
|
-
'jsx-a11y/img-redundant-alt': 'off',
|
|
620
|
-
'jsx-a11y/no-access-key': 'off',
|
|
621
|
-
'jsx-a11y/no-distracting-elements': 'off',
|
|
622
|
-
'jsx-a11y/no-redundant-roles': 'off',
|
|
623
|
-
'jsx-a11y/role-has-required-aria-props': 'off',
|
|
624
|
-
'jsx-a11y/role-supports-aria-props': 'off',
|
|
625
|
-
'jsx-a11y/scope': 'off',
|
|
626
|
-
'no-restricted-globals': ['error'].concat(restrictedGlobals.filter(x => x !== 'location')),
|
|
627
|
-
},
|
|
628
|
-
},
|
|
582
|
+
...eslintConfig,
|
|
629
583
|
}),
|
|
630
584
|
].filter(Boolean),
|
|
631
585
|
// Turn off performance processing because we utilize
|
package/lib/types/base.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference
|
|
1
|
+
/// <reference no-default-lib="true"/>
|
|
2
|
+
/// <reference lib="es2021" />
|
|
2
3
|
/// <reference types="react" />
|
|
3
|
-
/// <reference types="
|
|
4
|
-
/// <reference types="chai" />
|
|
5
|
-
|
|
6
|
-
declare var expect: Chai.ExpectStatic;
|
|
4
|
+
/// <reference types="webpack-env" />
|
|
7
5
|
|
|
8
6
|
declare namespace NodeJS {
|
|
9
7
|
interface ProcessEnv {
|
|
@@ -67,6 +65,11 @@ declare module '*.txt' {
|
|
|
67
65
|
export default value;
|
|
68
66
|
}
|
|
69
67
|
|
|
68
|
+
declare module '*.html' {
|
|
69
|
+
const value: string;
|
|
70
|
+
export default value;
|
|
71
|
+
}
|
|
72
|
+
|
|
70
73
|
declare module '!!raw-loader!*' {
|
|
71
74
|
const value: string;
|
|
72
75
|
export default value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactunity/scripts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Configuration and scripts for React Unity.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"types": "./lib/types/main.d.ts",
|
|
27
27
|
"typesVersions": {
|
|
28
28
|
"*": {
|
|
29
|
+
"main": [
|
|
30
|
+
"./lib/types/main.d.ts"
|
|
31
|
+
],
|
|
29
32
|
"editor": [
|
|
30
33
|
"./lib/types/editor.d.ts"
|
|
31
34
|
],
|
|
@@ -44,12 +47,12 @@
|
|
|
44
47
|
"preinstall": "npx only-allow@1.0.0 yarn"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@babel/core": "7.15.
|
|
48
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.
|
|
49
|
-
"@types/react": "^17.0.
|
|
50
|
-
"@types/webpack-env": "1.16.
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
52
|
-
"@typescript-eslint/parser": "^
|
|
50
|
+
"@babel/core": "7.15.8",
|
|
51
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.1",
|
|
52
|
+
"@types/react": "^17.0.30",
|
|
53
|
+
"@types/webpack-env": "1.16.3",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
55
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
53
56
|
"babel-eslint": "^10.1.0",
|
|
54
57
|
"babel-loader": "8.2.2",
|
|
55
58
|
"babel-plugin-named-asset-import": "^0.3.7",
|
|
@@ -58,50 +61,48 @@
|
|
|
58
61
|
"camelcase": "^6.2.0",
|
|
59
62
|
"case-sensitive-paths-webpack-plugin": "2.4.0",
|
|
60
63
|
"confusing-browser-globals": "^1.0.10",
|
|
61
|
-
"css-loader": "6.
|
|
64
|
+
"css-loader": "6.4.0",
|
|
62
65
|
"dotenv": "10.0.0",
|
|
63
66
|
"dotenv-expand": "5.1.0",
|
|
64
67
|
"eslint": "^7.32.0",
|
|
65
68
|
"eslint-config-react-app": "^6.0.0",
|
|
66
|
-
"eslint-plugin-
|
|
67
|
-
"eslint-plugin-
|
|
68
|
-
"eslint-plugin-jsx-a11y": "6.4.1",
|
|
69
|
-
"eslint-plugin-react": "^7.25.1",
|
|
69
|
+
"eslint-plugin-import": "^2.25.2",
|
|
70
|
+
"eslint-plugin-react": "^7.26.1",
|
|
70
71
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
71
|
-
"eslint-plugin-testing-library": "^4.12.
|
|
72
|
+
"eslint-plugin-testing-library": "^4.12.4",
|
|
72
73
|
"eslint-webpack-plugin": "^3.0.1",
|
|
73
74
|
"file-loader": "6.2.0",
|
|
74
75
|
"fs-extra": "^10.0.0",
|
|
75
76
|
"identity-obj-proxy": "3.0.0",
|
|
76
77
|
"null-loader": "^4.0.1",
|
|
77
78
|
"pnp-webpack-plugin": "1.7.0",
|
|
78
|
-
"prompts": "2.4.
|
|
79
|
+
"prompts": "2.4.2",
|
|
79
80
|
"raw-loader": "^4.0.2",
|
|
80
81
|
"react-app-polyfill": "^2.0.0",
|
|
81
82
|
"react-dev-utils": "https://github.com/ReactUnity/scripts/raw/main/temp/react-dev-utils-11.0.3-hotfix.tgz",
|
|
82
83
|
"react-refresh": "^0.10.0",
|
|
83
84
|
"resolve": "1.20.0",
|
|
84
85
|
"resolve-url-loader": "^4.0.0",
|
|
85
|
-
"sass-loader": "^12.
|
|
86
|
+
"sass-loader": "^12.2.0",
|
|
86
87
|
"semver": "7.3.5",
|
|
87
|
-
"style-loader": "3.
|
|
88
|
-
"terser-webpack-plugin": "5.2.
|
|
88
|
+
"style-loader": "3.3.0",
|
|
89
|
+
"terser-webpack-plugin": "5.2.4",
|
|
89
90
|
"ts-pnp": "1.2.0",
|
|
90
91
|
"url-loader": "4.1.1",
|
|
91
|
-
"webpack": "5.
|
|
92
|
-
"webpack-dev-server": "4.1
|
|
92
|
+
"webpack": "5.58.2",
|
|
93
|
+
"webpack-dev-server": "4.3.1"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
96
|
"react": "^17.0.2",
|
|
96
|
-
"typescript": "^4.4.
|
|
97
|
+
"typescript": "^4.4.4"
|
|
97
98
|
},
|
|
98
99
|
"optionalDependencies": {
|
|
99
100
|
"fsevents": "^2.3.2",
|
|
100
|
-
"sass": "^1.
|
|
101
|
+
"sass": "^1.43.2"
|
|
101
102
|
},
|
|
102
103
|
"peerDependencies": {
|
|
103
|
-
"@reactunity/renderer": "^0.
|
|
104
|
-
"typescript": "^4.4.
|
|
104
|
+
"@reactunity/renderer": "^0.7.0",
|
|
105
|
+
"typescript": "^4.4.4"
|
|
105
106
|
},
|
|
106
107
|
"peerDependenciesMeta": {
|
|
107
108
|
"typescript": {
|
package/scripts/init.js
CHANGED
package/scripts/lint.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @remove-on-eject-begin
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
// @remove-on-eject-end
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
// Do this as the first thing so that any code reading it knows the right env.
|
|
12
|
+
process.env.BABEL_ENV = process.env.BABEL_ENV || process.env.NODE_ENV || 'development';
|
|
13
|
+
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
14
|
+
|
|
15
|
+
// Makes the script crash on unhandled rejections instead of silently
|
|
16
|
+
// ignoring them. In the future, promise rejections that are not handled will
|
|
17
|
+
// terminate the Node.js process with a non-zero exit code.
|
|
18
|
+
process.on('unhandledRejection', err => {
|
|
19
|
+
throw err;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Ensure environment variables are read.
|
|
23
|
+
require('../config/env');
|
|
24
|
+
|
|
25
|
+
const paths = require('../config/paths');
|
|
26
|
+
const eslintConfig = require('../config/eslintConfig');
|
|
27
|
+
const formatter = require('react-dev-utils/eslintFormatter');
|
|
28
|
+
|
|
29
|
+
const { ESLint } = require("eslint");
|
|
30
|
+
|
|
31
|
+
(async function main() {
|
|
32
|
+
const eslint = new ESLint(eslintConfig);
|
|
33
|
+
const results = await eslint.lintFiles([paths.appSrc]);
|
|
34
|
+
const resultText = formatter(results);
|
|
35
|
+
console.log(resultText);
|
|
36
|
+
})().catch((error) => {
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
console.error(error);
|
|
39
|
+
});
|
|
@@ -263,6 +263,30 @@ function verifyTypeScriptSetup() {
|
|
|
263
263
|
);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
const types = appTsConfig.compilerOptions.types || (appTsConfig.compilerOptions.types = []);
|
|
267
|
+
|
|
268
|
+
if (!types.includes('@reactunity/scripts/main')) {
|
|
269
|
+
types.push('@reactunity/scripts/main');
|
|
270
|
+
messages.push(
|
|
271
|
+
`${chalk.cyan('types')} should include ${chalk.cyan.bold('@reactunity/scripts/main')}`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (!types.includes('@reactunity/scripts/ugui') && !types.includes('@reactunity/scripts/uitoolkit')
|
|
276
|
+
&& !types.includes('@reactunity/scripts/editor') && !types.includes('@reactunity/scripts/tests')) {
|
|
277
|
+
types.push('@reactunity/scripts/ugui');
|
|
278
|
+
messages.push(
|
|
279
|
+
`${chalk.cyan('types')} should include a valid platform target. Assuming ${chalk.cyan.bold('@reactunity/scripts/ugui')}`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Deprecate `react-unity-scripts` types
|
|
284
|
+
if (fs.existsSync(paths.appTypeDeclarations)) {
|
|
285
|
+
messages.push(
|
|
286
|
+
`References to ${chalk.cyan('@reactunity/scripts')} does not have to be in ${chalk.cyan.bold('react-unity.d.ts')} anymore. It can be removed.`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
266
290
|
if (messages.length > 0) {
|
|
267
291
|
if (firstTimeSetup) {
|
|
268
292
|
console.log(
|
|
@@ -288,14 +312,6 @@ function verifyTypeScriptSetup() {
|
|
|
288
312
|
}
|
|
289
313
|
writeJson(paths.appTsConfig, appTsConfig);
|
|
290
314
|
}
|
|
291
|
-
|
|
292
|
-
// Reference `react-unity-scripts` types
|
|
293
|
-
if (!fs.existsSync(paths.appTypeDeclarations)) {
|
|
294
|
-
fs.writeFileSync(
|
|
295
|
-
paths.appTypeDeclarations,
|
|
296
|
-
`/// <reference types="@reactunity/scripts" />${os.EOL}`
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
315
|
}
|
|
300
316
|
|
|
301
317
|
module.exports = verifyTypeScriptSetup;
|