@elinzy/cli 0.1.6 → 0.1.8

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.
@@ -0,0 +1,251 @@
1
+ import { configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, runtimes, strictConfigs } from "../../constants/common.mjs";
2
+ import "../../constants/index.mjs";
3
+ import { getConfigUrl } from "../../helpers/getConfigUrl/index.mjs";
4
+ import { exit, handleSigTerm, onCancel, onPromptState } from "../../utils/functions.mjs";
5
+ import { createESLintConfigFile } from "../../helpers/createEslintConfigFile/index.mjs";
6
+ import { getArgs } from "../../helpers/getArgs/index.mjs";
7
+ import { getCommands } from "../../helpers/getCommands/index.mjs";
8
+ import { installPackages } from "../../helpers/installPackages/index.mjs";
9
+ import pc from "ansis";
10
+ import prompts from "prompts";
11
+
12
+ //#region src/commands/eslint/index.ts
13
+ process.on("SIGINT", handleSigTerm);
14
+ process.on("SIGTERM", handleSigTerm);
15
+ const run = async (cliOpts = {}) => {
16
+ let args = await getArgs(cliOpts);
17
+ if (args.config === null) {
18
+ const { configBoolean } = await prompts({
19
+ type: "toggle",
20
+ name: "configBoolean",
21
+ message: "Config?",
22
+ initial: defaults.config === configs.EXTENDED,
23
+ active: "Extended",
24
+ inactive: "Legacy",
25
+ onState: onPromptState
26
+ }, { onCancel });
27
+ const config = configBoolean ? configs.EXTENDED : configs.LEGACY;
28
+ args = {
29
+ ...args,
30
+ config,
31
+ ...config === configs.EXTENDED ? { legacyConfig: null } : { runtime: null }
32
+ };
33
+ }
34
+ if (args.language === null) {
35
+ const { languageBoolean } = await prompts({
36
+ type: "toggle",
37
+ name: "languageBoolean",
38
+ message: `Are you using ${pc.blue("typescript")}?`,
39
+ initial: defaults.language === languages.TYPESCRIPT,
40
+ active: "Yes",
41
+ inactive: "No",
42
+ onState: onPromptState
43
+ }, { onCancel });
44
+ const language = languageBoolean ? languages.TYPESCRIPT : languages.JAVASCRIPT;
45
+ args = {
46
+ ...args,
47
+ language
48
+ };
49
+ }
50
+ if (args.formatter === formatters.NONE) args = {
51
+ ...args,
52
+ formatter: null
53
+ };
54
+ else if (args.formatter === null) {
55
+ const { formatterBoolean } = await prompts({
56
+ type: "toggle",
57
+ name: "formatterBoolean",
58
+ message: `Are you using ${pc.cyan("prettier")}?`,
59
+ initial: defaults.formatter === formatters.PRETTIER,
60
+ active: "Yes",
61
+ inactive: "No",
62
+ onState: onPromptState
63
+ }, { onCancel });
64
+ const formatter = formatterBoolean ? formatters.PRETTIER : null;
65
+ args = {
66
+ ...args,
67
+ formatter
68
+ };
69
+ }
70
+ if (args.config === configs.EXTENDED) {
71
+ if (!args.runtime) {
72
+ const { runtime } = await prompts({
73
+ type: "select",
74
+ name: "runtime",
75
+ message: "Are you using?",
76
+ choices: [
77
+ {
78
+ title: "Node",
79
+ description: pc.green("You are using Node or any other frameworks of it"),
80
+ value: runtimes.NODE
81
+ },
82
+ {
83
+ title: "React",
84
+ description: pc.cyan("You are using React.js library"),
85
+ value: runtimes.REACT
86
+ },
87
+ {
88
+ title: "Next",
89
+ description: pc.blackBright("You are using Next.js framework"),
90
+ value: runtimes.NEXT
91
+ }
92
+ ],
93
+ onState: onPromptState
94
+ }, { onCancel });
95
+ args = {
96
+ ...args,
97
+ runtime
98
+ };
99
+ }
100
+ if (args.strictConfig?.includes(strictConfigs.NONE)) args = {
101
+ ...args,
102
+ strictConfig: null
103
+ };
104
+ else if (!args.strictConfig) {
105
+ const { hasStrictConfig } = await prompts({
106
+ type: "toggle",
107
+ name: "hasStrictConfig",
108
+ message: `Do you want to add ${pc.cyan("strict")} configs?`,
109
+ initial: defaults.strictConfig,
110
+ active: "Yes",
111
+ inactive: "No",
112
+ onState: onPromptState
113
+ }, { onCancel });
114
+ if (hasStrictConfig) {
115
+ const { strictConfig } = await prompts({
116
+ type: "multiselect",
117
+ name: "strictConfig",
118
+ message: "Select Strict Configs:",
119
+ min: 1,
120
+ choices: [
121
+ {
122
+ title: "Import",
123
+ description: pc.yellow("Strict Import config"),
124
+ value: strictConfigs.IMPORT
125
+ },
126
+ ...args.runtime && [runtimes.REACT, runtimes.NEXT].includes(args.runtime) ? [{
127
+ title: "React",
128
+ description: pc.cyan("Strict React config"),
129
+ value: strictConfigs.REACT
130
+ }] : [],
131
+ ...args.language === languages.TYPESCRIPT ? [{
132
+ title: "TypeScript",
133
+ description: pc.blue("Strict TypeScript config"),
134
+ value: strictConfigs.TYPESCRIPT
135
+ }] : []
136
+ ],
137
+ onState: onPromptState
138
+ }, { onCancel });
139
+ args = {
140
+ ...args,
141
+ strictConfig
142
+ };
143
+ } else args = {
144
+ ...args,
145
+ strictConfig: null
146
+ };
147
+ }
148
+ }
149
+ if (args.config === configs.LEGACY) {
150
+ if (!args.legacyConfig) {
151
+ const { legacyConfig } = await prompts({
152
+ type: "select",
153
+ name: "legacyConfig",
154
+ message: "Are you using?",
155
+ choices: [{
156
+ title: "Base Config",
157
+ description: pc.green("@elinzy/eslint-config-extended base"),
158
+ value: legacyConfigs.BASE
159
+ }, {
160
+ title: "React Config",
161
+ description: pc.cyan("@elinzy/eslint-config-extended react"),
162
+ value: legacyConfigs.REACT
163
+ }],
164
+ onState: onPromptState
165
+ }, { onCancel });
166
+ args = {
167
+ ...args,
168
+ legacyConfig
169
+ };
170
+ }
171
+ if (args.legacyConfig === legacyConfigs.REACT) {
172
+ const { reactHooks } = await prompts({
173
+ type: "toggle",
174
+ name: "reactHooks",
175
+ message: "Are you using hooks?",
176
+ initial: defaults.legacyReactHooks,
177
+ active: "Yes",
178
+ inactive: "No",
179
+ onState: onPromptState
180
+ }, { onCancel });
181
+ const legacyConfig = reactHooks ? legacyConfigs.REACT_HOOKS : args.legacyConfig;
182
+ args = {
183
+ ...args,
184
+ legacyConfig
185
+ };
186
+ }
187
+ }
188
+ if (args.createEslintFile === null) {
189
+ const { createEslintFile } = await prompts({
190
+ type: "toggle",
191
+ name: "createEslintFile",
192
+ message: `Should I create an ${pc.blue(eslintConfigName)} file for you?`,
193
+ initial: defaults.createEslintFile,
194
+ active: "Yes",
195
+ inactive: "No",
196
+ onState: onPromptState
197
+ }, { onCancel });
198
+ args = {
199
+ ...args,
200
+ createEslintFile
201
+ };
202
+ }
203
+ if (args.skipInstall === null) {
204
+ const { skipInstall } = await prompts({
205
+ type: "toggle",
206
+ name: "skipInstall",
207
+ message: "Do you want to skip the package installation?",
208
+ initial: defaults.skipInstall,
209
+ active: "Yes",
210
+ inactive: "No",
211
+ onState: onPromptState
212
+ }, { onCancel });
213
+ args = {
214
+ ...args,
215
+ skipInstall
216
+ };
217
+ }
218
+ const newArgs = args;
219
+ const command = getCommands(newArgs).join(" ");
220
+ console.log();
221
+ if (newArgs.createEslintFile) await createESLintConfigFile(newArgs);
222
+ if (newArgs.skipInstall) {
223
+ console.log(`${pc.yellow("No Worries")}, you can install the packages yourself using your ${pc.blue("favourite")} package manager (${newArgs.packageManager}, maybe?)`);
224
+ console.log();
225
+ console.log(pc.cyan("Command:"));
226
+ console.log(pc.blue(command));
227
+ } else {
228
+ console.log(pc.blue(`Installing packages using ${newArgs.packageManager}, please wait...`));
229
+ await installPackages(newArgs);
230
+ console.log();
231
+ console.log(pc.yellow("Installation Completed"));
232
+ console.log();
233
+ console.log(pc.cyan("Executed Command:"));
234
+ console.log(pc.blue(command));
235
+ }
236
+ console.log();
237
+ console.log(pc.cyan(newArgs.createEslintFile ? "Created Config:" : "Config:"));
238
+ console.log(getConfigUrl(newArgs).url);
239
+ console.log();
240
+ };
241
+ const eslint = async (opts = {}) => {
242
+ try {
243
+ await run(opts);
244
+ } catch (error) {
245
+ if (error instanceof Error) exit(error);
246
+ else console.error(error);
247
+ }
248
+ };
249
+
250
+ //#endregion
251
+ export { eslint };
@@ -0,0 +1,13 @@
1
+ import { configs, eslintConfigName, formatters, languages, legacyConfigs, packageManagers, runtimes, strictConfigs, stringBooleans } from "../../constants/common.mjs";
2
+ import { eslint } from "./index.mjs";
3
+ import { Command, Option } from "commander";
4
+
5
+ //#region src/commands/eslint/register.ts
6
+ const register = (program) => {
7
+ program.command("eslint").description("Interactive ESLint config scaffold").addOption(new Option("--config <config>", "Explicitly tell the CLI to use selected config.").choices(Object.values(configs))).addOption(new Option("--lang, --language <lang>", "Generate configuration for a selected language project.").choices(Object.values(languages))).addOption(new Option("--formatter <formatter>", "Include selected formatter for specific linting rules.").choices(Object.values(formatters))).addOption(new Option("--runtime <runtime>", "Include selected runtime for specific linting rules.").choices(Object.values(runtimes)).conflicts(["legacy-config"])).addOption(new Option("--strict, --strict-config <config...>", "Include the selected strict ESLint config.").choices(Object.values(strictConfigs)).argParser((value, previous) => [.../* @__PURE__ */ new Set([...previous || [], value])]).conflicts(["legacy-config"])).addOption(new Option("--legacy, --legacy-config <config>", "Include the selected legacy ESLint config.").choices(Object.values(legacyConfigs)).conflicts(["runtime", "strict-config"])).addOption(new Option("--pm, --package-manager <pm>", "Explicitly tell the CLI to use selected package manager.").choices(Object.values(packageManagers))).addOption(new Option("--create-eslint-file [bool]", `Explicitly tell the CLI to create ${eslintConfigName} file.`).choices(Object.values(stringBooleans))).addOption(new Option("--skip-install [bool]", "Explicitly tell the CLI to skip installing packages.").choices(Object.values(stringBooleans))).action((options) => {
8
+ eslint(options);
9
+ });
10
+ };
11
+
12
+ //#endregion
13
+ export { register };
@@ -27,6 +27,16 @@ const legacyConfigs = {
27
27
  REACT: "react",
28
28
  REACT_HOOKS: "react-hooks"
29
29
  };
30
+ const packageManagers = {
31
+ NPM: "npm",
32
+ YARN: "yarn",
33
+ PNPM: "pnpm",
34
+ BUN: "bun"
35
+ };
36
+ const stringBooleans = {
37
+ TRUE: "true",
38
+ FALSE: "false"
39
+ };
30
40
  const defaults = {
31
41
  config: configs.EXTENDED,
32
42
  language: languages.TYPESCRIPT,
@@ -41,6 +51,8 @@ const subFolders = {
41
51
  STRICT: "strict"
42
52
  };
43
53
  const eslintConfigName = "eslint.config.mjs";
54
+ const baseGithubUrl = "https://github.com/Appleec/e/tree/main/packages/build-templates/templates";
55
+ const baseGithubRawUrl = "https://raw.githubusercontent.com/Appleec/e/refs/heads/main/packages/build-templates/templates";
44
56
 
45
57
  //#endregion
46
- export { configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, runtimes, strictConfigs, subFolders };
58
+ export { baseGithubRawUrl, baseGithubUrl, configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, packageManagers, runtimes, strictConfigs, stringBooleans, subFolders };
@@ -1,3 +1,3 @@
1
- import { configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, runtimes, strictConfigs, subFolders } from "./common.mjs";
1
+ import { baseGithubRawUrl, baseGithubUrl, configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, packageManagers, runtimes, strictConfigs, stringBooleans, subFolders } from "./common.mjs";
2
2
 
3
- export { configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, runtimes, strictConfigs, subFolders };
3
+ export { baseGithubRawUrl, baseGithubUrl, configs, defaults, eslintConfigName, formatters, languages, legacyConfigs, packageManagers, runtimes, strictConfigs, stringBooleans, subFolders };
@@ -1,6 +1,13 @@
1
- import path from "node:path";
1
+ import { baseGithubRawUrl, eslintConfigName } from "../../constants/common.mjs";
2
+ import "../../constants/index.mjs";
3
+ import { getConfigUrl } from "../getConfigUrl/index.mjs";
4
+ import { rootPath } from "../../utils/paths.mjs";
5
+ import "../../utils/index.mjs";
2
6
  import fs from "node:fs";
7
+ import fsPromise from "node:fs/promises";
8
+ import path from "node:path";
3
9
  import { fileURLToPath } from "node:url";
10
+ import fetch from "node-fetch";
4
11
 
5
12
  //#region src/helpers/createEslintConfigFile/index.ts
6
13
  /**
@@ -14,30 +21,34 @@ const resolveTemplatesDir = () => {
14
21
  if (fs.existsSync(dir)) return dir;
15
22
  } catch {}
16
23
  const base = import.meta.dirname;
17
- const resolvePaths = [
24
+ for (const p of [
18
25
  path.resolve(base, "..", "..", "..", "build-templates", "templates"),
19
26
  path.resolve(base, "..", "..", "..", "..", "build-templates", "templates"),
20
27
  path.resolve(process.cwd(), "packages", "build-templates", "templates")
21
- ];
22
- for (const p of resolvePaths) if (fs.existsSync(p)) return p;
28
+ ]) if (fs.existsSync(p)) return p;
23
29
  return null;
24
30
  };
25
31
  const templatesDir = resolveTemplatesDir();
26
- const createESLintConfigFile = async (config) => {
27
- const { configPath, outputPath } = config;
28
- if (!templatesDir) throw new Error("Cannot find @elinzy/build-templates package. Please ensure it is installed.");
29
- const templateFile = path.join(templatesDir, configPath);
30
- if (!fs.existsSync(templateFile)) {
31
- console.warn(`Template not found: ${configPath}`);
32
- console.warn(`Searched: ${templateFile}`);
33
- return;
32
+ const createESLintConfigFile = async (args) => {
33
+ try {
34
+ const configUrl = getConfigUrl(args);
35
+ if (!configUrl) return;
36
+ const { path: configPath } = configUrl;
37
+ if (templatesDir) {
38
+ const localFile = path.join(templatesDir, configPath);
39
+ if (fs.existsSync(localFile)) {
40
+ const content = fs.readFileSync(localFile, "utf8");
41
+ await fsPromise.writeFile(`${rootPath}/${eslintConfigName}`, content, { encoding: "utf8" });
42
+ return;
43
+ }
44
+ }
45
+ const url = `${baseGithubRawUrl}/${configPath}`;
46
+ const data = await (await fetch(url)).text();
47
+ await fsPromise.writeFile(`${rootPath}/${eslintConfigName}`, data, { encoding: "utf8" });
48
+ } catch (error) {
49
+ console.error(error);
34
50
  }
35
- const content = fs.readFileSync(templateFile, "utf8");
36
- fs.writeFileSync(outputPath, content, "utf8");
37
- console.log(`Created: ${outputPath}`);
38
- console.log(`Template: ${baseGithubUrl}/${configPath}`);
39
51
  };
40
- const baseGithubUrl = "https://github.com/Appleec/e/tree/main/packages/build-templates/templates";
41
52
 
42
53
  //#endregion
43
- export { baseGithubUrl, createESLintConfigFile };
54
+ export { createESLintConfigFile };
@@ -0,0 +1,67 @@
1
+ import { configs, formatters, languages, legacyConfigs, runtimes, stringBooleans } from "../../constants/common.mjs";
2
+ import "../../constants/index.mjs";
3
+ import { getPackageManager } from "../getPackageManager.mjs";
4
+
5
+ //#region src/helpers/getArgs/index.ts
6
+ const getConfig = (opts) => {
7
+ const { config } = opts;
8
+ if (config === configs.EXTENDED) return configs.EXTENDED;
9
+ if (config === configs.LEGACY) return configs.LEGACY;
10
+ return null;
11
+ };
12
+ const getLanguage = (opts) => {
13
+ const { language, lang } = opts;
14
+ const value = language || lang;
15
+ if (value === languages.JAVASCRIPT) return languages.JAVASCRIPT;
16
+ if (value === languages.TYPESCRIPT) return languages.TYPESCRIPT;
17
+ return null;
18
+ };
19
+ const getFormatter = (opts) => {
20
+ const { formatter } = opts;
21
+ if (formatter === formatters.NONE) return formatters.NONE;
22
+ if (formatter === formatters.PRETTIER) return formatters.PRETTIER;
23
+ return null;
24
+ };
25
+ const getRuntime = (opts) => {
26
+ const { runtime } = opts;
27
+ if (runtime === runtimes.REACT) return runtimes.REACT;
28
+ if (runtime === runtimes.NEXT) return runtimes.NEXT;
29
+ if (runtime === runtimes.NODE) return runtimes.NODE;
30
+ return null;
31
+ };
32
+ const getStrictConfig = (opts) => {
33
+ const { strictConfig } = opts;
34
+ return strictConfig?.length ? strictConfig : null;
35
+ };
36
+ const getLegacyConfig = (opts) => {
37
+ const { legacyConfig, legacy } = opts;
38
+ const value = legacyConfig || legacy;
39
+ if (value === legacyConfigs.BASE) return legacyConfigs.BASE;
40
+ if (value === legacyConfigs.REACT) return legacyConfigs.REACT;
41
+ if (value === legacyConfigs.REACT_HOOKS) return legacyConfigs.REACT_HOOKS;
42
+ return null;
43
+ };
44
+ const getCreateEslintFile = (opts) => {
45
+ const { createEslintFile } = opts;
46
+ if (createEslintFile === void 0) return null;
47
+ return createEslintFile === true || createEslintFile === stringBooleans.TRUE;
48
+ };
49
+ const getSkipInstall = (opts) => {
50
+ const { skipInstall } = opts;
51
+ if (skipInstall === void 0) return null;
52
+ return skipInstall === true || skipInstall === stringBooleans.TRUE;
53
+ };
54
+ const getArgs = async (opts = {}) => ({
55
+ config: getConfig(opts),
56
+ language: getLanguage(opts),
57
+ formatter: getFormatter(opts),
58
+ runtime: getRuntime(opts),
59
+ strictConfig: getStrictConfig(opts),
60
+ legacyConfig: getLegacyConfig(opts),
61
+ packageManager: await getPackageManager(),
62
+ createEslintFile: getCreateEslintFile(opts),
63
+ skipInstall: getSkipInstall(opts)
64
+ });
65
+
66
+ //#endregion
67
+ export { getArgs };
@@ -1,16 +1,21 @@
1
- import { formatters } from "../../constants/common.mjs";
1
+ import { formatters, packageManagers } from "../../constants/common.mjs";
2
2
  import "../../constants/index.mjs";
3
3
 
4
4
  //#region src/helpers/getCommands/index.ts
5
- const getCommands = (args) => {
6
- const { formatter } = args;
5
+ const getCommands = (args = {}) => {
6
+ const { formatter, packageManager = packageManagers.PNPM } = args;
7
7
  const commands = [
8
- "pnpm",
9
- "add",
8
+ packageManager,
9
+ {
10
+ [packageManagers.NPM]: "install",
11
+ [packageManagers.YARN]: "add",
12
+ [packageManagers.PNPM]: "install",
13
+ [packageManagers.BUN]: "add"
14
+ }[packageManager] || "install",
10
15
  "-D",
11
- "eslint",
16
+ "eslint@^9",
12
17
  "@eslint/compat",
13
- "@eslint/js",
18
+ "@eslint/js@^9",
14
19
  "@elinzy/eslint-config-extended"
15
20
  ];
16
21
  if (formatter === formatters.PRETTIER) commands.push("prettier", "eslint-plugin-prettier", "eslint-config-prettier");
@@ -1,5 +1,6 @@
1
- import { configs, eslintConfigName, formatters, languages, subFolders } from "../../constants/common.mjs";
1
+ import { baseGithubUrl, configs, eslintConfigName, formatters, languages, subFolders } from "../../constants/common.mjs";
2
2
  import "../../constants/index.mjs";
3
+ import pc from "ansis";
3
4
 
4
5
  //#region src/helpers/getConfigUrl/index.ts
5
6
  const getConfigUrl = (args) => {
@@ -13,13 +14,17 @@ const getConfigUrl = (args) => {
13
14
  const strictFolder = [...strictConfig].sort().join("-");
14
15
  return [subFolders.STRICT, strictFolder];
15
16
  })();
16
- return { path: [
17
+ const path = [
17
18
  ...isLegacy ? [configs.LEGACY, legacyLanguage] : [runtime],
18
19
  prettierText,
19
20
  tsOrJsText,
20
21
  ...strictOrDefaultText,
21
22
  eslintConfigName
22
- ].filter(Boolean).join("/") };
23
+ ].filter(Boolean).join("/");
24
+ return {
25
+ path,
26
+ url: pc.blue(`${baseGithubUrl}/${path}`)
27
+ };
23
28
  };
24
29
 
25
30
  //#endregion
@@ -0,0 +1,17 @@
1
+ import { packageManagers } from "../constants/common.mjs";
2
+ import "../constants/index.mjs";
3
+ import { detect } from "package-manager-detector/detect";
4
+
5
+ //#region src/helpers/getPackageManager.ts
6
+ const getPackageManager = async () => {
7
+ const pm = await detect();
8
+ if (!pm) return packageManagers.NPM;
9
+ const { name } = pm;
10
+ if (name === packageManagers.PNPM) return packageManagers.PNPM;
11
+ if (name === packageManagers.YARN) return packageManagers.YARN;
12
+ if (name === packageManagers.BUN) return packageManagers.BUN;
13
+ return packageManagers.NPM;
14
+ };
15
+
16
+ //#endregion
17
+ export { getPackageManager };
@@ -2,7 +2,7 @@ import { getCommands } from "../getCommands/index.mjs";
2
2
  import spawn from "cross-spawn";
3
3
 
4
4
  //#region src/helpers/installPackages/index.ts
5
- const installPackages = async (args) => {
5
+ const installPackages = async (args = {}) => {
6
6
  const [packageManager, ...commands] = getCommands(args);
7
7
  return new Promise((resolve, reject) => {
8
8
  spawn(packageManager, commands, {
package/dist/index.mjs CHANGED
@@ -1,19 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { exit } from "./utils/functions.mjs";
3
2
  import { name, version } from "./package.mjs";
4
- import eslint from "./commands/eslint.mjs";
3
+ import { register } from "./commands/eslint/register.mjs";
5
4
  import { Command } from "commander";
6
5
 
7
6
  //#region src/index.ts
8
7
  const program = new Command().name(name).version(version, "-v, --version", "Output the current version.").helpOption("-h, --help", "Display help message.");
9
- program.command("eslint").description("Interactive ESLint config scaffold").action(async () => {
10
- try {
11
- await eslint();
12
- } catch (error) {
13
- if (error instanceof Error) exit(error);
14
- else console.error(error);
15
- }
16
- });
8
+ register(program);
17
9
  program.parse();
18
10
 
19
11
  //#endregion
package/dist/package.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@elinzy/cli";
3
- var version = "0.1.6";
3
+ var version = "0.1.8";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
@@ -0,0 +1,4 @@
1
+ import { rootPath } from "./paths.mjs";
2
+ import { exit, handleSigTerm, onCancel, onPromptState } from "./functions.mjs";
3
+
4
+ export { exit, handleSigTerm, onCancel, onPromptState, rootPath };
@@ -0,0 +1,7 @@
1
+ import path from "node:path";
2
+
3
+ //#region src/utils/paths.ts
4
+ const rootPath = path.resolve(".");
5
+
6
+ //#endregion
7
+ export { rootPath };
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@elinzy/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A collection of common scripts and commands for e",
5
5
  "type": "module",
6
- "main": "./dist/index.cjs",
7
6
  "types": "./dist/index.d.cts",
8
7
  "exports": {
9
- ".": {
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
8
+ ".": "./dist/index.mjs",
13
9
  "./package.json": "./package.json"
14
10
  },
15
11
  "files": [
@@ -20,7 +16,8 @@
20
16
  "registry": "https://registry.npmjs.org/"
21
17
  },
22
18
  "bin": {
23
- "cli": "./dist/index.mjs"
19
+ "e": "./dist/index.mjs",
20
+ "e-cli": "./dist/index.mjs"
24
21
  },
25
22
  "repository": {
26
23
  "type": "git",
@@ -48,8 +45,8 @@
48
45
  "prompts": "^2.4.2",
49
46
  "semver": "^7.7.1",
50
47
  "@elinzy/core": "^0.1.2",
51
- "@elinzy/build-templates": "0.1.1",
52
- "@elinzy/logger": "1.0.0"
48
+ "@elinzy/logger": "1.0.0",
49
+ "@elinzy/build-templates": "0.1.2"
53
50
  },
54
51
  "engines": {
55
52
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -57,7 +54,6 @@
57
54
  "devDependencies": {
58
55
  "tsdown": "^0.23.1"
59
56
  },
60
- "module": "./dist/index.mjs",
61
57
  "scripts": {
62
58
  "dev": "tsx src/index.ts",
63
59
  "build": "tsdown",
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- exports.__toESM = __toESM;