etranzact-fe-cli 0.0.0 → 0.0.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/README.md CHANGED
@@ -2,7 +2,7 @@
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
package/dist/index.cjs ADDED
@@ -0,0 +1,108 @@
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: "list",
68
+ name: "template",
69
+ message: "Which template would you like to use?",
70
+ choices: [
71
+ { name: "Nextjs", value: "next" },
72
+ { name: "Express", value: "express" }
73
+ ],
74
+ default: "ts"
75
+ }
76
+ ]);
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)();
81
+ try {
82
+ spinner.text = `Downloading ${answers.template === "js" ? "JavaScript" : "TypeScript"} template...`;
83
+ await git.clone(repoUrl, projectPath);
84
+ spinner.succeed("Template downloaded successfully!");
85
+ process.chdir(projectPath);
86
+ spinner.start("Installing dependencies...");
87
+ await (0, import_execa.execa)("pnpm", ["install"], {
88
+ stdio: "inherit"
89
+ // shows install logs
90
+ });
91
+ spinner.succeed("Dependencies installed successfully!");
92
+ 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`));
96
+ } catch (error) {
97
+ spinner.fail("Failed to set up the project.");
98
+ console.error(import_chalk.default.red(error.message));
99
+ process.exit(1);
100
+ }
101
+ });
102
+ var scaffold_default = scaffoldCommand;
103
+
104
+ // src/index.ts
105
+ var program = new import_commander2.Command();
106
+ program.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");
107
+ program.addCommand(scaffold_default);
108
+ 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,16 +30,16 @@ 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
44
  type: "list",
68
45
  name: "template",
@@ -75,34 +52,34 @@ scaffoldCommand.argument("<project-name>", "name of the project").action(async (
75
52
  }
76
53
  ]);
77
54
  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
+ fs.mkdirSync(projectPath);
56
+ const spinner = ora().start();
57
+ const git = simpleGit();
81
58
  try {
82
59
  spinner.text = `Downloading ${answers.template === "js" ? "JavaScript" : "TypeScript"} template...`;
83
60
  await git.clone(repoUrl, projectPath);
84
61
  spinner.succeed("Template downloaded successfully!");
85
62
  process.chdir(projectPath);
86
63
  spinner.start("Installing dependencies...");
87
- await (0, import_execa.execa)("pnpm", ["install"], {
64
+ await execa("pnpm", ["install"], {
88
65
  stdio: "inherit"
89
66
  // shows install logs
90
67
  });
91
68
  spinner.succeed("Dependencies installed successfully!");
92
69
  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`));
70
+ console.log(chalk.green(`Project ${projectName} is ready! \u{1F680}`));
71
+ console.log(chalk.cyan(`cd ${projectName}`));
72
+ console.log(chalk.cyan(`pnpm dev`));
96
73
  } catch (error) {
97
74
  spinner.fail("Failed to set up the project.");
98
- console.error(import_chalk.default.red(error.message));
75
+ console.error(chalk.red(error.message));
99
76
  process.exit(1);
100
77
  }
101
78
  });
102
79
  var scaffold_default = scaffoldCommand;
103
80
 
104
81
  // src/index.ts
105
- var program = new import_commander2.Command();
82
+ var program = new Command2();
106
83
  program.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");
107
84
  program.addCommand(scaffold_default);
108
85
  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.1",
4
4
  "private": false,
5
5
  "description": "Etranzact Cli for scaffolding new frontend project",
6
6
  "type": "module",
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();