@learnpack/learnpack 4.0.10 → 4.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +25 -10
- package/lib/commands/audit.d.ts +6 -6
- package/lib/commands/audit.js +327 -327
- package/lib/commands/build.d.ts +11 -0
- package/lib/commands/build.js +160 -0
- package/lib/commands/clean.d.ts +8 -8
- package/lib/commands/clean.js +22 -22
- package/lib/commands/download.d.ts +13 -13
- package/lib/commands/download.js +52 -52
- package/lib/commands/init.d.ts +9 -9
- package/lib/commands/init.js +127 -127
- package/lib/commands/login.d.ts +14 -14
- package/lib/commands/login.js +34 -34
- package/lib/commands/logout.d.ts +14 -14
- package/lib/commands/logout.js +34 -34
- package/lib/commands/publish.d.ts +14 -14
- package/lib/commands/publish.js +79 -79
- package/lib/commands/start.d.ts +7 -7
- package/lib/commands/start.js +252 -250
- package/lib/commands/test.d.ts +6 -6
- package/lib/commands/test.js +62 -62
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -4
- package/lib/managers/config/allowed_files.d.ts +5 -5
- package/lib/managers/config/allowed_files.js +30 -30
- package/lib/managers/config/defaults.d.ts +47 -48
- package/lib/managers/config/defaults.js +51 -51
- package/lib/managers/config/exercise.d.ts +36 -36
- package/lib/managers/config/exercise.js +243 -236
- package/lib/managers/config/index.d.ts +3 -3
- package/lib/managers/config/index.js +464 -459
- package/lib/managers/file.d.ts +14 -14
- package/lib/managers/file.js +190 -184
- package/lib/managers/gitpod.d.ts +3 -3
- package/lib/managers/gitpod.js +67 -67
- package/lib/managers/server/index.d.ts +5 -6
- package/lib/managers/server/index.js +58 -58
- package/lib/managers/server/routes.d.ts +4 -4
- package/lib/managers/server/routes.js +228 -220
- package/lib/managers/session.d.ts +3 -3
- package/lib/managers/session.js +125 -125
- package/lib/managers/socket.d.ts +3 -3
- package/lib/managers/socket.js +188 -186
- package/lib/managers/telemetry.d.ts +74 -74
- package/lib/managers/telemetry.js +215 -214
- package/lib/managers/test.js +84 -84
- package/lib/models/action.d.ts +2 -2
- package/lib/models/action.js +2 -2
- package/lib/models/audit.d.ts +15 -15
- package/lib/models/audit.js +2 -2
- package/lib/models/config-manager.d.ts +21 -21
- package/lib/models/config-manager.js +2 -2
- package/lib/models/config.d.ts +86 -86
- package/lib/models/config.js +2 -2
- package/lib/models/counter.d.ts +11 -11
- package/lib/models/counter.js +2 -2
- package/lib/models/errors.d.ts +15 -15
- package/lib/models/errors.js +2 -2
- package/lib/models/exercise-obj.d.ts +29 -30
- package/lib/models/exercise-obj.js +2 -2
- package/lib/models/file.d.ts +5 -5
- package/lib/models/file.js +2 -2
- package/lib/models/findings.d.ts +17 -17
- package/lib/models/findings.js +2 -2
- package/lib/models/flags.d.ts +10 -10
- package/lib/models/flags.js +2 -2
- package/lib/models/front-matter.d.ts +11 -11
- package/lib/models/front-matter.js +2 -2
- package/lib/models/gitpod-data.d.ts +16 -16
- package/lib/models/gitpod-data.js +2 -2
- package/lib/models/language.d.ts +4 -4
- package/lib/models/language.js +2 -2
- package/lib/models/package.d.ts +7 -7
- package/lib/models/package.js +2 -2
- package/lib/models/plugin-config.d.ts +16 -16
- package/lib/models/plugin-config.js +2 -2
- package/lib/models/session.d.ts +31 -31
- package/lib/models/session.js +2 -2
- package/lib/models/socket.d.ts +37 -37
- package/lib/models/socket.js +2 -2
- package/lib/models/status.d.ts +1 -1
- package/lib/models/status.js +2 -2
- package/lib/models/success-types.d.ts +1 -1
- package/lib/models/success-types.js +2 -2
- package/lib/plugin/command/compile.d.ts +6 -6
- package/lib/plugin/command/compile.js +18 -18
- package/lib/plugin/command/test.d.ts +6 -6
- package/lib/plugin/command/test.js +25 -25
- package/lib/plugin/index.d.ts +27 -27
- package/lib/plugin/index.js +7 -7
- package/lib/plugin/plugin.d.ts +8 -8
- package/lib/plugin/plugin.js +68 -68
- package/lib/plugin/utils.d.ts +16 -16
- package/lib/plugin/utils.js +58 -58
- package/lib/ui/download.d.ts +5 -5
- package/lib/ui/download.js +62 -61
- package/lib/utils/BaseCommand.d.ts +8 -8
- package/lib/utils/BaseCommand.js +41 -41
- package/lib/utils/SessionCommand.d.ts +10 -10
- package/lib/utils/SessionCommand.js +43 -43
- package/lib/utils/api.d.ts +14 -14
- package/lib/utils/api.js +255 -255
- package/lib/utils/audit.d.ts +16 -16
- package/lib/utils/audit.js +303 -303
- package/lib/utils/checkNotInstalled.d.ts +8 -8
- package/lib/utils/checkNotInstalled.js +185 -181
- package/lib/utils/console.d.ts +12 -12
- package/lib/utils/console.js +19 -19
- package/lib/utils/errors.d.ts +17 -17
- package/lib/utils/errors.js +107 -100
- package/lib/utils/exercisesQueue.d.ts +9 -9
- package/lib/utils/exercisesQueue.js +38 -38
- package/lib/utils/fileQueue.d.ts +43 -43
- package/lib/utils/fileQueue.js +169 -169
- package/lib/utils/misc.d.ts +1 -1
- package/lib/utils/misc.js +24 -23
- package/lib/utils/osOperations.d.ts +5 -5
- package/lib/utils/osOperations.js +72 -72
- package/lib/utils/validators.d.ts +5 -5
- package/lib/utils/validators.js +16 -17
- package/lib/utils/watcher.d.ts +2 -2
- package/lib/utils/watcher.js +25 -25
- package/oclif.manifest.json +1 -1
- package/package.json +6 -4
- package/src/commands/build.ts +181 -0
- package/src/managers/config/index.ts +5 -0
- package/src/managers/server/routes.ts +10 -0
- package/src/managers/session.ts +1 -1
@@ -1,181 +1,185 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.checkNotInstalledDependencies = exports.checkNotInstalledPlugins = void 0;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const util_1 = require("util");
|
6
|
-
const child_process_1 = require("child_process");
|
7
|
-
const exec = util_1.promisify(child_process_1.exec);
|
8
|
-
const cli_ux_1 = require("cli-ux");
|
9
|
-
const console_1 = require("./console");
|
10
|
-
|
11
|
-
var e_1,
|
12
|
-
console_1.default.info("Checking needed plugins...");
|
13
|
-
const usefulExtensions = new Set(["py", "js", "jsx", "html"]);
|
14
|
-
const foundExtensions = [];
|
15
|
-
const testingExtensions = [];
|
16
|
-
const neededPlugins = [];
|
17
|
-
let someExerciseWithOnlyTestFile = false; // I will suppose that there are not exercises with only readme and test files
|
18
|
-
// See the extensions of the files that are not tests files
|
19
|
-
for (const e of exercises) {
|
20
|
-
const notReadmeFiles = e.files.filter(f => !f.name.toLowerCase().includes("readme"));
|
21
|
-
if (!someExerciseWithOnlyTestFile && notReadmeFiles.length > 0) {
|
22
|
-
someExerciseWithOnlyTestFile = notReadmeFiles.every(f => {
|
23
|
-
return f.name.includes("test");
|
24
|
-
});
|
25
|
-
if (someExerciseWithOnlyTestFile) {
|
26
|
-
console_1.default.debug("Some exercises have only test files, I will install the @learnpack/node plugin to run the tests.");
|
27
|
-
}
|
28
|
-
}
|
29
|
-
for (const f of notReadmeFiles) {
|
30
|
-
const ext = f.name.split(".").pop();
|
31
|
-
if (!ext)
|
32
|
-
continue;
|
33
|
-
if (f.name.includes("test")) {
|
34
|
-
!testingExtensions.includes(ext) && testingExtensions.push(ext);
|
35
|
-
continue;
|
36
|
-
}
|
37
|
-
if (usefulExtensions.has(ext) && !foundExtensions.includes(ext)) {
|
38
|
-
foundExtensions.push(ext);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
console_1.default.debug("foundExtensions", foundExtensions);
|
43
|
-
console_1.default.debug("testingExtensions", testingExtensions);
|
44
|
-
if (foundExtensions.length === 0 && testingExtensions.length === 0)
|
45
|
-
return {
|
46
|
-
needed: [],
|
47
|
-
notInstalled: [],
|
48
|
-
};
|
49
|
-
if (foundExtensions.includes("html") && foundExtensions.includes("js")) {
|
50
|
-
neededPlugins.push("@learnpack/dom");
|
51
|
-
}
|
52
|
-
if (foundExtensions.includes("html") && !foundExtensions.includes("js")) {
|
53
|
-
neededPlugins.push("@learnpack/html");
|
54
|
-
}
|
55
|
-
if (foundExtensions.includes("jsx")) {
|
56
|
-
neededPlugins.push("@learnpack/react");
|
57
|
-
}
|
58
|
-
if (foundExtensions.includes("py") || testingExtensions.includes("py")) {
|
59
|
-
neededPlugins.push("@learnpack/python");
|
60
|
-
}
|
61
|
-
if ((foundExtensions.includes("js") && !foundExtensions.includes("html")) ||
|
62
|
-
(testingExtensions.includes("js") && someExerciseWithOnlyTestFile)) {
|
63
|
-
neededPlugins.push("@learnpack/node");
|
64
|
-
}
|
65
|
-
const notInstalled = neededPlugins.filter(item => !installedPlugins.includes(item));
|
66
|
-
if (notInstalled.length > 0) {
|
67
|
-
console_1.default.error("These plugins are not installed but required: ", notInstalled);
|
68
|
-
const confirmInstall = await cli_ux_1.cli.confirm("Do you want to install the needed plugins? (y/n)");
|
69
|
-
if (confirmInstall) {
|
70
|
-
console_1.default.info("Installing the needed plugins...");
|
71
|
-
try {
|
72
|
-
for (var notInstalled_1 = tslib_1.__asyncValues(notInstalled), notInstalled_1_1; notInstalled_1_1 = await notInstalled_1.next(),
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
command = `
|
113
|
-
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
}
|
142
|
-
if (
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
return
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
return
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.checkNotInstalledDependencies = exports.checkNotInstalledPlugins = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const util_1 = require("util");
|
6
|
+
const child_process_1 = require("child_process");
|
7
|
+
const exec = (0, util_1.promisify)(child_process_1.exec);
|
8
|
+
const cli_ux_1 = require("cli-ux");
|
9
|
+
const console_1 = require("./console");
|
10
|
+
const checkNotInstalledPlugins = async (exercises, installedPlugins, command) => {
|
11
|
+
var _a, e_1, _b, _c;
|
12
|
+
console_1.default.info("Checking needed plugins...");
|
13
|
+
const usefulExtensions = new Set(["py", "js", "jsx", "html"]);
|
14
|
+
const foundExtensions = [];
|
15
|
+
const testingExtensions = [];
|
16
|
+
const neededPlugins = [];
|
17
|
+
let someExerciseWithOnlyTestFile = false; // I will suppose that there are not exercises with only readme and test files
|
18
|
+
// See the extensions of the files that are not tests files
|
19
|
+
for (const e of exercises) {
|
20
|
+
const notReadmeFiles = e.files.filter(f => !f.name.toLowerCase().includes("readme"));
|
21
|
+
if (!someExerciseWithOnlyTestFile && notReadmeFiles.length > 0) {
|
22
|
+
someExerciseWithOnlyTestFile = notReadmeFiles.every(f => {
|
23
|
+
return f.name.includes("test");
|
24
|
+
});
|
25
|
+
if (someExerciseWithOnlyTestFile) {
|
26
|
+
console_1.default.debug("Some exercises have only test files, I will install the @learnpack/node plugin to run the tests.");
|
27
|
+
}
|
28
|
+
}
|
29
|
+
for (const f of notReadmeFiles) {
|
30
|
+
const ext = f.name.split(".").pop();
|
31
|
+
if (!ext)
|
32
|
+
continue;
|
33
|
+
if (f.name.includes("test")) {
|
34
|
+
!testingExtensions.includes(ext) && testingExtensions.push(ext);
|
35
|
+
continue;
|
36
|
+
}
|
37
|
+
if (usefulExtensions.has(ext) && !foundExtensions.includes(ext)) {
|
38
|
+
foundExtensions.push(ext);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
console_1.default.debug("foundExtensions", foundExtensions);
|
43
|
+
console_1.default.debug("testingExtensions", testingExtensions);
|
44
|
+
if (foundExtensions.length === 0 && testingExtensions.length === 0)
|
45
|
+
return {
|
46
|
+
needed: [],
|
47
|
+
notInstalled: [],
|
48
|
+
};
|
49
|
+
if (foundExtensions.includes("html") && foundExtensions.includes("js")) {
|
50
|
+
neededPlugins.push("@learnpack/dom");
|
51
|
+
}
|
52
|
+
if (foundExtensions.includes("html") && !foundExtensions.includes("js")) {
|
53
|
+
neededPlugins.push("@learnpack/html");
|
54
|
+
}
|
55
|
+
if (foundExtensions.includes("jsx")) {
|
56
|
+
neededPlugins.push("@learnpack/react");
|
57
|
+
}
|
58
|
+
if (foundExtensions.includes("py") || testingExtensions.includes("py")) {
|
59
|
+
neededPlugins.push("@learnpack/python");
|
60
|
+
}
|
61
|
+
if ((foundExtensions.includes("js") && !foundExtensions.includes("html")) ||
|
62
|
+
(testingExtensions.includes("js") && someExerciseWithOnlyTestFile)) {
|
63
|
+
neededPlugins.push("@learnpack/node");
|
64
|
+
}
|
65
|
+
const notInstalled = neededPlugins.filter(item => !installedPlugins.includes(item));
|
66
|
+
if (notInstalled.length > 0) {
|
67
|
+
console_1.default.error("These plugins are not installed but required: ", notInstalled);
|
68
|
+
const confirmInstall = await cli_ux_1.cli.confirm("Do you want to install the needed plugins? (y/n)");
|
69
|
+
if (confirmInstall) {
|
70
|
+
console_1.default.info("Installing the needed plugins...");
|
71
|
+
try {
|
72
|
+
for (var _d = true, notInstalled_1 = tslib_1.__asyncValues(notInstalled), notInstalled_1_1; notInstalled_1_1 = await notInstalled_1.next(), _a = notInstalled_1_1.done, !_a; _d = true) {
|
73
|
+
_c = notInstalled_1_1.value;
|
74
|
+
_d = false;
|
75
|
+
const p = _c;
|
76
|
+
await command.config.runCommand(`plugins:install`, [p]);
|
77
|
+
console_1.default.log(`Plugin ${p} installed`);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
81
|
+
finally {
|
82
|
+
try {
|
83
|
+
if (!_d && !_a && (_b = notInstalled_1.return)) await _b.call(notInstalled_1);
|
84
|
+
}
|
85
|
+
finally { if (e_1) throw e_1.error; }
|
86
|
+
}
|
87
|
+
console_1.default.log("All needed plugins installed, please restart LearnPack to load them.");
|
88
|
+
console_1.default.info("Run: $ learnpack start");
|
89
|
+
command.exit(0);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
console_1.default.error("You need to install the plugins to complete this exercise");
|
93
|
+
console_1.default.info("To install the plugins run each of the following commands: ");
|
94
|
+
for (const p of notInstalled) {
|
95
|
+
console_1.default.log(`learnpack plugins:install ${p}`);
|
96
|
+
}
|
97
|
+
command.exit(1);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return {
|
101
|
+
needed: neededPlugins,
|
102
|
+
notInstalled,
|
103
|
+
};
|
104
|
+
};
|
105
|
+
exports.checkNotInstalledPlugins = checkNotInstalledPlugins;
|
106
|
+
function includesAll(baseString, elementsArray) {
|
107
|
+
return elementsArray.every(element => baseString.includes(element));
|
108
|
+
}
|
109
|
+
const installDependencies = async (deps, packageManager) => {
|
110
|
+
let command = "";
|
111
|
+
if (packageManager === "npm") {
|
112
|
+
command = `npm install -g ${deps.join(" ")}`;
|
113
|
+
}
|
114
|
+
else if (packageManager === "pip") {
|
115
|
+
command = `pip install ${deps.join(" ")}`;
|
116
|
+
}
|
117
|
+
const { stdout, stderr } = await exec(command);
|
118
|
+
if (stderr && (stderr.includes("npm ERR!") || stderr.includes("Traceback"))) {
|
119
|
+
console_1.default.error(`Error executing ${command}.`);
|
120
|
+
console_1.default.error(stderr);
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
console_1.default.info(`Dependencies ${deps.join(" ")} installed...`);
|
124
|
+
return true;
|
125
|
+
};
|
126
|
+
const checkNotInstalledDependencies = async (neededPlugins) => {
|
127
|
+
console_1.default.info("Checking needed dependencies...");
|
128
|
+
const jsPluginsDependencies = [
|
129
|
+
"jest@29.7.0",
|
130
|
+
"jest-environment-jsdom@29.7.0",
|
131
|
+
];
|
132
|
+
const pyPluginsDependencies = ["pytest==6.2.5", "pytest-testdox", "mock"];
|
133
|
+
const npmLsCommand = "npm ls jest jest-environment-jsdom -g";
|
134
|
+
let pytestNeeded = false;
|
135
|
+
let jestNeeded = false;
|
136
|
+
if (neededPlugins.includes("@learnpack/dom") ||
|
137
|
+
neededPlugins.includes("@learnpack/html") ||
|
138
|
+
neededPlugins.includes("@learnpack/react") ||
|
139
|
+
neededPlugins.includes("@learnpack/node")) {
|
140
|
+
jestNeeded = true;
|
141
|
+
}
|
142
|
+
if ("@learnpack/python" in neededPlugins) {
|
143
|
+
pytestNeeded = true;
|
144
|
+
}
|
145
|
+
if (jestNeeded) {
|
146
|
+
const { stdout, stderr } = await exec("npm ls -g");
|
147
|
+
if (stderr) {
|
148
|
+
console_1.default.error(`Error executing ${npmLsCommand}. Use debug for more info`);
|
149
|
+
console_1.default.debug(stderr);
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
if (includesAll(stdout, jsPluginsDependencies))
|
153
|
+
return true;
|
154
|
+
console_1.default.error("The jest dependencies are not installed");
|
155
|
+
const confirmInstall = await cli_ux_1.cli.confirm("Do you want to install the needed dependencies? (y/n)");
|
156
|
+
if (!confirmInstall) {
|
157
|
+
console_1.default.error(`The exercises can't be tested without the following dependencies: ${jsPluginsDependencies.join(", ")}`);
|
158
|
+
console_1.default.info(`Please install them and try again. Run the following command to install them: \nnpm install -g ${jsPluginsDependencies.join(" ")}`);
|
159
|
+
return false;
|
160
|
+
}
|
161
|
+
console_1.default.log("Installing jest dependencies...");
|
162
|
+
await installDependencies(jsPluginsDependencies, "npm");
|
163
|
+
}
|
164
|
+
if (pytestNeeded) {
|
165
|
+
const { stdout, stderr } = await exec("pip list");
|
166
|
+
if (stderr) {
|
167
|
+
console_1.default.error(`Error executing pip list. Use debug for more info`);
|
168
|
+
console_1.default.debug(stderr);
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
if (includesAll(stdout, pyPluginsDependencies))
|
172
|
+
return true;
|
173
|
+
console_1.default.error("The pytest dependencies are not installed");
|
174
|
+
const confirmInstall = await cli_ux_1.cli.confirm("Do you want to install the needed dependencies? (y/n)");
|
175
|
+
if (!confirmInstall) {
|
176
|
+
console_1.default.error(`The exercises can't be tested without the following dependencies: ${pyPluginsDependencies.join(", ")}`);
|
177
|
+
console_1.default.info(`Please install them and try again. Run the following command to install them: \npip install ${pyPluginsDependencies.join(" ")}`);
|
178
|
+
return false;
|
179
|
+
}
|
180
|
+
console_1.default.log("Installing pytest dependencies...");
|
181
|
+
await installDependencies(pyPluginsDependencies, "pip");
|
182
|
+
}
|
183
|
+
return true;
|
184
|
+
};
|
185
|
+
exports.checkNotInstalledDependencies = checkNotInstalledDependencies;
|
package/lib/utils/console.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
declare const _default: {
|
2
|
-
_debug: boolean;
|
3
|
-
startDebug: () => void;
|
4
|
-
log: (msg: string | Array<string>, ...args: Array<any>) => void;
|
5
|
-
error: (msg: string, ...args: Array<any>) => void;
|
6
|
-
success: (msg: string, ...args: Array<any>) => void;
|
7
|
-
info: (msg: any, ...args: Array<any>) => void;
|
8
|
-
help: (msg: string) => void;
|
9
|
-
debug(...args: Array<any>): void;
|
10
|
-
warning: (msg: string) => void;
|
11
|
-
};
|
12
|
-
export default _default;
|
1
|
+
declare const _default: {
|
2
|
+
_debug: boolean;
|
3
|
+
startDebug: () => void;
|
4
|
+
log: (msg: string | Array<string>, ...args: Array<any>) => void;
|
5
|
+
error: (msg: string, ...args: Array<any>) => void;
|
6
|
+
success: (msg: string, ...args: Array<any>) => void;
|
7
|
+
info: (msg: any, ...args: Array<any>) => void;
|
8
|
+
help: (msg: string) => void;
|
9
|
+
debug(...args: Array<any>): void;
|
10
|
+
warning: (msg: string) => void;
|
11
|
+
};
|
12
|
+
export default _default;
|
package/lib/utils/console.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const chalk = require("chalk");
|
4
|
-
exports.default = {
|
5
|
-
// _debug: true,
|
6
|
-
_debug: process.env.DEBUG === "true",
|
7
|
-
startDebug: function () {
|
8
|
-
this._debug = true;
|
9
|
-
},
|
10
|
-
log: (msg, ...args) => console.log(chalk.gray(msg), ...args),
|
11
|
-
error: (msg, ...args) => console.log(chalk.red("⨉ " + msg), ...args),
|
12
|
-
success: (msg, ...args) => console.log(chalk.green("✓ " + msg), ...args),
|
13
|
-
info: (msg, ...args) => console.log(chalk.blue("ⓘ " + msg), ...args),
|
14
|
-
help: (msg) => console.log(`${chalk.white.bold("⚠ help:")} ${chalk.white(msg)}`),
|
15
|
-
debug(...args) {
|
16
|
-
this._debug && console.log(chalk.magentaBright("⚠ debug: "), args);
|
17
|
-
},
|
18
|
-
warning: (msg) => console.log(`${chalk.yellow("⚠ warning:")} ${chalk.yellow(msg)}`),
|
19
|
-
};
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const chalk = require("chalk");
|
4
|
+
exports.default = {
|
5
|
+
// _debug: true,
|
6
|
+
_debug: process.env.DEBUG === "true",
|
7
|
+
startDebug: function () {
|
8
|
+
this._debug = true;
|
9
|
+
},
|
10
|
+
log: (msg, ...args) => console.log(chalk.gray(msg), ...args),
|
11
|
+
error: (msg, ...args) => console.log(chalk.red("⨉ " + msg), ...args),
|
12
|
+
success: (msg, ...args) => console.log(chalk.green("✓ " + msg), ...args),
|
13
|
+
info: (msg, ...args) => console.log(chalk.blue("ⓘ " + msg), ...args),
|
14
|
+
help: (msg) => console.log(`${chalk.white.bold("⚠ help:")} ${chalk.white(msg)}`),
|
15
|
+
debug(...args) {
|
16
|
+
this._debug && console.log(chalk.magentaBright("⚠ debug: "), args);
|
17
|
+
},
|
18
|
+
warning: (msg) => console.log(`${chalk.yellow("⚠ warning:")} ${chalk.yellow(msg)}`),
|
19
|
+
};
|
package/lib/utils/errors.d.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import { ISolution, IError } from '../models/errors';
|
2
|
-
export declare const getSolution: (slug?: string
|
3
|
-
export declare const ValidationError: (error: IError | string) => IError;
|
4
|
-
export declare const NotFoundError: (error: IError | string) => IError;
|
5
|
-
export declare const CompilerError: (error: IError | string) => IError;
|
6
|
-
export declare const TestingError: (error: IError | string) => IError;
|
7
|
-
export declare const AuthError: (error: IError | string) => IError;
|
8
|
-
export declare const InternalError: (error: IError | string) => IError;
|
9
|
-
declare const _default: {
|
10
|
-
ValidationError: (error:
|
11
|
-
CompilerError: (error:
|
12
|
-
TestingError: (error:
|
13
|
-
NotFoundError: (error:
|
14
|
-
InternalError: (error:
|
15
|
-
AuthError: (error:
|
16
|
-
};
|
17
|
-
export default _default;
|
1
|
+
import { ISolution, IError } from '../models/errors';
|
2
|
+
export declare const getSolution: (slug?: string) => ISolution;
|
3
|
+
export declare const ValidationError: (error: IError | string) => IError;
|
4
|
+
export declare const NotFoundError: (error: IError | string) => IError;
|
5
|
+
export declare const CompilerError: (error: IError | string) => IError;
|
6
|
+
export declare const TestingError: (error: IError | string) => IError;
|
7
|
+
export declare const AuthError: (error: IError | string) => IError;
|
8
|
+
export declare const InternalError: (error: IError | string) => IError;
|
9
|
+
declare const _default: {
|
10
|
+
ValidationError: (error: IError | string) => IError;
|
11
|
+
CompilerError: (error: IError | string) => IError;
|
12
|
+
TestingError: (error: IError | string) => IError;
|
13
|
+
NotFoundError: (error: IError | string) => IError;
|
14
|
+
InternalError: (error: IError | string) => IError;
|
15
|
+
AuthError: (error: IError | string) => IError;
|
16
|
+
};
|
17
|
+
export default _default;
|