@sb-codex/create-sb-app 0.0.3 → 0.0.4

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 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, basename } from "path";
12
+ import { join as join2, extname } from "path";
13
13
  import { execSync } from "child_process";
14
14
  import {
15
15
  intro,
@@ -204,32 +204,21 @@ async function main() {
204
204
  intro(pc.bgCyan(pc.black(" create-sb-app ")));
205
205
  const flags = parseFlags(process.argv.slice(2));
206
206
  const positional = process.argv.slice(2).find((a) => !a.startsWith("--"));
207
- let target = positional ?? (typeof flags.dir === "string" ? flags.dir : void 0);
207
+ let target = positional ?? (typeof flags.name === "string" ? flags.name : void 0);
208
208
  if (!target) {
209
209
  const answer = await text({
210
- message: "Project directory?",
210
+ message: "Project name?",
211
211
  placeholder: "my-saas",
212
- validate: (v) => v.length === 0 ? "Required" : void 0
212
+ validate: (v) => slugify(v).length === 0 ? "Invalid name" : void 0
213
213
  });
214
214
  if (isCancel(answer)) bail("Cancelled.");
215
215
  target = answer;
216
216
  }
217
+ const name = slugify(target);
217
218
  const targetDir = join2(process.cwd(), target);
218
219
  if (existsSync2(targetDir) && readdirSync2(targetDir).length > 0) {
219
220
  bail(`Directory "${target}" already exists and is not empty.`);
220
221
  }
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
222
  let domain;
234
223
  if (typeof flags.domain === "string") {
235
224
  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.3",
4
+ "version": "0.0.4",
5
5
  "description": "Scaffold a new multi-tenant SaaS project from the sb-codex starter.",
6
6
  "type": "module",
7
7
  "license": "MIT",