@stackone/cli 1.0.1 → 1.1.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/dist/chunk-CUT6urMc.cjs +1 -30
- package/dist/cli.cjs +1 -7
- package/dist/cli.js +1 -7
- package/dist/cliCore-Cgoai805.cjs +5 -0
- package/dist/cliCore-jii80_E0.js +5 -0
- package/dist/esm-BenXeAeS.js +1 -1572
- package/dist/esm-Chmlhd00.cjs +1 -1573
- package/dist/index.cjs +1 -3
- package/dist/index.js +1 -3
- package/package.json +3 -2
- package/dist/cliCore-C1gzrk1Q.cjs +0 -138
- package/dist/cliCore-DKDA_-me.js +0 -132
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackone/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "StackOne Connect CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"clean": "rimraf dist",
|
|
19
19
|
"prebuild": "npm run clean",
|
|
20
|
-
"build": "tsdown --env.NODE_ENV=production",
|
|
20
|
+
"build": "tsdown --env.NODE_ENV=production --minify",
|
|
21
21
|
"prebuild:dev": "npm run clean",
|
|
22
22
|
"build:dev": "tsdown --env.NODE_ENV=development",
|
|
23
23
|
"code:format": "biome format ./src ./*.mjs",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"author": "StackOne",
|
|
42
42
|
"license": "ISC",
|
|
43
43
|
"dependencies": {
|
|
44
|
+
"@stackone/connect-sdk": "*",
|
|
44
45
|
"chalk": "^5.3.0",
|
|
45
46
|
"commander": "^12.1.0",
|
|
46
47
|
"inquirer": "^12.0.0",
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const chalk = require_chunk.__toESM(require("chalk"));
|
|
3
|
-
const commander = require_chunk.__toESM(require("commander"));
|
|
4
|
-
const ora = require_chunk.__toESM(require("ora"));
|
|
5
|
-
const fs = require_chunk.__toESM(require("fs"));
|
|
6
|
-
const path = require_chunk.__toESM(require("path"));
|
|
7
|
-
const url = require_chunk.__toESM(require("url"));
|
|
8
|
-
|
|
9
|
-
//#region src/utils/logger.ts
|
|
10
|
-
var Logger = class {
|
|
11
|
-
static info(message) {
|
|
12
|
-
console.info(chalk.default.blue("ℹ"), message);
|
|
13
|
-
}
|
|
14
|
-
static warn(message) {
|
|
15
|
-
console.info(chalk.default.yellow("⚠"), message);
|
|
16
|
-
}
|
|
17
|
-
static error(message) {
|
|
18
|
-
console.info(chalk.default.red("✗"), message);
|
|
19
|
-
}
|
|
20
|
-
static success(message) {
|
|
21
|
-
console.info(chalk.default.green("✓"), message);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/commands/validate.ts
|
|
27
|
-
var ValidateCommand = class {
|
|
28
|
-
async execute(options) {
|
|
29
|
-
const { watchMode, fileOrDir } = options;
|
|
30
|
-
const spinner = (0, ora.default)("Watching for changes...");
|
|
31
|
-
const displayWatchModeEnabled = () => {
|
|
32
|
-
console.clear();
|
|
33
|
-
console.info(chalk.default.yellow("Watch mode enabled. Press \"q\" to quit.\n"));
|
|
34
|
-
};
|
|
35
|
-
if (!fileOrDir) return;
|
|
36
|
-
if (watchMode) {
|
|
37
|
-
const { watch } = await Promise.resolve().then(() => require("./esm-Chmlhd00.cjs"));
|
|
38
|
-
const readline = await import("readline");
|
|
39
|
-
const rl = readline.createInterface({
|
|
40
|
-
input: process.stdin,
|
|
41
|
-
output: process.stdout
|
|
42
|
-
});
|
|
43
|
-
process.stdin.setRawMode(true);
|
|
44
|
-
process.stdin.resume();
|
|
45
|
-
process.stdin.setEncoding("utf8");
|
|
46
|
-
const cleanup = () => {
|
|
47
|
-
console.info(chalk.default.grey("\n\nExiting watch mode..."));
|
|
48
|
-
watcher.close();
|
|
49
|
-
spinner.stop();
|
|
50
|
-
rl.close();
|
|
51
|
-
process.exit(0);
|
|
52
|
-
};
|
|
53
|
-
displayWatchModeEnabled();
|
|
54
|
-
console.info(chalk.default.blue(`Running connector(s) validations...`));
|
|
55
|
-
await validateConnector(fileOrDir);
|
|
56
|
-
spinner.start();
|
|
57
|
-
const watcher = watch(fileOrDir || ".", {
|
|
58
|
-
ignored: /(^|[/\\])\../,
|
|
59
|
-
persistent: true
|
|
60
|
-
});
|
|
61
|
-
watcher.on("change", async (path$1) => {
|
|
62
|
-
displayWatchModeEnabled();
|
|
63
|
-
spinner.stop();
|
|
64
|
-
console.info(chalk.default.blue(`File change detected. Running connector(s) validations...`));
|
|
65
|
-
await validateConnector(fileOrDir);
|
|
66
|
-
spinner.start();
|
|
67
|
-
});
|
|
68
|
-
process.stdin.on("data", (key) => {
|
|
69
|
-
if (key.toString() === "q") cleanup();
|
|
70
|
-
});
|
|
71
|
-
process.on("SIGINT", () => {
|
|
72
|
-
cleanup();
|
|
73
|
-
});
|
|
74
|
-
} else await validateConnector(fileOrDir);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const validateConnector = async (path$1) => {
|
|
78
|
-
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
79
|
-
Logger.success(`Connector ${path$1} is valid!\n`);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/utils/packageVersion.ts
|
|
84
|
-
const getPackageVersion = () => {
|
|
85
|
-
try {
|
|
86
|
-
const __filename$1 = (0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
|
|
87
|
-
const __dirname$1 = (0, path.dirname)(__filename$1);
|
|
88
|
-
const packageJsonPath = (0, path.join)(__dirname$1, "..", "package.json");
|
|
89
|
-
const packageJson = JSON.parse((0, fs.readFileSync)(packageJsonPath, "utf8"));
|
|
90
|
-
return packageJson.version;
|
|
91
|
-
} catch {
|
|
92
|
-
return "unknown";
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/cliCore.ts
|
|
98
|
-
var CLI = class {
|
|
99
|
-
constructor(program = new commander.Command(), version = getPackageVersion()) {
|
|
100
|
-
this.program = program;
|
|
101
|
-
this.version = version;
|
|
102
|
-
this.setupProgram();
|
|
103
|
-
this.registerCommands();
|
|
104
|
-
}
|
|
105
|
-
setupProgram() {
|
|
106
|
-
this.program.name("stackone").description("StackOne Connect CLI tool").version(this.version);
|
|
107
|
-
}
|
|
108
|
-
registerCommands() {
|
|
109
|
-
const validateCommand = new ValidateCommand();
|
|
110
|
-
this.program.configureOutput({
|
|
111
|
-
writeOut: (str) => process.stdout.write(str),
|
|
112
|
-
writeErr: (str) => process.stderr.write(str),
|
|
113
|
-
outputError: (str, write) => {
|
|
114
|
-
write(chalk.default.red(str));
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
this.program.command("validate").option("-w, --watch", "Run in watch mode").addArgument(new commander.Argument("<path>", "Connector file or directory with connectors to validate")).description("Validate a StackOne connector").action((fileOrDir, options) => {
|
|
118
|
-
validateCommand.execute({
|
|
119
|
-
watchMode: options.watch,
|
|
120
|
-
fileOrDir
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
this.program.command("version").description("Show version information").action(() => {
|
|
124
|
-
console.info(`${chalk.default.greenBright("StackOne")} ${chalk.default.grey("CLI")} ${chalk.default.whiteBright(this.version)}`);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
run() {
|
|
128
|
-
this.program.parse(process.argv);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
Object.defineProperty(exports, 'CLI', {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
get: function () {
|
|
136
|
-
return CLI;
|
|
137
|
-
}
|
|
138
|
-
});
|
package/dist/cliCore-DKDA_-me.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { Argument, Command } from "commander";
|
|
3
|
-
import ora from "ora";
|
|
4
|
-
import { readFileSync } from "fs";
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
|
|
8
|
-
//#region src/utils/logger.ts
|
|
9
|
-
var Logger = class {
|
|
10
|
-
static info(message) {
|
|
11
|
-
console.info(chalk.blue("ℹ"), message);
|
|
12
|
-
}
|
|
13
|
-
static warn(message) {
|
|
14
|
-
console.info(chalk.yellow("⚠"), message);
|
|
15
|
-
}
|
|
16
|
-
static error(message) {
|
|
17
|
-
console.info(chalk.red("✗"), message);
|
|
18
|
-
}
|
|
19
|
-
static success(message) {
|
|
20
|
-
console.info(chalk.green("✓"), message);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/commands/validate.ts
|
|
26
|
-
var ValidateCommand = class {
|
|
27
|
-
async execute(options) {
|
|
28
|
-
const { watchMode, fileOrDir } = options;
|
|
29
|
-
const spinner = ora("Watching for changes...");
|
|
30
|
-
const displayWatchModeEnabled = () => {
|
|
31
|
-
console.clear();
|
|
32
|
-
console.info(chalk.yellow("Watch mode enabled. Press \"q\" to quit.\n"));
|
|
33
|
-
};
|
|
34
|
-
if (!fileOrDir) return;
|
|
35
|
-
if (watchMode) {
|
|
36
|
-
const { watch: watch$1 } = await import("./esm-BenXeAeS.js");
|
|
37
|
-
const readline = await import("readline");
|
|
38
|
-
const rl = readline.createInterface({
|
|
39
|
-
input: process.stdin,
|
|
40
|
-
output: process.stdout
|
|
41
|
-
});
|
|
42
|
-
process.stdin.setRawMode(true);
|
|
43
|
-
process.stdin.resume();
|
|
44
|
-
process.stdin.setEncoding("utf8");
|
|
45
|
-
const cleanup = () => {
|
|
46
|
-
console.info(chalk.grey("\n\nExiting watch mode..."));
|
|
47
|
-
watcher.close();
|
|
48
|
-
spinner.stop();
|
|
49
|
-
rl.close();
|
|
50
|
-
process.exit(0);
|
|
51
|
-
};
|
|
52
|
-
displayWatchModeEnabled();
|
|
53
|
-
console.info(chalk.blue(`Running connector(s) validations...`));
|
|
54
|
-
await validateConnector(fileOrDir);
|
|
55
|
-
spinner.start();
|
|
56
|
-
const watcher = watch$1(fileOrDir || ".", {
|
|
57
|
-
ignored: /(^|[/\\])\../,
|
|
58
|
-
persistent: true
|
|
59
|
-
});
|
|
60
|
-
watcher.on("change", async (path) => {
|
|
61
|
-
displayWatchModeEnabled();
|
|
62
|
-
spinner.stop();
|
|
63
|
-
console.info(chalk.blue(`File change detected. Running connector(s) validations...`));
|
|
64
|
-
await validateConnector(fileOrDir);
|
|
65
|
-
spinner.start();
|
|
66
|
-
});
|
|
67
|
-
process.stdin.on("data", (key) => {
|
|
68
|
-
if (key.toString() === "q") cleanup();
|
|
69
|
-
});
|
|
70
|
-
process.on("SIGINT", () => {
|
|
71
|
-
cleanup();
|
|
72
|
-
});
|
|
73
|
-
} else await validateConnector(fileOrDir);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const validateConnector = async (path) => {
|
|
77
|
-
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
78
|
-
Logger.success(`Connector ${path} is valid!\n`);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/utils/packageVersion.ts
|
|
83
|
-
const getPackageVersion = () => {
|
|
84
|
-
try {
|
|
85
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
86
|
-
const __dirname = dirname(__filename);
|
|
87
|
-
const packageJsonPath = join(__dirname, "..", "package.json");
|
|
88
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
89
|
-
return packageJson.version;
|
|
90
|
-
} catch {
|
|
91
|
-
return "unknown";
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/cliCore.ts
|
|
97
|
-
var CLI = class {
|
|
98
|
-
constructor(program = new Command(), version = getPackageVersion()) {
|
|
99
|
-
this.program = program;
|
|
100
|
-
this.version = version;
|
|
101
|
-
this.setupProgram();
|
|
102
|
-
this.registerCommands();
|
|
103
|
-
}
|
|
104
|
-
setupProgram() {
|
|
105
|
-
this.program.name("stackone").description("StackOne Connect CLI tool").version(this.version);
|
|
106
|
-
}
|
|
107
|
-
registerCommands() {
|
|
108
|
-
const validateCommand = new ValidateCommand();
|
|
109
|
-
this.program.configureOutput({
|
|
110
|
-
writeOut: (str) => process.stdout.write(str),
|
|
111
|
-
writeErr: (str) => process.stderr.write(str),
|
|
112
|
-
outputError: (str, write) => {
|
|
113
|
-
write(chalk.red(str));
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
this.program.command("validate").option("-w, --watch", "Run in watch mode").addArgument(new Argument("<path>", "Connector file or directory with connectors to validate")).description("Validate a StackOne connector").action((fileOrDir, options) => {
|
|
117
|
-
validateCommand.execute({
|
|
118
|
-
watchMode: options.watch,
|
|
119
|
-
fileOrDir
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
this.program.command("version").description("Show version information").action(() => {
|
|
123
|
-
console.info(`${chalk.greenBright("StackOne")} ${chalk.grey("CLI")} ${chalk.whiteBright(this.version)}`);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
run() {
|
|
127
|
-
this.program.parse(process.argv);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
//#endregion
|
|
132
|
-
export { CLI };
|