@initx-plugin/utils 0.0.8 → 0.0.10

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
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## @initx-plugin/utils
8
8
 
9
- initx utils
9
+ Utilities for `initx`
10
10
 
11
11
  ## Documentation
12
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@initx-plugin/utils",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "description": "More convenient initialization tool",
6
6
  "author": "imba97",
7
7
  "license": "MIT",
@@ -19,16 +19,14 @@
19
19
  "exports": {
20
20
  ".": {
21
21
  "types": "./dist/index.d.ts",
22
- "import": "./dist/index.mjs",
23
- "require": "./dist/index.cjs"
22
+ "import": "./dist/index.mjs"
24
23
  },
25
24
  "./gpg": {
26
25
  "types": "./dist/gpg.d.ts",
27
- "import": "./dist/gpg.mjs",
28
- "require": "./dist/gpg.cjs"
26
+ "import": "./dist/gpg.mjs"
29
27
  }
30
28
  },
31
- "main": "dist/index.cjs",
29
+ "main": "dist/index.mjs",
32
30
  "module": "dist/index.mjs",
33
31
  "types": "dist/index.d.ts",
34
32
  "files": [
package/dist/gpg.cjs DELETED
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- const node_os = require('node:os');
4
- const index = require('./index.cjs');
5
- require('execa');
6
- require('picocolors');
7
- require('which');
8
-
9
- async function gpgList() {
10
- const result = await index.c("gpg", ["-k"]);
11
- const keys = [];
12
- const lines = result.stdout.split(node_os.EOL).filter((str) => str.trim() !== "");
13
- if (!lines || lines.length < 4) {
14
- return [];
15
- }
16
- const data = {
17
- key: "",
18
- name: "",
19
- email: ""
20
- };
21
- lines.forEach((line) => {
22
- const [, key] = /^\s+(\w{40})$/.exec(line) || [];
23
- if (key) {
24
- data.key = key;
25
- return;
26
- }
27
- if (line.startsWith("uid")) {
28
- const [, name, email] = /\s(\w+)\s<([\w-]+@[\w-]+(?:\.[\w-]+)+)>/.exec(line) || [];
29
- data.name = name;
30
- data.email = email;
31
- return;
32
- }
33
- if (line.startsWith("sub")) {
34
- keys.push({
35
- ...data
36
- });
37
- }
38
- });
39
- return keys;
40
- }
41
-
42
- exports.gpgList = gpgList;
package/dist/gpg.d.cts DELETED
@@ -1,8 +0,0 @@
1
- interface GpgInfo {
2
- key: string;
3
- name: string;
4
- email: string;
5
- }
6
- declare function gpgList(): Promise<GpgInfo[]>;
7
-
8
- export { gpgList };
package/dist/index.cjs DELETED
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- const execa = require('execa');
4
- const c$1 = require('picocolors');
5
- const which = require('which');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
-
9
- const c__default = /*#__PURE__*/_interopDefaultCompat(c$1);
10
- const which__default = /*#__PURE__*/_interopDefaultCompat(which);
11
-
12
- const log = {
13
- success: (msg) => console.log(`${c__default.bgGreen(c__default.black(" SUCCESS "))} ${msg}`),
14
- info: (msg) => console.log(`${c__default.bgBlue(c__default.white(" INFO "))} ${msg}`),
15
- warn: (msg) => console.log(`${c__default.bgYellow(c__default.black(" WARN "))} ${msg}`),
16
- error: (msg) => console.log(`${c__default.bgRed(c__default.white(" ERROR "))} ${msg}`)
17
- };
18
-
19
- const where = which__default.sync;
20
-
21
- async function c(command, options) {
22
- try {
23
- where(command);
24
- return await execa.execa(command, options);
25
- } catch (e) {
26
- if (e.message && e.message.startsWith("not found")) {
27
- log.error(`"${command}" is not installed`);
28
- }
29
- return e;
30
- }
31
- }
32
-
33
- exports.c = c;
34
- exports.log = log;
35
- exports.where = where;
package/dist/index.d.cts DELETED
@@ -1,15 +0,0 @@
1
- import { Result } from 'execa';
2
- import which from 'which';
3
-
4
- declare function c(command: string, options?: string[]): Promise<Result>;
5
-
6
- declare const log: {
7
- success: (msg: string) => void;
8
- info: (msg: string) => void;
9
- warn: (msg: string) => void;
10
- error: (msg: string) => void;
11
- };
12
-
13
- declare const where: typeof which.sync;
14
-
15
- export { c, log, where };