@promoboxx/react-scripts-vite 0.1.26 → 0.1.28-rc.1
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/dist/cli.js +14 -32
- package/dist/replaceEnvInHtml.js +5 -5
- package/dist/viteConfig.js +15 -23
- package/package.json +11 -11
package/dist/cli.js
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __assign = (this && this.__assign) || function () {
|
|
4
|
-
__assign = Object.assign || function(t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
return __assign.apply(this, arguments);
|
|
13
|
-
};
|
|
14
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
15
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
16
|
-
if (ar || !(i in from)) {
|
|
17
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
18
|
-
ar[i] = from[i];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
22
|
-
};
|
|
23
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
25
5
|
function main(command, args) {
|
|
26
6
|
switch (command) {
|
|
27
7
|
case 'start':
|
|
@@ -33,29 +13,31 @@ function main(command, args) {
|
|
|
33
13
|
spawnAndExit('./node_modules/.bin/vitest', args, { NODE_ENV: 'test' });
|
|
34
14
|
break;
|
|
35
15
|
case 'build':
|
|
36
|
-
spawnAndExit('./node_modules/.bin/vite',
|
|
16
|
+
spawnAndExit('./node_modules/.bin/vite', ['build', ...args], {
|
|
37
17
|
NODE_ENV: 'production',
|
|
38
18
|
});
|
|
39
19
|
break;
|
|
40
20
|
default:
|
|
41
|
-
throw new Error(
|
|
21
|
+
throw new Error(`Unknown command: ${command}`);
|
|
42
22
|
}
|
|
43
23
|
}
|
|
44
|
-
function spawnAndExit(command, args, env) {
|
|
45
|
-
|
|
46
|
-
var child = (0, child_process_1.spawn)(command, args, {
|
|
24
|
+
function spawnAndExit(command, args = [], env) {
|
|
25
|
+
const child = (0, child_process_1.spawn)(command, args, {
|
|
47
26
|
stdio: 'inherit',
|
|
48
|
-
env:
|
|
27
|
+
env: {
|
|
28
|
+
...process.env,
|
|
29
|
+
...env,
|
|
30
|
+
},
|
|
49
31
|
// shell: true,
|
|
50
32
|
});
|
|
51
|
-
child.on('exit',
|
|
52
|
-
process.exit(code
|
|
33
|
+
child.on('exit', (code) => {
|
|
34
|
+
process.exit(code ?? undefined);
|
|
53
35
|
});
|
|
54
36
|
}
|
|
55
|
-
|
|
37
|
+
const [
|
|
56
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
-
_interpreter
|
|
39
|
+
_interpreter,
|
|
58
40
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
|
-
_thisFile
|
|
41
|
+
_thisFile, command, ...args] = process.argv;
|
|
60
42
|
main(command, args);
|
|
61
43
|
//# sourceMappingURL=cli.js.map
|
package/dist/replaceEnvInHtml.js
CHANGED
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
* @see https://vitejs.dev/guide/api-plugin.html#transformindexhtml
|
|
7
7
|
*/
|
|
8
8
|
function replaceEnvInHtml() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let config = undefined;
|
|
10
|
+
const plugin = {
|
|
11
11
|
name: 'replace-env-in-html',
|
|
12
|
-
configResolved
|
|
12
|
+
configResolved(resolvedConfig) {
|
|
13
13
|
config = resolvedConfig;
|
|
14
14
|
},
|
|
15
15
|
transformIndexHtml: {
|
|
16
16
|
enforce: 'pre',
|
|
17
|
-
transform
|
|
18
|
-
return html.replace(/%(.*?)%/g,
|
|
17
|
+
transform(html) {
|
|
18
|
+
return html.replace(/%(.*?)%/g, (match, envVarName) => config?.env?.[envVarName] ?? match);
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
};
|
package/dist/viteConfig.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.pluginOptions = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
|
|
9
|
+
const vite_plugin_checker_1 = __importDefault(require("vite-plugin-checker"));
|
|
10
|
+
const vite_plugin_env_compatible_1 = __importDefault(require("vite-plugin-env-compatible"));
|
|
11
|
+
const vite_plugin_pwa_1 = require("vite-plugin-pwa");
|
|
12
|
+
const vite_plugin_svgr_1 = __importDefault(require("vite-plugin-svgr"));
|
|
13
|
+
const vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
|
|
14
|
+
const replaceEnvInHtml_1 = __importDefault(require("./replaceEnvInHtml"));
|
|
26
15
|
exports.pluginOptions = {
|
|
27
16
|
checker: {
|
|
28
17
|
eslint: process.env.DISABLE_ESLINT_PLUGIN === 'true'
|
|
29
18
|
? undefined
|
|
30
19
|
: {
|
|
31
|
-
lintCommand:
|
|
20
|
+
lintCommand: `eslint --max-warnings=${process.env.CI === 'true' ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`,
|
|
32
21
|
},
|
|
33
22
|
typescript: process.env.TSC_COMPILE_ON_ERROR !== 'true',
|
|
34
23
|
enableBuild: true,
|
|
@@ -38,10 +27,13 @@ exports.pluginOptions = {
|
|
|
38
27
|
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === 'true' ? 'classic' : undefined,
|
|
39
28
|
},
|
|
40
29
|
};
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
const viteConfig = () => {
|
|
31
|
+
const ENV_PREFIX = exports.pluginOptions.envPrefix || 'REACT_APP_';
|
|
43
32
|
if (exports.pluginOptions.envCompatible !== false) {
|
|
44
|
-
exports.pluginOptions.envCompatible =
|
|
33
|
+
exports.pluginOptions.envCompatible = {
|
|
34
|
+
prefix: ENV_PREFIX,
|
|
35
|
+
...exports.pluginOptions.envCompatible,
|
|
36
|
+
};
|
|
45
37
|
}
|
|
46
38
|
return {
|
|
47
39
|
base: process.env.PUBLIC_URL,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promoboxx/react-scripts-vite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28-rc.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@promoboxx/eslint-config": "^2.5.0",
|
|
18
|
-
"prettier": "^2.
|
|
19
|
-
"typescript": "^
|
|
18
|
+
"prettier": "^2.8.8",
|
|
19
|
+
"typescript": "^5.1.6"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vitejs/plugin-react": "^1.
|
|
22
|
+
"@vitejs/plugin-react": "^3.1.0",
|
|
23
23
|
"eslint": "^7.32.0",
|
|
24
|
-
"jsdom": "^
|
|
25
|
-
"vite": "^
|
|
26
|
-
"vite-plugin-checker": "^0.
|
|
24
|
+
"jsdom": "^22.1.0",
|
|
25
|
+
"vite": "^4.3.9",
|
|
26
|
+
"vite-plugin-checker": "^0.6.1",
|
|
27
27
|
"vite-plugin-env-compatible": "^1.1.1",
|
|
28
|
-
"vite-plugin-pwa": "^0.
|
|
29
|
-
"vite-plugin-svgr": "^
|
|
30
|
-
"vite-tsconfig-paths": "^
|
|
31
|
-
"vitest": "^0.
|
|
28
|
+
"vite-plugin-pwa": "^0.16.4",
|
|
29
|
+
"vite-plugin-svgr": "^3.2.0",
|
|
30
|
+
"vite-tsconfig-paths": "^4.2.0",
|
|
31
|
+
"vitest": "^0.32.2"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dist/cli.d.ts",
|