create-brainerce-store 1.27.0 → 1.27.3

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -26
  2. package/package.json +1 -1
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.27.0",
34
+ version: "1.27.3",
35
35
  description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
36
36
  bin: {
37
37
  "create-brainerce-store": "dist/index.js"
@@ -163,29 +163,16 @@ async function installDependencies(projectDir, pkgManager) {
163
163
  // src/cli.ts
164
164
  async function runInteractive(defaults) {
165
165
  const questions = [];
166
- if (!defaults.projectName) {
167
- questions.push({
168
- type: "text",
169
- name: "projectName",
170
- message: "Project name:",
171
- initial: "my-store",
172
- validate: (value) => {
173
- const error = validateProjectName(value);
174
- return error || true;
175
- }
176
- });
177
- } else {
178
- questions.push({
179
- type: "text",
180
- name: "projectName",
181
- message: "Project name:",
182
- initial: defaults.projectName,
183
- validate: (value) => {
184
- const error = validateProjectName(value);
185
- return error || true;
186
- }
187
- });
188
- }
166
+ questions.push({
167
+ type: "text",
168
+ name: "projectName",
169
+ message: "Project name:",
170
+ initial: defaults.projectName || "",
171
+ validate: (value) => {
172
+ const error = validateProjectName(value);
173
+ return error || true;
174
+ }
175
+ });
189
176
  if (!defaults.connectionId) {
190
177
  questions.push({
191
178
  type: "text",
@@ -624,8 +611,10 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
624
611
  );
625
612
  }
626
613
  }
627
- const slugify = (s) => s.toLowerCase().trim().replace(/[^a-z0-9\u0590-\u05FF]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 50);
628
- const projectNameDefault = projectName || (storeInfo ? slugify(storeInfo.name) : void 0);
614
+ const slugify = (s) => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9._-]+/g, "-").replace(/^[.-]+|[.-]+$/g, "").slice(0, 50);
615
+ const channelSlug = storeInfo ? slugify(storeInfo.name) : "";
616
+ const storeSlug = storeInfo ? slugify(storeInfo.storeName) : "";
617
+ const projectNameDefault = projectName || channelSlug || storeSlug || void 0;
629
618
  const languageDefault = language || storeInfo?.language;
630
619
  if (!projectName || !connectionId || !language) {
631
620
  const answers = await runInteractive({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.27.0",
3
+ "version": "1.27.3",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"