UNPKG

1.29 kBJavaScriptView Raw
1"use strict";
2const fs = require("fs-extra-promise");
3const path = require("path");
4const util = require('egret-node-utils');
5let error_code_filename = path.join(__dirname, "../error_code.json");
6let errorcode = fs.readJSONSync(error_code_filename, { "encoding": "utf-8" });
7exports.shell;
8exports.shell = util.shell;
9class CliException extends Error {
10 constructor(errorId, param) {
11 super();
12 this.errorId = errorId;
13 var message = errorcode[this.errorId];
14 if (message) {
15 message = message.replace('{0}', param);
16 }
17 else {
18 message = `unkown error : ${errorId}`;
19 console.error(message);
20 }
21 this.message = message;
22 }
23}
24exports.CliException = CliException;
25function findValidatePathSync(pathStr) {
26 if (!pathStr) {
27 pathStr = process.cwd();
28 }
29 else {
30 if (!fs.existsSync(pathStr)) {
31 pathStr = path.join(process.cwd(), pathStr);
32 }
33 }
34 return pathStr;
35}
36exports.findValidatePathSync = findValidatePathSync;
37function checkEgret() {
38 //todo
39}
40exports.checkEgret = checkEgret;
41function clean(path) {
42 //todo
43}
44exports.clean = clean;
45function minify(targetPath, savePath) {
46 //todo
47}
48exports.minify = minify;
49//# sourceMappingURL=util.js.map
\No newline at end of file