everything-dev 1.19.0 → 1.20.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/src/plugin.ts CHANGED
@@ -1213,11 +1213,17 @@ export default createPlugin({
1213
1213
  extendsAccount = extendsAccount || "dev.everything.near";
1214
1214
  extendsGateway = extendsGateway || "everything.dev";
1215
1215
 
1216
+ const s = p.spinner();
1217
+ s.start("Initializing project");
1218
+
1216
1219
  let parentPluginKeys: string[] = [];
1217
1220
  let parentConfig: BosConfig | null = null;
1218
1221
  try {
1219
- parentConfig = await timePhase(timings, "parent config", () =>
1220
- fetchParentConfig(extendsAccount, extendsGateway),
1222
+ parentConfig = await timePhase(
1223
+ timings,
1224
+ "parent config",
1225
+ () => fetchParentConfig(extendsAccount, extendsGateway),
1226
+ s,
1221
1227
  );
1222
1228
  if (parentConfig?.plugins && typeof parentConfig.plugins === "object") {
1223
1229
  parentPluginKeys = Object.keys(parentConfig.plugins);
@@ -1225,6 +1231,7 @@ export default createPlugin({
1225
1231
  } catch {}
1226
1232
 
1227
1233
  if (!input.noInteractive) {
1234
+ s.stop("Config fetched");
1228
1235
  const prompted = await promptInitOptions({
1229
1236
  extends: `bos://${extendsAccount}/${extendsGateway}`,
1230
1237
  directory,
@@ -1241,6 +1248,7 @@ export default createPlugin({
1241
1248
  domain = prompted.domain;
1242
1249
  withHost = prompted.withHost;
1243
1250
  plugins = prompted.plugins;
1251
+ s.start("Setting up project");
1244
1252
  }
1245
1253
 
1246
1254
  directory = directory || domain || extendsGateway;
@@ -1250,10 +1258,14 @@ export default createPlugin({
1250
1258
 
1251
1259
  if (!parentConfig) {
1252
1260
  try {
1253
- parentConfig = await timePhase(timings, "parent config", () =>
1254
- fetchParentConfig(extendsAccount, extendsGateway),
1261
+ parentConfig = await timePhase(
1262
+ timings,
1263
+ "parent config",
1264
+ () => fetchParentConfig(extendsAccount, extendsGateway),
1265
+ s,
1255
1266
  );
1256
1267
  } catch {
1268
+ s.stop("Failed");
1257
1269
  return {
1258
1270
  status: "error" as const,
1259
1271
  directory,
@@ -1273,12 +1285,16 @@ export default createPlugin({
1273
1285
  sourceDir,
1274
1286
  parentConfig: resolvedParentConfig,
1275
1287
  cleanup,
1276
- } = await timePhase(timings, "template source", () =>
1277
- resolveSourceDir({
1278
- extendsAccount,
1279
- extendsGateway,
1280
- source: input.source,
1281
- }),
1288
+ } = await timePhase(
1289
+ timings,
1290
+ "template source",
1291
+ () =>
1292
+ resolveSourceDir({
1293
+ extendsAccount,
1294
+ extendsGateway,
1295
+ source: input.source,
1296
+ }),
1297
+ s,
1282
1298
  );
1283
1299
 
1284
1300
  parentConfig = resolvedParentConfig;
@@ -1286,25 +1302,27 @@ export default createPlugin({
1286
1302
  const isMinimalScaffold = sourceDir === "";
1287
1303
 
1288
1304
  try {
1289
- const s = p.spinner();
1290
- s.start("Setting up project");
1291
-
1292
1305
  let filesCopied: number;
1293
1306
 
1294
1307
  if (isMinimalScaffold) {
1295
- filesCopied = await timePhase(timings, "scaffold project", () =>
1296
- scaffoldMinimalProject(targetDir, parentConfig as unknown as BosConfigInput, {
1297
- extendsAccount,
1298
- extendsGateway,
1299
- account: account || extendsAccount,
1300
- domain,
1301
- plugins,
1302
- withHost,
1303
- }),
1308
+ filesCopied = await timePhase(
1309
+ timings,
1310
+ "scaffold project",
1311
+ () =>
1312
+ scaffoldMinimalProject(targetDir, parentConfig as unknown as BosConfigInput, {
1313
+ extendsAccount,
1314
+ extendsGateway,
1315
+ account: account || extendsAccount,
1316
+ domain,
1317
+ plugins,
1318
+ withHost,
1319
+ }),
1320
+ s,
1304
1321
  );
1305
1322
  } else {
1306
1323
  const patterns = await readTemplatekeep(sourceDir);
1307
1324
  if (patterns.length === 0) {
1325
+ s.stop("Failed");
1308
1326
  return {
1309
1327
  status: "error" as const,
1310
1328
  directory,
@@ -1330,59 +1348,90 @@ export default createPlugin({
1330
1348
  }
1331
1349
  }
1332
1350
 
1333
- filesCopied = await timePhase(timings, "copy files", () =>
1334
- copyFilteredFiles(sourceDir, targetDir, patterns, {
1335
- withHost,
1336
- plugins,
1337
- pluginRoutes,
1338
- }),
1351
+ filesCopied = await timePhase(
1352
+ timings,
1353
+ "copy files",
1354
+ () =>
1355
+ copyFilteredFiles(sourceDir, targetDir, patterns, {
1356
+ withHost,
1357
+ plugins,
1358
+ pluginRoutes,
1359
+ }),
1360
+ s,
1339
1361
  );
1340
1362
 
1341
- await timePhase(timings, "personalize config", () =>
1342
- personalizeConfig(targetDir, {
1343
- extendsAccount,
1344
- extendsGateway,
1345
- account: account || extendsAccount,
1346
- domain: domain || extendsGateway,
1347
- plugins,
1348
- pluginRoutes,
1349
- workspaceOpts: { sourceDir },
1350
- withHost,
1351
- }),
1363
+ await timePhase(
1364
+ timings,
1365
+ "personalize config",
1366
+ () =>
1367
+ personalizeConfig(targetDir, {
1368
+ extendsAccount,
1369
+ extendsGateway,
1370
+ account: account || extendsAccount,
1371
+ domain: domain || extendsGateway,
1372
+ plugins,
1373
+ pluginRoutes,
1374
+ workspaceOpts: { sourceDir },
1375
+ withHost,
1376
+ }),
1377
+ s,
1352
1378
  );
1353
1379
 
1354
- await timePhase(timings, "write snapshot", () =>
1355
- writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
1356
- withHost,
1357
- plugins,
1358
- pluginRoutes,
1359
- }),
1380
+ await timePhase(
1381
+ timings,
1382
+ "write snapshot",
1383
+ () =>
1384
+ writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
1385
+ withHost,
1386
+ plugins,
1387
+ pluginRoutes,
1388
+ }),
1389
+ s,
1360
1390
  );
1361
1391
  }
1362
1392
 
1363
- const initConfig = await timePhase(timings, "resolve config", () =>
1364
- loadConfig({ cwd: targetDir }),
1393
+ const initConfig = await timePhase(
1394
+ timings,
1395
+ "resolve config",
1396
+ () => loadConfig({ cwd: targetDir }),
1397
+ s,
1365
1398
  );
1366
1399
  if (initConfig?.runtime) {
1367
- await timePhase(timings, "generate env/docker", async () => {
1368
- writeGeneratedInfra(targetDir, initConfig.runtime);
1369
- });
1400
+ await timePhase(
1401
+ timings,
1402
+ "generate env/docker",
1403
+ async () => {
1404
+ writeGeneratedInfra(targetDir, initConfig.runtime);
1405
+ },
1406
+ s,
1407
+ );
1370
1408
  }
1371
- await timePhase(timings, "create env file", async () => {
1372
- ensureEnvFile(targetDir);
1373
- });
1409
+ await timePhase(
1410
+ timings,
1411
+ "create env file",
1412
+ async () => {
1413
+ ensureEnvFile(targetDir);
1414
+ },
1415
+ s,
1416
+ );
1374
1417
 
1375
1418
  if (!input.noInstall) {
1376
- await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
1377
- await timePhase(timings, "generate types", () => runTypesGen(targetDir));
1378
- await timePhase(timings, "generate migrations", () =>
1379
- generateDatabaseMigrations(targetDir),
1419
+ await timePhase(timings, "install dependencies", () => runBunInstall(targetDir), s);
1420
+ await timePhase(timings, "generate types", () => runTypesGen(targetDir), s);
1421
+ await timePhase(
1422
+ timings,
1423
+ "generate migrations",
1424
+ () => generateDatabaseMigrations(targetDir),
1425
+ s,
1380
1426
  );
1381
1427
  }
1382
1428
 
1383
1429
  if (input.noInstall && initConfig?.config) {
1384
- await timePhase(timings, "generate code artifacts", () =>
1385
- generateCodeArtifacts(targetDir, initConfig.config),
1430
+ await timePhase(
1431
+ timings,
1432
+ "generate code artifacts",
1433
+ () => generateCodeArtifacts(targetDir, initConfig.config),
1434
+ s,
1386
1435
  );
1387
1436
  }
1388
1437