@sb-codex/create-sb-app 0.0.3 → 0.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 +0 -7
- package/dist/index.js +9 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,13 +48,6 @@ pnpm dev
|
|
|
48
48
|
npx @sb-codex/create-sb-app my-saas --name my-saas --domain localhost --no-git
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
## Local usage (from the monorepo)
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pnpm --filter @sb-codex/create-sb-app build
|
|
55
|
-
node packages/create-sb-app/dist/index.js ../my-saas
|
|
56
|
-
```
|
|
57
|
-
|
|
58
51
|
---
|
|
59
52
|
|
|
60
53
|
Part of the [sb-codex SaaS starter](https://github.com/SB-SLIM/react-app-starter). See [docs/plugins](../../docs/plugins/README.md).
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
rmSync as rmSync2,
|
|
10
10
|
copyFileSync
|
|
11
11
|
} from "fs";
|
|
12
|
-
import { join as join2, extname
|
|
12
|
+
import { join as join2, extname } from "path";
|
|
13
13
|
import { execSync } from "child_process";
|
|
14
14
|
import {
|
|
15
15
|
intro,
|
|
@@ -153,6 +153,10 @@ function applyAppsOnly(targetDir) {
|
|
|
153
153
|
const changesetDir = join(targetDir, ".changeset");
|
|
154
154
|
if (existsSync(changesetDir))
|
|
155
155
|
rmSync(changesetDir, { recursive: true, force: true });
|
|
156
|
+
for (const rel of [".claude", "CLAUDE.md", "docs"]) {
|
|
157
|
+
const p = join(targetDir, rel);
|
|
158
|
+
if (existsSync(p)) rmSync(p, { recursive: true, force: true });
|
|
159
|
+
}
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
// src/index.ts
|
|
@@ -204,32 +208,21 @@ async function main() {
|
|
|
204
208
|
intro(pc.bgCyan(pc.black(" create-sb-app ")));
|
|
205
209
|
const flags = parseFlags(process.argv.slice(2));
|
|
206
210
|
const positional = process.argv.slice(2).find((a) => !a.startsWith("--"));
|
|
207
|
-
let target = positional ?? (typeof flags.
|
|
211
|
+
let target = positional ?? (typeof flags.name === "string" ? flags.name : void 0);
|
|
208
212
|
if (!target) {
|
|
209
213
|
const answer = await text({
|
|
210
|
-
message: "Project
|
|
214
|
+
message: "Project name?",
|
|
211
215
|
placeholder: "my-saas",
|
|
212
|
-
validate: (v) => v.length === 0 ? "
|
|
216
|
+
validate: (v) => slugify(v).length === 0 ? "Invalid name" : void 0
|
|
213
217
|
});
|
|
214
218
|
if (isCancel(answer)) bail("Cancelled.");
|
|
215
219
|
target = answer;
|
|
216
220
|
}
|
|
221
|
+
const name = slugify(target);
|
|
217
222
|
const targetDir = join2(process.cwd(), target);
|
|
218
223
|
if (existsSync2(targetDir) && readdirSync2(targetDir).length > 0) {
|
|
219
224
|
bail(`Directory "${target}" already exists and is not empty.`);
|
|
220
225
|
}
|
|
221
|
-
let name;
|
|
222
|
-
if (typeof flags.name === "string") {
|
|
223
|
-
name = flags.name;
|
|
224
|
-
} else {
|
|
225
|
-
const nameAnswer = await text({
|
|
226
|
-
message: "Project name (package name)?",
|
|
227
|
-
initialValue: slugify(basename(target)),
|
|
228
|
-
validate: (v) => slugify(v).length === 0 ? "Invalid name" : void 0
|
|
229
|
-
});
|
|
230
|
-
if (isCancel(nameAnswer)) bail("Cancelled.");
|
|
231
|
-
name = nameAnswer;
|
|
232
|
-
}
|
|
233
226
|
let domain;
|
|
234
227
|
if (typeof flags.domain === "string") {
|
|
235
228
|
domain = flags.domain;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@sb-codex/create-sb-app",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "Scaffold a new multi-tenant SaaS project from the sb-codex starter.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|