esa-cli 0.0.1-beta.7 → 0.0.1-beta.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/commands/commit/prodBuild.js +1 -1
- package/dist/commands/dev/config/devBuild.js +1 -1
- package/dist/commands/dev/devPack.js +2 -1
- package/dist/commands/dev/index.js +2 -1
- package/dist/commands/dev/server.js +2 -1
- package/dist/commands/init/index.js +7 -8
- package/dist/commands/utils.js +2 -1
- package/dist/i18n/index.js +4 -1
- package/dist/i18n/locales.json +781 -781
- package/dist/index.js +2 -3
- package/dist/package.json +2 -3
- package/dist/utils/checkVersion.js +1 -1
- package/dist/utils/fileUtils/base.js +31 -0
- package/dist/utils/fileUtils/index.js +4 -32
- package/dist/utils/installRuntime.js +1 -1
- package/dist/utils/readJson.js +10 -0
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import yargs from 'yargs';
|
|
11
11
|
import { hideBin } from 'yargs/helpers';
|
|
12
|
+
import chalk from 'chalk';
|
|
12
13
|
import login from './commands/login/index.js';
|
|
13
14
|
import config from './commands/config.js';
|
|
14
15
|
import dev from './commands/dev/index.js';
|
|
@@ -38,9 +39,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
38
39
|
.version(false)
|
|
39
40
|
.wrap(null)
|
|
40
41
|
.help(false)
|
|
41
|
-
|
|
42
|
-
// `${t('main_epilogue').d('For more information, visit DCDN')}: ${chalk.underline.blue('https://dcdnnext.console.aliyun.com/')}`
|
|
43
|
-
// )
|
|
42
|
+
.epilogue(`${t('main_epilogue').d('For more information, visit ESA')}: ${chalk.underline.blue('https://www.aliyun.com/product/esa')}`)
|
|
44
43
|
.options('version', {
|
|
45
44
|
describe: t('main_version_describe').d('Show version'),
|
|
46
45
|
alias: 'v'
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esa-cli",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.9",
|
|
4
4
|
"description": "A CLI for operating Alibaba Cloud ESA EdgeRoutine (Edge Functions).",
|
|
5
5
|
"main": "bin/enter.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"lint-staged": "lint-staged",
|
|
18
18
|
"prepare": "npm run build",
|
|
19
19
|
"test": "vitest",
|
|
20
|
-
"coverage": "vitest --coverage"
|
|
21
|
-
"preuninstall": "rm -rf ~/.esa/config"
|
|
20
|
+
"coverage": "vitest --coverage"
|
|
22
21
|
},
|
|
23
22
|
"keywords": [
|
|
24
23
|
"cli",
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { promises as fs } from 'fs';
|
|
11
|
-
import { getDirName } from '../utils/fileUtils/
|
|
11
|
+
import { getDirName } from '../utils/fileUtils/base.js';
|
|
12
12
|
import path from 'path';
|
|
13
13
|
export function handleCheckVersion() {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
const cliConfigFile = 'cliconfig.toml';
|
|
5
|
+
export const getDirName = (metaUrl) => {
|
|
6
|
+
const __filename = fileURLToPath(metaUrl);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
return __dirname;
|
|
9
|
+
};
|
|
10
|
+
export const getRoot = (root) => {
|
|
11
|
+
if (typeof root === 'undefined') {
|
|
12
|
+
root = process.cwd();
|
|
13
|
+
}
|
|
14
|
+
if (root === '/') {
|
|
15
|
+
return process.cwd();
|
|
16
|
+
}
|
|
17
|
+
const file = path.join(root, cliConfigFile);
|
|
18
|
+
const prev = path.resolve(root, '../');
|
|
19
|
+
try {
|
|
20
|
+
const hasToml = fs.existsSync(file);
|
|
21
|
+
if (hasToml) {
|
|
22
|
+
return root;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return getRoot(prev);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return getRoot(prev);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -7,44 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import toml from '@iarna/toml';
|
|
11
|
-
import path from 'path';
|
|
12
10
|
import fs from 'fs';
|
|
11
|
+
import os from 'os';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import toml from '@iarna/toml';
|
|
13
14
|
import { promises as fsPromises } from 'fs';
|
|
14
|
-
import {
|
|
15
|
+
import { getDirName, getRoot } from './base.js';
|
|
15
16
|
import logger from '../../libs/logger.js';
|
|
16
17
|
import t from '../../i18n/index.js';
|
|
17
|
-
import os from 'os';
|
|
18
18
|
const projectConfigFile = 'esa.toml';
|
|
19
|
-
const cliConfigFile = 'cliconfig.toml';
|
|
20
|
-
export const getDirName = (metaUrl) => {
|
|
21
|
-
const __filename = fileURLToPath(metaUrl);
|
|
22
|
-
const __dirname = path.dirname(__filename);
|
|
23
|
-
return __dirname;
|
|
24
|
-
};
|
|
25
19
|
const __dirname = getDirName(import.meta.url);
|
|
26
|
-
export const getRoot = (root) => {
|
|
27
|
-
if (typeof root === 'undefined') {
|
|
28
|
-
root = process.cwd();
|
|
29
|
-
}
|
|
30
|
-
if (root === '/') {
|
|
31
|
-
return process.cwd();
|
|
32
|
-
}
|
|
33
|
-
const file = path.join(root, cliConfigFile);
|
|
34
|
-
const prev = path.resolve(root, '../');
|
|
35
|
-
try {
|
|
36
|
-
const hasToml = fs.existsSync(file);
|
|
37
|
-
if (hasToml) {
|
|
38
|
-
return root;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return getRoot(prev);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
return getRoot(prev);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
20
|
const root = getRoot();
|
|
49
21
|
export const projectConfigPath = path.join(root, projectConfigFile);
|
|
50
22
|
export const cliConfigPath = path.join(os.homedir(), '.esa/config/default.toml');
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { exec, execSync } from 'child_process';
|
|
11
11
|
import os from 'os';
|
|
12
|
-
import { getDirName } from './fileUtils/
|
|
12
|
+
import { getDirName } from './fileUtils/base.js';
|
|
13
13
|
import logger from '../libs/logger.js';
|
|
14
14
|
import path from 'path';
|
|
15
15
|
import t from '../i18n/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esa-cli",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.9",
|
|
4
4
|
"description": "A CLI for operating Alibaba Cloud ESA EdgeRoutine (Edge Functions).",
|
|
5
5
|
"main": "bin/enter.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"lint-staged": "lint-staged",
|
|
18
18
|
"prepare": "npm run build",
|
|
19
19
|
"test": "vitest",
|
|
20
|
-
"coverage": "vitest --coverage"
|
|
21
|
-
"preuninstall": "rm -rf ~/.esa/config"
|
|
20
|
+
"coverage": "vitest --coverage"
|
|
22
21
|
},
|
|
23
22
|
"keywords": [
|
|
24
23
|
"cli",
|