@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
|
@@ -4973,15 +4973,42 @@ __export(web_exports, {
|
|
|
4973
4973
|
});
|
|
4974
4974
|
module.exports = __toCommonJS(web_exports);
|
|
4975
4975
|
init_cjs_shims();
|
|
4976
|
-
var
|
|
4977
|
-
var
|
|
4976
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
4977
|
+
var import_fs4 = __toESM(require("fs"), 1);
|
|
4978
4978
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
4979
4979
|
|
|
4980
4980
|
// src/commands/web/scaffold.ts
|
|
4981
4981
|
init_cjs_shims();
|
|
4982
|
-
var
|
|
4983
|
-
var
|
|
4982
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
4983
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
4984
|
+
var import_node_url2 = require("url");
|
|
4985
|
+
|
|
4986
|
+
// src/commands/app/package-paths.ts
|
|
4987
|
+
init_cjs_shims();
|
|
4988
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
4989
|
+
var import_path = __toESM(require("path"), 1);
|
|
4984
4990
|
var import_node_url = require("url");
|
|
4991
|
+
function getCreateBasekitPackageRoot(fromDir = import_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl))) {
|
|
4992
|
+
let dir = import_path.default.resolve(fromDir);
|
|
4993
|
+
for (let i = 0; i < 8; i += 1) {
|
|
4994
|
+
const pkgPath = import_path.default.join(dir, "package.json");
|
|
4995
|
+
if (import_fs.default.existsSync(pkgPath)) {
|
|
4996
|
+
try {
|
|
4997
|
+
const name = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8")).name;
|
|
4998
|
+
if (name === "@appsbyme/create-basekit") {
|
|
4999
|
+
return dir;
|
|
5000
|
+
}
|
|
5001
|
+
} catch {
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
const parent = import_path.default.dirname(dir);
|
|
5005
|
+
if (parent === dir) break;
|
|
5006
|
+
dir = parent;
|
|
5007
|
+
}
|
|
5008
|
+
throw new Error(
|
|
5009
|
+
`Could not find @appsbyme/create-basekit package root (started at ${fromDir})`
|
|
5010
|
+
);
|
|
5011
|
+
}
|
|
4985
5012
|
|
|
4986
5013
|
// src/commands/web/spinner.ts
|
|
4987
5014
|
init_cjs_shims();
|
|
@@ -5015,8 +5042,8 @@ function createSpinner(text) {
|
|
|
5015
5042
|
// src/commands/web/utils.ts
|
|
5016
5043
|
init_cjs_shims();
|
|
5017
5044
|
var import_child_process = require("child_process");
|
|
5018
|
-
var
|
|
5019
|
-
var
|
|
5045
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
5046
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
5020
5047
|
function logStep(msg) {
|
|
5021
5048
|
console.log(`
|
|
5022
5049
|
\u25B6 ${msg}`);
|
|
@@ -5034,27 +5061,27 @@ function logError(msg) {
|
|
|
5034
5061
|
console.error(` \u2717 ${msg}`);
|
|
5035
5062
|
}
|
|
5036
5063
|
function exists(absPath) {
|
|
5037
|
-
return
|
|
5064
|
+
return import_fs2.default.existsSync(absPath);
|
|
5038
5065
|
}
|
|
5039
5066
|
function copyDir(src, dest) {
|
|
5040
|
-
|
|
5067
|
+
import_fs2.default.cpSync(src, dest, { recursive: true });
|
|
5041
5068
|
}
|
|
5042
5069
|
function readText(absPath) {
|
|
5043
|
-
return
|
|
5070
|
+
return import_fs2.default.readFileSync(absPath, "utf-8");
|
|
5044
5071
|
}
|
|
5045
5072
|
function writeText(absPath, content) {
|
|
5046
|
-
|
|
5073
|
+
import_fs2.default.writeFileSync(absPath, content);
|
|
5047
5074
|
}
|
|
5048
5075
|
function readJson(absPath) {
|
|
5049
|
-
return JSON.parse(
|
|
5076
|
+
return JSON.parse(import_fs2.default.readFileSync(absPath, "utf-8"));
|
|
5050
5077
|
}
|
|
5051
5078
|
function writeJson(absPath, data) {
|
|
5052
|
-
|
|
5079
|
+
import_fs2.default.writeFileSync(absPath, JSON.stringify(data, null, 2) + "\n");
|
|
5053
5080
|
}
|
|
5054
5081
|
function safeUnlink(absPath) {
|
|
5055
5082
|
if (!exists(absPath)) return false;
|
|
5056
5083
|
try {
|
|
5057
|
-
|
|
5084
|
+
import_fs2.default.unlinkSync(absPath);
|
|
5058
5085
|
return true;
|
|
5059
5086
|
} catch {
|
|
5060
5087
|
return false;
|
|
@@ -5063,7 +5090,7 @@ function safeUnlink(absPath) {
|
|
|
5063
5090
|
function safeRmDir(absDir) {
|
|
5064
5091
|
if (!exists(absDir)) return false;
|
|
5065
5092
|
try {
|
|
5066
|
-
|
|
5093
|
+
import_fs2.default.rmSync(absDir, { recursive: true, force: true });
|
|
5067
5094
|
return true;
|
|
5068
5095
|
} catch {
|
|
5069
5096
|
return false;
|
|
@@ -5131,7 +5158,7 @@ function removeMarkedSection(content, marker) {
|
|
|
5131
5158
|
return content.replace(regex, "\n");
|
|
5132
5159
|
}
|
|
5133
5160
|
function getDestDir(appName) {
|
|
5134
|
-
return
|
|
5161
|
+
return import_path2.default.resolve(process.cwd(), appName);
|
|
5135
5162
|
}
|
|
5136
5163
|
function patchReplace(content, pattern, replacement, description) {
|
|
5137
5164
|
const result = content.replace(pattern, replacement);
|
|
@@ -5143,23 +5170,15 @@ function patchReplace(content, pattern, replacement, description) {
|
|
|
5143
5170
|
|
|
5144
5171
|
// src/commands/web/scaffold.ts
|
|
5145
5172
|
function templateDir() {
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
import_path2.default.join(here, "../template-web")
|
|
5150
|
-
];
|
|
5151
|
-
for (const candidate of candidates) {
|
|
5152
|
-
const resolved = import_path2.default.resolve(candidate);
|
|
5153
|
-
if (import_fs2.default.existsSync(resolved)) return resolved;
|
|
5154
|
-
}
|
|
5155
|
-
throw new Error(
|
|
5156
|
-
`Starter template is missing (searched: ${candidates.map((c) => import_path2.default.resolve(c)).join(", ")})`
|
|
5173
|
+
return import_path3.default.join(
|
|
5174
|
+
getCreateBasekitPackageRoot(import_path3.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl))),
|
|
5175
|
+
"template-web"
|
|
5157
5176
|
);
|
|
5158
5177
|
}
|
|
5159
5178
|
async function scaffold(opts) {
|
|
5160
5179
|
const { appName, description, destDir, enableTailwind, enablePwa, enableDocker, enableHusky } = opts;
|
|
5161
5180
|
if (exists(destDir)) {
|
|
5162
|
-
throw new Error(`Directory "${
|
|
5181
|
+
throw new Error(`Directory "${import_path3.default.basename(destDir)}" already exists.`);
|
|
5163
5182
|
}
|
|
5164
5183
|
try {
|
|
5165
5184
|
await scaffoldInner(opts);
|
|
@@ -5176,10 +5195,11 @@ async function scaffoldInner(opts) {
|
|
|
5176
5195
|
const { appName, description, destDir, enableTailwind, enablePwa, enableDocker, enableHusky, portOffset } = opts;
|
|
5177
5196
|
await cloneTemplate(destDir);
|
|
5178
5197
|
materializeGitignore(destDir);
|
|
5179
|
-
|
|
5180
|
-
|
|
5198
|
+
materializeYarnrc(destDir);
|
|
5199
|
+
safeUnlink(import_path3.default.join(destDir, "yarn.lock"));
|
|
5200
|
+
safeRmDir(import_path3.default.join(destDir, ".git"));
|
|
5181
5201
|
logOk("Removed .git history \u2014 clean slate");
|
|
5182
|
-
safeUnlink(
|
|
5202
|
+
safeUnlink(import_path3.default.join(destDir, "commitlint.config.js"));
|
|
5183
5203
|
cleanupGitignore(destDir);
|
|
5184
5204
|
logStep("Customising template");
|
|
5185
5205
|
replaceTokens(destDir, appName, description);
|
|
@@ -5218,7 +5238,7 @@ async function scaffoldInner(opts) {
|
|
|
5218
5238
|
}
|
|
5219
5239
|
async function cloneTemplate(destDir) {
|
|
5220
5240
|
const source = templateDir();
|
|
5221
|
-
if (!
|
|
5241
|
+
if (!import_fs3.default.existsSync(source)) {
|
|
5222
5242
|
throw new Error(`Starter template is missing at ${source}`);
|
|
5223
5243
|
}
|
|
5224
5244
|
const spinner = createSpinner("Copying starter template\u2026");
|
|
@@ -5231,16 +5251,21 @@ async function cloneTemplate(destDir) {
|
|
|
5231
5251
|
spinner.succeed("Template copied");
|
|
5232
5252
|
}
|
|
5233
5253
|
function materializeGitignore(destDir) {
|
|
5234
|
-
const packagedPath =
|
|
5254
|
+
const packagedPath = import_path3.default.join(destDir, "_gitignore");
|
|
5255
|
+
if (!exists(packagedPath)) return;
|
|
5256
|
+
import_fs3.default.renameSync(packagedPath, import_path3.default.join(destDir, ".gitignore"));
|
|
5257
|
+
}
|
|
5258
|
+
function materializeYarnrc(destDir) {
|
|
5259
|
+
const packagedPath = import_path3.default.join(destDir, "_yarnrc.yml");
|
|
5235
5260
|
if (!exists(packagedPath)) return;
|
|
5236
|
-
|
|
5261
|
+
import_fs3.default.renameSync(packagedPath, import_path3.default.join(destDir, ".yarnrc.yml"));
|
|
5237
5262
|
}
|
|
5238
5263
|
var TEMPLATE_TITLE = "React Starter Kit";
|
|
5239
5264
|
var TEMPLATE_DESCRIPTION = "A modern React starter kit with TypeScript, Vite, SCSS, and comprehensive tooling for building scalable applications";
|
|
5240
5265
|
function replaceTokens(destDir, appName, description) {
|
|
5241
5266
|
const pkgName = toPackageName(appName);
|
|
5242
5267
|
const appTitle = toTitle(appName);
|
|
5243
|
-
const pkgPath =
|
|
5268
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5244
5269
|
if (exists(pkgPath)) {
|
|
5245
5270
|
const pkg = readJson(pkgPath);
|
|
5246
5271
|
pkg["name"] = pkgName;
|
|
@@ -5255,7 +5280,7 @@ function replaceTokens(destDir, appName, description) {
|
|
|
5255
5280
|
writeJson(pkgPath, pkg);
|
|
5256
5281
|
logOk("package.json \u2014 name, description, version, stripped monorepo fields");
|
|
5257
5282
|
}
|
|
5258
|
-
const indexPath =
|
|
5283
|
+
const indexPath = import_path3.default.join(destDir, "index.html");
|
|
5259
5284
|
if (exists(indexPath)) {
|
|
5260
5285
|
let html = readText(indexPath);
|
|
5261
5286
|
html = html.replace(
|
|
@@ -5273,7 +5298,7 @@ function replaceTokens(destDir, appName, description) {
|
|
|
5273
5298
|
writeText(indexPath, html);
|
|
5274
5299
|
logOk("index.html \u2014 title, meta description, application-name");
|
|
5275
5300
|
}
|
|
5276
|
-
const configPath =
|
|
5301
|
+
const configPath = import_path3.default.join(destDir, "src", "configs", "appConfig.ts");
|
|
5277
5302
|
if (exists(configPath)) {
|
|
5278
5303
|
let cfg = readText(configPath);
|
|
5279
5304
|
cfg = cfg.replace(
|
|
@@ -5283,7 +5308,7 @@ function replaceTokens(destDir, appName, description) {
|
|
|
5283
5308
|
writeText(configPath, cfg);
|
|
5284
5309
|
logOk("src/configs/appConfig.ts \u2014 default title");
|
|
5285
5310
|
}
|
|
5286
|
-
const readmePath =
|
|
5311
|
+
const readmePath = import_path3.default.join(destDir, "README.md");
|
|
5287
5312
|
if (exists(readmePath)) {
|
|
5288
5313
|
let readme = readText(readmePath);
|
|
5289
5314
|
readme = readme.replace(
|
|
@@ -5297,7 +5322,7 @@ function replaceTokens(destDir, appName, description) {
|
|
|
5297
5322
|
writeText(readmePath, readme);
|
|
5298
5323
|
logOk("README.md \u2014 heading");
|
|
5299
5324
|
}
|
|
5300
|
-
const manifestPath =
|
|
5325
|
+
const manifestPath = import_path3.default.join(destDir, "public", "manifest.webmanifest");
|
|
5301
5326
|
if (exists(manifestPath)) {
|
|
5302
5327
|
let manifest = readText(manifestPath);
|
|
5303
5328
|
manifest = manifest.replace(
|
|
@@ -5309,7 +5334,7 @@ function replaceTokens(destDir, appName, description) {
|
|
|
5309
5334
|
}
|
|
5310
5335
|
}
|
|
5311
5336
|
function patchDockerComposeForProject(destDir, appName, portOffset) {
|
|
5312
|
-
const composePath =
|
|
5337
|
+
const composePath = import_path3.default.join(destDir, "docker-compose.yml");
|
|
5313
5338
|
if (!exists(composePath)) return;
|
|
5314
5339
|
logStep("Patching docker-compose.yml \u2014 container names + ports");
|
|
5315
5340
|
let content = readText(composePath);
|
|
@@ -5342,7 +5367,7 @@ function patchDockerComposeForProject(destDir, appName, portOffset) {
|
|
|
5342
5367
|
}
|
|
5343
5368
|
}
|
|
5344
5369
|
function patchMakefileForProject(destDir, appName) {
|
|
5345
|
-
const makefilePath =
|
|
5370
|
+
const makefilePath = import_path3.default.join(destDir, "Makefile");
|
|
5346
5371
|
if (!exists(makefilePath)) return;
|
|
5347
5372
|
let content = readText(makefilePath);
|
|
5348
5373
|
content = content.replace(
|
|
@@ -5355,7 +5380,7 @@ function patchMakefileForProject(destDir, appName) {
|
|
|
5355
5380
|
logOk("Makefile \u2014 ensured dynamic container names");
|
|
5356
5381
|
}
|
|
5357
5382
|
function patchViteConfigPort(destDir, portOffset) {
|
|
5358
|
-
const configPath =
|
|
5383
|
+
const configPath = import_path3.default.join(destDir, "vite.config.ts");
|
|
5359
5384
|
if (!exists(configPath)) return;
|
|
5360
5385
|
const devPort = 3e3 + portOffset;
|
|
5361
5386
|
let content = readText(configPath);
|
|
@@ -5366,7 +5391,7 @@ function patchViteConfigPort(destDir, portOffset) {
|
|
|
5366
5391
|
function patchEnvExamplePorts(destDir, portOffset) {
|
|
5367
5392
|
const bePort = 8e3 + portOffset;
|
|
5368
5393
|
for (const envFile of [".env.example", ".env.local"]) {
|
|
5369
|
-
const envPath =
|
|
5394
|
+
const envPath = import_path3.default.join(destDir, envFile);
|
|
5370
5395
|
if (!exists(envPath)) continue;
|
|
5371
5396
|
let content = readText(envPath);
|
|
5372
5397
|
content = patchReplace(
|
|
@@ -5383,17 +5408,17 @@ function removeDocker(destDir) {
|
|
|
5383
5408
|
const files = ["Dockerfile", "docker-compose.yml", ".dockerignore", "nginx.conf"];
|
|
5384
5409
|
let deleted = 0;
|
|
5385
5410
|
for (const f of files) {
|
|
5386
|
-
if (safeUnlink(
|
|
5411
|
+
if (safeUnlink(import_path3.default.join(destDir, f))) deleted++;
|
|
5387
5412
|
}
|
|
5388
|
-
if (safeRmDir(
|
|
5413
|
+
if (safeRmDir(import_path3.default.join(destDir, "nginx"))) {
|
|
5389
5414
|
deleted++;
|
|
5390
5415
|
logInfo("nginx/ \u2014 removed");
|
|
5391
5416
|
}
|
|
5392
|
-
if (safeUnlink(
|
|
5417
|
+
if (safeUnlink(import_path3.default.join(destDir, "Makefile"))) {
|
|
5393
5418
|
deleted++;
|
|
5394
5419
|
logInfo("Makefile \u2014 removed");
|
|
5395
5420
|
}
|
|
5396
|
-
const readmePath =
|
|
5421
|
+
const readmePath = import_path3.default.join(destDir, "README.md");
|
|
5397
5422
|
if (exists(readmePath)) {
|
|
5398
5423
|
let readme = readText(readmePath);
|
|
5399
5424
|
readme = removeMarkedSection(readme, "DOCKER");
|
|
@@ -5403,7 +5428,7 @@ function removeDocker(destDir) {
|
|
|
5403
5428
|
writeText(readmePath, readme);
|
|
5404
5429
|
logInfo("README.md \u2014 removed Docker sections");
|
|
5405
5430
|
}
|
|
5406
|
-
const envExPath =
|
|
5431
|
+
const envExPath = import_path3.default.join(destDir, ".env.example");
|
|
5407
5432
|
if (exists(envExPath)) {
|
|
5408
5433
|
let env = readText(envExPath);
|
|
5409
5434
|
env = env.replace(/# -{5,}\s*\n# 🐳 Docker[^#]*/g, "");
|
|
@@ -5426,16 +5451,16 @@ var PWA_FILES = [
|
|
|
5426
5451
|
function removePwa(destDir) {
|
|
5427
5452
|
let deleted = 0;
|
|
5428
5453
|
for (const f of PWA_FILES) {
|
|
5429
|
-
if (safeUnlink(
|
|
5454
|
+
if (safeUnlink(import_path3.default.join(destDir, f))) deleted++;
|
|
5430
5455
|
}
|
|
5431
|
-
if (safeRmDir(
|
|
5432
|
-
safeRmDir(
|
|
5433
|
-
safeRmDir(
|
|
5456
|
+
if (safeRmDir(import_path3.default.join(destDir, "public", "icons"))) deleted++;
|
|
5457
|
+
safeRmDir(import_path3.default.join(destDir, "src", "sw"));
|
|
5458
|
+
safeRmDir(import_path3.default.join(destDir, "src", "pwa"));
|
|
5434
5459
|
removePwaFromPackageJson(destDir);
|
|
5435
5460
|
removePwaFromPluginsIndex(destDir);
|
|
5436
5461
|
removePwaFromViteConfig(destDir);
|
|
5437
5462
|
removePwaFromIndexHtml(destDir);
|
|
5438
|
-
const readmePath =
|
|
5463
|
+
const readmePath = import_path3.default.join(destDir, "README.md");
|
|
5439
5464
|
if (exists(readmePath)) {
|
|
5440
5465
|
let readme = readText(readmePath);
|
|
5441
5466
|
readme = removeMarkedSection(readme, "PWA");
|
|
@@ -5450,7 +5475,7 @@ function removePwa(destDir) {
|
|
|
5450
5475
|
logOk(`Deleted ${deleted} PWA file(s)`);
|
|
5451
5476
|
}
|
|
5452
5477
|
function removePwaFromPackageJson(destDir) {
|
|
5453
|
-
const pkgPath =
|
|
5478
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5454
5479
|
if (!exists(pkgPath)) return;
|
|
5455
5480
|
const pkg = readJson(pkgPath);
|
|
5456
5481
|
let changed = false;
|
|
@@ -5471,7 +5496,7 @@ function removePwaFromPackageJson(destDir) {
|
|
|
5471
5496
|
removePkgScript(destDir, "setup:pwa");
|
|
5472
5497
|
}
|
|
5473
5498
|
function removePwaFromPluginsIndex(destDir) {
|
|
5474
|
-
const indexPath =
|
|
5499
|
+
const indexPath = import_path3.default.join(destDir, "plugins", "index.ts");
|
|
5475
5500
|
if (!exists(indexPath)) return;
|
|
5476
5501
|
let content = readText(indexPath);
|
|
5477
5502
|
content = content.replace(/^.*pwaPlugin.*\n/gm, "");
|
|
@@ -5483,7 +5508,7 @@ function removePwaFromPluginsIndex(destDir) {
|
|
|
5483
5508
|
logInfo("plugins/index.ts \u2014 removed PWA plugin exports");
|
|
5484
5509
|
}
|
|
5485
5510
|
function removePwaFromViteConfig(destDir) {
|
|
5486
|
-
const configPath =
|
|
5511
|
+
const configPath = import_path3.default.join(destDir, "vite.config.ts");
|
|
5487
5512
|
if (!exists(configPath)) return;
|
|
5488
5513
|
let content = readText(configPath);
|
|
5489
5514
|
content = content.replace(
|
|
@@ -5504,7 +5529,7 @@ function removePwaFromViteConfig(destDir) {
|
|
|
5504
5529
|
logInfo("vite.config.ts \u2014 removed PWA plugin usage");
|
|
5505
5530
|
}
|
|
5506
5531
|
function removePwaFromIndexHtml(destDir) {
|
|
5507
|
-
const indexPath =
|
|
5532
|
+
const indexPath = import_path3.default.join(destDir, "index.html");
|
|
5508
5533
|
if (!exists(indexPath)) return;
|
|
5509
5534
|
let html = readText(indexPath);
|
|
5510
5535
|
html = html.replace(/\s*<link rel="manifest"[^>]*>\s*/g, "\n ");
|
|
@@ -5522,7 +5547,7 @@ function removePwaFromIndexHtml(destDir) {
|
|
|
5522
5547
|
logInfo("index.html \u2014 removed PWA meta tags and manifest link");
|
|
5523
5548
|
}
|
|
5524
5549
|
function removePwaFromMainTsx(destDir) {
|
|
5525
|
-
const mainPath =
|
|
5550
|
+
const mainPath = import_path3.default.join(destDir, "src", "main.tsx");
|
|
5526
5551
|
if (!exists(mainPath)) return;
|
|
5527
5552
|
let content = readText(mainPath);
|
|
5528
5553
|
content = content.replace(/^import\s*\{[^}]*initPWA[^}]*\}\s*from\s*['"][^'"]*pwa['"];\s*\n/gm, "");
|
|
@@ -5532,7 +5557,7 @@ function removePwaFromMainTsx(destDir) {
|
|
|
5532
5557
|
logInfo("src/main.tsx \u2014 removed initPWA import and call");
|
|
5533
5558
|
}
|
|
5534
5559
|
function removePwaFromAppTsx(destDir) {
|
|
5535
|
-
const appPath =
|
|
5560
|
+
const appPath = import_path3.default.join(destDir, "src", "App.tsx");
|
|
5536
5561
|
if (!exists(appPath)) return;
|
|
5537
5562
|
let content = readText(appPath);
|
|
5538
5563
|
content = content.replace(/,\s*PwaUpdateBanner\b/g, "");
|
|
@@ -5543,11 +5568,11 @@ function removePwaFromAppTsx(destDir) {
|
|
|
5543
5568
|
logInfo("src/App.tsx \u2014 removed PwaUpdateBanner");
|
|
5544
5569
|
}
|
|
5545
5570
|
function removeHusky(destDir) {
|
|
5546
|
-
const huskyDir =
|
|
5571
|
+
const huskyDir = import_path3.default.join(destDir, ".husky");
|
|
5547
5572
|
if (safeRmDir(huskyDir)) {
|
|
5548
5573
|
logInfo(".husky/ \u2014 removed");
|
|
5549
5574
|
}
|
|
5550
|
-
const pkgPath =
|
|
5575
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5551
5576
|
if (exists(pkgPath)) {
|
|
5552
5577
|
const pkg = readJson(pkgPath);
|
|
5553
5578
|
let changed = false;
|
|
@@ -5587,7 +5612,7 @@ function addTailwind(destDir) {
|
|
|
5587
5612
|
importTailwindInMain(destDir);
|
|
5588
5613
|
}
|
|
5589
5614
|
function addTailwindDeps(destDir) {
|
|
5590
|
-
const pkgPath =
|
|
5615
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5591
5616
|
if (!exists(pkgPath)) return;
|
|
5592
5617
|
const pkg = readJson(pkgPath);
|
|
5593
5618
|
const devDeps = pkg["devDependencies"] ?? {};
|
|
@@ -5598,7 +5623,7 @@ function addTailwindDeps(destDir) {
|
|
|
5598
5623
|
logOk("package.json \u2014 added tailwindcss + @tailwindcss/vite");
|
|
5599
5624
|
}
|
|
5600
5625
|
function addTailwindVitePlugin(destDir) {
|
|
5601
|
-
const configPath =
|
|
5626
|
+
const configPath = import_path3.default.join(destDir, "vite.config.ts");
|
|
5602
5627
|
if (!exists(configPath)) return;
|
|
5603
5628
|
let content = readText(configPath);
|
|
5604
5629
|
if (!content.includes("@tailwindcss/vite")) {
|
|
@@ -5669,12 +5694,12 @@ function createTailwindCss(destDir) {
|
|
|
5669
5694
|
--radius-lg: var(--radius-4);
|
|
5670
5695
|
}
|
|
5671
5696
|
`;
|
|
5672
|
-
const stylesDir =
|
|
5673
|
-
writeText(
|
|
5697
|
+
const stylesDir = import_path3.default.join(destDir, "src", "styles");
|
|
5698
|
+
writeText(import_path3.default.join(stylesDir, "tailwind.css"), tailwindCss);
|
|
5674
5699
|
logOk("src/styles/tailwind.css \u2014 created with theme bridge");
|
|
5675
5700
|
}
|
|
5676
5701
|
function importTailwindInMain(destDir) {
|
|
5677
|
-
const mainPath =
|
|
5702
|
+
const mainPath = import_path3.default.join(destDir, "src", "main.tsx");
|
|
5678
5703
|
if (!exists(mainPath)) return;
|
|
5679
5704
|
let content = readText(mainPath);
|
|
5680
5705
|
const tailwindImport = "import '@styles/tailwind.css';";
|
|
@@ -5708,7 +5733,7 @@ function cleanupSetupScripts(destDir, opts) {
|
|
|
5708
5733
|
if (scriptsToRemove.length === 0) return;
|
|
5709
5734
|
logStep("Removing unused setup scripts");
|
|
5710
5735
|
for (const script of scriptsToRemove) {
|
|
5711
|
-
const scriptPath =
|
|
5736
|
+
const scriptPath = import_path3.default.join(destDir, "scripts", script);
|
|
5712
5737
|
if (safeUnlink(scriptPath)) {
|
|
5713
5738
|
logOk(`scripts/${script} \u2014 removed`);
|
|
5714
5739
|
}
|
|
@@ -5785,11 +5810,11 @@ function injectBrandColors(destDir, opts) {
|
|
|
5785
5810
|
"}",
|
|
5786
5811
|
""
|
|
5787
5812
|
].join("\n");
|
|
5788
|
-
const themesDir =
|
|
5789
|
-
const brandPath =
|
|
5813
|
+
const themesDir = import_path3.default.join(destDir, "src", "styles", "themes");
|
|
5814
|
+
const brandPath = import_path3.default.join(themesDir, "_brand.scss");
|
|
5790
5815
|
writeText(brandPath, brandScss);
|
|
5791
5816
|
logOk("src/styles/themes/_brand.scss \u2014 created");
|
|
5792
|
-
const indexPath =
|
|
5817
|
+
const indexPath = import_path3.default.join(themesDir, "_index.scss");
|
|
5793
5818
|
if (exists(indexPath)) {
|
|
5794
5819
|
let idx = readText(indexPath);
|
|
5795
5820
|
if (!idx.includes("@forward './brand'")) {
|
|
@@ -5800,8 +5825,8 @@ function injectBrandColors(destDir, opts) {
|
|
|
5800
5825
|
}
|
|
5801
5826
|
}
|
|
5802
5827
|
function generateEnvLocal(destDir, appName) {
|
|
5803
|
-
const examplePath =
|
|
5804
|
-
const localPath =
|
|
5828
|
+
const examplePath = import_path3.default.join(destDir, ".env.example");
|
|
5829
|
+
const localPath = import_path3.default.join(destDir, ".env.local");
|
|
5805
5830
|
if (!exists(examplePath)) {
|
|
5806
5831
|
logInfo(".env.example not found \u2014 skipping .env.local generation");
|
|
5807
5832
|
return;
|
|
@@ -5816,7 +5841,7 @@ function generateEnvLocal(destDir, appName) {
|
|
|
5816
5841
|
logOk(".env.local generated from .env.example");
|
|
5817
5842
|
}
|
|
5818
5843
|
function cleanupGitignore(destDir) {
|
|
5819
|
-
const gitignorePath =
|
|
5844
|
+
const gitignorePath = import_path3.default.join(destDir, ".gitignore");
|
|
5820
5845
|
if (!exists(gitignorePath)) return;
|
|
5821
5846
|
let content = readText(gitignorePath);
|
|
5822
5847
|
const monorepoPatterns = [
|
|
@@ -5848,7 +5873,7 @@ function cleanupTemplateDocs(destDir) {
|
|
|
5848
5873
|
logStep("Removing template documentation files");
|
|
5849
5874
|
let removed = 0;
|
|
5850
5875
|
for (const f of docFiles) {
|
|
5851
|
-
if (safeUnlink(
|
|
5876
|
+
if (safeUnlink(import_path3.default.join(destDir, f))) {
|
|
5852
5877
|
logOk(`${f} \u2014 removed`);
|
|
5853
5878
|
removed++;
|
|
5854
5879
|
}
|
|
@@ -5884,7 +5909,7 @@ function initGitRepo(destDir, appName) {
|
|
|
5884
5909
|
}
|
|
5885
5910
|
}
|
|
5886
5911
|
function removePkgScript(destDir, scriptName) {
|
|
5887
|
-
const pkgPath =
|
|
5912
|
+
const pkgPath = import_path3.default.join(destDir, "package.json");
|
|
5888
5913
|
if (!exists(pkgPath)) return;
|
|
5889
5914
|
const pkg = readJson(pkgPath);
|
|
5890
5915
|
const scripts = pkg["scripts"];
|
|
@@ -5957,7 +5982,7 @@ async function runWebCommand(argv) {
|
|
|
5957
5982
|
return;
|
|
5958
5983
|
}
|
|
5959
5984
|
if (args.includes("--version") || args.includes("-v")) {
|
|
5960
|
-
console.log("1.0.
|
|
5985
|
+
console.log("1.0.5");
|
|
5961
5986
|
return;
|
|
5962
5987
|
}
|
|
5963
5988
|
printBanner();
|
|
@@ -5972,7 +5997,7 @@ async function runWebCommand(argv) {
|
|
|
5972
5997
|
const destDir2 = getDestDir(appName2);
|
|
5973
5998
|
const pm2 = detectDefaultPm();
|
|
5974
5999
|
console.log("");
|
|
5975
|
-
logStep(`Creating "${appName2}" (non-interactive) in ${
|
|
6000
|
+
logStep(`Creating "${appName2}" (non-interactive) in ${import_path4.default.relative(process.cwd(), import_path4.default.dirname(destDir2))}`);
|
|
5976
6001
|
try {
|
|
5977
6002
|
await scaffold({
|
|
5978
6003
|
appName: appName2,
|
|
@@ -6121,7 +6146,7 @@ async function runWebCommand(argv) {
|
|
|
6121
6146
|
const appName = toPackageName(argName ?? answers.appName ?? "my-web-app");
|
|
6122
6147
|
const destDir = getDestDir(appName);
|
|
6123
6148
|
console.log("");
|
|
6124
|
-
logStep(`Creating "${appName}" in ${
|
|
6149
|
+
logStep(`Creating "${appName}" in ${import_path4.default.relative(process.cwd(), import_path4.default.dirname(destDir))}`);
|
|
6125
6150
|
try {
|
|
6126
6151
|
await scaffold({
|
|
6127
6152
|
appName,
|
|
@@ -6161,19 +6186,19 @@ async function runWebCommand(argv) {
|
|
|
6161
6186
|
function printBanner() {
|
|
6162
6187
|
console.log("");
|
|
6163
6188
|
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\u2557");
|
|
6164
|
-
console.log(` \u2551 create-basekit web v${"1.0.
|
|
6189
|
+
console.log(` \u2551 create-basekit web v${"1.0.5"} \u2551`);
|
|
6165
6190
|
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\u255D");
|
|
6166
6191
|
console.log("");
|
|
6167
6192
|
}
|
|
6168
6193
|
function abortIfInsideWorkspace(argv) {
|
|
6169
6194
|
const exampleName = argv.find((a) => !a.startsWith("-") && !isValueOfFlag(argv, a))?.trim() ?? "my-app";
|
|
6170
6195
|
let dir = process.cwd();
|
|
6171
|
-
const root =
|
|
6196
|
+
const root = import_path4.default.parse(dir).root;
|
|
6172
6197
|
while (dir !== root) {
|
|
6173
|
-
const pkgPath =
|
|
6174
|
-
if (
|
|
6198
|
+
const pkgPath = import_path4.default.join(dir, "package.json");
|
|
6199
|
+
if (import_fs4.default.existsSync(pkgPath)) {
|
|
6175
6200
|
try {
|
|
6176
|
-
const pkg = JSON.parse(
|
|
6201
|
+
const pkg = JSON.parse(import_fs4.default.readFileSync(pkgPath, "utf8"));
|
|
6177
6202
|
if (pkg.workspaces) {
|
|
6178
6203
|
console.error("");
|
|
6179
6204
|
console.error(" \u2717 Cannot create app inside a Yarn workspace.");
|
|
@@ -6195,7 +6220,7 @@ function abortIfInsideWorkspace(argv) {
|
|
|
6195
6220
|
} catch {
|
|
6196
6221
|
}
|
|
6197
6222
|
}
|
|
6198
|
-
const parent =
|
|
6223
|
+
const parent = import_path4.default.dirname(dir);
|
|
6199
6224
|
if (parent === dir) break;
|
|
6200
6225
|
dir = parent;
|
|
6201
6226
|
}
|