@elinzy/cli 0.1.5 → 0.1.6

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.
@@ -3,21 +3,29 @@ let node_path = require("node:path");
3
3
  node_path = require_runtime.__toESM(node_path, 1);
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_runtime.__toESM(node_fs, 1);
6
+ let node_url = require("node:url");
6
7
 
7
8
  //#region src/helpers/createEslintConfigFile/index.ts
8
9
  /**
9
10
  * Resolve templates directory from the `@elinzy/build-templates` package.
10
- * Uses import.meta.resolve to find the package, then reads templates locally.
11
11
  */
12
- const templatesDir = (() => {
12
+ const resolveTemplatesDir = () => {
13
+ try {
14
+ const pkgUrl = {}.resolve("@elinzy/build-templates/package.json");
15
+ const pkgPath = (0, node_url.fileURLToPath)(pkgUrl);
16
+ const dir = node_path.default.join(node_path.default.dirname(pkgPath), "templates");
17
+ if (node_fs.default.existsSync(dir)) return dir;
18
+ } catch {}
19
+ const base = __dirname;
13
20
  const resolvePaths = [
14
- node_path.default.resolve(__dirname, "..", "..", "..", "build-templates", "templates"),
15
- node_path.default.resolve(__dirname, "..", "..", "..", "..", "build-templates", "templates"),
21
+ node_path.default.resolve(base, "..", "..", "..", "build-templates", "templates"),
22
+ node_path.default.resolve(base, "..", "..", "..", "..", "build-templates", "templates"),
16
23
  node_path.default.resolve(process.cwd(), "packages", "build-templates", "templates")
17
24
  ];
18
25
  for (const p of resolvePaths) if (node_fs.default.existsSync(p)) return p;
19
26
  return null;
20
- })();
27
+ };
28
+ const templatesDir = resolveTemplatesDir();
21
29
  const createESLintConfigFile = async (config) => {
22
30
  const { configPath, outputPath } = config;
23
31
  if (!templatesDir) throw new Error("Cannot find @elinzy/build-templates package. Please ensure it is installed.");
@@ -1,20 +1,28 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
+ import { fileURLToPath } from "node:url";
3
4
 
4
5
  //#region src/helpers/createEslintConfigFile/index.ts
5
6
  /**
6
7
  * Resolve templates directory from the `@elinzy/build-templates` package.
7
- * Uses import.meta.resolve to find the package, then reads templates locally.
8
8
  */
9
- const templatesDir = (() => {
9
+ const resolveTemplatesDir = () => {
10
+ try {
11
+ const pkgUrl = import.meta.resolve("@elinzy/build-templates/package.json");
12
+ const pkgPath = fileURLToPath(pkgUrl);
13
+ const dir = path.join(path.dirname(pkgPath), "templates");
14
+ if (fs.existsSync(dir)) return dir;
15
+ } catch {}
16
+ const base = import.meta.dirname;
10
17
  const resolvePaths = [
11
- path.resolve(import.meta.dirname, "..", "..", "..", "build-templates", "templates"),
12
- path.resolve(import.meta.dirname, "..", "..", "..", "..", "build-templates", "templates"),
18
+ path.resolve(base, "..", "..", "..", "build-templates", "templates"),
19
+ path.resolve(base, "..", "..", "..", "..", "build-templates", "templates"),
13
20
  path.resolve(process.cwd(), "packages", "build-templates", "templates")
14
21
  ];
15
22
  for (const p of resolvePaths) if (fs.existsSync(p)) return p;
16
23
  return null;
17
- })();
24
+ };
25
+ const templatesDir = resolveTemplatesDir();
18
26
  const createESLintConfigFile = async (config) => {
19
27
  const { configPath, outputPath } = config;
20
28
  if (!templatesDir) throw new Error("Cannot find @elinzy/build-templates package. Please ensure it is installed.");
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@elinzy/cli";
3
- var version = "0.1.5";
3
+ var version = "0.1.6";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, "name", {
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.5";
3
+ var version = "0.1.6";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elinzy/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "A collection of common scripts and commands for e",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -48,7 +48,7 @@
48
48
  "prompts": "^2.4.2",
49
49
  "semver": "^7.7.1",
50
50
  "@elinzy/core": "^0.1.2",
51
- "@elinzy/build-templates": "0.1.0",
51
+ "@elinzy/build-templates": "0.1.1",
52
52
  "@elinzy/logger": "1.0.0"
53
53
  },
54
54
  "engines": {