@vayucloud/cli 0.0.0-stage → 0.1.0
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 +79 -2
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/base.d.ts +13 -0
- package/dist/base.js +77 -0
- package/dist/commands/deploy.d.ts +18 -0
- package/dist/commands/deploy.js +209 -0
- package/dist/commands/hello/index.d.ts +12 -0
- package/dist/commands/hello/index.js +19 -0
- package/dist/commands/hello/world.d.ts +8 -0
- package/dist/commands/hello/world.js +29 -0
- package/dist/commands/login.d.ts +12 -0
- package/dist/commands/login.js +127 -0
- package/dist/commands/logout.d.ts +6 -0
- package/dist/commands/logout.js +18 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +4 -0
- package/dist/helper.d.ts +13 -0
- package/dist/helper.js +86 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/oclif.manifest.json +174 -0
- package/package.json +89 -4
package/README.md
CHANGED
|
@@ -1,3 +1,80 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VayuCloud CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ابزار خط فرمان VayuCloud برای ورود به حساب کاربری، مدیریت نشست و استقرار پروژهها.
|
|
4
|
+
|
|
5
|
+
## پیشنیازها
|
|
6
|
+
|
|
7
|
+
- Node.js نسخه ۱۸ یا بالاتر
|
|
8
|
+
- حساب کاربری VayuCloud
|
|
9
|
+
|
|
10
|
+
## نصب
|
|
11
|
+
|
|
12
|
+
برای نصب نسخه منتشرشده:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @vayucloud/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
برای بررسی نصب:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
vayu --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## استفاده
|
|
25
|
+
|
|
26
|
+
### ورود
|
|
27
|
+
|
|
28
|
+
نام کاربری و رمز عبور را بهصورت تعاملی وارد کنید:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
vayu login
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
یا آنها را مستقیماً به فرمان بدهید:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
vayu login --username <username> --password <password>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### استقرار پروژه
|
|
41
|
+
|
|
42
|
+
در پوشهی پروژه اجرا کنید تا CLI پروژه را بستهبندی و برای سرویس انتخابشده ارسال کند:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
vayu deploy
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
برای تعیین مسیر پروژه یا سرویس:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
vayu deploy --path <project-path> --name <service-name>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
حجم فایلهای پروژه پس از فشردهسازی نباید بیشتر از ۱۰۰ مگابایت باشد. پوشهها و فایلهای رایج مانند `node_modules`، `.git`، فایلهای log و محیطهای مجازی از بستهی استقرار حذف میشوند.
|
|
55
|
+
|
|
56
|
+
### خروج
|
|
57
|
+
|
|
58
|
+
برای حذف نشست ذخیرهشده از این سیستم:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
vayu logout
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## توسعه
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install
|
|
68
|
+
npm run build
|
|
69
|
+
npm test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
اجرای CLI محلی پس از build:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
./bin/run.js --help
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## مجوز
|
|
79
|
+
|
|
80
|
+
این پروژه تحت مجوز MIT منتشر شده است.
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default abstract class extends Command {
|
|
3
|
+
axiosConfig: any;
|
|
4
|
+
read_config(): Promise<{
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
users: Record<string, {
|
|
7
|
+
token: string;
|
|
8
|
+
}>;
|
|
9
|
+
}>;
|
|
10
|
+
write_config(object: any): Promise<void>;
|
|
11
|
+
get_services(filter?: {}): Promise<any>;
|
|
12
|
+
init_run(): Promise<void>;
|
|
13
|
+
}
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { BASE_API_URL, GLOBAL_CONF_PATH } from "./constants.js";
|
|
4
|
+
import { read_config_file, get_all_services } from "./helper.js";
|
|
5
|
+
import HttpsProxyAgent from 'https-proxy-agent';
|
|
6
|
+
import got from 'got';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
// import got, {Options} from 'got'
|
|
9
|
+
import * as https from 'https';
|
|
10
|
+
export default class extends Command {
|
|
11
|
+
// static flags = {
|
|
12
|
+
// help: Flags.help({char: 'h'}),
|
|
13
|
+
// };
|
|
14
|
+
axiosConfig = {
|
|
15
|
+
...axios.defaults
|
|
16
|
+
};
|
|
17
|
+
// got = got.extend();
|
|
18
|
+
async read_config() {
|
|
19
|
+
return read_config_file();
|
|
20
|
+
}
|
|
21
|
+
async write_config(object) {
|
|
22
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(object));
|
|
23
|
+
}
|
|
24
|
+
async get_services(filter = {}) {
|
|
25
|
+
return await get_all_services(filter, this.axiosConfig);
|
|
26
|
+
}
|
|
27
|
+
// this function called just after every cli command for checking existed token and set some config
|
|
28
|
+
async init_run() {
|
|
29
|
+
// await checkUpdate(this.config.version)
|
|
30
|
+
const main_agent = new https.Agent({
|
|
31
|
+
rejectUnauthorized: false
|
|
32
|
+
});
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const gotConfig = {};
|
|
35
|
+
this.axiosConfig.httpsAgent = main_agent;
|
|
36
|
+
this.axiosConfig.baseURL = BASE_API_URL;
|
|
37
|
+
gotConfig.prefixUrl = this.axiosConfig.baseURL;
|
|
38
|
+
gotConfig.agent = { https: main_agent };
|
|
39
|
+
const proxy = process.env.http_proxy || process.env.https_proxy;
|
|
40
|
+
if (proxy) {
|
|
41
|
+
this.log(`Using proxy server ${proxy}`);
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
const agent = new HttpsProxyAgent(proxy);
|
|
44
|
+
this.axiosConfig.httpsAgent = agent;
|
|
45
|
+
this.axiosConfig.proxy = false;
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
gotConfig.agent = { https: agent };
|
|
48
|
+
}
|
|
49
|
+
const config_json = read_config_file();
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.got = got.extend(gotConfig);
|
|
52
|
+
// if (isEmptyObject(config_json) || isEmptyObject(config_json.users)) {
|
|
53
|
+
// return;
|
|
54
|
+
// }
|
|
55
|
+
const firstEmail = Object.keys(config_json.users)[0] || null;
|
|
56
|
+
let token = null;
|
|
57
|
+
if (firstEmail) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
token = config_json.users[firstEmail].token;
|
|
60
|
+
// this.log('this is existing token:',token)
|
|
61
|
+
}
|
|
62
|
+
// return
|
|
63
|
+
// this.log('token:',token);
|
|
64
|
+
// const usersArray = Object.values(config_json.users);
|
|
65
|
+
// this.log('this is token:',usersArray[0].token)
|
|
66
|
+
// return
|
|
67
|
+
// const token = usersArray[0].token || null;
|
|
68
|
+
// this.log('this is token',config_json.users[0])
|
|
69
|
+
if (token) {
|
|
70
|
+
this.axiosConfig.headers.Authorization = `Bearer ${token}`;
|
|
71
|
+
gotConfig.headers = { Authorization: `Bearer ${token}` };
|
|
72
|
+
// this.log("set header")
|
|
73
|
+
}
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
this.got = got.extend(gotConfig);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from "../base.ts";
|
|
2
|
+
export default class Deploy extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
file: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
prepare_archive(project_path: any): Promise<unknown>;
|
|
14
|
+
upload(archive_path: any, selected_service: any, cli: any, vayu_file: any): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
message: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import Command from "../base.js";
|
|
3
|
+
import { isEmptyObject, addIgnorePatterns } from "../helper.js";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import inquirer from 'inquirer';
|
|
7
|
+
import FormData from "form-data";
|
|
8
|
+
import ignore from "ignore";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
import * as os from "os";
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import archiver from 'archiver';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import fs from 'fs-extra';
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
import ProgressBar from 'progress';
|
|
17
|
+
const MAX_SOURCE_SIZE = 100 * 1024 * 1024; // 100 MB
|
|
18
|
+
export default class Deploy extends Command {
|
|
19
|
+
static args = {
|
|
20
|
+
file: Args.string({ description: 'file to read' }),
|
|
21
|
+
};
|
|
22
|
+
static description = 'describe the command here';
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %>',
|
|
25
|
+
];
|
|
26
|
+
static flags = {
|
|
27
|
+
// flag with a value (-p, --path=VALUE)
|
|
28
|
+
path: Flags.string({
|
|
29
|
+
char: "p",
|
|
30
|
+
description: "project path in your computer",
|
|
31
|
+
}),
|
|
32
|
+
name: Flags.string({
|
|
33
|
+
char: "n",
|
|
34
|
+
description: "project name",
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
async run() {
|
|
38
|
+
const { args, flags } = await this.parse(Deploy);
|
|
39
|
+
await this.init_run();
|
|
40
|
+
const config_json = await this.read_config();
|
|
41
|
+
let selected_service = flags.name;
|
|
42
|
+
let project_path = flags.path ? flags.path : process.cwd();
|
|
43
|
+
let vayu_file = { service: "" };
|
|
44
|
+
this.log('this is project path', project_path);
|
|
45
|
+
if (isEmptyObject(config_json.users)) {
|
|
46
|
+
this.log(`${chalk.red("[Error]")} first you should login!`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (selected_service) {
|
|
50
|
+
console.log("this is service that selected:", selected_service);
|
|
51
|
+
}
|
|
52
|
+
if (!selected_service) {
|
|
53
|
+
let all_services = await this.get_services({
|
|
54
|
+
has_deploy: "true",
|
|
55
|
+
status: "on",
|
|
56
|
+
});
|
|
57
|
+
console.log(all_services);
|
|
58
|
+
if (all_services.length > 0) {
|
|
59
|
+
let { service } = await inquirer.prompt({
|
|
60
|
+
type: "rawlist",
|
|
61
|
+
message: "Please select a service:",
|
|
62
|
+
name: "service",
|
|
63
|
+
choices: all_services,
|
|
64
|
+
});
|
|
65
|
+
selected_service = service;
|
|
66
|
+
this.log('this is selected project', selected_service);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.log("first you should create service");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let archive_path = await this.prepare_archive(project_path);
|
|
74
|
+
let upload_response = await this.upload(archive_path, selected_service, this, vayu_file);
|
|
75
|
+
if (upload_response.success) {
|
|
76
|
+
this.log(chalk.green(upload_response.message));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.log(chalk.red("[Error] " + upload_response.message));
|
|
80
|
+
}
|
|
81
|
+
// build
|
|
82
|
+
const body = { product_assignment_id: selected_service };
|
|
83
|
+
// this.log('axios',this.axiosConfig)
|
|
84
|
+
try {
|
|
85
|
+
const { data } = await axios.post("product/build/?product_assignment_id=" + selected_service, body, this.axiosConfig);
|
|
86
|
+
if (data.success) {
|
|
87
|
+
this.log(chalk.green("[Success] " + 'building project successfully started.'));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.log(chalk.red("[Error] " + 'there is a problem with building project.'));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
// this.log('there is a problem in build',error.response);
|
|
96
|
+
this.log('there is a problem in build');
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
}
|
|
100
|
+
// const name = flags.name ?? 'world'
|
|
101
|
+
// this.log(`hello ${name} from D:\\myProject\\paasar_cli\\paasar-cli\\src\\commands\\deploy.ts`)
|
|
102
|
+
// if (args.file && flags.force) {
|
|
103
|
+
// this.log(`you input --force and --file: ${args.file}`)
|
|
104
|
+
// }
|
|
105
|
+
}
|
|
106
|
+
async prepare_archive(project_path) {
|
|
107
|
+
const defaultIgnores = [
|
|
108
|
+
".npm", ".git", ".idea", ".DS_Store", ".vscode",
|
|
109
|
+
"__pycache__", ".next", ".nuxt", "*.*~",
|
|
110
|
+
"node_modules", "bower_components", "venv",
|
|
111
|
+
"vendor", "*.log",
|
|
112
|
+
];
|
|
113
|
+
const tmpDir = path.join(os.tmpdir(), "vayucloud-cli");
|
|
114
|
+
const archivePath = path.join(tmpDir, `${Date.now()}.zip`);
|
|
115
|
+
fs.ensureDirSync(tmpDir);
|
|
116
|
+
const output = fs.createWriteStream(archivePath);
|
|
117
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
118
|
+
const ignoreInstance = ignore({ ignorecase: false }).add(defaultIgnores);
|
|
119
|
+
const files = [];
|
|
120
|
+
const collectFiles = (directory) => {
|
|
121
|
+
const relativeDirectory = path.relative(project_path, directory) || '.';
|
|
122
|
+
addIgnorePatterns(ignoreInstance, project_path, relativeDirectory);
|
|
123
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
124
|
+
const fullPath = path.join(directory, entry.name);
|
|
125
|
+
const relativePath = path.relative(project_path, fullPath).replace(/\\/g, '/');
|
|
126
|
+
if (ignoreInstance.ignores(relativePath)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (entry.isDirectory()) {
|
|
130
|
+
collectFiles(fullPath);
|
|
131
|
+
}
|
|
132
|
+
else if (entry.isFile()) {
|
|
133
|
+
files.push(relativePath);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
collectFiles(project_path);
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
output.on('close', () => {
|
|
140
|
+
console.log('ZIP created: ' + archive.pointer() + ' total bytes');
|
|
141
|
+
resolve(archivePath);
|
|
142
|
+
});
|
|
143
|
+
archive.on('error', (err) => reject(err));
|
|
144
|
+
archive.pipe(output);
|
|
145
|
+
files.forEach((relativePath) => {
|
|
146
|
+
const fullPath = path.join(project_path, relativePath);
|
|
147
|
+
archive.file(fullPath, { name: relativePath });
|
|
148
|
+
});
|
|
149
|
+
archive.finalize();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async upload(archive_path, selected_service, cli, vayu_file) {
|
|
153
|
+
let upload_response = {
|
|
154
|
+
success: false,
|
|
155
|
+
message: "some problem",
|
|
156
|
+
};
|
|
157
|
+
const body = new FormData();
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
body.append("file", fs.createReadStream(archive_path));
|
|
160
|
+
// body.append("options", JSON.stringify(vayu_file));
|
|
161
|
+
// this.log('this is selected service',selected_service)
|
|
162
|
+
body.append("product_assignment_id", selected_service);
|
|
163
|
+
const { size: sourceSize } = fs.statSync(archive_path);
|
|
164
|
+
if (sourceSize > MAX_SOURCE_SIZE) {
|
|
165
|
+
upload_response.message = "Source is too large. (max: 100MB)";
|
|
166
|
+
return upload_response;
|
|
167
|
+
}
|
|
168
|
+
const bar = new ProgressBar("Uploading [:bar] :percent :etas", {
|
|
169
|
+
total: sourceSize,
|
|
170
|
+
width: 20,
|
|
171
|
+
complete: "=",
|
|
172
|
+
incomplete: "",
|
|
173
|
+
clear: true,
|
|
174
|
+
});
|
|
175
|
+
try {
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
const response = await this.got
|
|
178
|
+
.post(`product/upload/`, { body })
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
.on("uploadProgress", (progress) => {
|
|
181
|
+
bar.tick(progress.transferred - bar.curr);
|
|
182
|
+
})
|
|
183
|
+
.json();
|
|
184
|
+
if (response.success) {
|
|
185
|
+
upload_response.success = true;
|
|
186
|
+
upload_response.message = "Deployment finished successfully.";
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// if (process.env.PAASAR_DEBUG == "true") {
|
|
190
|
+
// this.log(response);
|
|
191
|
+
// }
|
|
192
|
+
}
|
|
193
|
+
return upload_response;
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
// if (process.env.PAASAR_DEBUG == "true") {
|
|
197
|
+
// // this.log(error);
|
|
198
|
+
// }
|
|
199
|
+
upload_response.success = false;
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
upload_response.message = `Deployment failed: ${error.message}`;
|
|
202
|
+
return upload_response;
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
// cleanup
|
|
206
|
+
fs.unlink(archive_path).catch(() => { });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Hello extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
person: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
export default class Hello extends Command {
|
|
3
|
+
static args = {
|
|
4
|
+
person: Args.string({ description: 'Person to say hello to', required: true }),
|
|
5
|
+
};
|
|
6
|
+
static description = 'Say hello';
|
|
7
|
+
static examples = [
|
|
8
|
+
`<%= config.bin %> <%= command.id %> friend --from oclif
|
|
9
|
+
hello friend from oclif! (./src/commands/hello/index.ts)
|
|
10
|
+
`,
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
from: Flags.string({ char: 'f', description: 'Who is saying hello', required: true }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(Hello);
|
|
17
|
+
this.log(`hello ${args.person} from ${flags.from}! (./src/commands/hello/index.ts)`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
export default class World extends Command {
|
|
5
|
+
static args = {};
|
|
6
|
+
static description = 'Say hello world';
|
|
7
|
+
static examples = [
|
|
8
|
+
`<%= config.bin %> <%= command.id %>
|
|
9
|
+
hello world! (./src/commands/hello/world.ts)
|
|
10
|
+
`,
|
|
11
|
+
];
|
|
12
|
+
static flags = {};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args } = await this.parse(World);
|
|
15
|
+
this.log('hello world! (./src/commands/hello/world.ts)');
|
|
16
|
+
const { project } = await inquirer.prompt({
|
|
17
|
+
name: 'project',
|
|
18
|
+
type: 'List',
|
|
19
|
+
message: 'Please select an app:',
|
|
20
|
+
default: 'iran',
|
|
21
|
+
choices: ['iran', 'german']
|
|
22
|
+
});
|
|
23
|
+
const spinner = ora('Loading unicorns').start();
|
|
24
|
+
spinner.color = 'magenta';
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
spinner.color = 'red';
|
|
27
|
+
}, 2000);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Command from "../base.ts";
|
|
2
|
+
export default class Login extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
private getApiMessage;
|
|
11
|
+
private fail;
|
|
12
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import Command from "../base.js";
|
|
5
|
+
import { isObject } from "../helper.js";
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
export default class Login extends Command {
|
|
9
|
+
// static override args = {
|
|
10
|
+
// file: Args.string({description: 'file to read'}),
|
|
11
|
+
// }
|
|
12
|
+
static description = 'describe the command here';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %>',
|
|
15
|
+
];
|
|
16
|
+
static flags = {
|
|
17
|
+
// flag with no value (-n, --username=VALUE)
|
|
18
|
+
username: Flags.string({ char: 'n', description: 'enter username or phonenumber' }),
|
|
19
|
+
// flag with a value (-p, --password=VALUE)
|
|
20
|
+
password: Flags.string({ char: 'p', description: 'enter password' }),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(Login);
|
|
24
|
+
const body = { username: flags.username, password: flags.password };
|
|
25
|
+
const config_json = await this.read_config();
|
|
26
|
+
if (isObject(config_json.users) && Object.keys(config_json.users).length > 0) {
|
|
27
|
+
this.log(`${chalk.yellow('[Info]')} You are already logged in. Run \`vayu logout\` before logging in again.`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
await this.init_run();
|
|
31
|
+
if (!flags.username) {
|
|
32
|
+
let { username } = await inquirer.prompt({
|
|
33
|
+
type: 'input',
|
|
34
|
+
message: 'Enter your username:',
|
|
35
|
+
name: 'username',
|
|
36
|
+
validate(input) {
|
|
37
|
+
if (input.length === 0) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
body.username = username;
|
|
44
|
+
}
|
|
45
|
+
if (!flags.password) {
|
|
46
|
+
let { password } = await inquirer.prompt({
|
|
47
|
+
type: 'password',
|
|
48
|
+
name: 'password',
|
|
49
|
+
message: 'Enter your password:',
|
|
50
|
+
validate(input) {
|
|
51
|
+
if (input.length === 0) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
body.password = password;
|
|
58
|
+
}
|
|
59
|
+
// this.log(this.axiosConfig)
|
|
60
|
+
const spinner = ora('loading...').start();
|
|
61
|
+
spinner.color = 'magenta';
|
|
62
|
+
let data;
|
|
63
|
+
try {
|
|
64
|
+
({ data } = await axios.post("account/login/", body, this.axiosConfig));
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const requestError = axios.isAxiosError(error);
|
|
68
|
+
const status = requestError ? error.response?.status : undefined;
|
|
69
|
+
const message = status === 400 || status === 401 || status === 403
|
|
70
|
+
? 'Invalid username or password.'
|
|
71
|
+
: requestError && error.response
|
|
72
|
+
? this.getApiMessage(error.response.data) || 'Login failed. Check your username and password.'
|
|
73
|
+
: requestError
|
|
74
|
+
? 'Could not connect to the login service. Check your internet connection and try again.'
|
|
75
|
+
: 'Login failed unexpectedly.';
|
|
76
|
+
this.fail(message);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
spinner.stop();
|
|
81
|
+
}
|
|
82
|
+
if (!data?.success) {
|
|
83
|
+
const message = this.getApiMessage(data) || 'Login failed. Check your username and password.';
|
|
84
|
+
this.fail(message);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!data.data?.email || !data.data?.access) {
|
|
88
|
+
this.fail('The server returned an invalid login response.');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!isObject(config_json.users)) {
|
|
92
|
+
config_json.users = {};
|
|
93
|
+
}
|
|
94
|
+
config_json.users[data.data.email] = { token: data.data.access };
|
|
95
|
+
this.write_config(config_json);
|
|
96
|
+
this.log(`${chalk.green('[Success]')} you are logged in successfully.`);
|
|
97
|
+
// this.log('this is config json',config_json)
|
|
98
|
+
// const name = flags.name ?? 'world'
|
|
99
|
+
// this.log(`hello ${username} from paasar-cli`)
|
|
100
|
+
// this.log(`hello password ${password} from paasar-cli`)
|
|
101
|
+
// if (flags.force) {
|
|
102
|
+
// this.log(`this is a force flag!`);
|
|
103
|
+
// }
|
|
104
|
+
// if (args.file && flags.force) {
|
|
105
|
+
// this.log(`you input --force and --file: ${args.file}`)
|
|
106
|
+
// }
|
|
107
|
+
}
|
|
108
|
+
getApiMessage(data) {
|
|
109
|
+
if (!data || typeof data !== 'object')
|
|
110
|
+
return undefined;
|
|
111
|
+
const response = data;
|
|
112
|
+
for (const key of ['detail', 'message', 'error']) {
|
|
113
|
+
const value = response[key];
|
|
114
|
+
if (typeof value === 'string' && value.trim())
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
const errors = response.non_field_errors;
|
|
118
|
+
if (Array.isArray(errors) && errors.every((value) => typeof value === 'string')) {
|
|
119
|
+
return errors.join(' ');
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
fail(message) {
|
|
124
|
+
this.log(`${chalk.red('[Error]')} ${message}`);
|
|
125
|
+
process.exitCode = 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from "../base.js";
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { isObject } from "../helper.js";
|
|
4
|
+
export default class Logout extends Command {
|
|
5
|
+
static description = 'Log out of VayuCloud on this computer';
|
|
6
|
+
static examples = ['<%= config.bin %> logout'];
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(Logout);
|
|
9
|
+
const config = await this.read_config();
|
|
10
|
+
if (!isObject(config.users) || Object.keys(config.users).length === 0) {
|
|
11
|
+
this.log(`${chalk.yellow('[Info]')} You are not logged in.`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
config.users = {};
|
|
15
|
+
this.write_config(config);
|
|
16
|
+
this.log(`${chalk.green('[Success]')} you have been logged out.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/helper.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ignore } from 'ignore';
|
|
2
|
+
export declare function isObject(obj: any): boolean;
|
|
3
|
+
export declare function isEmptyObject(obj: any): any;
|
|
4
|
+
export declare function read_config_file(): {
|
|
5
|
+
users: Record<string, {
|
|
6
|
+
token: string;
|
|
7
|
+
}>;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
export declare function get_all_services(filter: {} | undefined, axiosConfig: any): Promise<any>;
|
|
11
|
+
export declare const loadIgnoreFile: (ignoreInstance: Ignore, ignoreFilePath: string, projectPath: string) => void;
|
|
12
|
+
export declare function addIgnorePatterns(ignoreInstance: Ignore, projectPath: string, dir: string): void;
|
|
13
|
+
export declare function trimLines(lines: string[]): string[];
|
package/dist/helper.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import { GLOBAL_CONF_PATH } from "./constants.js";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { dirname, join, relative } from "path";
|
|
5
|
+
export function isObject(obj) {
|
|
6
|
+
return obj != null && obj.constructor.name === "Object";
|
|
7
|
+
}
|
|
8
|
+
export function isEmptyObject(obj) {
|
|
9
|
+
return obj && obj.constructor === Object && Object.keys(obj).length === 0;
|
|
10
|
+
}
|
|
11
|
+
export function read_config_file() {
|
|
12
|
+
let config_json = {
|
|
13
|
+
users: {},
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
config_json = JSON.parse(fs.readFileSync(GLOBAL_CONF_PATH).toString('utf-8')) || {};
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
}
|
|
20
|
+
return config_json;
|
|
21
|
+
}
|
|
22
|
+
export async function get_all_services(filter = {}, axiosConfig) {
|
|
23
|
+
let all_services = [];
|
|
24
|
+
try {
|
|
25
|
+
let url_filter = "";
|
|
26
|
+
Object.keys(filter).forEach((item, index) => {
|
|
27
|
+
let key = item;
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
let value = filter[item];
|
|
30
|
+
if (index == 0) {
|
|
31
|
+
url_filter += `?${key}=${value}`;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
url_filter += `&${key}=${value}`;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const { data } = await axios.get("product/my-products/" + url_filter, axiosConfig);
|
|
38
|
+
data.data.forEach(function (item) {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
if (item.product_type == 'PAAS') {
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
all_services.push({ "value": item.id, "name": `${item.project_name} (${item.product_details.name}-${item.domain_assignments[0].domain_name})` });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
console.log(e.response.data);
|
|
48
|
+
}
|
|
49
|
+
return all_services;
|
|
50
|
+
}
|
|
51
|
+
export const loadIgnoreFile = (ignoreInstance, ignoreFilePath, projectPath) => {
|
|
52
|
+
const patterns = trimLines(fs.readFileSync(ignoreFilePath).toString().split('\n'));
|
|
53
|
+
const relativeToProjectPath = patterns.map((pattern) => {
|
|
54
|
+
const dir = dirname(ignoreFilePath);
|
|
55
|
+
if (pattern.startsWith('!')) {
|
|
56
|
+
const absolutePrefix = pattern.substr(1).startsWith('/') ? '/' : '';
|
|
57
|
+
return '!' + absolutePrefix + relative(projectPath, join(dir, pattern.substr(1)));
|
|
58
|
+
}
|
|
59
|
+
const absolutePrefix = pattern.startsWith('/') ? '/' : '';
|
|
60
|
+
return absolutePrefix + relative(projectPath, join(dir, pattern));
|
|
61
|
+
});
|
|
62
|
+
const linuxify = relativeToProjectPath.map(p => p.replace(/\\/g, '/'));
|
|
63
|
+
ignoreInstance.add(linuxify);
|
|
64
|
+
};
|
|
65
|
+
export function addIgnorePatterns(ignoreInstance, projectPath, dir) {
|
|
66
|
+
const vayuignorePath = join(projectPath, dir, '.vayuignore');
|
|
67
|
+
const dockerignorePath = join(projectPath, dir, '.dockerignore');
|
|
68
|
+
const gitignorePath = join(projectPath, dir, '.gitignore');
|
|
69
|
+
if (fs.existsSync(vayuignorePath)) {
|
|
70
|
+
loadIgnoreFile(ignoreInstance, vayuignorePath, projectPath);
|
|
71
|
+
}
|
|
72
|
+
if (fs.existsSync(dockerignorePath)) {
|
|
73
|
+
loadIgnoreFile(ignoreInstance, dockerignorePath, projectPath);
|
|
74
|
+
}
|
|
75
|
+
if (fs.existsSync(gitignorePath)) {
|
|
76
|
+
loadIgnoreFile(ignoreInstance, gitignorePath, projectPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function trimLines(lines) {
|
|
80
|
+
return lines.reduce((prev, line) => {
|
|
81
|
+
if (!line.trim() || line.startsWith('#')) {
|
|
82
|
+
return prev;
|
|
83
|
+
}
|
|
84
|
+
return [...prev, line];
|
|
85
|
+
}, []);
|
|
86
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": {
|
|
3
|
+
"deploy": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {
|
|
6
|
+
"file": {
|
|
7
|
+
"description": "file to read",
|
|
8
|
+
"name": "file"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"description": "describe the command here",
|
|
12
|
+
"examples": [
|
|
13
|
+
"<%= config.bin %> <%= command.id %>"
|
|
14
|
+
],
|
|
15
|
+
"flags": {
|
|
16
|
+
"path": {
|
|
17
|
+
"char": "p",
|
|
18
|
+
"description": "project path in your computer",
|
|
19
|
+
"name": "path",
|
|
20
|
+
"hasDynamicHelp": false,
|
|
21
|
+
"multiple": false,
|
|
22
|
+
"type": "option"
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"char": "n",
|
|
26
|
+
"description": "project name",
|
|
27
|
+
"name": "name",
|
|
28
|
+
"hasDynamicHelp": false,
|
|
29
|
+
"multiple": false,
|
|
30
|
+
"type": "option"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"hasDynamicHelp": false,
|
|
34
|
+
"hiddenAliases": [],
|
|
35
|
+
"id": "deploy",
|
|
36
|
+
"pluginAlias": "@vayucloud/cli",
|
|
37
|
+
"pluginName": "@vayucloud/cli",
|
|
38
|
+
"pluginType": "core",
|
|
39
|
+
"strict": true,
|
|
40
|
+
"isESM": true,
|
|
41
|
+
"relativePath": [
|
|
42
|
+
"dist",
|
|
43
|
+
"commands",
|
|
44
|
+
"deploy.js"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"login": {
|
|
48
|
+
"aliases": [],
|
|
49
|
+
"args": {},
|
|
50
|
+
"description": "describe the command here",
|
|
51
|
+
"examples": [
|
|
52
|
+
"<%= config.bin %> <%= command.id %>"
|
|
53
|
+
],
|
|
54
|
+
"flags": {
|
|
55
|
+
"username": {
|
|
56
|
+
"char": "n",
|
|
57
|
+
"description": "enter username or phonenumber",
|
|
58
|
+
"name": "username",
|
|
59
|
+
"hasDynamicHelp": false,
|
|
60
|
+
"multiple": false,
|
|
61
|
+
"type": "option"
|
|
62
|
+
},
|
|
63
|
+
"password": {
|
|
64
|
+
"char": "p",
|
|
65
|
+
"description": "enter password",
|
|
66
|
+
"name": "password",
|
|
67
|
+
"hasDynamicHelp": false,
|
|
68
|
+
"multiple": false,
|
|
69
|
+
"type": "option"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"hasDynamicHelp": false,
|
|
73
|
+
"hiddenAliases": [],
|
|
74
|
+
"id": "login",
|
|
75
|
+
"pluginAlias": "@vayucloud/cli",
|
|
76
|
+
"pluginName": "@vayucloud/cli",
|
|
77
|
+
"pluginType": "core",
|
|
78
|
+
"strict": true,
|
|
79
|
+
"isESM": true,
|
|
80
|
+
"relativePath": [
|
|
81
|
+
"dist",
|
|
82
|
+
"commands",
|
|
83
|
+
"login.js"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"logout": {
|
|
87
|
+
"aliases": [],
|
|
88
|
+
"args": {},
|
|
89
|
+
"description": "Log out of VayuCloud on this computer",
|
|
90
|
+
"examples": [
|
|
91
|
+
"<%= config.bin %> logout"
|
|
92
|
+
],
|
|
93
|
+
"flags": {},
|
|
94
|
+
"hasDynamicHelp": false,
|
|
95
|
+
"hiddenAliases": [],
|
|
96
|
+
"id": "logout",
|
|
97
|
+
"pluginAlias": "@vayucloud/cli",
|
|
98
|
+
"pluginName": "@vayucloud/cli",
|
|
99
|
+
"pluginType": "core",
|
|
100
|
+
"strict": true,
|
|
101
|
+
"isESM": true,
|
|
102
|
+
"relativePath": [
|
|
103
|
+
"dist",
|
|
104
|
+
"commands",
|
|
105
|
+
"logout.js"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"hello": {
|
|
109
|
+
"aliases": [],
|
|
110
|
+
"args": {
|
|
111
|
+
"person": {
|
|
112
|
+
"description": "Person to say hello to",
|
|
113
|
+
"name": "person",
|
|
114
|
+
"required": true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"description": "Say hello",
|
|
118
|
+
"examples": [
|
|
119
|
+
"<%= config.bin %> <%= command.id %> friend --from oclif\nhello friend from oclif! (./src/commands/hello/index.ts)\n"
|
|
120
|
+
],
|
|
121
|
+
"flags": {
|
|
122
|
+
"from": {
|
|
123
|
+
"char": "f",
|
|
124
|
+
"description": "Who is saying hello",
|
|
125
|
+
"name": "from",
|
|
126
|
+
"required": true,
|
|
127
|
+
"hasDynamicHelp": false,
|
|
128
|
+
"multiple": false,
|
|
129
|
+
"type": "option"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"hasDynamicHelp": false,
|
|
133
|
+
"hiddenAliases": [],
|
|
134
|
+
"id": "hello",
|
|
135
|
+
"pluginAlias": "@vayucloud/cli",
|
|
136
|
+
"pluginName": "@vayucloud/cli",
|
|
137
|
+
"pluginType": "core",
|
|
138
|
+
"strict": true,
|
|
139
|
+
"enableJsonFlag": false,
|
|
140
|
+
"isESM": true,
|
|
141
|
+
"relativePath": [
|
|
142
|
+
"dist",
|
|
143
|
+
"commands",
|
|
144
|
+
"hello",
|
|
145
|
+
"index.js"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"hello:world": {
|
|
149
|
+
"aliases": [],
|
|
150
|
+
"args": {},
|
|
151
|
+
"description": "Say hello world",
|
|
152
|
+
"examples": [
|
|
153
|
+
"<%= config.bin %> <%= command.id %>\nhello world! (./src/commands/hello/world.ts)\n"
|
|
154
|
+
],
|
|
155
|
+
"flags": {},
|
|
156
|
+
"hasDynamicHelp": false,
|
|
157
|
+
"hiddenAliases": [],
|
|
158
|
+
"id": "hello:world",
|
|
159
|
+
"pluginAlias": "@vayucloud/cli",
|
|
160
|
+
"pluginName": "@vayucloud/cli",
|
|
161
|
+
"pluginType": "core",
|
|
162
|
+
"strict": true,
|
|
163
|
+
"enableJsonFlag": false,
|
|
164
|
+
"isESM": true,
|
|
165
|
+
"relativePath": [
|
|
166
|
+
"dist",
|
|
167
|
+
"commands",
|
|
168
|
+
"hello",
|
|
169
|
+
"world.js"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"version": "0.1.0"
|
|
174
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vayucloud/cli",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "Official CLI for VayuCloud",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": "VayuCloud",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vayu": "bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/vayucloud-ir/cli/issues"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@oclif/core": "^4",
|
|
14
|
+
"@oclif/plugin-help": "^6",
|
|
15
|
+
"@oclif/plugin-plugins": "^5",
|
|
16
|
+
"archiver": "^7.0.1",
|
|
17
|
+
"axios": "^1.13.2",
|
|
18
|
+
"bytes": "^3.1.2",
|
|
19
|
+
"chalk": "^5.6.2",
|
|
20
|
+
"form-data": "^4.0.4",
|
|
21
|
+
"fs-extra": "^11.3.2",
|
|
22
|
+
"got": "^14.6.5",
|
|
23
|
+
"https-proxy-agent": "^7.0.6",
|
|
24
|
+
"ignore": "^7.0.5",
|
|
25
|
+
"inquirer": "^13.0.1",
|
|
26
|
+
"ora": "^9.0.0",
|
|
27
|
+
"progress": "^2.0.3",
|
|
28
|
+
"tar": "^7.5.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@eslint/compat": "^1",
|
|
32
|
+
"@oclif/prettier-config": "^0.2.1",
|
|
33
|
+
"@oclif/test": "^4",
|
|
34
|
+
"@types/chai": "^4",
|
|
35
|
+
"@types/mocha": "^10",
|
|
36
|
+
"@types/node": "^18",
|
|
37
|
+
"chai": "^4",
|
|
38
|
+
"eslint": "^9",
|
|
39
|
+
"eslint-config-oclif": "^6",
|
|
40
|
+
"eslint-config-prettier": "^10",
|
|
41
|
+
"mocha": "^10",
|
|
42
|
+
"oclif": "^4",
|
|
43
|
+
"shx": "^0.3.3",
|
|
44
|
+
"ts-node": "^10",
|
|
45
|
+
"typescript": "^5.7.3"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=18.0.0"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"./bin",
|
|
52
|
+
"./dist",
|
|
53
|
+
"./oclif.manifest.json"
|
|
54
|
+
],
|
|
55
|
+
"homepage": "https://github.com/vayucloud-ir/cli",
|
|
56
|
+
"keywords": [
|
|
57
|
+
"oclif"
|
|
58
|
+
],
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"main": "dist/index.js",
|
|
61
|
+
"type": "module",
|
|
62
|
+
"oclif": {
|
|
63
|
+
"bin": "vayu",
|
|
64
|
+
"dirname": "vayu",
|
|
65
|
+
"commands": "./dist/commands",
|
|
66
|
+
"plugins": [
|
|
67
|
+
"@oclif/plugin-help",
|
|
68
|
+
"@oclif/plugin-plugins"
|
|
69
|
+
],
|
|
70
|
+
"topicSeparator": " ",
|
|
71
|
+
"topics": {
|
|
72
|
+
"hello": {
|
|
73
|
+
"description": "Say hello to the world and others"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"repository": {
|
|
78
|
+
"type": "git",
|
|
79
|
+
"url": "git+https://github.com/vayucloud-ir/cli.git"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "shx rm -rf dist && tsc -b",
|
|
83
|
+
"lint": "eslint",
|
|
84
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
85
|
+
"posttest": "npm run lint",
|
|
86
|
+
"prepack": "oclif manifest && oclif readme",
|
|
87
|
+
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
88
|
+
"version": "oclif readme && git add README.md"
|
|
89
|
+
},
|
|
90
|
+
"types": "dist/index.d.ts"
|
|
91
|
+
}
|