@apps-in-toss/cli 0.0.40 → 1.0.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/index.cjs +633 -40
- package/dist/index.js +633 -40
- package/package.json +9 -3
package/dist/index.js
CHANGED
|
@@ -785,7 +785,7 @@ import assert from "assert";
|
|
|
785
785
|
import fs2 from "fs";
|
|
786
786
|
import path from "path";
|
|
787
787
|
import * as p from "@clack/prompts";
|
|
788
|
-
import { getPackageRoot, readZipContent } from "@
|
|
788
|
+
import { getPackageRoot, readZipContent } from "@granite-js/utils";
|
|
789
789
|
import { Command, Option } from "clipanion";
|
|
790
790
|
|
|
791
791
|
// src/utils/constants.ts
|
|
@@ -912,7 +912,7 @@ init_esm_shims();
|
|
|
912
912
|
import fs3 from "fs";
|
|
913
913
|
import path2 from "path";
|
|
914
914
|
import * as p2 from "@clack/prompts";
|
|
915
|
-
import { getPackageRoot as getPackageRoot2 } from "@
|
|
915
|
+
import { getPackageRoot as getPackageRoot2 } from "@granite-js/utils";
|
|
916
916
|
import { Command as Command2, Option as Option2 } from "clipanion";
|
|
917
917
|
|
|
918
918
|
// ../../.yarn/cache/es-toolkit-npm-1.32.0-019fc7c155-56ba965570.zip/node_modules/es-toolkit/dist/index.mjs
|
|
@@ -957,9 +957,10 @@ export default defineConfig({
|
|
|
957
957
|
});
|
|
958
958
|
`;
|
|
959
959
|
var REACT_NATIVE_FRAMEWORK_CONFIG_TEMPLATE = `import { appsInToss } from '@apps-in-toss/framework/plugins';
|
|
960
|
-
import { defineConfig } from 'react-native
|
|
960
|
+
import { defineConfig } from '@granite-js/react-native/config';
|
|
961
961
|
|
|
962
962
|
export default defineConfig({
|
|
963
|
+
scheme: 'intoss',
|
|
963
964
|
appName: '%%appName%%',
|
|
964
965
|
plugins: [
|
|
965
966
|
appsInToss({
|
|
@@ -976,7 +977,7 @@ export default defineConfig({
|
|
|
976
977
|
`;
|
|
977
978
|
var APP_TEMPLATE = `import { AppsInToss } from '@apps-in-toss/framework';
|
|
978
979
|
import { PropsWithChildren } from 'react';
|
|
979
|
-
import { InitialProps } from 'react-native
|
|
980
|
+
import { InitialProps } from '@granite-js/react-native';
|
|
980
981
|
import { context } from '../require.context';
|
|
981
982
|
|
|
982
983
|
function AppContainer({ children }: PropsWithChildren<InitialProps>) {
|
|
@@ -1019,17 +1020,17 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
|
1019
1020
|
dev: scripts?.scripts?.dev || scripts?.scripts?.start,
|
|
1020
1021
|
build: scripts?.scripts?.build
|
|
1021
1022
|
};
|
|
1022
|
-
scripts.scripts.dev = "
|
|
1023
|
-
scripts.scripts.build = "
|
|
1023
|
+
scripts.scripts.dev = "granite dev";
|
|
1024
|
+
scripts.scripts.build = "granite build";
|
|
1024
1025
|
scripts.scripts.deploy = "ait deploy";
|
|
1025
1026
|
await fs3.promises.writeFile(path2.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
|
|
1026
1027
|
encoding: "utf-8"
|
|
1027
1028
|
});
|
|
1028
1029
|
p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
|
|
1029
|
-
await fs3.promises.appendFile(path2.join(cwd, ".gitignore"), "\n.
|
|
1030
|
+
await fs3.promises.appendFile(path2.join(cwd, ".gitignore"), "\n.granite\n");
|
|
1030
1031
|
const placeholder = {
|
|
1031
|
-
dev: originalScripts.dev === "
|
|
1032
|
-
build: originalScripts.build === "
|
|
1032
|
+
dev: originalScripts.dev === "granite dev" ? "" : originalScripts.dev,
|
|
1033
|
+
build: originalScripts.build === "granite build" ? "" : originalScripts.build
|
|
1033
1034
|
};
|
|
1034
1035
|
const scriptInputs = skipInput ? placeholder : await p2.group(
|
|
1035
1036
|
{
|
|
@@ -1050,7 +1051,7 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
|
1050
1051
|
}
|
|
1051
1052
|
}
|
|
1052
1053
|
);
|
|
1053
|
-
p2.log.step("
|
|
1054
|
+
p2.log.step("granite.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
|
|
1054
1055
|
const webPort = skipInput ? "5173" : await p2.text({
|
|
1055
1056
|
message: "Enter web port",
|
|
1056
1057
|
placeholder: "5173",
|
|
@@ -1063,19 +1064,19 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
|
1063
1064
|
const config = transformTemplate(WEB_FRAMEWORK_CONFIG_TEMPLATE, {
|
|
1064
1065
|
appName,
|
|
1065
1066
|
webPort,
|
|
1066
|
-
webDevCommand: scriptInputs.dev === "
|
|
1067
|
-
webBuildCommand: scriptInputs.build === "
|
|
1067
|
+
webDevCommand: scriptInputs.dev === "granite dev" ? "" : scriptInputs.dev,
|
|
1068
|
+
webBuildCommand: scriptInputs.build === "granite build" ? "" : scriptInputs.build
|
|
1068
1069
|
});
|
|
1069
|
-
await fs3.promises.writeFile(path2.join(cwd, "
|
|
1070
|
+
await fs3.promises.writeFile(path2.join(cwd, "granite.config.ts"), config, {
|
|
1070
1071
|
encoding: "utf-8"
|
|
1071
1072
|
});
|
|
1072
1073
|
}
|
|
1073
1074
|
async function templateReactNative({ appName, cwd }) {
|
|
1074
|
-
p2.log.step("
|
|
1075
|
+
p2.log.step("granite.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
|
|
1075
1076
|
const config = transformTemplate(REACT_NATIVE_FRAMEWORK_CONFIG_TEMPLATE, {
|
|
1076
1077
|
appName
|
|
1077
1078
|
});
|
|
1078
|
-
await fs3.promises.writeFile(path2.join(cwd, "
|
|
1079
|
+
await fs3.promises.writeFile(path2.join(cwd, "granite.config.ts"), config, {
|
|
1079
1080
|
encoding: "utf-8"
|
|
1080
1081
|
});
|
|
1081
1082
|
p2.log.step("src/_app.tsx \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
|
|
@@ -1101,8 +1102,8 @@ var InitCommand = class extends Command2 {
|
|
|
1101
1102
|
},
|
|
1102
1103
|
{
|
|
1103
1104
|
value: "react-native",
|
|
1104
|
-
label: "React Native \uD504\uB808\uC784\uC6CC\uD06C (
|
|
1105
|
-
hint: "
|
|
1105
|
+
label: "React Native \uD504\uB808\uC784\uC6CC\uD06C (Granite)",
|
|
1106
|
+
hint: "Granite \uD504\uB85C\uC81D\uD2B8\uC5D0 \uC571\uC778\uD1A0\uC2A4 React Native\uC6A9 \uAC1C\uBC1C\uD658\uACBD\uC744 \uC138\uD305\uD569\uB2C8\uB2E4."
|
|
1106
1107
|
}
|
|
1107
1108
|
]
|
|
1108
1109
|
})
|
|
@@ -1154,19 +1155,610 @@ var InitCommand = class extends Command2 {
|
|
|
1154
1155
|
}
|
|
1155
1156
|
};
|
|
1156
1157
|
|
|
1158
|
+
// src/MigrateCommand/index.ts
|
|
1159
|
+
init_esm_shims();
|
|
1160
|
+
|
|
1161
|
+
// src/MigrateCommand/MigrateCommand.ts
|
|
1162
|
+
init_esm_shims();
|
|
1163
|
+
import { Command as Command3, Option as Option3 } from "clipanion";
|
|
1164
|
+
|
|
1165
|
+
// src/MigrateCommand/logger/index.ts
|
|
1166
|
+
init_esm_shims();
|
|
1167
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1168
|
+
var Logger = class {
|
|
1169
|
+
prefix = import_picocolors2.default.bold(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" MIGRATE ")));
|
|
1170
|
+
log(...args) {
|
|
1171
|
+
console.log(this.prefix, ...args);
|
|
1172
|
+
}
|
|
1173
|
+
success(...args) {
|
|
1174
|
+
console.log(this.prefix, import_picocolors2.default.green("\u2713"), ...args);
|
|
1175
|
+
}
|
|
1176
|
+
error(...args) {
|
|
1177
|
+
console.error(this.prefix, import_picocolors2.default.red("\u2717"), ...args);
|
|
1178
|
+
}
|
|
1179
|
+
warn(...args) {
|
|
1180
|
+
console.warn(this.prefix, import_picocolors2.default.yellow("!"), ...args);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
var logger = new Logger();
|
|
1184
|
+
|
|
1185
|
+
// src/MigrateCommand/presets/index.ts
|
|
1186
|
+
init_esm_shims();
|
|
1187
|
+
|
|
1188
|
+
// src/MigrateCommand/presets/granite/index.ts
|
|
1189
|
+
init_esm_shims();
|
|
1190
|
+
|
|
1191
|
+
// src/MigrateCommand/presets/granite/migrateGranite.ts
|
|
1192
|
+
init_esm_shims();
|
|
1193
|
+
import assert2 from "assert";
|
|
1194
|
+
import dedent from "dedent";
|
|
1195
|
+
|
|
1196
|
+
// src/MigrateCommand/presets/granite/configProcessor.ts
|
|
1197
|
+
init_esm_shims();
|
|
1198
|
+
|
|
1199
|
+
// src/MigrateCommand/fs/fileProcessor.ts
|
|
1200
|
+
init_esm_shims();
|
|
1201
|
+
import { promises as fs4 } from "fs";
|
|
1202
|
+
async function readFile(filePath) {
|
|
1203
|
+
try {
|
|
1204
|
+
return await fs4.readFile(filePath, "utf-8");
|
|
1205
|
+
} catch {
|
|
1206
|
+
throw new Error(`Failed to read file: ${filePath}`);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
async function writeFile(filePath, content) {
|
|
1210
|
+
try {
|
|
1211
|
+
await fs4.writeFile(filePath, content, "utf-8");
|
|
1212
|
+
} catch {
|
|
1213
|
+
throw new Error(`Failed to write file: ${filePath}`);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
async function fileExists(filePath) {
|
|
1217
|
+
try {
|
|
1218
|
+
await fs4.access(filePath);
|
|
1219
|
+
return true;
|
|
1220
|
+
} catch {
|
|
1221
|
+
return false;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
async function renameFile(oldPath, newPath) {
|
|
1225
|
+
try {
|
|
1226
|
+
await fs4.rename(oldPath, newPath);
|
|
1227
|
+
} catch {
|
|
1228
|
+
throw new Error(`Failed to rename file: ${oldPath} -> ${newPath}`);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// src/MigrateCommand/presets/granite/configProcessor.ts
|
|
1233
|
+
var configTransformer = (root, { j }) => {
|
|
1234
|
+
root.find(j.ImportDeclaration).forEach((path5) => {
|
|
1235
|
+
const source = path5.value.source;
|
|
1236
|
+
if (j.StringLiteral.check(source) && source.value === "react-native-bedrock/config") {
|
|
1237
|
+
const defineConfigName = path5.value.specifiers?.find(
|
|
1238
|
+
(specifier) => j.ImportSpecifier.check(specifier) && specifier.imported.name === "defineConfig"
|
|
1239
|
+
)?.local?.name;
|
|
1240
|
+
if (!defineConfigName) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
root.find(j.CallExpression).forEach((path6) => {
|
|
1244
|
+
const callee = path6.value.callee;
|
|
1245
|
+
if (j.Identifier.check(callee) && callee.name === defineConfigName && path6.value.arguments.length > 0 && j.ObjectExpression.check(path6.value.arguments[0])) {
|
|
1246
|
+
const obj = path6.value.arguments[0];
|
|
1247
|
+
const hasScheme = obj.properties.some(
|
|
1248
|
+
(prop) => j.ObjectProperty.check(prop) && j.Identifier.check(prop.key) && prop.key.name === "scheme"
|
|
1249
|
+
);
|
|
1250
|
+
if (!hasScheme) {
|
|
1251
|
+
obj.properties.unshift(j.objectProperty(j.identifier("scheme"), j.stringLiteral("intoss")));
|
|
1252
|
+
}
|
|
1253
|
+
const routerImport = root.find(j.ImportDeclaration).filter((path7) => {
|
|
1254
|
+
const source2 = path7.value.source;
|
|
1255
|
+
return j.StringLiteral.check(source2) && source2.value === "@granite-js/plugin-router";
|
|
1256
|
+
});
|
|
1257
|
+
if (routerImport.length === 0) {
|
|
1258
|
+
const firstImport = root.find(j.ImportDeclaration).at(0);
|
|
1259
|
+
if (firstImport.length > 0) {
|
|
1260
|
+
firstImport.insertAfter(
|
|
1261
|
+
j.importDeclaration(
|
|
1262
|
+
[j.importSpecifier(j.identifier("router"))],
|
|
1263
|
+
j.stringLiteral("@granite-js/plugin-router")
|
|
1264
|
+
)
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
const hasPlugins = obj.properties.some(
|
|
1269
|
+
(prop) => j.ObjectProperty.check(prop) && j.Identifier.check(prop.key) && prop.key.name === "plugins"
|
|
1270
|
+
);
|
|
1271
|
+
const routerPluginCallExpr = j.callExpression(j.identifier("router"), []);
|
|
1272
|
+
if (hasPlugins) {
|
|
1273
|
+
const pluginsProp = obj.properties.find(
|
|
1274
|
+
(prop) => j.ObjectProperty.check(prop) && j.Identifier.check(prop.key) && prop.key.name === "plugins"
|
|
1275
|
+
);
|
|
1276
|
+
if (j.ObjectProperty.check(pluginsProp) && j.ArrayExpression.check(pluginsProp.value)) {
|
|
1277
|
+
const hasRouter = pluginsProp.value.elements.some(
|
|
1278
|
+
(element) => j.Identifier.check(element) && element.name === "router"
|
|
1279
|
+
);
|
|
1280
|
+
if (!hasRouter) {
|
|
1281
|
+
pluginsProp.value.elements.push(routerPluginCallExpr);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
} else {
|
|
1285
|
+
obj.properties.unshift(
|
|
1286
|
+
j.objectProperty(j.identifier("plugins"), j.arrayExpression([routerPluginCallExpr]))
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
return root;
|
|
1294
|
+
};
|
|
1295
|
+
var processBedrockConfig = async (cwd, config) => {
|
|
1296
|
+
logger.log("Processing bedrock.config.ts...");
|
|
1297
|
+
const bedrockConfigPath = `${cwd}/bedrock.config.ts`;
|
|
1298
|
+
const graniteConfigPath = `${cwd}/granite.config.ts`;
|
|
1299
|
+
if (!await fileExists(bedrockConfigPath)) {
|
|
1300
|
+
logger.log("No bedrock.config.ts found");
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
if (config.dryRun) {
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
try {
|
|
1307
|
+
await renameFile(bedrockConfigPath, graniteConfigPath);
|
|
1308
|
+
logger.success("Renamed bedrock.config.ts to granite.config.ts");
|
|
1309
|
+
} catch (error) {
|
|
1310
|
+
logger.error(`Failed to process bedrock.config.ts: ${error}`);
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
// src/MigrateCommand/presets/granite/gitignoreProcessor.ts
|
|
1315
|
+
init_esm_shims();
|
|
1316
|
+
var processGitignore = async (cwd, config) => {
|
|
1317
|
+
let modified = false;
|
|
1318
|
+
logger.log("Processing .gitignore...");
|
|
1319
|
+
const gitignorePath = `${cwd}/.gitignore`;
|
|
1320
|
+
try {
|
|
1321
|
+
if (await fileExists(gitignorePath)) {
|
|
1322
|
+
const content = await readFile(gitignorePath);
|
|
1323
|
+
const newContent = content.replace(/\.bedrock/g, ".granite");
|
|
1324
|
+
if (newContent !== content) {
|
|
1325
|
+
if (config.dryRun) {
|
|
1326
|
+
logger.log("Skipping file write in dry run mode");
|
|
1327
|
+
} else {
|
|
1328
|
+
await writeFile(gitignorePath, newContent);
|
|
1329
|
+
logger.success("Updated .gitignore");
|
|
1330
|
+
}
|
|
1331
|
+
modified ||= true;
|
|
1332
|
+
} else {
|
|
1333
|
+
logger.log(`No changes needed in ${gitignorePath}`);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
logger.error(`Failed to process .gitignore: ${error}`);
|
|
1338
|
+
}
|
|
1339
|
+
if (!modified) {
|
|
1340
|
+
logger.log("No .gitignore found");
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
// src/MigrateCommand/presets/granite/identifierReplacements.ts
|
|
1346
|
+
init_esm_shims();
|
|
1347
|
+
|
|
1348
|
+
// src/MigrateCommand/codemod/utils.ts
|
|
1349
|
+
init_esm_shims();
|
|
1350
|
+
function getIdentifierName(j, id) {
|
|
1351
|
+
if (typeof id === "string") {
|
|
1352
|
+
return id;
|
|
1353
|
+
}
|
|
1354
|
+
if (j.Identifier.check(id)) {
|
|
1355
|
+
return id.name;
|
|
1356
|
+
}
|
|
1357
|
+
return "";
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// src/MigrateCommand/presets/granite/identifierReplacements.ts
|
|
1361
|
+
var identifierReplacementsTransformer = (root, { j }) => {
|
|
1362
|
+
const importedVariables = /* @__PURE__ */ new Set();
|
|
1363
|
+
function toGraniteName(name) {
|
|
1364
|
+
let newName = null;
|
|
1365
|
+
if (name === "BedrockRoute") {
|
|
1366
|
+
newName = "createRoute";
|
|
1367
|
+
} else if (name.startsWith("bedrock")) {
|
|
1368
|
+
newName = toGraniteCamel(name);
|
|
1369
|
+
} else if (name.startsWith("Bedrock")) {
|
|
1370
|
+
newName = toGranitePascal(name);
|
|
1371
|
+
} else if (name.startsWith("BEDROCK")) {
|
|
1372
|
+
newName = toGraniteSnake(name);
|
|
1373
|
+
}
|
|
1374
|
+
return newName;
|
|
1375
|
+
}
|
|
1376
|
+
function toGraniteCamel(name) {
|
|
1377
|
+
const rest = name.substring(7);
|
|
1378
|
+
return "granite" + rest;
|
|
1379
|
+
}
|
|
1380
|
+
function toGranitePascal(name) {
|
|
1381
|
+
const rest = name.substring(7);
|
|
1382
|
+
return "Granite" + rest;
|
|
1383
|
+
}
|
|
1384
|
+
function toGraniteSnake(name) {
|
|
1385
|
+
const rest = name.substring(7);
|
|
1386
|
+
return "GRANITE" + rest;
|
|
1387
|
+
}
|
|
1388
|
+
root.find(j.ImportDeclaration, { source: { value: "react-native-bedrock" } }).forEach((importPath) => {
|
|
1389
|
+
importPath.value.specifiers?.forEach((specifier) => {
|
|
1390
|
+
if (j.ImportSpecifier.check(specifier)) {
|
|
1391
|
+
const importedName = getIdentifierName(j, specifier.imported);
|
|
1392
|
+
const localName = specifier.local ? getIdentifierName(j, specifier.local) : importedName;
|
|
1393
|
+
if (j.Identifier.check(specifier.imported)) {
|
|
1394
|
+
const newName = toGraniteName(importedName);
|
|
1395
|
+
if (newName) {
|
|
1396
|
+
specifier.imported.name = newName;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
importedVariables.add(localName);
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1403
|
+
root.find(j.Identifier).forEach((path5) => {
|
|
1404
|
+
const name = path5.value.name;
|
|
1405
|
+
if (importedVariables.has(name)) {
|
|
1406
|
+
const newName = toGraniteName(path5.value.name);
|
|
1407
|
+
if (newName) {
|
|
1408
|
+
path5.value.name = newName;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
return root;
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// src/MigrateCommand/presets/granite/isBedrockProject.ts
|
|
1416
|
+
init_esm_shims();
|
|
1417
|
+
import * as fs5 from "fs";
|
|
1418
|
+
var BASE_NAME = "bedrock.config";
|
|
1419
|
+
var EXTENSIONS = ["ts", "mts", "js", "cjs"];
|
|
1420
|
+
async function isBedrockProject(cwd) {
|
|
1421
|
+
const files = fs5.readdirSync(cwd);
|
|
1422
|
+
return files.some(isBedrockConfigFile);
|
|
1423
|
+
}
|
|
1424
|
+
function isBedrockConfigFile(file) {
|
|
1425
|
+
return EXTENSIONS.some((ext) => file === `${BASE_NAME}.${ext}`);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// src/MigrateCommand/presets/granite/packageImports.ts
|
|
1429
|
+
init_esm_shims();
|
|
1430
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
1431
|
+
|
|
1432
|
+
// src/MigrateCommand/presets/granite/constants.ts
|
|
1433
|
+
init_esm_shims();
|
|
1434
|
+
var UNSUPPORTED_LIBRARIES = [
|
|
1435
|
+
"@react-native-bedrock/e2e-testing-library",
|
|
1436
|
+
"@react-native-bedrock/babel-plugin-obfuscate"
|
|
1437
|
+
];
|
|
1438
|
+
var TARGET_VERSION = {
|
|
1439
|
+
granitePackages: "0.1.21",
|
|
1440
|
+
appsInTossPackages: "^1.0.0",
|
|
1441
|
+
tossDesignSystem: "^1.0.4"
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
// src/MigrateCommand/presets/granite/packageImports.ts
|
|
1445
|
+
var packageImportsTransformer = (root, { j }, { fileName = "<unknown>" }) => {
|
|
1446
|
+
function transformPackageName(value) {
|
|
1447
|
+
if (UNSUPPORTED_LIBRARIES.includes(value)) {
|
|
1448
|
+
const libName = import_picocolors3.default.gray(`(${value})`);
|
|
1449
|
+
logger.warn(`Unsupported library found ${libName}`);
|
|
1450
|
+
logger.warn(`\u2514\u2500 ${import_picocolors3.default.gray(`at ${fileName}`)}`);
|
|
1451
|
+
return value;
|
|
1452
|
+
}
|
|
1453
|
+
if (value === "react-native-bedrock" || value.startsWith("react-native-bedrock/")) {
|
|
1454
|
+
return value.replace("react-native-bedrock", "@granite-js/react-native");
|
|
1455
|
+
}
|
|
1456
|
+
if (value.startsWith("@react-native-bedrock/")) {
|
|
1457
|
+
return value.replace("@react-native-bedrock/", "@granite-js/");
|
|
1458
|
+
}
|
|
1459
|
+
return value;
|
|
1460
|
+
}
|
|
1461
|
+
root.find(j.ImportDeclaration).forEach((path5) => {
|
|
1462
|
+
const source = path5.value.source;
|
|
1463
|
+
if (j.StringLiteral.check(source)) {
|
|
1464
|
+
const transformed = transformPackageName(source.value);
|
|
1465
|
+
if (transformed !== source.value) {
|
|
1466
|
+
source.value = transformed;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
root.find(j.CallExpression, {
|
|
1471
|
+
callee: { name: "require" }
|
|
1472
|
+
}).forEach((path5) => {
|
|
1473
|
+
const args = path5.value.arguments;
|
|
1474
|
+
if (args.length > 0 && j.StringLiteral.check(args[0])) {
|
|
1475
|
+
const transformed = transformPackageName(args[0].value);
|
|
1476
|
+
if (transformed !== args[0].value) {
|
|
1477
|
+
args[0].value = transformed;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
root.find(j.ImportExpression).forEach((path5) => {
|
|
1482
|
+
const source = path5.value.source;
|
|
1483
|
+
if (j.StringLiteral.check(source)) {
|
|
1484
|
+
const transformed = transformPackageName(source.value);
|
|
1485
|
+
if (transformed !== source.value) {
|
|
1486
|
+
source.value = transformed;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
return root;
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
// src/MigrateCommand/presets/granite/packageJsonProcessor.ts
|
|
1494
|
+
init_esm_shims();
|
|
1495
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
1496
|
+
var processPackageJson = async (cwd, config) => {
|
|
1497
|
+
logger.log("Processing package.json...");
|
|
1498
|
+
const packageJsonPath = `${cwd}/package.json`;
|
|
1499
|
+
if (!await fileExists(packageJsonPath)) {
|
|
1500
|
+
logger.log("No package.json found");
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
try {
|
|
1504
|
+
const content = await readFile(packageJsonPath);
|
|
1505
|
+
const packageJson = JSON.parse(content);
|
|
1506
|
+
let modified = false;
|
|
1507
|
+
const depFields = ["dependencies", "devDependencies", "peerDependencies"];
|
|
1508
|
+
for (const field of depFields) {
|
|
1509
|
+
if (packageJson[field]) {
|
|
1510
|
+
const deps = packageJson[field];
|
|
1511
|
+
const newDeps = {
|
|
1512
|
+
"@granite-js/plugin-router": TARGET_VERSION.granitePackages
|
|
1513
|
+
};
|
|
1514
|
+
for (const [originLibName, originLibVersion] of Object.entries(deps)) {
|
|
1515
|
+
let libName = originLibName;
|
|
1516
|
+
let libVersion = originLibVersion;
|
|
1517
|
+
if (originLibName === "react-native-bedrock") {
|
|
1518
|
+
libName = "@granite-js/react-native";
|
|
1519
|
+
libVersion = TARGET_VERSION.granitePackages;
|
|
1520
|
+
} else if (originLibName.startsWith("@react-native-bedrock/")) {
|
|
1521
|
+
if (UNSUPPORTED_LIBRARIES.includes(originLibName)) {
|
|
1522
|
+
const packageName = import_picocolors4.default.gray(`(${originLibName})`);
|
|
1523
|
+
logger.warn(`Unsupported library found in package.json ${packageName}`);
|
|
1524
|
+
} else {
|
|
1525
|
+
libName = originLibName.replace("@react-native-bedrock", "@granite-js");
|
|
1526
|
+
libVersion = TARGET_VERSION.granitePackages;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
if (libName.startsWith("@apps-in-toss/")) {
|
|
1530
|
+
libVersion = TARGET_VERSION.appsInTossPackages;
|
|
1531
|
+
} else if (libName === "@toss-design-system/react-native") {
|
|
1532
|
+
libVersion = TARGET_VERSION.tossDesignSystem;
|
|
1533
|
+
}
|
|
1534
|
+
newDeps[libName] = libVersion;
|
|
1535
|
+
modified ||= libName !== originLibName;
|
|
1536
|
+
}
|
|
1537
|
+
packageJson[field] = newDeps;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
if (packageJson.scripts) {
|
|
1541
|
+
const scripts = packageJson.scripts;
|
|
1542
|
+
for (const [key, value] of Object.entries(scripts)) {
|
|
1543
|
+
if (typeof value === "string" && value.includes("bedrock")) {
|
|
1544
|
+
scripts[key] = value.replace(/\bbedrock\b/g, "granite");
|
|
1545
|
+
modified ||= true;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
if (config.dryRun) {
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
if (modified) {
|
|
1553
|
+
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
1554
|
+
logger.success("Updated package.json");
|
|
1555
|
+
} else {
|
|
1556
|
+
logger.log("No changes needed in package.json");
|
|
1557
|
+
}
|
|
1558
|
+
} catch (error) {
|
|
1559
|
+
logger.error(`Failed to process package.json: ${error}`);
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
// src/MigrateCommand/presets/granite/toAppsInTossFrameworkImport.ts
|
|
1564
|
+
init_esm_shims();
|
|
1565
|
+
var APPS_IN_TOSS_FRAMEWORK_EXPORTS = [
|
|
1566
|
+
"closeView",
|
|
1567
|
+
"getLocale",
|
|
1568
|
+
"getSchemeUri",
|
|
1569
|
+
"generateHapticFeedback",
|
|
1570
|
+
"share",
|
|
1571
|
+
"setSecureScreen",
|
|
1572
|
+
"setScreenAwakeMode",
|
|
1573
|
+
"getNetworkStatus",
|
|
1574
|
+
"setIosSwipeGestureEnabled",
|
|
1575
|
+
"openURL",
|
|
1576
|
+
"getPlatformOS"
|
|
1577
|
+
];
|
|
1578
|
+
var toAppsInTossFrameworkImport = (root, { j }, { fileName = "<unknown>" }) => {
|
|
1579
|
+
const appsInTossFrameworkMembers = [];
|
|
1580
|
+
root.find(j.ImportDeclaration).forEach((path5) => {
|
|
1581
|
+
const source = path5.node.source.value;
|
|
1582
|
+
if (typeof source !== "string") {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
if (source === "@granite-js/react-native") {
|
|
1586
|
+
if (Array.isArray(path5.node.specifiers)) {
|
|
1587
|
+
path5.node.specifiers = path5.node.specifiers.filter((specifier) => {
|
|
1588
|
+
if (shouldImportFromAppsInTossFramework(fileName, specifier)) {
|
|
1589
|
+
appsInTossFrameworkMembers.push(specifier);
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
return true;
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
if (path5.node.specifiers?.length === 0) {
|
|
1596
|
+
j(path5).remove();
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
if (appsInTossFrameworkMembers.length > 0) {
|
|
1601
|
+
const importStatement = j.importDeclaration(appsInTossFrameworkMembers, j.literal("@apps-in-toss/framework"));
|
|
1602
|
+
root.find(j.Program).get("body", 0).insertBefore(importStatement);
|
|
1603
|
+
}
|
|
1604
|
+
return root;
|
|
1605
|
+
};
|
|
1606
|
+
function shouldImportFromAppsInTossFramework(fileName, specifier) {
|
|
1607
|
+
switch (specifier.type) {
|
|
1608
|
+
case "ImportSpecifier":
|
|
1609
|
+
return APPS_IN_TOSS_FRAMEWORK_EXPORTS.includes(String(specifier.imported.name));
|
|
1610
|
+
case "ImportDefaultSpecifier":
|
|
1611
|
+
case "ImportNamespaceSpecifier":
|
|
1612
|
+
default:
|
|
1613
|
+
logger.warn(`Unknown import specifier in ${fileName}`);
|
|
1614
|
+
return false;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
// src/MigrateCommand/codemod/index.ts
|
|
1619
|
+
init_esm_shims();
|
|
1620
|
+
|
|
1621
|
+
// src/MigrateCommand/codemod/transform.ts
|
|
1622
|
+
init_esm_shims();
|
|
1623
|
+
import jscodeshift from "jscodeshift";
|
|
1624
|
+
function transform(source, { transformers: transformers2, options = {} }) {
|
|
1625
|
+
const j = jscodeshift.withParser("tsx");
|
|
1626
|
+
const report = [];
|
|
1627
|
+
const stats = /* @__PURE__ */ new Map();
|
|
1628
|
+
const context = {
|
|
1629
|
+
j,
|
|
1630
|
+
jscodeshift: j,
|
|
1631
|
+
stats: (name, quantity = 1) => {
|
|
1632
|
+
if (quantity === 0) {
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
stats.set(name, (stats.get(name) ?? 0) + quantity);
|
|
1636
|
+
},
|
|
1637
|
+
report: (message) => {
|
|
1638
|
+
report.push(message);
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
const root = transformers2.reduce((root2, transformer) => transformer(root2, context, options), j(source));
|
|
1642
|
+
return root.toSource();
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
// src/MigrateCommand/fs/fileScanner.ts
|
|
1646
|
+
init_esm_shims();
|
|
1647
|
+
import glob from "fast-glob";
|
|
1648
|
+
var DEFAULT_EXTENSIONS = ["js", "ts", "jsx", "tsx", "cjs", "mjs"];
|
|
1649
|
+
var DEFAULT_EXCLUDE_PATTERNS = ["**/node_modules/**", "**/.git/**", "**/dist/**"];
|
|
1650
|
+
async function scanFiles(directory, options = {}) {
|
|
1651
|
+
const { extensions = DEFAULT_EXTENSIONS, excludePatterns = DEFAULT_EXCLUDE_PATTERNS } = options;
|
|
1652
|
+
const patterns = extensions.map((ext) => `**/*.${ext}`);
|
|
1653
|
+
const files = await glob(patterns, {
|
|
1654
|
+
cwd: directory,
|
|
1655
|
+
absolute: true,
|
|
1656
|
+
ignore: excludePatterns
|
|
1657
|
+
});
|
|
1658
|
+
return files;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// src/MigrateCommand/presets/granite/migrateGranite.ts
|
|
1662
|
+
var transformers = [
|
|
1663
|
+
configTransformer,
|
|
1664
|
+
identifierReplacementsTransformer,
|
|
1665
|
+
packageImportsTransformer,
|
|
1666
|
+
toAppsInTossFrameworkImport
|
|
1667
|
+
];
|
|
1668
|
+
var migrateGranite = async (cwd, config) => {
|
|
1669
|
+
assert2(isBedrockProject(cwd), "This is not a Bedrock project");
|
|
1670
|
+
let processedCount = 0;
|
|
1671
|
+
const files = await scanFiles(cwd);
|
|
1672
|
+
logger.log(`Found ${files.length} source files`);
|
|
1673
|
+
logger.log("Processing source files...");
|
|
1674
|
+
for (const file of files) {
|
|
1675
|
+
try {
|
|
1676
|
+
const content = await readFile(file);
|
|
1677
|
+
const newContent = await transform(content, {
|
|
1678
|
+
transformers,
|
|
1679
|
+
options: {
|
|
1680
|
+
fileName: file
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
if (config.dryRun !== true && newContent !== content) {
|
|
1684
|
+
await writeFile(file, newContent);
|
|
1685
|
+
processedCount++;
|
|
1686
|
+
}
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
logger.error(`Failed to process file: ${file}`, error);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
if (processedCount > 0) {
|
|
1692
|
+
logger.success(`Processed ${processedCount} source files`);
|
|
1693
|
+
} else {
|
|
1694
|
+
logger.log("No source files needed processing");
|
|
1695
|
+
}
|
|
1696
|
+
await processPackageJson(cwd, config);
|
|
1697
|
+
await processGitignore(cwd, config);
|
|
1698
|
+
await processBedrockConfig(cwd, config);
|
|
1699
|
+
logger.log(dedent`
|
|
1700
|
+
Please check the following steps:
|
|
1701
|
+
|
|
1702
|
+
- Install dependencies
|
|
1703
|
+
- Run type checks
|
|
1704
|
+
- Run lint checks if a lint config exists
|
|
1705
|
+
- Verify test results if tests are present\n
|
|
1706
|
+
`);
|
|
1707
|
+
};
|
|
1708
|
+
|
|
1709
|
+
// src/MigrateCommand/presets/index.ts
|
|
1710
|
+
var MIGRATE_PRESETS = {
|
|
1711
|
+
granite: migrateGranite
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
// src/MigrateCommand/MigrateCommand.ts
|
|
1715
|
+
var MigrateCommand = class extends Command3 {
|
|
1716
|
+
static paths = [[`migrate`]];
|
|
1717
|
+
static usage = Command3.Usage({
|
|
1718
|
+
category: "Migration",
|
|
1719
|
+
description: "Run migration",
|
|
1720
|
+
examples: [
|
|
1721
|
+
["Run migration", "ait migrate <target>"],
|
|
1722
|
+
["Check migration availability", "ait migrate <target> --dryRun"]
|
|
1723
|
+
]
|
|
1724
|
+
});
|
|
1725
|
+
target = Option3.String({ required: true });
|
|
1726
|
+
dryRun = Option3.Boolean("--dry-run", { required: false });
|
|
1727
|
+
async execute() {
|
|
1728
|
+
try {
|
|
1729
|
+
const cwd = process.cwd();
|
|
1730
|
+
const config = {
|
|
1731
|
+
dryRun: this.dryRun
|
|
1732
|
+
};
|
|
1733
|
+
logger.log("Starting migration...");
|
|
1734
|
+
logger.log(`Working directory: ${cwd}`);
|
|
1735
|
+
const migrate = MIGRATE_PRESETS[this.target];
|
|
1736
|
+
if (migrate == null) {
|
|
1737
|
+
throw new Error(`Unknown target: ${this.target}`);
|
|
1738
|
+
}
|
|
1739
|
+
await migrate(cwd, config);
|
|
1740
|
+
logger.success("Migration completed successfully!");
|
|
1741
|
+
return 0;
|
|
1742
|
+
} catch (error) {
|
|
1743
|
+
logger.error(`Migration failed: ${error.message}`);
|
|
1744
|
+
return 1;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1157
1749
|
// src/integrations/UploadSentrySourcemap/index.ts
|
|
1158
1750
|
init_esm_shims();
|
|
1159
1751
|
|
|
1160
1752
|
// src/integrations/UploadSentrySourcemap/UploadSentrySourcemap.ts
|
|
1161
1753
|
init_esm_shims();
|
|
1162
|
-
import * as
|
|
1754
|
+
import * as fs9 from "fs/promises";
|
|
1163
1755
|
import * as p3 from "@clack/prompts";
|
|
1164
|
-
import { Command as
|
|
1756
|
+
import { Command as Command4, Option as Option4 } from "clipanion";
|
|
1165
1757
|
|
|
1166
1758
|
// src/integrations/UploadSentrySourcemap/downloadArtifacts.ts
|
|
1167
1759
|
init_esm_shims();
|
|
1168
1760
|
var import_debug4 = __toESM(require_src(), 1);
|
|
1169
|
-
import * as
|
|
1761
|
+
import * as fs6 from "fs";
|
|
1170
1762
|
import * as os from "os";
|
|
1171
1763
|
import * as path3 from "path";
|
|
1172
1764
|
import { pipeline } from "stream";
|
|
@@ -1197,34 +1789,34 @@ async function downloadArtifacts(options) {
|
|
|
1197
1789
|
const tmpDir = await createTempDirectory();
|
|
1198
1790
|
const tmpFile = `${deploymentId}.zip`;
|
|
1199
1791
|
const tmpFilePath = path3.join(tmpDir.path, tmpFile);
|
|
1200
|
-
const fileStream =
|
|
1792
|
+
const fileStream = fs6.createWriteStream(tmpFilePath);
|
|
1201
1793
|
await streamPipeline(response.body, fileStream);
|
|
1202
1794
|
debug4("Artifacts downloaded", { tmpFilePath });
|
|
1203
1795
|
return tmpFilePath;
|
|
1204
1796
|
}
|
|
1205
1797
|
function createTempDirectory() {
|
|
1206
1798
|
const tempDir = path3.join(os.tmpdir(), "apps-in-toss", "sentry-integration");
|
|
1207
|
-
|
|
1799
|
+
fs6.mkdirSync(tempDir, { recursive: true });
|
|
1208
1800
|
debug4("Temp directory created", { tempDir });
|
|
1209
1801
|
return {
|
|
1210
1802
|
path: tempDir,
|
|
1211
1803
|
cleanup: () => {
|
|
1212
|
-
|
|
1804
|
+
fs6.rmSync(tempDir, { recursive: true, force: true });
|
|
1213
1805
|
}
|
|
1214
1806
|
};
|
|
1215
1807
|
}
|
|
1216
1808
|
|
|
1217
1809
|
// src/integrations/UploadSentrySourcemap/extractSentryDebugId.ts
|
|
1218
1810
|
init_esm_shims();
|
|
1219
|
-
import
|
|
1811
|
+
import fs7 from "fs/promises";
|
|
1220
1812
|
async function extractSentryDebugId(bundlePath) {
|
|
1221
|
-
const bundleContent = await
|
|
1813
|
+
const bundleContent = await fs7.readFile(bundlePath, "utf-8");
|
|
1222
1814
|
return bundleContent.match(/SENTRY_DEBUG_ID=([\w-]+)/)?.[1];
|
|
1223
1815
|
}
|
|
1224
1816
|
|
|
1225
1817
|
// src/integrations/UploadSentrySourcemap/extractSources.ts
|
|
1226
1818
|
init_esm_shims();
|
|
1227
|
-
import * as
|
|
1819
|
+
import * as fs8 from "fs";
|
|
1228
1820
|
import * as path4 from "path";
|
|
1229
1821
|
import { pipeline as pipeline2 } from "stream";
|
|
1230
1822
|
import { promisify as promisify2 } from "util";
|
|
@@ -1246,12 +1838,12 @@ async function extractSources(zipPath) {
|
|
|
1246
1838
|
hermesSourceMap: ""
|
|
1247
1839
|
}
|
|
1248
1840
|
};
|
|
1249
|
-
await
|
|
1841
|
+
await fs8.createReadStream(zipPath).pipe(unzipper.Parse()).on("entry", async (entry) => {
|
|
1250
1842
|
const isRoot = !entry.path.includes("/");
|
|
1251
1843
|
const fileName = path4.basename(entry.path);
|
|
1252
1844
|
const outputPath = path4.join(path4.dirname(zipPath), fileName);
|
|
1253
1845
|
if (isRoot) {
|
|
1254
|
-
entry.pipe(
|
|
1846
|
+
entry.pipe(fs8.createWriteStream(outputPath));
|
|
1255
1847
|
const platform = fileName.includes("android") ? "android" : "ios";
|
|
1256
1848
|
if (fileName.endsWith(".js")) {
|
|
1257
1849
|
sources[platform].packagerBundle = outputPath;
|
|
@@ -1279,7 +1871,7 @@ async function extractSources(zipPath) {
|
|
|
1279
1871
|
}
|
|
1280
1872
|
async function decompressGzip(gzFile) {
|
|
1281
1873
|
const outfile = gzFile.replace(/\.gz$/g, "");
|
|
1282
|
-
await pipe(
|
|
1874
|
+
await pipe(fs8.createReadStream(gzFile), zlib.createGunzip(), fs8.createWriteStream(outfile));
|
|
1283
1875
|
return outfile;
|
|
1284
1876
|
}
|
|
1285
1877
|
|
|
@@ -1310,33 +1902,33 @@ function uploadSourcemap(bundlePath, sourcemapPath, options) {
|
|
|
1310
1902
|
}
|
|
1311
1903
|
|
|
1312
1904
|
// src/integrations/UploadSentrySourcemap/UploadSentrySourcemap.ts
|
|
1313
|
-
var UploadSentrySourcemap = class extends
|
|
1905
|
+
var UploadSentrySourcemap = class extends Command4 {
|
|
1314
1906
|
static paths = [["sentry", "upload-sourcemap"]];
|
|
1315
|
-
apiKey =
|
|
1907
|
+
apiKey = Option4.String("--api-key", {
|
|
1316
1908
|
required: false,
|
|
1317
1909
|
description: "\uC778\uC99D API \uD0A4"
|
|
1318
1910
|
});
|
|
1319
|
-
appName =
|
|
1911
|
+
appName = Option4.String("--app-name", {
|
|
1320
1912
|
required: false,
|
|
1321
1913
|
description: "\uC571 \uC774\uB984"
|
|
1322
1914
|
});
|
|
1323
|
-
deploymentId =
|
|
1915
|
+
deploymentId = Option4.String("--deployment-id", {
|
|
1324
1916
|
required: false,
|
|
1325
1917
|
description: "\uBC30\uD3EC ID"
|
|
1326
1918
|
});
|
|
1327
|
-
sentryAuthToken =
|
|
1919
|
+
sentryAuthToken = Option4.String("--sentry-auth-token", {
|
|
1328
1920
|
required: false,
|
|
1329
1921
|
description: "Sentry \uC778\uC99D\uD0A4"
|
|
1330
1922
|
});
|
|
1331
|
-
sentryOrg =
|
|
1923
|
+
sentryOrg = Option4.String("--sentry-org", {
|
|
1332
1924
|
required: false,
|
|
1333
1925
|
description: "Sentry \uC870\uC9C1"
|
|
1334
1926
|
});
|
|
1335
|
-
sentryProject =
|
|
1927
|
+
sentryProject = Option4.String("--sentry-project", {
|
|
1336
1928
|
required: false,
|
|
1337
1929
|
description: "Sentry \uD504\uB85C\uC81D\uD2B8"
|
|
1338
1930
|
});
|
|
1339
|
-
baseUrl =
|
|
1931
|
+
baseUrl = Option4.String("--base-url", {
|
|
1340
1932
|
description: "API Base URL"
|
|
1341
1933
|
});
|
|
1342
1934
|
async execute() {
|
|
@@ -1392,11 +1984,11 @@ var UploadSentrySourcemap = class extends Command3 {
|
|
|
1392
1984
|
throw new Error("Sentry Debug ID\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
1393
1985
|
}
|
|
1394
1986
|
const mergedSourceMap = await mergeSourceMaps(
|
|
1395
|
-
await
|
|
1396
|
-
await
|
|
1987
|
+
await fs9.readFile(sources.packagerSourceMap, "utf-8"),
|
|
1988
|
+
await fs9.readFile(sources.hermesSourceMap, "utf-8")
|
|
1397
1989
|
);
|
|
1398
1990
|
const injectedSourceMap = injectSentryDebugId(mergedSourceMap, debugId);
|
|
1399
|
-
await
|
|
1991
|
+
await fs9.writeFile(sources.hermesSourceMap, JSON.stringify(injectedSourceMap, null, 2), "utf-8");
|
|
1400
1992
|
}
|
|
1401
1993
|
async promptRequiredValue(type, message, validateMessage) {
|
|
1402
1994
|
const result = await p3[type]({
|
|
@@ -1423,6 +2015,7 @@ function initialize() {
|
|
|
1423
2015
|
});
|
|
1424
2016
|
cli.register(DeployCommand);
|
|
1425
2017
|
cli.register(InitCommand);
|
|
2018
|
+
cli.register(MigrateCommand);
|
|
1426
2019
|
cli.register(UploadSentrySourcemap);
|
|
1427
2020
|
cli.runExit(process.argv.slice(2));
|
|
1428
2021
|
}
|