amxxpack 1.4.5 → 1.4.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/lib/builder/builder.js +32 -26
- package/lib/cli/controller.js +4 -1
- package/package.json +1 -1
package/lib/builder/builder.js
CHANGED
|
@@ -468,7 +468,7 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
468
468
|
switch (_a.label) {
|
|
469
469
|
case 0:
|
|
470
470
|
pathPattern = (0, lodash_1.map)(this.projectConfig.input.scripts, function (dir) { return path_1.default.join(dir, '**', pattern); });
|
|
471
|
-
return [4 /*yield*/, globule_1.default.find(pathPattern)];
|
|
471
|
+
return [4 /*yield*/, globule_1.default.find(pathPattern, { nodir: true })];
|
|
472
472
|
case 1:
|
|
473
473
|
matches = _a.sent();
|
|
474
474
|
return [2 /*return*/, matches.filter(function (filePath) { return path_1.default.extname(filePath) === '.sma'; })];
|
|
@@ -479,9 +479,10 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
479
479
|
AmxxBuilder.prototype.compilePlugin = function (srcDir, srcFile, compileOptions) {
|
|
480
480
|
if (compileOptions === void 0) { compileOptions = {}; }
|
|
481
481
|
return __awaiter(this, void 0, void 0, function () {
|
|
482
|
-
var srcPath, _a, scriptName, srcNestedDir, destDir, pluginDest, isUpdated, _b, relateiveSrcPath, executablePath, result, destPath, relativeFilePath;
|
|
483
|
-
|
|
484
|
-
|
|
482
|
+
var srcPath, _a, scriptName, srcNestedDir, destDir, pluginDest, isUpdated, _b, relateiveSrcPath, executablePath, result, _c, _d, _e, destPath, relativeFilePath;
|
|
483
|
+
var _f;
|
|
484
|
+
return __generator(this, function (_g) {
|
|
485
|
+
switch (_g.label) {
|
|
485
486
|
case 0:
|
|
486
487
|
if (!this.projectConfig.output.plugins) {
|
|
487
488
|
return [2 /*return*/];
|
|
@@ -495,8 +496,8 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
495
496
|
return [3 /*break*/, 3];
|
|
496
497
|
case 1: return [4 /*yield*/, this.pluginCache.isPluginUpdated(srcPath, pluginDest)];
|
|
497
498
|
case 2:
|
|
498
|
-
_b =
|
|
499
|
-
|
|
499
|
+
_b = _g.sent();
|
|
500
|
+
_g.label = 3;
|
|
500
501
|
case 3:
|
|
501
502
|
isUpdated = _b;
|
|
502
503
|
relateiveSrcPath = path_1.default.relative(process.cwd(), srcPath);
|
|
@@ -507,28 +508,33 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
507
508
|
executablePath = path_1.default.join(this.projectConfig.compiler.dir, this.projectConfig.compiler.executable);
|
|
508
509
|
return [4 /*yield*/, (0, mkdirp_1.default)(destDir)];
|
|
509
510
|
case 4:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
511
|
+
_g.sent();
|
|
512
|
+
_c = amxxpc_1.default;
|
|
513
|
+
_f = {
|
|
514
|
+
path: srcPath,
|
|
515
|
+
dest: pluginDest,
|
|
516
|
+
compiler: executablePath
|
|
517
|
+
};
|
|
518
|
+
_d = [__spreadArray([
|
|
519
|
+
path_1.default.join(this.projectConfig.compiler.dir, 'include')
|
|
520
|
+
], this.projectConfig.include, true)];
|
|
521
|
+
_e = lodash_1.map;
|
|
522
|
+
return [4 /*yield*/, globule_1.default.find((0, lodash_1.map)(this.projectConfig.input.include, function (dir) { return path_1.default.join(dir, '**/'); }))];
|
|
523
|
+
case 5: return [4 /*yield*/, _c.apply(void 0, [(_f.includeDir = __spreadArray.apply(void 0, _d.concat([_e.apply(void 0, [_g.sent(), function (dir) { return path_1.default.resolve(dir); }]), true])),
|
|
524
|
+
_f)])];
|
|
524
525
|
case 6:
|
|
525
|
-
|
|
526
|
-
return [3 /*break*/,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
526
|
+
result = _g.sent();
|
|
527
|
+
if (!!compileOptions.noCache) return [3 /*break*/, 10];
|
|
528
|
+
if (!!result.error) return [3 /*break*/, 8];
|
|
529
|
+
return [4 /*yield*/, this.pluginCache.updatePlugin(srcPath, pluginDest)];
|
|
530
|
+
case 7:
|
|
531
|
+
_g.sent();
|
|
532
|
+
return [3 /*break*/, 10];
|
|
533
|
+
case 8: return [4 /*yield*/, this.pluginCache.deletePlugin(srcPath)];
|
|
531
534
|
case 9:
|
|
535
|
+
_g.sent();
|
|
536
|
+
_g.label = 10;
|
|
537
|
+
case 10:
|
|
532
538
|
result.output.messages.forEach(function (message) {
|
|
533
539
|
var startLine = message.startLine, type = message.type, code = message.code, text = message.text, filename = message.filename;
|
|
534
540
|
var relativeFilePath = filename ? path_1.default.relative(process.cwd(), filename) : relateiveSrcPath;
|
package/lib/cli/controller.js
CHANGED
|
@@ -247,8 +247,11 @@ var Controller = /** @class */ (function () {
|
|
|
247
247
|
Controller.prototype.cleanCache = function () {
|
|
248
248
|
return __awaiter(this, void 0, void 0, function () {
|
|
249
249
|
return __generator(this, function (_a) {
|
|
250
|
-
fs_1.default.
|
|
250
|
+
if (fs_1.default.existsSync(config_1.default.cacheFile)) {
|
|
251
|
+
fs_1.default.promises.rm(config_1.default.cacheFile);
|
|
252
|
+
}
|
|
251
253
|
fs_1.default.promises.rm(config_1.default.downloadDir, { recursive: true, force: true });
|
|
254
|
+
logger_1.default.info("🧹 Cache cleaned!");
|
|
252
255
|
return [2 /*return*/];
|
|
253
256
|
});
|
|
254
257
|
});
|