amxxpack 0.0.5 → 0.0.6

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.
@@ -73,12 +73,13 @@ var mkdirp_1 = __importDefault(require("mkdirp"));
73
73
  var glob_promise_1 = __importDefault(require("glob-promise"));
74
74
  var chokidar_1 = __importDefault(require("chokidar"));
75
75
  var normalize_path_1 = __importDefault(require("normalize-path"));
76
+ var lodash_1 = require("lodash");
76
77
  var amxxpc_1 = __importStar(require("./amxxpc"));
77
78
  var logger_1 = __importDefault(require("../services/logger"));
78
79
  var constants_1 = require("./constants");
79
80
  var AmxxBuilder = /** @class */ (function () {
80
81
  function AmxxBuilder(config) {
81
- var compiler = config.compiler, input = config.input, output = config.output;
82
+ var compiler = config.compiler, input = config.input, output = config.output, rules = config.rules;
82
83
  this.logger = new logger_1.default();
83
84
  this.config = {
84
85
  compiler: {
@@ -95,6 +96,9 @@ var AmxxBuilder = /** @class */ (function () {
95
96
  plugins: path_1.default.resolve(output.plugins),
96
97
  include: path_1.default.resolve(output.include),
97
98
  assets: path_1.default.resolve(output.assets)
99
+ },
100
+ rules: {
101
+ flatCompilation: (0, lodash_1.get)(rules, 'flatCompilation', true)
98
102
  }
99
103
  };
100
104
  }
@@ -308,13 +312,17 @@ var AmxxBuilder = /** @class */ (function () {
308
312
  };
309
313
  AmxxBuilder.prototype.compilePlugin = function (filePath) {
310
314
  return __awaiter(this, void 0, void 0, function () {
311
- var srcPath, destDir, relateiveSrcPath, result, destPath, relativeFilePath;
315
+ var srcPath, destDir, srcDir, relateiveSrcPath, result, destPath, relativeFilePath;
312
316
  var _this = this;
313
317
  return __generator(this, function (_a) {
314
318
  switch (_a.label) {
315
319
  case 0:
316
320
  srcPath = path_1.default.resolve(filePath);
317
321
  destDir = path_1.default.resolve(this.config.output.plugins);
322
+ if (!this.config.rules.flatCompilation) {
323
+ srcDir = path_1.default.parse(srcPath).dir;
324
+ destDir = path_1.default.join(destDir, path_1.default.relative(this.config.input.scripts, srcDir));
325
+ }
318
326
  relateiveSrcPath = path_1.default.relative(process.cwd(), srcPath);
319
327
  return [4 /*yield*/, (0, mkdirp_1.default)(destDir)];
320
328
  case 1:
@@ -14,4 +14,7 @@ export interface IAmxxBuilderConfig {
14
14
  include: string;
15
15
  assets: string;
16
16
  };
17
+ rules?: {
18
+ flatCompilation?: boolean;
19
+ };
17
20
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "amxxpack",
3
3
  "description": "AMXXPack",
4
4
  "author": "Hedgehog Fog",
5
- "version": "0.0.5",
5
+ "version": "0.0.6",
6
6
  "license": "MIT",
7
7
  "main": "lib/builder/index.js",
8
8
  "types": "lib/builder/index.d.ts",
@@ -39,6 +39,7 @@
39
39
  "commander": "^9.0.0",
40
40
  "glob": "^7.2.0",
41
41
  "glob-promise": "^4.2.2",
42
+ "lodash": "^4.17.21",
42
43
  "mkdirp": "^1.0.4",
43
44
  "normalize-path": "^3.0.0"
44
45
  },
@@ -46,6 +47,7 @@
46
47
  "@types/chokidar": "^2.1.3",
47
48
  "@types/colors": "^1.2.1",
48
49
  "@types/commander": "^2.12.2",
50
+ "@types/lodash": "^4.14.178",
49
51
  "@types/mkdirp": "^1.0.2",
50
52
  "@types/normalize-path": "^3.0.0",
51
53
  "@typescript-eslint/eslint-plugin": "^5.12.0",
@@ -15,5 +15,8 @@
15
15
  "plugins": "./dist/addons/amxmodx/plugins",
16
16
  "include": "./dist/addons/amxmodx/scripting/include",
17
17
  "assets": "./dist"
18
+ },
19
+ "rules": {
20
+ "flatCompilation": true
18
21
  }
19
22
  }