etranzact-fe-cli 0.0.0 → 0.0.2

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
@@ -2,11 +2,14 @@
2
2
  ## To install dependencies:
3
3
 
4
4
  ```bash
5
- pnpm add etz-cli
5
+ pnpm add etranzact-fe-cli -g
6
6
  ```
7
7
 
8
8
  ## Usage
9
9
 
10
10
  ```bash
11
11
  npx etz-cli new [project-name]
12
- ```
12
+ ```
13
+
14
+ <!-- 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 -->
15
+ git remote set-url origin https://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@github.com/olayinkaa/etz-cli.git
package/dist/index.cjs ADDED
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/index.ts
27
+ var import_commander2 = require("commander");
28
+
29
+ // src/commands/scaffold.ts
30
+ var import_commander = require("commander");
31
+ var import_chalk = __toESM(require("chalk"), 1);
32
+ var import_fs_extra = __toESM(require("fs-extra"), 1);
33
+ var import_path = __toESM(require("path"), 1);
34
+ var import_simple_git = require("simple-git");
35
+ var import_ora = __toESM(require("ora"), 1);
36
+ var import_inquirer = __toESM(require("inquirer"), 1);
37
+ var import_execa = require("execa");
38
+
39
+ // src/utils/constants.ts
40
+ var NEXT_TEMPLATE = "https://github.com/olayinkaa/nextjs-starter-template-etz.git";
41
+ var EXPRESS_TEMPLATE = "https://github.com/MUKE-coder/nodejs-typescript-starter-template.git";
42
+
43
+ // src/utils/resolve-templates.ts
44
+ function resolveTemplate(template) {
45
+ switch (template) {
46
+ case "next":
47
+ return { repoUrl: NEXT_TEMPLATE, label: "Next.js" };
48
+ case "express":
49
+ return { repoUrl: EXPRESS_TEMPLATE, label: "Express" };
50
+ default:
51
+ throw new Error("Invalid template selected.");
52
+ }
53
+ }
54
+
55
+ // src/commands/scaffold.ts
56
+ var scaffoldCommand = new import_commander.Command("new");
57
+ scaffoldCommand.argument("<project-name>", "name of the project").action(async (projectName) => {
58
+ const projectPath = import_path.default.join(process.cwd(), projectName);
59
+ if (import_fs_extra.default.existsSync(projectPath)) {
60
+ console.error(
61
+ import_chalk.default.red(`Error: Directory ${projectName} already exists.`)
62
+ );
63
+ process.exit(1);
64
+ }
65
+ const answers = await import_inquirer.default.prompt([
66
+ {
67
+ type: "rawlist",
68
+ name: "template",
69
+ message: "Which template would you like to use?",
70
+ choices: [
71
+ { name: "Nextjs", value: "next" },
72
+ { name: "Tanstack Start", value: "ts-start" },
73
+ { name: "Nodejs Express", value: "express" }
74
+ ],
75
+ default: "next"
76
+ }
77
+ ]);
78
+ const { repoUrl, label } = resolveTemplate(answers.template);
79
+ import_fs_extra.default.mkdirSync(projectPath);
80
+ const spinner = (0, import_ora.default)().start();
81
+ const git = (0, import_simple_git.simpleGit)();
82
+ try {
83
+ spinner.text = `Downloading ${label} template...`;
84
+ await git.clone(repoUrl, projectPath);
85
+ spinner.succeed("Template downloaded successfully!");
86
+ process.chdir(projectPath);
87
+ spinner.start("Installing dependencies...");
88
+ await (0, import_execa.execa)("pnpm", ["install"], {
89
+ stdio: "inherit"
90
+ // shows install logs
91
+ });
92
+ spinner.succeed("Dependencies installed successfully!");
93
+ console.log();
94
+ console.log(import_chalk.default.green(`Project ${projectName} is ready! \u{1F680}`));
95
+ console.log(import_chalk.default.cyan(`cd ${projectName}`));
96
+ console.log(import_chalk.default.cyan(`pnpm dev`));
97
+ } catch (error) {
98
+ spinner.fail("Failed to set up the project.");
99
+ console.error(import_chalk.default.red(error.message));
100
+ process.exit(1);
101
+ }
102
+ });
103
+ var scaffold_default = scaffoldCommand;
104
+
105
+ // src/index.ts
106
+ var program = new import_commander2.Command();
107
+ program.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");
108
+ program.addCommand(scaffold_default);
109
+ program.parse(process.argv);
package/dist/index.js CHANGED
@@ -1,40 +1,17 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
2
 
26
3
  // src/index.ts
27
- var import_commander2 = require("commander");
4
+ import { Command as Command2 } from "commander";
28
5
 
29
6
  // src/commands/scaffold.ts
30
- var import_commander = require("commander");
31
- var import_chalk = __toESM(require("chalk"));
32
- var import_fs_extra = __toESM(require("fs-extra"));
33
- var import_path = __toESM(require("path"));
34
- var import_simple_git = require("simple-git");
35
- var import_ora = __toESM(require("ora"));
36
- var import_inquirer = __toESM(require("inquirer"));
37
- var import_execa = require("execa");
7
+ import { Command } from "commander";
8
+ import chalk from "chalk";
9
+ import fs from "fs-extra";
10
+ import path from "path";
11
+ import { simpleGit } from "simple-git";
12
+ import ora from "ora";
13
+ import inquirer from "inquirer";
14
+ import { execa } from "execa";
38
15
 
39
16
  // src/utils/constants.ts
40
17
  var NEXT_TEMPLATE = "https://github.com/olayinkaa/nextjs-starter-template-etz.git";
@@ -53,56 +30,57 @@ function resolveTemplate(template) {
53
30
  }
54
31
 
55
32
  // src/commands/scaffold.ts
56
- var scaffoldCommand = new import_commander.Command("new");
33
+ var scaffoldCommand = new Command("new");
57
34
  scaffoldCommand.argument("<project-name>", "name of the project").action(async (projectName) => {
58
- const projectPath = import_path.default.join(process.cwd(), projectName);
59
- if (import_fs_extra.default.existsSync(projectPath)) {
35
+ const projectPath = path.join(process.cwd(), projectName);
36
+ if (fs.existsSync(projectPath)) {
60
37
  console.error(
61
- import_chalk.default.red(`Error: Directory ${projectName} already exists.`)
38
+ chalk.red(`Error: Directory ${projectName} already exists.`)
62
39
  );
63
40
  process.exit(1);
64
41
  }
65
- const answers = await import_inquirer.default.prompt([
42
+ const answers = await inquirer.prompt([
66
43
  {
67
- type: "list",
44
+ type: "rawlist",
68
45
  name: "template",
69
46
  message: "Which template would you like to use?",
70
47
  choices: [
71
48
  { name: "Nextjs", value: "next" },
72
- { name: "Express", value: "express" }
49
+ { name: "Tanstack Start", value: "ts-start" },
50
+ { name: "Nodejs Express", value: "express" }
73
51
  ],
74
- default: "ts"
52
+ default: "next"
75
53
  }
76
54
  ]);
77
- const { repoUrl } = resolveTemplate(answers.template);
78
- import_fs_extra.default.mkdirSync(projectPath);
79
- const spinner = (0, import_ora.default)().start();
80
- const git = (0, import_simple_git.simpleGit)();
55
+ const { repoUrl, label } = resolveTemplate(answers.template);
56
+ fs.mkdirSync(projectPath);
57
+ const spinner = ora().start();
58
+ const git = simpleGit();
81
59
  try {
82
- spinner.text = `Downloading ${answers.template === "js" ? "JavaScript" : "TypeScript"} template...`;
60
+ spinner.text = `Downloading ${label} template...`;
83
61
  await git.clone(repoUrl, projectPath);
84
62
  spinner.succeed("Template downloaded successfully!");
85
63
  process.chdir(projectPath);
86
64
  spinner.start("Installing dependencies...");
87
- await (0, import_execa.execa)("pnpm", ["install"], {
65
+ await execa("pnpm", ["install"], {
88
66
  stdio: "inherit"
89
67
  // shows install logs
90
68
  });
91
69
  spinner.succeed("Dependencies installed successfully!");
92
70
  console.log();
93
- console.log(import_chalk.default.green(`Project ${projectName} is ready! \u{1F680}`));
94
- console.log(import_chalk.default.cyan(`cd ${projectName}`));
95
- console.log(import_chalk.default.cyan(`pnpm dev`));
71
+ console.log(chalk.green(`Project ${projectName} is ready! \u{1F680}`));
72
+ console.log(chalk.cyan(`cd ${projectName}`));
73
+ console.log(chalk.cyan(`pnpm dev`));
96
74
  } catch (error) {
97
75
  spinner.fail("Failed to set up the project.");
98
- console.error(import_chalk.default.red(error.message));
76
+ console.error(chalk.red(error.message));
99
77
  process.exit(1);
100
78
  }
101
79
  });
102
80
  var scaffold_default = scaffoldCommand;
103
81
 
104
82
  // src/index.ts
105
- var program = new import_commander2.Command();
83
+ var program = new Command2();
106
84
  program.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");
107
85
  program.addCommand(scaffold_default);
108
86
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etranzact-fe-cli",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "description": "Etranzact Cli for scaffolding new frontend project",
6
6
  "type": "module",
@@ -10,20 +10,14 @@
10
10
  "etz-cli": "./dist/index.js"
11
11
  },
12
12
  "files": [
13
- "dist"
13
+ "dist",
14
+ "README.md"
14
15
  ],
15
- "scripts": {
16
- "dev": "tsc -w",
17
- "build:tsc": "tsc",
18
- "build:esb": "node esbuild.config.mjs",
19
- "build:tsup": "tsup",
20
- "build": "tsup"
21
- },
22
16
  "keywords": [],
23
17
  "author": "Olayinka Ibrahim",
24
18
  "license": "ISC",
25
- "packageManager": "pnpm@10.28.1",
26
19
  "devDependencies": {
20
+ "@changesets/cli": "^2.29.8",
27
21
  "@types/fs-extra": "^11.0.4",
28
22
  "@types/node": "^25.3.0",
29
23
  "esbuild": "^0.27.3",
@@ -38,5 +32,14 @@
38
32
  "inquirer": "^13.3.0",
39
33
  "ora": "^9.3.0",
40
34
  "simple-git": "^3.32.2"
35
+ },
36
+ "scripts": {
37
+ "dev": "tsc --watch",
38
+ "build:tsc": "pnpm run clean && tsc",
39
+ "build:esb": "node esbuild.config.mjs",
40
+ "build:tsup": "tsup",
41
+ "build": "pnpm run clean && tsup",
42
+ "clean": "rm -rf dist",
43
+ "release": "pnpm run build && changeset publish"
41
44
  }
42
45
  }
package/dist/index.mjs DELETED
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __esm = (fn, res) => function __init() {
4
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
- };
6
- var __commonJS = (cb, mod) => function __require() {
7
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
- };
9
-
10
- // src/utils/constants.ts
11
- var NEXT_TEMPLATE, EXPRESS_TEMPLATE;
12
- var init_constants = __esm({
13
- "src/utils/constants.ts"() {
14
- "use strict";
15
- NEXT_TEMPLATE = "https://github.com/olayinkaa/nextjs-starter-template-etz.git";
16
- EXPRESS_TEMPLATE = "https://github.com/MUKE-coder/nodejs-typescript-starter-template.git";
17
- }
18
- });
19
-
20
- // src/utils/resolve-templates.ts
21
- function resolveTemplate(template) {
22
- switch (template) {
23
- case "next":
24
- return { repoUrl: NEXT_TEMPLATE, label: "Next.js" };
25
- case "express":
26
- return { repoUrl: EXPRESS_TEMPLATE, label: "Express" };
27
- default:
28
- throw new Error("Invalid template selected.");
29
- }
30
- }
31
- var init_resolve_templates = __esm({
32
- "src/utils/resolve-templates.ts"() {
33
- "use strict";
34
- init_constants();
35
- }
36
- });
37
-
38
- // src/commands/scaffold.ts
39
- import { Command } from "commander";
40
- import chalk from "chalk";
41
- import fs from "fs-extra";
42
- import path from "path";
43
- import { simpleGit } from "simple-git";
44
- import ora from "ora";
45
- import inquirer from "inquirer";
46
- import { execa } from "execa";
47
- var scaffoldCommand, scaffold_default;
48
- var init_scaffold = __esm({
49
- "src/commands/scaffold.ts"() {
50
- "use strict";
51
- init_resolve_templates();
52
- scaffoldCommand = new Command("new");
53
- scaffoldCommand.argument("<project-name>", "name of the project").action(async (projectName) => {
54
- const projectPath = path.join(process.cwd(), projectName);
55
- if (fs.existsSync(projectPath)) {
56
- console.error(
57
- chalk.red(`Error: Directory ${projectName} already exists.`)
58
- );
59
- process.exit(1);
60
- }
61
- const answers = await inquirer.prompt([
62
- {
63
- type: "list",
64
- name: "template",
65
- message: "Which template would you like to use?",
66
- choices: [
67
- { name: "Nextjs", value: "next" },
68
- { name: "Express", value: "express" }
69
- ],
70
- default: "ts"
71
- }
72
- ]);
73
- const { repoUrl } = resolveTemplate(answers.template);
74
- fs.mkdirSync(projectPath);
75
- const spinner = ora().start();
76
- const git = simpleGit();
77
- try {
78
- spinner.text = `Downloading ${answers.template === "js" ? "JavaScript" : "TypeScript"} template...`;
79
- await git.clone(repoUrl, projectPath);
80
- spinner.succeed("Template downloaded successfully!");
81
- process.chdir(projectPath);
82
- spinner.start("Installing dependencies...");
83
- await execa("pnpm", ["install"], {
84
- stdio: "inherit"
85
- // shows install logs
86
- });
87
- spinner.succeed("Dependencies installed successfully!");
88
- console.log();
89
- console.log(chalk.green(`Project ${projectName} is ready! \u{1F680}`));
90
- console.log(chalk.cyan(`cd ${projectName}`));
91
- console.log(chalk.cyan(`pnpm dev`));
92
- } catch (error) {
93
- spinner.fail("Failed to set up the project.");
94
- console.error(chalk.red(error.message));
95
- process.exit(1);
96
- }
97
- });
98
- scaffold_default = scaffoldCommand;
99
- }
100
- });
101
-
102
- // src/index.ts
103
- import { Command as Command2 } from "commander";
104
- var require_index = __commonJS({
105
- "src/index.ts"() {
106
- init_scaffold();
107
- var program = new Command2();
108
- program.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");
109
- program.addCommand(scaffold_default);
110
- program.parse(process.argv);
111
- }
112
- });
113
- export default require_index();