@onexapis/cli 1.0.1 → 1.0.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.
package/dist/cli.mjs CHANGED
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import chalk4 from 'chalk';
4
2
  import path from 'path';
5
- import fs2 from 'fs';
6
- import { execSync, spawn } from 'child_process';
7
- import inquirer from 'inquirer';
8
- import ora from 'ora';
3
+ import os from 'os';
4
+ import dotenv from 'dotenv';
9
5
  import fs from 'fs-extra';
10
6
  import ejs from 'ejs';
7
+ import { execSync, spawn } from 'child_process';
8
+ import chalk4 from 'chalk';
9
+ import ora from 'ora';
10
+ import { Command } from 'commander';
11
+ import fs2 from 'fs';
12
+ import inquirer from 'inquirer';
11
13
  import archiver from 'archiver';
12
14
  import FormData from 'form-data';
13
15
  import fetch from 'node-fetch';
14
16
  import { PutObjectCommand, GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
15
- import os from 'os';
16
17
  import AdmZip from 'adm-zip';
17
18
 
18
19
  var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
@@ -69,34 +70,7 @@ var Logger = class {
69
70
  };
70
71
  var logger = new Logger();
71
72
 
72
- // src/utils/validators.ts
73
- function validateName(name) {
74
- return /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name);
75
- }
76
- function toKebabCase(str) {
77
- return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
78
- }
79
- function toPascalCase(str) {
80
- return str.split(/[-_\s]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
81
- }
82
- function validateThemeName(name) {
83
- return /^[a-z][a-z0-9-]*$/.test(name);
84
- }
85
- function getValidCategories() {
86
- return [
87
- "headers",
88
- "heroes",
89
- "content",
90
- "features",
91
- "testimonials",
92
- "galleries",
93
- "cta",
94
- "footers",
95
- "ecommerce",
96
- "blog",
97
- "contact"
98
- ];
99
- }
73
+ // src/utils/file-helpers.ts
100
74
  async function renderTemplate(templatePath, data) {
101
75
  const template = await fs.readFile(templatePath, "utf-8");
102
76
  return ejs.render(template, data);
@@ -243,6 +217,35 @@ async function installDependencies(projectPath, packageManager = "npm") {
243
217
  });
244
218
  }
245
219
 
220
+ // src/utils/validators.ts
221
+ function validateName(name) {
222
+ return /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name);
223
+ }
224
+ function toKebabCase(str) {
225
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
226
+ }
227
+ function toPascalCase(str) {
228
+ return str.split(/[-_\s]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
229
+ }
230
+ function validateThemeName(name) {
231
+ return /^[a-z][a-z0-9-]*$/.test(name);
232
+ }
233
+ function getValidCategories() {
234
+ return [
235
+ "headers",
236
+ "heroes",
237
+ "content",
238
+ "features",
239
+ "testimonials",
240
+ "galleries",
241
+ "cta",
242
+ "footers",
243
+ "ecommerce",
244
+ "blog",
245
+ "contact"
246
+ ];
247
+ }
248
+
246
249
  // src/commands/init.ts
247
250
  async function initCommand(projectName, options = {}) {
248
251
  logger.header("Create New OneX Theme Project");
@@ -2672,6 +2675,10 @@ async function cloneCommand(themeName, options) {
2672
2675
  }
2673
2676
 
2674
2677
  // src/cli.ts
2678
+ var projectRoot = getProjectRoot();
2679
+ dotenv.config({ path: path.join(projectRoot, ".env.local"), quiet: true });
2680
+ dotenv.config({ path: path.join(projectRoot, ".env"), quiet: true });
2681
+ dotenv.config({ path: path.join(os.homedir(), ".onex", ".env"), quiet: true });
2675
2682
  var program = new Command();
2676
2683
  program.name("onex").description("CLI tool for OneX theme development").version("0.1.0");
2677
2684
  program.command("init").description("Create a new OneX theme project").argument("[project-name]", "Name of the project").option(