create-brainerce-store 1.19.0 → 1.20.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/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "create-brainerce-store",
34
- version: "1.19.0",
34
+ version: "1.20.1",
35
35
  description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
36
36
  bin: {
37
37
  "create-brainerce-store": "dist/index.js"
@@ -78,6 +78,7 @@ var require_package = __commonJS({
78
78
  });
79
79
 
80
80
  // src/index.ts
81
+ var import_path2 = __toESM(require("path"));
81
82
  var import_commander = require("commander");
82
83
 
83
84
  // src/cli.ts
@@ -272,9 +273,9 @@ function getFontConfig(language) {
272
273
  };
273
274
  }
274
275
  async function scaffold(options) {
275
- const { projectName, framework, theme } = options;
276
- const targetDir = import_path.default.resolve(process.cwd(), projectName);
277
- if (await import_fs_extra.default.pathExists(targetDir)) {
276
+ const { projectName, framework, theme, scaffoldInPlace } = options;
277
+ const targetDir = scaffoldInPlace ? process.cwd() : import_path.default.resolve(process.cwd(), projectName);
278
+ if (!scaffoldInPlace && await import_fs_extra.default.pathExists(targetDir)) {
278
279
  const contents = await import_fs_extra.default.readdir(targetDir);
279
280
  if (contents.length > 0) {
280
281
  throw new Error(`Directory "${projectName}" already exists and is not empty.`);
@@ -512,6 +513,11 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
512
513
  logger.banner(pkg.version);
513
514
  const updateCheck = checkForUpdate(pkg.name, pkg.version);
514
515
  let projectName = projectNameArg;
516
+ let scaffoldInPlace = false;
517
+ if (projectName === "." || projectName === "./") {
518
+ projectName = import_path2.default.basename(import_path2.default.resolve("."));
519
+ scaffoldInPlace = true;
520
+ }
515
521
  let connectionId = options.connectionId;
516
522
  let language = options.language;
517
523
  let framework = options.framework;
@@ -574,18 +580,22 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
574
580
  storeName: storeInfo.name,
575
581
  currency: storeInfo.currency,
576
582
  language: language || storeInfo.language,
577
- i18n: storeInfo.i18n
583
+ i18n: storeInfo.i18n,
584
+ scaffoldInPlace
578
585
  });
579
- scaffoldSpinner.succeed(`Scaffolded into ./${projectName}`);
586
+ scaffoldSpinner.succeed(
587
+ scaffoldInPlace ? "Scaffolded into current directory" : `Scaffolded into ./${projectName}`
588
+ );
580
589
  if (!skipGit) {
581
590
  const gitSpinner = createSpinner("Initializing git...");
582
591
  gitSpinner.start();
583
592
  try {
584
593
  const { execSync: execSync2 } = require("child_process");
585
- execSync2("git init", { cwd: projectName, stdio: "ignore" });
586
- execSync2("git add -A", { cwd: projectName, stdio: "ignore" });
594
+ const cwd = scaffoldInPlace ? "." : projectName;
595
+ execSync2("git init", { cwd, stdio: "ignore" });
596
+ execSync2("git add -A", { cwd, stdio: "ignore" });
587
597
  execSync2('git commit -m "Initial commit from create-brainerce-store"', {
588
- cwd: projectName,
598
+ cwd,
589
599
  stdio: "ignore"
590
600
  });
591
601
  gitSpinner.succeed("Git initialized");
@@ -597,16 +607,20 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
597
607
  const installSpinner = createSpinner(`Installing dependencies with ${pkgManager}...`);
598
608
  installSpinner.start();
599
609
  try {
600
- await installDependencies(projectName, pkgManager);
610
+ await installDependencies(scaffoldInPlace ? "." : projectName, pkgManager);
601
611
  installSpinner.succeed("Dependencies installed");
602
612
  } catch {
603
613
  installSpinner.fail("Dependency installation failed");
604
- logger.warn(`Run \`cd ${projectName} && ${pkgManager} install\` manually.`);
614
+ logger.warn(
615
+ scaffoldInPlace ? `Run \`${pkgManager} install\` manually.` : `Run \`cd ${projectName} && ${pkgManager} install\` manually.`
616
+ );
605
617
  }
606
618
  }
607
619
  logger.success("\nYour Brainerce store is ready!\n");
608
620
  logger.info("Next steps:");
609
- logger.step(`cd ${projectName}`);
621
+ if (!scaffoldInPlace) {
622
+ logger.step(`cd ${projectName}`);
623
+ }
610
624
  logger.step(`${pkgManager}${pkgManager === "npm" ? " run" : ""} dev`);
611
625
  logger.info(`
612
626
  Your store will be running at http://localhost:3000`);
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "create-brainerce-store",
3
- "version": "1.19.0",
4
- "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
- "bin": {
6
- "create-brainerce-store": "dist/index.js"
7
- },
8
- "files": [
9
- "dist",
10
- "templates",
11
- "messages"
12
- ],
13
- "scripts": {
14
- "build": "tsup src/index.ts --format cjs --dts --clean",
15
- "dev": "tsup src/index.ts --format cjs --dts --watch",
16
- "clean": "rimraf dist"
17
- },
18
- "dependencies": {
19
- "chalk": "^4.1.2",
20
- "commander": "^12.1.0",
21
- "ejs": "^3.1.10",
22
- "fs-extra": "^11.2.0",
23
- "ora": "^5.4.1",
24
- "prompts": "^2.4.2"
25
- },
26
- "devDependencies": {
27
- "@types/ejs": "^3.1.5",
28
- "@types/fs-extra": "^11.0.4",
29
- "@types/prompts": "^2.4.9",
30
- "tsup": "^8.0.0",
31
- "typescript": "^5.4.0"
32
- },
33
- "engines": {
34
- "node": ">=18"
35
- },
36
- "keywords": [
37
- "brainerce",
38
- "ecommerce",
39
- "storefront",
40
- "scaffold",
41
- "create",
42
- "nextjs"
43
- ],
44
- "license": "MIT"
45
- }
1
+ {
2
+ "name": "create-brainerce-store",
3
+ "version": "1.20.1",
4
+ "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
+ "bin": {
6
+ "create-brainerce-store": "dist/index.js"
7
+ },
8
+ "files": [
9
+ "dist",
10
+ "templates",
11
+ "messages"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup src/index.ts --format cjs --dts --clean",
15
+ "dev": "tsup src/index.ts --format cjs --dts --watch",
16
+ "clean": "rimraf dist"
17
+ },
18
+ "dependencies": {
19
+ "chalk": "^4.1.2",
20
+ "commander": "^12.1.0",
21
+ "ejs": "^3.1.10",
22
+ "fs-extra": "^11.2.0",
23
+ "ora": "^5.4.1",
24
+ "prompts": "^2.4.2"
25
+ },
26
+ "devDependencies": {
27
+ "@types/ejs": "^3.1.5",
28
+ "@types/fs-extra": "^11.0.4",
29
+ "@types/prompts": "^2.4.9",
30
+ "tsup": "^8.0.0",
31
+ "typescript": "^5.4.0"
32
+ },
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "keywords": [
37
+ "brainerce",
38
+ "ecommerce",
39
+ "storefront",
40
+ "scaffold",
41
+ "create",
42
+ "nextjs"
43
+ ],
44
+ "license": "MIT"
45
+ }