@appsbyme/create-basekit 1.0.4 → 1.0.5
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 +2 -2
- package/dist/commands/app/index.cjs +361 -357
- package/dist/commands/mobile/index.cjs +68 -43
- package/dist/commands/web/index.cjs +108 -83
- package/dist/index.cjs +427 -423
- package/package.json +11 -3
- package/template-mobile/README.md +2 -2
- package/template-mobile/_yarnrc.yml +1 -0
- package/template-mobile/src/__mocks__/expo-env.ts +2 -1
- package/template-mobile/src/features/auth/api/auth.api.ts +1 -1
- package/template-mobile/src/features/auth/components/AuthBackButton.tsx +2 -1
- package/template-mobile/src/features/auth/guestAuth.ts +1 -1
- package/template-mobile/src/lib/certPinning.ts +2 -2
- package/template-mobile/src/lib/sentry.ts +1 -1
- package/template-mobile/src/services/http.ts +1 -1
- package/template-mobile/src/services/refreshSession.ts +1 -1
- package/template-mobile/src/services/websocket.ts +1 -1
- package/template-web/AGENTS.md +4 -4
- package/template-web/Dockerfile +2 -2
- package/template-web/_yarnrc.yml +4 -0
- package/template-web/docker-compose.yml +1 -1
- package/template-web/package.json +3 -0
- package/template-web/scripts/setup-add-docker.js +14 -3
|
@@ -4977,15 +4977,42 @@ var import_prompts = __toESM(require_prompts3(), 1);
|
|
|
4977
4977
|
|
|
4978
4978
|
// src/commands/mobile/scaffold.ts
|
|
4979
4979
|
init_cjs_shims();
|
|
4980
|
-
var
|
|
4981
|
-
var
|
|
4980
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
4981
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
4982
|
+
var import_node_url2 = require("url");
|
|
4983
|
+
|
|
4984
|
+
// src/commands/app/package-paths.ts
|
|
4985
|
+
init_cjs_shims();
|
|
4986
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
4987
|
+
var import_path = __toESM(require("path"), 1);
|
|
4982
4988
|
var import_node_url = require("url");
|
|
4989
|
+
function getCreateBasekitPackageRoot(fromDir = import_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl))) {
|
|
4990
|
+
let dir = import_path.default.resolve(fromDir);
|
|
4991
|
+
for (let i = 0; i < 8; i += 1) {
|
|
4992
|
+
const pkgPath = import_path.default.join(dir, "package.json");
|
|
4993
|
+
if (import_fs.default.existsSync(pkgPath)) {
|
|
4994
|
+
try {
|
|
4995
|
+
const name = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8")).name;
|
|
4996
|
+
if (name === "@appsbyme/create-basekit") {
|
|
4997
|
+
return dir;
|
|
4998
|
+
}
|
|
4999
|
+
} catch {
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
const parent = import_path.default.dirname(dir);
|
|
5003
|
+
if (parent === dir) break;
|
|
5004
|
+
dir = parent;
|
|
5005
|
+
}
|
|
5006
|
+
throw new Error(
|
|
5007
|
+
`Could not find @appsbyme/create-basekit package root (started at ${fromDir})`
|
|
5008
|
+
);
|
|
5009
|
+
}
|
|
4983
5010
|
|
|
4984
5011
|
// src/commands/mobile/utils.ts
|
|
4985
5012
|
init_cjs_shims();
|
|
4986
5013
|
var import_child_process = require("child_process");
|
|
4987
|
-
var
|
|
4988
|
-
var
|
|
5014
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
5015
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
4989
5016
|
function logStep(msg) {
|
|
4990
5017
|
console.log(`
|
|
4991
5018
|
\u25B6 ${msg}`);
|
|
@@ -5000,21 +5027,21 @@ function logError(msg) {
|
|
|
5000
5027
|
console.error(` \u2717 ${msg}`);
|
|
5001
5028
|
}
|
|
5002
5029
|
function exists(absPath) {
|
|
5003
|
-
return
|
|
5030
|
+
return import_fs2.default.existsSync(absPath);
|
|
5004
5031
|
}
|
|
5005
5032
|
function copyDir(src, dest) {
|
|
5006
|
-
|
|
5033
|
+
import_fs2.default.cpSync(src, dest, { recursive: true });
|
|
5007
5034
|
}
|
|
5008
5035
|
function readText(absPath) {
|
|
5009
|
-
return
|
|
5036
|
+
return import_fs2.default.readFileSync(absPath, "utf-8");
|
|
5010
5037
|
}
|
|
5011
5038
|
function writeText(absPath, content) {
|
|
5012
|
-
|
|
5039
|
+
import_fs2.default.writeFileSync(absPath, content);
|
|
5013
5040
|
}
|
|
5014
5041
|
function safeRmDir(absDir) {
|
|
5015
5042
|
if (!exists(absDir)) return false;
|
|
5016
5043
|
try {
|
|
5017
|
-
|
|
5044
|
+
import_fs2.default.rmSync(absDir, { recursive: true, force: true });
|
|
5018
5045
|
return true;
|
|
5019
5046
|
} catch {
|
|
5020
5047
|
return false;
|
|
@@ -5075,7 +5102,7 @@ function toSlug(name) {
|
|
|
5075
5102
|
return toKebab(name).replace(/-/g, "");
|
|
5076
5103
|
}
|
|
5077
5104
|
function getDestDir(appName) {
|
|
5078
|
-
return
|
|
5105
|
+
return import_path2.default.resolve(process.cwd(), appName);
|
|
5079
5106
|
}
|
|
5080
5107
|
|
|
5081
5108
|
// src/commands/mobile/spinner.ts
|
|
@@ -5109,17 +5136,9 @@ function createSpinner(text) {
|
|
|
5109
5136
|
|
|
5110
5137
|
// src/commands/mobile/scaffold.ts
|
|
5111
5138
|
function templateDir() {
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
import_path2.default.join(here, "../template-mobile")
|
|
5116
|
-
];
|
|
5117
|
-
for (const candidate of candidates) {
|
|
5118
|
-
const resolved = import_path2.default.resolve(candidate);
|
|
5119
|
-
if (import_fs2.default.existsSync(resolved)) return resolved;
|
|
5120
|
-
}
|
|
5121
|
-
throw new Error(
|
|
5122
|
-
`Starter template is missing (searched: ${candidates.map((c) => import_path2.default.resolve(c)).join(", ")})`
|
|
5139
|
+
return import_path3.default.join(
|
|
5140
|
+
getCreateBasekitPackageRoot(import_path3.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl))),
|
|
5141
|
+
"template-mobile"
|
|
5123
5142
|
);
|
|
5124
5143
|
}
|
|
5125
5144
|
async function scaffold(opts) {
|
|
@@ -5143,6 +5162,7 @@ async function scaffoldInner(opts) {
|
|
|
5143
5162
|
const apiUrl = `http://localhost:${8e3 + portOffset}/api/v1`;
|
|
5144
5163
|
await cloneTemplate(destDir);
|
|
5145
5164
|
materializeGitignore(destDir);
|
|
5165
|
+
materializeYarnrc(destDir);
|
|
5146
5166
|
if (opts.monorepo) {
|
|
5147
5167
|
stripBundledShared(destDir);
|
|
5148
5168
|
adjustSharedPaths(destDir);
|
|
@@ -5164,7 +5184,7 @@ async function scaffoldInner(opts) {
|
|
|
5164
5184
|
}
|
|
5165
5185
|
async function cloneTemplate(destDir) {
|
|
5166
5186
|
const source = templateDir();
|
|
5167
|
-
if (!
|
|
5187
|
+
if (!import_fs3.default.existsSync(source)) {
|
|
5168
5188
|
throw new Error(`Starter template is missing at ${source}`);
|
|
5169
5189
|
}
|
|
5170
5190
|
logStep("Copying the Expo starter");
|
|
@@ -5179,12 +5199,17 @@ async function cloneTemplate(destDir) {
|
|
|
5179
5199
|
spinner.succeed("Template copied");
|
|
5180
5200
|
}
|
|
5181
5201
|
function materializeGitignore(destDir) {
|
|
5182
|
-
const packagedPath =
|
|
5202
|
+
const packagedPath = import_path3.default.join(destDir, "_gitignore");
|
|
5203
|
+
if (!exists(packagedPath)) return;
|
|
5204
|
+
import_fs3.default.renameSync(packagedPath, import_path3.default.join(destDir, ".gitignore"));
|
|
5205
|
+
}
|
|
5206
|
+
function materializeYarnrc(destDir) {
|
|
5207
|
+
const packagedPath = import_path3.default.join(destDir, "_yarnrc.yml");
|
|
5183
5208
|
if (!exists(packagedPath)) return;
|
|
5184
|
-
|
|
5209
|
+
import_fs3.default.renameSync(packagedPath, import_path3.default.join(destDir, ".yarnrc.yml"));
|
|
5185
5210
|
}
|
|
5186
5211
|
function stripBundledShared(destDir) {
|
|
5187
|
-
const sharedDir =
|
|
5212
|
+
const sharedDir = import_path3.default.join(destDir, "packages");
|
|
5188
5213
|
if (exists(sharedDir)) {
|
|
5189
5214
|
safeRmDir(sharedDir);
|
|
5190
5215
|
logOk("Stripped bundled packages/shared/ (orchestrator provides this)");
|
|
@@ -5192,30 +5217,30 @@ function stripBundledShared(destDir) {
|
|
|
5192
5217
|
}
|
|
5193
5218
|
function adjustSharedPaths(destDir) {
|
|
5194
5219
|
patchFile(
|
|
5195
|
-
|
|
5220
|
+
import_path3.default.join(destDir, "tsconfig.json"),
|
|
5196
5221
|
"./packages/shared/src/*",
|
|
5197
5222
|
"../packages/shared/src/*",
|
|
5198
5223
|
"tsconfig @shared/* path"
|
|
5199
5224
|
);
|
|
5200
5225
|
patchFile(
|
|
5201
|
-
|
|
5226
|
+
import_path3.default.join(destDir, "tsconfig.json"),
|
|
5202
5227
|
'"packages/shared/src"',
|
|
5203
5228
|
'"../packages/shared/src"',
|
|
5204
5229
|
"tsconfig include path"
|
|
5205
5230
|
);
|
|
5206
5231
|
patchFile(
|
|
5207
|
-
|
|
5232
|
+
import_path3.default.join(destDir, "tsconfig.json"),
|
|
5208
5233
|
'"packages/shared/src/**/__tests__/**"',
|
|
5209
5234
|
'"../packages/shared/src/**/__tests__/**"',
|
|
5210
5235
|
"tsconfig exclude path"
|
|
5211
5236
|
);
|
|
5212
5237
|
patchFile(
|
|
5213
|
-
|
|
5238
|
+
import_path3.default.join(destDir, "babel.config.js"),
|
|
5214
5239
|
"'./packages/shared/src'",
|
|
5215
5240
|
"'../packages/shared/src'",
|
|
5216
5241
|
"babel @shared alias"
|
|
5217
5242
|
);
|
|
5218
|
-
const metroPath =
|
|
5243
|
+
const metroPath = import_path3.default.join(destDir, "metro.config.js");
|
|
5219
5244
|
if (exists(metroPath)) {
|
|
5220
5245
|
let metro = readText(metroPath);
|
|
5221
5246
|
metro = metro.replace(
|
|
@@ -5232,7 +5257,7 @@ function adjustSharedPaths(destDir) {
|
|
|
5232
5257
|
writeText(metroPath, metro);
|
|
5233
5258
|
logOk("Adjusted metro.config.js for monorepo layout");
|
|
5234
5259
|
}
|
|
5235
|
-
const pkgPath =
|
|
5260
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5236
5261
|
if (exists(pkgPath)) {
|
|
5237
5262
|
let pkgText = readText(pkgPath);
|
|
5238
5263
|
pkgText = pkgText.replace(
|
|
@@ -5254,7 +5279,7 @@ function replaceTokens(destDir, tokens) {
|
|
|
5254
5279
|
"README.md"
|
|
5255
5280
|
];
|
|
5256
5281
|
for (const relPath of targetFiles) {
|
|
5257
|
-
const absPath =
|
|
5282
|
+
const absPath = import_path3.default.join(destDir, relPath);
|
|
5258
5283
|
if (!exists(absPath)) continue;
|
|
5259
5284
|
let content = readText(absPath);
|
|
5260
5285
|
let changed = false;
|
|
@@ -5271,8 +5296,8 @@ function replaceTokens(destDir, tokens) {
|
|
|
5271
5296
|
}
|
|
5272
5297
|
}
|
|
5273
5298
|
function createDotEnv(destDir, apiUrl) {
|
|
5274
|
-
const examplePath =
|
|
5275
|
-
const envPath =
|
|
5299
|
+
const examplePath = import_path3.default.join(destDir, ".env.example");
|
|
5300
|
+
const envPath = import_path3.default.join(destDir, ".env");
|
|
5276
5301
|
if (exists(examplePath)) {
|
|
5277
5302
|
let content = readText(examplePath);
|
|
5278
5303
|
content = content.replace(
|
|
@@ -5284,18 +5309,18 @@ function createDotEnv(destDir, apiUrl) {
|
|
|
5284
5309
|
}
|
|
5285
5310
|
}
|
|
5286
5311
|
function cleanupArtifacts(destDir) {
|
|
5287
|
-
safeRmDir(
|
|
5288
|
-
const lockPath =
|
|
5312
|
+
safeRmDir(import_path3.default.join(destDir, ".git"));
|
|
5313
|
+
const lockPath = import_path3.default.join(destDir, "yarn.lock");
|
|
5289
5314
|
if (exists(lockPath)) {
|
|
5290
|
-
|
|
5315
|
+
import_fs3.default.unlinkSync(lockPath);
|
|
5291
5316
|
}
|
|
5292
|
-
const readmePath =
|
|
5317
|
+
const readmePath = import_path3.default.join(destDir, "README.md");
|
|
5293
5318
|
if (exists(readmePath)) {
|
|
5294
|
-
|
|
5319
|
+
import_fs3.default.unlinkSync(readmePath);
|
|
5295
5320
|
}
|
|
5296
|
-
const licensePath =
|
|
5321
|
+
const licensePath = import_path3.default.join(destDir, "LICENSE");
|
|
5297
5322
|
if (exists(licensePath)) {
|
|
5298
|
-
|
|
5323
|
+
import_fs3.default.unlinkSync(licensePath);
|
|
5299
5324
|
}
|
|
5300
5325
|
}
|
|
5301
5326
|
function initGitRepo(destDir) {
|
|
@@ -5365,7 +5390,7 @@ async function runMobileCommand(argv) {
|
|
|
5365
5390
|
return;
|
|
5366
5391
|
}
|
|
5367
5392
|
if (args.includes("--version") || args.includes("-v")) {
|
|
5368
|
-
console.log("1.0.
|
|
5393
|
+
console.log("1.0.5");
|
|
5369
5394
|
return;
|
|
5370
5395
|
}
|
|
5371
5396
|
printBanner();
|
|
@@ -5468,7 +5493,7 @@ async function runMobileCommand(argv) {
|
|
|
5468
5493
|
function printBanner() {
|
|
5469
5494
|
console.log("");
|
|
5470
5495
|
console.log(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
5471
|
-
console.log(` \u2551 create-basekit mobile v${"1.0.
|
|
5496
|
+
console.log(` \u2551 create-basekit mobile v${"1.0.5"} \u2551`);
|
|
5472
5497
|
console.log(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
5473
5498
|
console.log("");
|
|
5474
5499
|
console.log(" Expo (React Native) app scaffolder");
|