amxxpack 0.0.3 → 0.0.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/README.md +4 -0
- package/lib/builder/builder.js +10 -2
- package/lib/builder/types.d.ts +3 -0
- package/lib/cli/program.js +2 -2
- package/package.json +11 -2
- package/resources/default-config.json +3 -0
package/README.md
CHANGED
|
@@ -11,6 +11,9 @@ This system will be useful for projects with multiple plugins and assets. Using
|
|
|
11
11
|
- 🔥 Hot reload
|
|
12
12
|
- 🧸 Assets builder
|
|
13
13
|
|
|
14
|
+
## 🔄Requirements
|
|
15
|
+
- Node.js 10.0.0+
|
|
16
|
+
|
|
14
17
|
## 🔧 Installation
|
|
15
18
|
**AMXXPack** is available through the npm registry.
|
|
16
19
|
Installation can be done using the `npm install` command:
|
|
@@ -29,6 +32,7 @@ npm install -g amxxpack
|
|
|
29
32
|
- Execute `npm init -y` command to init the package
|
|
30
33
|
- Execute `npm install amxxpack --save-dev` command to install `amxxpack` locally
|
|
31
34
|
- Execute `npx amxxpack init` command to create new config
|
|
35
|
+
- Extract the **Amx Mod X** compiler to the `./compiler` dir of the project (content of `scripting` folder).
|
|
32
36
|
- Use `npx amxxpack build` command to build the project
|
|
33
37
|
- Adding build scripts *(optional)*
|
|
34
38
|
|
package/lib/builder/builder.js
CHANGED
|
@@ -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:
|
package/lib/builder/types.d.ts
CHANGED
package/lib/cli/program.js
CHANGED
|
@@ -64,7 +64,7 @@ program
|
|
|
64
64
|
program
|
|
65
65
|
.command('compile')
|
|
66
66
|
.argument('<path>', 'Script path or glob')
|
|
67
|
-
.option('--config, -c', 'Config file', '.amxxpack.json')
|
|
67
|
+
.option('--config, -c <path>', 'Config file', '.amxxpack.json')
|
|
68
68
|
.action(function (str, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
69
|
return __generator(this, function (_a) {
|
|
70
70
|
switch (_a.label) {
|
|
@@ -78,7 +78,7 @@ program
|
|
|
78
78
|
program
|
|
79
79
|
.command('build')
|
|
80
80
|
.option('--watch, -w', 'Watch project')
|
|
81
|
-
.option('--config, -c', 'Config file', '.amxxpack.json')
|
|
81
|
+
.option('--config, -c <path>', 'Config file', '.amxxpack.json')
|
|
82
82
|
.action(function (str, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
83
83
|
var opts;
|
|
84
84
|
return __generator(this, function (_a) {
|
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
|
+
"version": "0.0.7",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "lib/builder/index.js",
|
|
8
8
|
"types": "lib/builder/index.d.ts",
|
|
@@ -18,6 +18,14 @@
|
|
|
18
18
|
"bin": {
|
|
19
19
|
"amxxpack": "./lib/cli/index.js"
|
|
20
20
|
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/Hedgefog/node-amxxpack"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/Hedgefog/node-amxxpack/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/Hedgefog/node-amxxpack",
|
|
21
29
|
"keywords": [
|
|
22
30
|
"amx",
|
|
23
31
|
"amxx",
|
|
@@ -26,12 +34,12 @@
|
|
|
26
34
|
"pawn"
|
|
27
35
|
],
|
|
28
36
|
"dependencies": {
|
|
29
|
-
"chalk": "^5.0.0",
|
|
30
37
|
"chokidar": "^3.5.3",
|
|
31
38
|
"colors": "^1.4.0",
|
|
32
39
|
"commander": "^9.0.0",
|
|
33
40
|
"glob": "^7.2.0",
|
|
34
41
|
"glob-promise": "^4.2.2",
|
|
42
|
+
"lodash": "^4.17.21",
|
|
35
43
|
"mkdirp": "^1.0.4",
|
|
36
44
|
"normalize-path": "^3.0.0"
|
|
37
45
|
},
|
|
@@ -39,6 +47,7 @@
|
|
|
39
47
|
"@types/chokidar": "^2.1.3",
|
|
40
48
|
"@types/colors": "^1.2.1",
|
|
41
49
|
"@types/commander": "^2.12.2",
|
|
50
|
+
"@types/lodash": "^4.14.178",
|
|
42
51
|
"@types/mkdirp": "^1.0.2",
|
|
43
52
|
"@types/normalize-path": "^3.0.0",
|
|
44
53
|
"@typescript-eslint/eslint-plugin": "^5.12.0",
|