create-brainerce-store 1.20.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 +26 -12
- package/package.json +8 -8
- package/LICENSE +0 -0
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.20.
|
|
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(
|
|
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
|
-
|
|
586
|
-
execSync2("git
|
|
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
|
|
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(
|
|
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
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-brainerce-store",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-brainerce-store": "dist/index.js"
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"templates",
|
|
11
11
|
"messages"
|
|
12
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
|
+
},
|
|
13
18
|
"dependencies": {
|
|
14
19
|
"chalk": "^4.1.2",
|
|
15
20
|
"commander": "^12.1.0",
|
|
@@ -36,10 +41,5 @@
|
|
|
36
41
|
"create",
|
|
37
42
|
"nextjs"
|
|
38
43
|
],
|
|
39
|
-
"license": "MIT"
|
|
40
|
-
|
|
41
|
-
"build": "tsup src/index.ts --format cjs --dts --clean",
|
|
42
|
-
"dev": "tsup src/index.ts --format cjs --dts --watch",
|
|
43
|
-
"clean": "rimraf dist"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
44
|
+
"license": "MIT"
|
|
45
|
+
}
|
package/LICENSE
DELETED
|
File without changes
|