initx 0.0.8 → 0.0.9
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/dist/cli.mjs +1 -1
- package/package.json +6 -6
- package/dist/cli.cjs +0 -159
- package/dist/cli.d.cts +0 -2
- package/dist/index.cjs +0 -13
- package/dist/index.d.cts +0 -3
package/dist/cli.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { GitHandler } from '@initx-plugin/git';
|
|
|
4
4
|
import { CpHandler } from '@initx-plugin/cp';
|
|
5
5
|
import { GpgHandler } from '@initx-plugin/gpg';
|
|
6
6
|
|
|
7
|
-
const pkgJson = {name:"initx",type:"module",version:"0.0.
|
|
7
|
+
const pkgJson = {name:"initx",type:"module",version:"0.0.9",packageManager:"pnpm@9.12.2",description:"More convenient initialization tool",author:"imba97",license:"MIT",homepage:"https://github.com/imba97/initx#readme",repository:{type:"git",url:"git+ssh://git@github.com/imba97/initx"},bugs:{url:"https://github.com/imba97/initx/issues"},keywords:["initx"],main:"dist/index.mjs",module:"dist/index.mjs",types:"dist/index.d.ts",bin:"bin/initx.mjs",files:["dist"],scripts:{stub:"unbuild --stub",build:"unbuild"},dependencies:{"@initx-plugin/core":"workspace:*","@initx-plugin/cp":"workspace:*","@initx-plugin/git":"workspace:*","@initx-plugin/gpg":"workspace:*",cac:"^6.7.14",inquirer:"^12.0.0"}};
|
|
8
8
|
|
|
9
9
|
function getDefaultExportFromCjs (x) {
|
|
10
10
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "initx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "More convenient initialization tool",
|
|
6
6
|
"author": "imba97",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"keywords": [
|
|
17
17
|
"initx"
|
|
18
18
|
],
|
|
19
|
-
"main": "dist/index.
|
|
19
|
+
"main": "dist/index.mjs",
|
|
20
20
|
"module": "dist/index.mjs",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
22
|
"bin": "bin/initx.mjs",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"cac": "^6.7.14",
|
|
28
28
|
"inquirer": "^12.0.0",
|
|
29
|
-
"@initx-plugin/
|
|
30
|
-
"@initx-plugin/
|
|
31
|
-
"@initx-plugin/git": "0.0.
|
|
32
|
-
"@initx-plugin/gpg": "0.0.
|
|
29
|
+
"@initx-plugin/cp": "0.0.9",
|
|
30
|
+
"@initx-plugin/core": "0.0.9",
|
|
31
|
+
"@initx-plugin/git": "0.0.9",
|
|
32
|
+
"@initx-plugin/gpg": "0.0.9"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"stub": "unbuild --stub",
|
package/dist/cli.cjs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const cac = require('cac');
|
|
4
|
-
const inquirer = require('inquirer');
|
|
5
|
-
const git = require('@initx-plugin/git');
|
|
6
|
-
const cp = require('@initx-plugin/cp');
|
|
7
|
-
const gpg = require('@initx-plugin/gpg');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
10
|
-
|
|
11
|
-
const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
12
|
-
const inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
|
|
13
|
-
|
|
14
|
-
const pkgJson = {name:"initx",type:"module",version:"0.0.8",packageManager:"pnpm@9.12.2",description:"More convenient initialization tool",author:"imba97",license:"MIT",homepage:"https://github.com/imba97/initx#readme",repository:{type:"git",url:"git+ssh://git@github.com/imba97/initx"},bugs:{url:"https://github.com/imba97/initx/issues"},keywords:["initx"],main:"dist/index.cjs",module:"dist/index.mjs",types:"dist/index.d.ts",bin:"bin/initx.mjs",files:["dist"],scripts:{stub:"unbuild --stub",build:"unbuild"},dependencies:{"@initx-plugin/core":"workspace:*","@initx-plugin/cp":"workspace:*","@initx-plugin/git":"workspace:*","@initx-plugin/gpg":"workspace:*",cac:"^6.7.14",inquirer:"^12.0.0"}};
|
|
15
|
-
|
|
16
|
-
function getDefaultExportFromCjs (x) {
|
|
17
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var picocolors = {exports: {}};
|
|
21
|
-
|
|
22
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
23
|
-
let isColorSupported =
|
|
24
|
-
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
25
|
-
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
26
|
-
|
|
27
|
-
let formatter = (open, close, replace = open) =>
|
|
28
|
-
input => {
|
|
29
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
30
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
let replaceClose = (string, close, replace, index) => {
|
|
34
|
-
let result = "", cursor = 0;
|
|
35
|
-
do {
|
|
36
|
-
result += string.substring(cursor, index) + replace;
|
|
37
|
-
cursor = index + close.length;
|
|
38
|
-
index = string.indexOf(close, cursor);
|
|
39
|
-
} while (~index)
|
|
40
|
-
return result + string.substring(cursor)
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
let createColors = (enabled = isColorSupported) => {
|
|
44
|
-
let f = enabled ? formatter : () => String;
|
|
45
|
-
return {
|
|
46
|
-
isColorSupported: enabled,
|
|
47
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
48
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
49
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
50
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
51
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
52
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
53
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
54
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
55
|
-
|
|
56
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
57
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
58
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
59
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
60
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
61
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
62
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
63
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
64
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
65
|
-
|
|
66
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
67
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
68
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
69
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
70
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
71
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
72
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
73
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
74
|
-
|
|
75
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
76
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
77
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
78
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
79
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
80
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
81
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
82
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
83
|
-
|
|
84
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
85
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
86
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
87
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
88
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
89
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
90
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
91
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
picocolors.exports = createColors();
|
|
96
|
-
picocolors.exports.createColors = createColors;
|
|
97
|
-
|
|
98
|
-
var picocolorsExports = picocolors.exports;
|
|
99
|
-
const c = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
|
100
|
-
|
|
101
|
-
const log = {
|
|
102
|
-
success: (msg) => console.log(`${c.bgGreen(c.black(" SUCCESS "))} ${msg}`),
|
|
103
|
-
info: (msg) => console.log(`${c.bgBlue(c.white(" INFO "))} ${msg}`),
|
|
104
|
-
warn: (msg) => console.log(`${c.bgYellow(c.black(" WARN "))} ${msg}`),
|
|
105
|
-
error: (msg) => console.log(`${c.bgRed(c.white(" ERROR "))} ${msg}`)
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const handlers = [
|
|
109
|
-
new git.GitHandler(),
|
|
110
|
-
new cp.CpHandler(),
|
|
111
|
-
new gpg.GpgHandler()
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
const cli = cac__default("initx");
|
|
115
|
-
cli.help().command("<something>", "see https://github.com/imba97/initx").usage("").option("-v, --version", "Display version number");
|
|
116
|
-
const { args, options: cliOptions } = cli.parse();
|
|
117
|
-
if (cliOptions.h || cliOptions.help) {
|
|
118
|
-
process.exit(0);
|
|
119
|
-
}
|
|
120
|
-
if (cliOptions.v || cliOptions.version) {
|
|
121
|
-
console.log(pkgJson.version);
|
|
122
|
-
process.exit(0);
|
|
123
|
-
}
|
|
124
|
-
const [key, ...others] = args;
|
|
125
|
-
if (!key || typeof key !== "string") {
|
|
126
|
-
log.error("Please enter something");
|
|
127
|
-
process.exit(0);
|
|
128
|
-
}
|
|
129
|
-
const matchedHandlers = [];
|
|
130
|
-
for (const handler of handlers) {
|
|
131
|
-
const matched = handler.run({
|
|
132
|
-
key,
|
|
133
|
-
cliOptions,
|
|
134
|
-
optionsList: Object.keys(cliOptions).filter((key2) => cliOptions[key2] === true).map((key2) => `--${key2}`)
|
|
135
|
-
}, ...others);
|
|
136
|
-
matchedHandlers.push(...matched);
|
|
137
|
-
}
|
|
138
|
-
if (matchedHandlers.length === 0) {
|
|
139
|
-
process.exit(0);
|
|
140
|
-
}
|
|
141
|
-
(async function() {
|
|
142
|
-
if (matchedHandlers.length === 1) {
|
|
143
|
-
const [{ handler }] = matchedHandlers;
|
|
144
|
-
await handler();
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const { index } = await inquirer__default.prompt([
|
|
148
|
-
{
|
|
149
|
-
type: "list",
|
|
150
|
-
name: "index",
|
|
151
|
-
message: "Which handler do you want to run?",
|
|
152
|
-
choices: matchedHandlers.map(({ description }, index2) => ({
|
|
153
|
-
name: description,
|
|
154
|
-
value: index2
|
|
155
|
-
}))
|
|
156
|
-
}
|
|
157
|
-
]);
|
|
158
|
-
await matchedHandlers[index]?.handler();
|
|
159
|
-
})();
|
package/dist/cli.d.cts
DELETED
package/dist/index.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const git = require('@initx-plugin/git');
|
|
4
|
-
const cp = require('@initx-plugin/cp');
|
|
5
|
-
const core = require('@initx-plugin/core');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.GitHandler = git.GitHandler;
|
|
10
|
-
exports.CpHandler = cp.CpHandler;
|
|
11
|
-
Object.keys(core).forEach(function (k) {
|
|
12
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = core[k];
|
|
13
|
-
});
|
package/dist/index.d.cts
DELETED