1 | "use strict";
|
2 | const fs = require("fs-extra-promise");
|
3 | const path = require("path");
|
4 | const util = require('egret-node-utils');
|
5 | let error_code_filename = path.join(__dirname, "../error_code.json");
|
6 | let errorcode = fs.readJSONSync(error_code_filename, { "encoding": "utf-8" });
|
7 | exports.shell;
|
8 | exports.shell = util.shell;
|
9 | class 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 | }
|
24 | exports.CliException = CliException;
|
25 | function 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 | }
|
36 | exports.findValidatePathSync = findValidatePathSync;
|
37 | function checkEgret() {
|
38 |
|
39 | }
|
40 | exports.checkEgret = checkEgret;
|
41 | function clean(path) {
|
42 |
|
43 | }
|
44 | exports.clean = clean;
|
45 | function minify(targetPath, savePath) {
|
46 |
|
47 | }
|
48 | exports.minify = minify;
|
49 |
|
\ | No newline at end of file |