esa-cli 0.0.2-beta.5 → 0.0.2-beta.7
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/i18n/locales.json
CHANGED
|
@@ -476,8 +476,8 @@
|
|
|
476
476
|
"zh_CN": "route不合法"
|
|
477
477
|
},
|
|
478
478
|
"install_runtime_explain": {
|
|
479
|
-
"en": "
|
|
480
|
-
"zh_CN": "
|
|
479
|
+
"en": "Our runtime does not yet support this OS. We are temporarily using Deno as the local development runtime, which needs to be installed first.",
|
|
480
|
+
"zh_CN": "我们的Runtime还不支持此操作系统,我们暂时使用Deno作为本地开发runtime,需要先安装。"
|
|
481
481
|
},
|
|
482
482
|
"install_runtime_tip": {
|
|
483
483
|
"en": "🔔 Runtime must be installed to use esa dev. Installing...",
|
|
@@ -913,6 +913,10 @@
|
|
|
913
913
|
},
|
|
914
914
|
"deno_download_success": {
|
|
915
915
|
"en": "Download success",
|
|
916
|
-
"zh_CN": ""
|
|
916
|
+
"zh_CN": "下载成功"
|
|
917
|
+
},
|
|
918
|
+
"deno_install_success_tips": {
|
|
919
|
+
"en": "Please run ${dev} again",
|
|
920
|
+
"zh_CN": "请重新运行 ${dev}"
|
|
917
921
|
}
|
|
918
922
|
}
|
package/dist/utils/download.js
CHANGED
|
@@ -16,6 +16,7 @@ import { exec } from 'child_process';
|
|
|
16
16
|
import { promisify } from 'util';
|
|
17
17
|
import t from '../i18n/index.js';
|
|
18
18
|
import logger from '../libs/logger.js';
|
|
19
|
+
import chalk from 'chalk';
|
|
19
20
|
const execAsync = promisify(exec);
|
|
20
21
|
function getBinDir() {
|
|
21
22
|
const home = os.homedir();
|
|
@@ -110,43 +111,50 @@ export function downloadRuntimeAndUnzipForWindows() {
|
|
|
110
111
|
const DenoZip = path.join(BinDir, 'deno.zip');
|
|
111
112
|
const Target = 'x86_64-pc-windows-msvc';
|
|
112
113
|
const DownloadUrl = `http://esa-runtime.myalicdn.com/runtime/deno-${Target}.zip`;
|
|
114
|
+
logger.ora.start('Downloading...');
|
|
113
115
|
try {
|
|
114
116
|
yield fs.mkdir(BinDir, { recursive: true });
|
|
115
117
|
}
|
|
116
118
|
catch (error) {
|
|
117
119
|
const err = error;
|
|
120
|
+
logger.ora.fail();
|
|
118
121
|
logger.error(`mkdir error ${BinDir}: ${err.message}`);
|
|
119
122
|
process.exit(1);
|
|
120
123
|
}
|
|
121
124
|
try {
|
|
122
125
|
yield downloadFile(DownloadUrl, DenoZip);
|
|
123
|
-
logger.success(`${t('deno_download_success').d('Download success')}: ${DenoZip}`);
|
|
124
126
|
}
|
|
125
127
|
catch (error) {
|
|
126
128
|
const err = error;
|
|
129
|
+
logger.ora.fail();
|
|
127
130
|
logger.error(`${t('deno_download_failed').d('Download failed')}: ${err.message}`);
|
|
128
131
|
process.exit(1);
|
|
129
132
|
}
|
|
130
133
|
logger.info(`Unzip file to: ${BinDir}`);
|
|
131
134
|
try {
|
|
135
|
+
logger.ora.text = 'Unzip...';
|
|
132
136
|
unzipFile(DenoZip, BinDir);
|
|
133
137
|
}
|
|
134
138
|
catch (error) {
|
|
135
139
|
const err = error;
|
|
140
|
+
logger.ora.fail();
|
|
136
141
|
logger.error(`${t('deno_unzip_failed').d('Unzip failed')}: ${err.message}`);
|
|
137
142
|
process.exit(1);
|
|
138
143
|
}
|
|
139
144
|
try {
|
|
145
|
+
logger.ora.text = 'Deleting temp file...';
|
|
140
146
|
yield fs.unlink(DenoZip);
|
|
147
|
+
logger.ora.succeed('Download success');
|
|
141
148
|
logger.info(`Delete temp file: ${DenoZip}`);
|
|
142
149
|
}
|
|
143
150
|
catch (error) {
|
|
144
151
|
logger.warn(`Delete temp file ${DenoZip} failed: ${error}`);
|
|
145
152
|
}
|
|
146
153
|
try {
|
|
154
|
+
logger.ora.text = 'Adding Bin dir to PATH...';
|
|
147
155
|
const inPath = yield isBinDirInPath(BinDir);
|
|
148
156
|
if (!inPath) {
|
|
149
|
-
logger.info(`${BinDir} not in PATH
|
|
157
|
+
logger.info(`${BinDir} not in PATH`);
|
|
150
158
|
yield addBinDirToPath(BinDir);
|
|
151
159
|
}
|
|
152
160
|
else {
|
|
@@ -155,13 +163,18 @@ export function downloadRuntimeAndUnzipForWindows() {
|
|
|
155
163
|
}
|
|
156
164
|
catch (error) {
|
|
157
165
|
const err = error;
|
|
166
|
+
logger.ora.fail();
|
|
158
167
|
logger.error(`${t('deno_add_path_failed').d('Add BinDir to Path failed')}: ${err.message}`);
|
|
159
168
|
process.exit(1);
|
|
160
169
|
}
|
|
161
170
|
logger.success(t('deno_install_success').d('Runtime install success!'));
|
|
171
|
+
logger.block();
|
|
172
|
+
const dev = chalk.green('esa dev');
|
|
173
|
+
logger.log(t('deno_install_success_tips', { dev }).d(`Please run ${dev} again`));
|
|
162
174
|
}
|
|
163
175
|
catch (error) {
|
|
164
176
|
const err = error;
|
|
177
|
+
logger.ora.fail();
|
|
165
178
|
logger.error(`Download Error: ${err.message}`);
|
|
166
179
|
process.exit(1);
|
|
167
180
|
}
|
|
@@ -18,8 +18,8 @@ export function preCheckDeno() {
|
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const command = yield checkDenoInstalled();
|
|
20
20
|
if (!command) {
|
|
21
|
-
logger.error(t('install_runtime_explain').d('
|
|
22
|
-
installDeno();
|
|
21
|
+
logger.error(t('install_runtime_explain').d('Our runtime does not yet support this OS. We are temporarily using Deno as the local development runtime, which needs to be installed first.'));
|
|
22
|
+
yield installDeno();
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
return command;
|
|
@@ -46,7 +46,6 @@ export function checkDenoInstalled() {
|
|
|
46
46
|
resolve(res);
|
|
47
47
|
})
|
|
48
48
|
.catch((err) => {
|
|
49
|
-
console.log(err);
|
|
50
49
|
resolve(false);
|
|
51
50
|
});
|
|
52
51
|
});
|