react-scripts-intlayer
Version:
Integrate Intlayer with Create React App using custom React scripts for internationalization i18n and advanced Webpack configurations
73 lines • 2.99 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var import_config = require("@intlayer/config");
var import_cross_spawn = __toESM(require("cross-spawn"));
const args = process.argv.slice(2);
const scriptIndex = args.findIndex(
(x) => x === "build" || x === "start" || x === "test"
);
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
switch (script) {
case "build":
case "start":
case "test": {
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
const scriptPath = import_config.ESMxCJSRequire.resolve(
`@craco/craco/dist/scripts/${script}`
);
const scriptArgs = args.slice(scriptIndex + 1);
const processArgs = nodeArgs.concat(scriptPath).concat([
...scriptArgs,
"--config",
"./node_modules/react-scripts-intlayer/dist/cjs/craco.config.cjs"
]);
const child = import_cross_spawn.default.sync("node", processArgs, {
stdio: "inherit"
});
if (child.signal) {
if (child.signal === "SIGKILL") {
(0, import_config.logger)(`
The build failed because the process exited too early.
This probably means the system ran out of memory or someone called
\`kill -9\` on the process.
`);
} else if (child.signal === "SIGTERM") {
(0, import_config.logger)(`
The build failed because the process exited too early.
Someone might have called \`kill\` or \`killall\`, or the system could
be shutting down.
`);
}
process.exit(1);
}
process.exit(child.status ?? void 0);
break;
}
default:
(0, import_config.logger)(`Unknown script "${script}".`);
(0, import_config.logger)("Perhaps you need to update craco?");
break;
}
//# sourceMappingURL=react-scripts-intlayer.cjs.map
;