@idevconn/create-icore 0.8.0 → 0.9.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/README.md +44 -9
- package/dist/cli.js +218 -48
- package/dist/index.cjs +198 -28
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +196 -26
- package/package.json +1 -1
- package/templates/docker-compose.yml +17 -0
- package/templates/libs/auth-strategies/mongodb/package.json +4 -0
package/dist/index.cjs
CHANGED
|
@@ -132,6 +132,11 @@ async function rewriteRootPackageJson(targetDir, opts) {
|
|
|
132
132
|
const deps = pkg["dependencies"] ??= {};
|
|
133
133
|
Object.assign(deps, MONGODB_DEPS);
|
|
134
134
|
}
|
|
135
|
+
if (opts.authProvider === "mongodb") {
|
|
136
|
+
const devDeps = pkg["devDependencies"] ??= {};
|
|
137
|
+
devDeps["@types/bcrypt"] = "^6.0.0";
|
|
138
|
+
devDeps["@types/jsonwebtoken"] = "^9.0.10";
|
|
139
|
+
}
|
|
135
140
|
if (opts.packageManager !== "yarn") {
|
|
136
141
|
delete pkg.packageManager;
|
|
137
142
|
} else {
|
|
@@ -267,6 +272,62 @@ async function removeFirebaseAdminLib(targetDir) {
|
|
|
267
272
|
"@icore/firebase-admin"
|
|
268
273
|
]);
|
|
269
274
|
}
|
|
275
|
+
async function removeAuthStack(targetDir) {
|
|
276
|
+
const rmPaths = [
|
|
277
|
+
"apps/microservices/auth",
|
|
278
|
+
"libs/auth-strategies",
|
|
279
|
+
"libs/auth-client",
|
|
280
|
+
"Dockerfile.ms-auth",
|
|
281
|
+
"apps/api/src/app/auth",
|
|
282
|
+
"apps/api/src/app/profile",
|
|
283
|
+
"apps/api/src/app/abilities",
|
|
284
|
+
"apps/client/src/components/auth",
|
|
285
|
+
"apps/client/src/routes/login.tsx",
|
|
286
|
+
"apps/client/src/routes/auth.callback.tsx",
|
|
287
|
+
"apps/client/src/routes/auth.oauth.callback.tsx",
|
|
288
|
+
"apps/client/src/routes/_dashboard/profile.tsx"
|
|
289
|
+
];
|
|
290
|
+
for (const p2 of rmPaths) {
|
|
291
|
+
await (0, import_promises2.rm)((0, import_node_path2.join)(targetDir, p2), { recursive: true, force: true });
|
|
292
|
+
}
|
|
293
|
+
const appModulePath = (0, import_node_path2.join)(targetDir, "apps/api/src/app/app.module.ts");
|
|
294
|
+
try {
|
|
295
|
+
const src = await (0, import_promises2.readFile)(appModulePath, "utf8");
|
|
296
|
+
const next = src.replace(/^import \{ AuthModule \} from '\.\/auth\/auth\.module';\n/m, "").replace(/^import \{ ProfileModule \} from '\.\/profile\/profile\.module';\n/m, "").replace(/^import \{ AbilitiesModule \} from '\.\/abilities\/abilities\.module';\n/m, "").replace(/\bAuthModule,\s*/g, "").replace(/,\s*AuthModule\b/g, "").replace(/\bProfileModule,\s*/g, "").replace(/,\s*ProfileModule\b/g, "").replace(/\bAbilitiesModule,\s*/g, "").replace(/,\s*AbilitiesModule\b/g, "");
|
|
297
|
+
await (0, import_promises2.writeFile)(appModulePath, next);
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
const dashboardPath = (0, import_node_path2.join)(targetDir, "apps/client/src/routes/_dashboard.tsx");
|
|
301
|
+
try {
|
|
302
|
+
const src = await (0, import_promises2.readFile)(dashboardPath, "utf8");
|
|
303
|
+
const next = src.replace(/^import \{ useAuthStore \} from '@icore\/template-shared';\n/m, "").replace(/, redirect/g, "").replace(/\n {2}beforeLoad: \(\) => \{[\s\S]*?\n {2}\},/m, "");
|
|
304
|
+
await (0, import_promises2.writeFile)(dashboardPath, next);
|
|
305
|
+
} catch {
|
|
306
|
+
}
|
|
307
|
+
for (const alias of [
|
|
308
|
+
"@icore/auth-client",
|
|
309
|
+
"@icore/auth-supabase",
|
|
310
|
+
"@icore/auth-firebase",
|
|
311
|
+
"@icore/auth-mongodb"
|
|
312
|
+
]) {
|
|
313
|
+
await stripTsconfigPath(targetDir, alias);
|
|
314
|
+
}
|
|
315
|
+
await stripDeps((0, import_node_path2.join)(targetDir, "apps/api/package.json"), ["@icore/auth-client"]);
|
|
316
|
+
const gatewayEnv = (0, import_node_path2.join)(targetDir, "apps/api/.env");
|
|
317
|
+
try {
|
|
318
|
+
const env = await (0, import_promises2.readFile)(gatewayEnv, "utf8");
|
|
319
|
+
const next = env.split("\n").filter((line) => !line.startsWith("AUTH_") && !line.startsWith("# AUTH_")).join("\n");
|
|
320
|
+
await (0, import_promises2.writeFile)(gatewayEnv, next);
|
|
321
|
+
} catch {
|
|
322
|
+
}
|
|
323
|
+
const composePath = (0, import_node_path2.join)(targetDir, "docker-compose.yml");
|
|
324
|
+
try {
|
|
325
|
+
const compose = await (0, import_promises2.readFile)(composePath, "utf8");
|
|
326
|
+
const next = compose.replace(/\n {2}auth:[\s\S]+?(?=\n {2}\w|\nnetworks:)/m, "\n").replace(/\n {6}auth:\n {8}condition: service_started/g, "").replace(/\n {6}AUTH_TRANSPORT:[^\n]*/g, "").replace(/\n {6}AUTH_REDIS_URL:[^\n]*/g, "");
|
|
327
|
+
await (0, import_promises2.writeFile)(composePath, next);
|
|
328
|
+
} catch {
|
|
329
|
+
}
|
|
330
|
+
}
|
|
270
331
|
async function removeUploadStack(targetDir) {
|
|
271
332
|
const paths = [
|
|
272
333
|
"apps/microservices/upload",
|
|
@@ -536,7 +597,8 @@ async function writeFeaturesWiring(targetDir, opts) {
|
|
|
536
597
|
export class FeaturesModule {}
|
|
537
598
|
`;
|
|
538
599
|
await (0, import_promises4.writeFile)((0, import_node_path4.join)(targetDir, FEATURES_MODULE), featuresModule);
|
|
539
|
-
const services = [
|
|
600
|
+
const services = [];
|
|
601
|
+
if (opts.authProvider !== "none") services.push({ name: "auth", prefix: "AUTH" });
|
|
540
602
|
if (opts.upload !== "none") services.push({ name: "upload", prefix: "UPLOAD" });
|
|
541
603
|
for (const k of chosen) {
|
|
542
604
|
const svc = FEATURES[k].gatewayService;
|
|
@@ -641,12 +703,14 @@ async function writeJson(targetDir, rel, data) {
|
|
|
641
703
|
}
|
|
642
704
|
async function writeServiceBlueprints(targetDir, opts) {
|
|
643
705
|
const t = opts.transport;
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
706
|
+
if (opts.authProvider !== "none") {
|
|
707
|
+
await writeJson(targetDir, "apps/microservices/auth", {
|
|
708
|
+
schemaVersion: 1,
|
|
709
|
+
service: "auth",
|
|
710
|
+
authProvider: opts.authProvider,
|
|
711
|
+
transport: t
|
|
712
|
+
});
|
|
713
|
+
}
|
|
650
714
|
if (opts.upload !== "none") {
|
|
651
715
|
await writeJson(targetDir, "apps/microservices/upload", {
|
|
652
716
|
schemaVersion: 1,
|
|
@@ -742,7 +806,9 @@ async function writePnpmWorkspace(targetDir) {
|
|
|
742
806
|
"@parcel/watcher",
|
|
743
807
|
"@scarf/scarf",
|
|
744
808
|
"@swc/core",
|
|
809
|
+
"bcrypt",
|
|
745
810
|
"less",
|
|
811
|
+
"mongodb-memory-server",
|
|
746
812
|
"msgpackr-extract",
|
|
747
813
|
"nx",
|
|
748
814
|
"protobufjs",
|
|
@@ -1086,7 +1152,7 @@ function runInstall(cwd, pm) {
|
|
|
1086
1152
|
async function scaffold(opts, templatesDir) {
|
|
1087
1153
|
await copyTree(templatesDir, opts.targetDir);
|
|
1088
1154
|
await rewriteRootPackageJson(opts.targetDir, opts);
|
|
1089
|
-
await writeAuthEnv(opts.targetDir, opts);
|
|
1155
|
+
if (opts.authProvider !== "none") await writeAuthEnv(opts.targetDir, opts);
|
|
1090
1156
|
await writeUploadEnv(opts.targetDir, opts);
|
|
1091
1157
|
await writeNotesEnv(opts.targetDir, opts);
|
|
1092
1158
|
await writePaymentEnv(opts.targetDir, opts);
|
|
@@ -1098,18 +1164,22 @@ async function scaffold(opts, templatesDir) {
|
|
|
1098
1164
|
await cleanupUnusedFeatures(opts.targetDir, opts);
|
|
1099
1165
|
await writeFeaturesWiring(opts.targetDir, opts);
|
|
1100
1166
|
await writeNavConfig(opts.targetDir, opts);
|
|
1101
|
-
|
|
1102
|
-
|
|
1167
|
+
if (opts.authProvider !== "none") {
|
|
1168
|
+
await cleanupUnusedAuth(opts.targetDir, opts.authProvider);
|
|
1169
|
+
await writeAuthProvider(opts.targetDir, opts.authProvider);
|
|
1170
|
+
} else {
|
|
1171
|
+
await removeAuthStack(opts.targetDir);
|
|
1172
|
+
}
|
|
1103
1173
|
if (opts.upload !== "none") {
|
|
1104
1174
|
await cleanupUnusedStorage(opts.targetDir, opts.upload);
|
|
1105
1175
|
await writeStorageProvider(opts.targetDir, opts.upload);
|
|
1106
1176
|
}
|
|
1107
|
-
if (opts.example !== "none") {
|
|
1108
|
-
await cleanupUnusedDb(opts.targetDir, opts.dbProvider);
|
|
1109
|
-
await writeDbProvider(opts.targetDir, opts.dbProvider);
|
|
1110
|
-
}
|
|
1111
1177
|
const firebaseUsed = opts.authProvider === "firebase" || opts.dbProvider === "firebase" || opts.upload === "firebase";
|
|
1112
1178
|
if (!firebaseUsed) await removeFirebaseAdminLib(opts.targetDir);
|
|
1179
|
+
await cleanupUnusedDb(opts.targetDir, opts.dbProvider);
|
|
1180
|
+
if (opts.dbProvider !== "none" && opts.example !== "none") {
|
|
1181
|
+
await writeDbProvider(opts.targetDir, opts.dbProvider);
|
|
1182
|
+
}
|
|
1113
1183
|
await pruneRootProviderDeps(opts.targetDir, opts);
|
|
1114
1184
|
await writeBlueprintJson(opts.targetDir, opts);
|
|
1115
1185
|
await writeServiceBlueprints(opts.targetDir, opts);
|
|
@@ -1132,9 +1202,98 @@ async function scaffold(opts, templatesDir) {
|
|
|
1132
1202
|
// src/lib/prompts.ts
|
|
1133
1203
|
var p = __toESM(require("@clack/prompts"), 1);
|
|
1134
1204
|
var import_node_path9 = require("path");
|
|
1135
|
-
var
|
|
1205
|
+
var import_promises10 = require("fs/promises");
|
|
1136
1206
|
var import_node_path10 = require("path");
|
|
1137
1207
|
var import_node_url = require("url");
|
|
1208
|
+
|
|
1209
|
+
// src/lib/config.ts
|
|
1210
|
+
var import_promises9 = require("fs/promises");
|
|
1211
|
+
var ConfigFileError = class extends Error {
|
|
1212
|
+
constructor(message) {
|
|
1213
|
+
super(message);
|
|
1214
|
+
this.name = "ConfigFileError";
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
var AUTH_PROVIDERS = ["supabase", "firebase", "mongodb", "none"];
|
|
1218
|
+
var DB_PROVIDERS = ["supabase", "firebase", "mongodb", "none"];
|
|
1219
|
+
var UPLOAD_PROVIDERS = [
|
|
1220
|
+
"supabase",
|
|
1221
|
+
"firebase",
|
|
1222
|
+
"cloudinary",
|
|
1223
|
+
"mongodb",
|
|
1224
|
+
"none"
|
|
1225
|
+
];
|
|
1226
|
+
var PAYMENT_PROVIDERS = ["paypal", "none"];
|
|
1227
|
+
var JOBS_PROVIDERS = ["bullmq", "none"];
|
|
1228
|
+
var EXAMPLE_MODES = ["notes", "none"];
|
|
1229
|
+
var UI_LIBRARIES = ["shadcn", "antd", "mui"];
|
|
1230
|
+
var MS_TRANSPORTS = ["tcp", "redis", "nats", "mqtt", "rmq", "kafka"];
|
|
1231
|
+
var PACKAGE_MANAGERS = ["yarn", "npm", "pnpm"];
|
|
1232
|
+
function assertEnum(field, value, valid) {
|
|
1233
|
+
if (typeof value !== "string" || !valid.includes(value)) {
|
|
1234
|
+
throw new ConfigFileError(
|
|
1235
|
+
`config field "${field}" got "${String(value)}", expected one of: ${valid.join(", ")}`
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
return value;
|
|
1239
|
+
}
|
|
1240
|
+
function assertBoolean(field, value) {
|
|
1241
|
+
if (typeof value !== "boolean") {
|
|
1242
|
+
throw new ConfigFileError(`config field "${field}" must be a boolean, got ${typeof value}`);
|
|
1243
|
+
}
|
|
1244
|
+
return value;
|
|
1245
|
+
}
|
|
1246
|
+
function validateConfig(raw) {
|
|
1247
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
1248
|
+
throw new ConfigFileError("config file must be a JSON object");
|
|
1249
|
+
}
|
|
1250
|
+
const obj = raw;
|
|
1251
|
+
const result = {};
|
|
1252
|
+
if ("projectName" in obj) {
|
|
1253
|
+
const v = obj["projectName"];
|
|
1254
|
+
if (typeof v !== "string" || !/^[a-z0-9-]+$/i.test(v)) {
|
|
1255
|
+
throw new ConfigFileError(
|
|
1256
|
+
`config field "projectName" must match /^[a-z0-9-]+$/i, got "${String(v)}"`
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
result.projectName = v;
|
|
1260
|
+
}
|
|
1261
|
+
if ("authProvider" in obj)
|
|
1262
|
+
result.authProvider = assertEnum("authProvider", obj["authProvider"], AUTH_PROVIDERS);
|
|
1263
|
+
if ("dbProvider" in obj)
|
|
1264
|
+
result.dbProvider = assertEnum("dbProvider", obj["dbProvider"], DB_PROVIDERS);
|
|
1265
|
+
if ("upload" in obj) result.upload = assertEnum("upload", obj["upload"], UPLOAD_PROVIDERS);
|
|
1266
|
+
if ("payment" in obj) result.payment = assertEnum("payment", obj["payment"], PAYMENT_PROVIDERS);
|
|
1267
|
+
if ("jobs" in obj) result.jobs = assertEnum("jobs", obj["jobs"], JOBS_PROVIDERS);
|
|
1268
|
+
if ("example" in obj) result.example = assertEnum("example", obj["example"], EXAMPLE_MODES);
|
|
1269
|
+
if ("ui" in obj) result.ui = assertEnum("ui", obj["ui"], UI_LIBRARIES);
|
|
1270
|
+
if ("transport" in obj)
|
|
1271
|
+
result.transport = assertEnum("transport", obj["transport"], MS_TRANSPORTS);
|
|
1272
|
+
if ("packageManager" in obj)
|
|
1273
|
+
result.packageManager = assertEnum("packageManager", obj["packageManager"], PACKAGE_MANAGERS);
|
|
1274
|
+
if ("initGit" in obj) result.initGit = assertBoolean("initGit", obj["initGit"]);
|
|
1275
|
+
if ("install" in obj) result.install = assertBoolean("install", obj["install"]);
|
|
1276
|
+
return result;
|
|
1277
|
+
}
|
|
1278
|
+
async function loadConfig(filePath) {
|
|
1279
|
+
let raw;
|
|
1280
|
+
try {
|
|
1281
|
+
raw = await (0, import_promises9.readFile)(filePath, "utf8");
|
|
1282
|
+
} catch {
|
|
1283
|
+
throw new ConfigFileError(`config file not found: ${filePath}`);
|
|
1284
|
+
}
|
|
1285
|
+
let parsed;
|
|
1286
|
+
try {
|
|
1287
|
+
parsed = JSON.parse(raw);
|
|
1288
|
+
} catch (e) {
|
|
1289
|
+
throw new ConfigFileError(
|
|
1290
|
+
`config file is not valid JSON: ${e instanceof Error ? e.message : String(e)}`
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
return validateConfig(parsed);
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
// src/lib/prompts.ts
|
|
1138
1297
|
function detectPackageManager() {
|
|
1139
1298
|
const ua = process.env["npm_config_user_agent"] ?? "";
|
|
1140
1299
|
if (ua.startsWith("yarn/")) return "yarn";
|
|
@@ -1145,7 +1304,7 @@ function detectPackageManager() {
|
|
|
1145
1304
|
async function readSelfVersion() {
|
|
1146
1305
|
try {
|
|
1147
1306
|
const here = (0, import_node_path10.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
1148
|
-
const pkgRaw = await (0,
|
|
1307
|
+
const pkgRaw = await (0, import_promises10.readFile)((0, import_node_path10.join)(here, "..", "package.json"), "utf8");
|
|
1149
1308
|
const pkg = JSON.parse(pkgRaw);
|
|
1150
1309
|
return pkg.version ?? null;
|
|
1151
1310
|
} catch {
|
|
@@ -1219,12 +1378,21 @@ function parseFlags(argv) {
|
|
|
1219
1378
|
case "no-install":
|
|
1220
1379
|
out.install = false;
|
|
1221
1380
|
break;
|
|
1381
|
+
case "config":
|
|
1382
|
+
out._configPath = v;
|
|
1383
|
+
break;
|
|
1222
1384
|
}
|
|
1223
1385
|
}
|
|
1224
1386
|
return out;
|
|
1225
1387
|
}
|
|
1226
1388
|
async function collectOptions({ argv, cwd }) {
|
|
1227
1389
|
const flags = parseFlags(argv);
|
|
1390
|
+
const configPath = flags._configPath;
|
|
1391
|
+
delete flags._configPath;
|
|
1392
|
+
if (configPath) {
|
|
1393
|
+
const configValues = await loadConfig(configPath);
|
|
1394
|
+
Object.assign(flags, { ...configValues, ...flags });
|
|
1395
|
+
}
|
|
1228
1396
|
const [selfVersion, latestVersion] = await Promise.all([readSelfVersion(), fetchLatestVersion()]);
|
|
1229
1397
|
const versionTag = selfVersion ? ` v${selfVersion}` : "";
|
|
1230
1398
|
p.intro(`iCore${versionTag} \u2014 bootstrap a new project`);
|
|
@@ -1247,11 +1415,12 @@ Re-run with @latest to refresh:
|
|
|
1247
1415
|
options: [
|
|
1248
1416
|
{ value: "supabase", label: "Supabase" },
|
|
1249
1417
|
{ value: "firebase", label: "Firebase" },
|
|
1250
|
-
{ value: "mongodb", label: "MongoDB (Custom Auth)" }
|
|
1418
|
+
{ value: "mongodb", label: "MongoDB (Custom Auth)" },
|
|
1419
|
+
{ value: "none", label: "None \u2014 no login, open API (simple SPA)" }
|
|
1251
1420
|
]
|
|
1252
1421
|
});
|
|
1253
1422
|
if (p.isCancel(authProvider)) throw new Error("cancelled");
|
|
1254
|
-
const dbProvider = flags.dbProvider ?? await p.select({
|
|
1423
|
+
const dbProvider = authProvider === "none" ? "none" : flags.dbProvider ?? await p.select({
|
|
1255
1424
|
message: "Database backend",
|
|
1256
1425
|
options: [
|
|
1257
1426
|
{ value: "supabase", label: "Supabase Postgres" },
|
|
@@ -1290,7 +1459,7 @@ Re-run with @latest to refresh:
|
|
|
1290
1459
|
initialValue: "none"
|
|
1291
1460
|
});
|
|
1292
1461
|
if (p.isCancel(jobs)) throw new Error("cancelled");
|
|
1293
|
-
const example = flags.example ?? await p.select({
|
|
1462
|
+
const example = authProvider === "none" ? "none" : flags.example ?? await p.select({
|
|
1294
1463
|
message: "Include notes sample feature? (CRUD demo \u2014 remove before production)",
|
|
1295
1464
|
options: [
|
|
1296
1465
|
{ value: "notes", label: "Yes \u2014 include notes sample" },
|
|
@@ -1315,7 +1484,8 @@ Re-run with @latest to refresh:
|
|
|
1315
1484
|
initialValue: "shadcn"
|
|
1316
1485
|
});
|
|
1317
1486
|
if (p.isCancel(ui)) throw new Error("cancelled");
|
|
1318
|
-
const
|
|
1487
|
+
const noMicroservices = authProvider === "none" && upload === "none" && payment === "none";
|
|
1488
|
+
const transport = flags.transport ?? (noMicroservices ? "tcp" : await p.select({
|
|
1319
1489
|
message: "Microservice transport",
|
|
1320
1490
|
options: [
|
|
1321
1491
|
{ value: "tcp", label: "TCP (default, no broker required)" },
|
|
@@ -1326,7 +1496,7 @@ Re-run with @latest to refresh:
|
|
|
1326
1496
|
{ value: "kafka", label: "Kafka" }
|
|
1327
1497
|
],
|
|
1328
1498
|
initialValue: "tcp"
|
|
1329
|
-
});
|
|
1499
|
+
}));
|
|
1330
1500
|
if (p.isCancel(transport)) throw new Error("cancelled");
|
|
1331
1501
|
const packageManager = flags.packageManager ?? detectPackageManager();
|
|
1332
1502
|
if (packageManager === "yarn") {
|
|
@@ -1358,11 +1528,11 @@ Re-run with @latest to refresh:
|
|
|
1358
1528
|
}
|
|
1359
1529
|
|
|
1360
1530
|
// src/manifest/audit.ts
|
|
1361
|
-
var
|
|
1531
|
+
var import_promises11 = require("fs/promises");
|
|
1362
1532
|
var import_node_path11 = require("path");
|
|
1363
1533
|
var IGNORE_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".nx"]);
|
|
1364
1534
|
async function walk(dir, out = []) {
|
|
1365
|
-
const entries = await (0,
|
|
1535
|
+
const entries = await (0, import_promises11.readdir)(dir, { withFileTypes: true });
|
|
1366
1536
|
for (const e of entries) {
|
|
1367
1537
|
if (e.isDirectory()) {
|
|
1368
1538
|
if (!IGNORE_DIRS.has(e.name)) await walk((0, import_node_path11.join)(dir, e.name), out);
|
|
@@ -1374,7 +1544,7 @@ async function walk(dir, out = []) {
|
|
|
1374
1544
|
}
|
|
1375
1545
|
async function tsconfigAliases(dir) {
|
|
1376
1546
|
try {
|
|
1377
|
-
const raw = await (0,
|
|
1547
|
+
const raw = await (0, import_promises11.readFile)((0, import_node_path11.join)(dir, "tsconfig.base.json"), "utf8");
|
|
1378
1548
|
const aliases = /* @__PURE__ */ new Set();
|
|
1379
1549
|
for (const m of raw.matchAll(/"(@icore\/[a-z0-9.-]+)"\s*:/g)) {
|
|
1380
1550
|
if (m[1]) aliases.add(m[1]);
|
|
@@ -1392,7 +1562,7 @@ var PROVIDER_SDKS = {
|
|
|
1392
1562
|
};
|
|
1393
1563
|
async function readBlueprint(dir) {
|
|
1394
1564
|
try {
|
|
1395
|
-
return JSON.parse(await (0,
|
|
1565
|
+
return JSON.parse(await (0, import_promises11.readFile)((0, import_node_path11.join)(dir, "blueprint.json"), "utf8"));
|
|
1396
1566
|
} catch {
|
|
1397
1567
|
return null;
|
|
1398
1568
|
}
|
|
@@ -1414,7 +1584,7 @@ async function allPackageJsons(dir) {
|
|
|
1414
1584
|
async function walk2(d) {
|
|
1415
1585
|
let entries;
|
|
1416
1586
|
try {
|
|
1417
|
-
entries = await (0,
|
|
1587
|
+
entries = await (0, import_promises11.readdir)(d, { withFileTypes: true });
|
|
1418
1588
|
} catch {
|
|
1419
1589
|
return;
|
|
1420
1590
|
}
|
|
@@ -1431,7 +1601,7 @@ async function allPackageJsons(dir) {
|
|
|
1431
1601
|
}
|
|
1432
1602
|
async function depKeys(pkgPath) {
|
|
1433
1603
|
try {
|
|
1434
|
-
const pkg = JSON.parse(await (0,
|
|
1604
|
+
const pkg = JSON.parse(await (0, import_promises11.readFile)(pkgPath, "utf8"));
|
|
1435
1605
|
return /* @__PURE__ */ new Set([
|
|
1436
1606
|
...Object.keys(pkg.dependencies ?? {}),
|
|
1437
1607
|
...Object.keys(pkg.devDependencies ?? {})
|
|
@@ -1445,7 +1615,7 @@ async function auditProject(dir, opts = {}) {
|
|
|
1445
1615
|
const violations = [];
|
|
1446
1616
|
const aliases = await tsconfigAliases(dir);
|
|
1447
1617
|
for (const file of await walk(dir)) {
|
|
1448
|
-
const src = await (0,
|
|
1618
|
+
const src = await (0, import_promises11.readFile)(file, "utf8");
|
|
1449
1619
|
for (const m of src.matchAll(ICORE_IMPORT)) {
|
|
1450
1620
|
const alias = m[1];
|
|
1451
1621
|
if (alias && !aliases.has(alias)) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
1
|
+
type AuthBackend = 'supabase' | 'firebase' | 'mongodb';
|
|
2
|
+
type AuthProvider = AuthBackend | 'none';
|
|
3
|
+
type DbProvider = 'supabase' | 'firebase' | 'mongodb' | 'none';
|
|
3
4
|
type UploadProvider = 'supabase' | 'firebase' | 'cloudinary' | 'mongodb' | 'none';
|
|
4
5
|
type PaymentProvider = 'paypal' | 'none';
|
|
5
6
|
type JobsProvider = 'bullmq' | 'none';
|
|
@@ -45,4 +46,4 @@ declare function auditProject(dir: string, opts?: {
|
|
|
45
46
|
forbiddenDeps?: string[];
|
|
46
47
|
}): Promise<Violation[]>;
|
|
47
48
|
|
|
48
|
-
export { type AuthProvider, type CreateIcoreOptions, type DbProvider, type ExampleMode, type JobsProvider, type MsTransport, type PackageManager, type PaymentProvider, type UiLibrary, type UploadProvider, type Violation, auditProject, collectOptions, pmRun, scaffold };
|
|
49
|
+
export { type AuthBackend, type AuthProvider, type CreateIcoreOptions, type DbProvider, type ExampleMode, type JobsProvider, type MsTransport, type PackageManager, type PaymentProvider, type UiLibrary, type UploadProvider, type Violation, auditProject, collectOptions, pmRun, scaffold };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
1
|
+
type AuthBackend = 'supabase' | 'firebase' | 'mongodb';
|
|
2
|
+
type AuthProvider = AuthBackend | 'none';
|
|
3
|
+
type DbProvider = 'supabase' | 'firebase' | 'mongodb' | 'none';
|
|
3
4
|
type UploadProvider = 'supabase' | 'firebase' | 'cloudinary' | 'mongodb' | 'none';
|
|
4
5
|
type PaymentProvider = 'paypal' | 'none';
|
|
5
6
|
type JobsProvider = 'bullmq' | 'none';
|
|
@@ -45,4 +46,4 @@ declare function auditProject(dir: string, opts?: {
|
|
|
45
46
|
forbiddenDeps?: string[];
|
|
46
47
|
}): Promise<Violation[]>;
|
|
47
48
|
|
|
48
|
-
export { type AuthProvider, type CreateIcoreOptions, type DbProvider, type ExampleMode, type JobsProvider, type MsTransport, type PackageManager, type PaymentProvider, type UiLibrary, type UploadProvider, type Violation, auditProject, collectOptions, pmRun, scaffold };
|
|
49
|
+
export { type AuthBackend, type AuthProvider, type CreateIcoreOptions, type DbProvider, type ExampleMode, type JobsProvider, type MsTransport, type PackageManager, type PaymentProvider, type UiLibrary, type UploadProvider, type Violation, auditProject, collectOptions, pmRun, scaffold };
|