amxxpack 0.1.4 → 1.0.2

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.
Files changed (61) hide show
  1. package/README.md +26 -21
  2. package/lib/builder/builder.d.ts +2 -3
  3. package/lib/builder/builder.js +20 -41
  4. package/lib/builder/index.d.ts +0 -1
  5. package/lib/builder/index.js +0 -11
  6. package/lib/cli/controller.d.ts +13 -9
  7. package/lib/cli/controller.js +121 -65
  8. package/lib/cli/index.d.ts +2 -1
  9. package/lib/cli/index.js +5 -0
  10. package/lib/cli/program.js +76 -20
  11. package/lib/cli/services/project-creator.d.ts +21 -0
  12. package/lib/cli/services/project-creator.js +292 -0
  13. package/lib/cli/services/template-builder.d.ts +11 -0
  14. package/lib/cli/services/template-builder.js +104 -0
  15. package/lib/cli/types.d.ts +12 -0
  16. package/lib/{builder → cli}/types.js +0 -0
  17. package/lib/config/index.d.ts +8 -0
  18. package/lib/config/index.js +14 -0
  19. package/lib/downloaders/compiler/constants.d.ts +9 -0
  20. package/lib/{compiler-downloader → downloaders/compiler}/constants.js +1 -4
  21. package/lib/downloaders/compiler/downloader.d.ts +3 -0
  22. package/lib/{compiler-downloader → downloaders/compiler}/downloader.js +14 -37
  23. package/lib/{compiler-downloader → downloaders/compiler}/index.d.ts +0 -0
  24. package/lib/{compiler-downloader → downloaders/compiler}/index.js +0 -0
  25. package/lib/{compiler-downloader → downloaders/compiler}/resolvers.d.ts +1 -1
  26. package/lib/{compiler-downloader → downloaders/compiler}/resolvers.js +2 -1
  27. package/lib/{compiler-downloader → downloaders/compiler}/types.d.ts +0 -0
  28. package/lib/{compiler-downloader → downloaders/compiler}/types.js +0 -0
  29. package/lib/downloaders/thirdparty/downloader.d.ts +3 -0
  30. package/lib/downloaders/thirdparty/downloader.js +69 -0
  31. package/lib/downloaders/thirdparty/index.d.ts +1 -0
  32. package/lib/downloaders/thirdparty/index.js +9 -0
  33. package/lib/downloaders/thirdparty/types.d.ts +5 -0
  34. package/lib/downloaders/thirdparty/types.js +2 -0
  35. package/lib/logger/constants.d.ts +7 -0
  36. package/lib/logger/constants.js +12 -0
  37. package/lib/{services → logger}/logger.d.ts +5 -11
  38. package/lib/{services → logger}/logger.js +17 -25
  39. package/lib/logger/types.d.ts +3 -0
  40. package/lib/logger/types.js +2 -0
  41. package/lib/project-config/defaults.d.ts +3 -0
  42. package/lib/project-config/defaults.js +38 -0
  43. package/lib/project-config/index.d.ts +6 -0
  44. package/lib/project-config/index.js +8 -0
  45. package/lib/project-config/resolve.d.ts +3 -0
  46. package/lib/project-config/resolve.js +110 -0
  47. package/lib/types/index.d.ts +45 -0
  48. package/lib/types/index.js +2 -0
  49. package/lib/utils/accumulator.d.ts +2 -1
  50. package/lib/utils/download.d.ts +6 -0
  51. package/lib/utils/download.js +63 -0
  52. package/package.json +7 -1
  53. package/resources/templates/include-directive.txt +1 -0
  54. package/resources/templates/include.txt +5 -0
  55. package/resources/templates/library-include.txt +6 -0
  56. package/resources/templates/library-script.txt +10 -0
  57. package/resources/templates/script.txt +5 -0
  58. package/lib/builder/types.d.ts +0 -20
  59. package/lib/compiler-downloader/constants.d.ts +0 -12
  60. package/lib/compiler-downloader/downloader.d.ts +0 -2
  61. package/resources/default-config.json +0 -22
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var path_1 = __importDefault(require("path"));
43
+ var download_1 = __importDefault(require("download"));
44
+ var mkdirp_1 = __importDefault(require("mkdirp"));
45
+ function download(url, filePath) {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var _a, dir, filename;
48
+ return __generator(this, function (_b) {
49
+ switch (_b.label) {
50
+ case 0:
51
+ _a = path_1.default.parse(filePath), dir = _a.dir, filename = _a.base;
52
+ return [4 /*yield*/, (0, mkdirp_1.default)(dir)];
53
+ case 1:
54
+ _b.sent();
55
+ return [4 /*yield*/, (0, download_1.default)(url, dir, { filename: filename })];
56
+ case 2:
57
+ _b.sent();
58
+ return [2 /*return*/, { url: url, path: filePath }];
59
+ }
60
+ });
61
+ });
62
+ }
63
+ exports.default = download;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "amxxpack",
3
3
  "description": "AMXXPack",
4
4
  "author": "Hedgehog Fog",
5
- "version": "0.1.4",
5
+ "version": "1.0.2",
6
6
  "license": "MIT",
7
7
  "main": "lib/builder/index.js",
8
8
  "types": "lib/builder/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "resources/**/*"
12
12
  ],
13
13
  "scripts": {
14
+ "test": "jest",
14
15
  "build": "tsc",
15
16
  "lint": "eslint",
16
17
  "prepare": "npm run build"
@@ -38,6 +39,7 @@
38
39
  "colors": "^1.4.0",
39
40
  "commander": "^9.0.0",
40
41
  "decompress": "^4.2.1",
42
+ "download": "^8.0.0",
41
43
  "glob": "^7.2.0",
42
44
  "glob-promise": "^4.2.2",
43
45
  "lodash": "^4.17.21",
@@ -49,6 +51,8 @@
49
51
  "@types/colors": "^1.2.1",
50
52
  "@types/commander": "^2.12.2",
51
53
  "@types/decompress": "^4.2.4",
54
+ "@types/download": "^8.0.1",
55
+ "@types/jest": "^27.4.1",
52
56
  "@types/lodash": "^4.14.178",
53
57
  "@types/mkdirp": "^1.0.2",
54
58
  "@types/normalize-path": "^3.0.0",
@@ -58,6 +62,8 @@
58
62
  "eslint-config-airbnb-base": "^15.0.0",
59
63
  "eslint-config-airbnb-typescript": "^16.1.0",
60
64
  "eslint-plugin-import": "^2.25.4",
65
+ "jest": "^27.5.1",
66
+ "ts-jest": "^27.1.3",
61
67
  "typescript": "^4.5.5"
62
68
  }
63
69
  }
@@ -0,0 +1 @@
1
+ #include <{{FILE}}>
@@ -0,0 +1,5 @@
1
+ #if defined _{{FILE_NAME}}_included
2
+ #endinput
3
+ #endif
4
+ #define _{{FILE_NAME}}_included
5
+
@@ -0,0 +1,6 @@
1
+ #if defined _{{LIBRARY_NAME}}_included
2
+ #endinput
3
+ #endif
4
+ #define _{{LIBRARY_NAME}}_included
5
+
6
+ #pragma reqlib {{LIBRARY_NAME}}
@@ -0,0 +1,10 @@
1
+ {{INCLUDES}}
2
+ #include <{{INCLUDE_NAME}}>
3
+
4
+ public plugin_init() {
5
+ register_plugin("{{PLUGIN_NAME}}", "{{PLUGIN_VERSION}}", "{{PLUGIN_AUTHOR}}");
6
+ }
7
+
8
+ public plugin_native() {
9
+ register_library("{{LIBRARY_NAME}}");
10
+ }
@@ -0,0 +1,5 @@
1
+ {{INCLUDES}}
2
+
3
+ public plugin_init() {
4
+ register_plugin("{{PLUGIN_NAME}}", "{{PLUGIN_VERSION}}", "{{PLUGIN_AUTHOR}}");
5
+ }
@@ -1,20 +0,0 @@
1
- export interface IAmxxBuilderConfig {
2
- compiler: {
3
- executable: string;
4
- include: string[];
5
- };
6
- input: {
7
- scripts: string;
8
- include: string;
9
- assets: string;
10
- };
11
- output: {
12
- scripts: string;
13
- plugins: string;
14
- include: string;
15
- assets: string;
16
- };
17
- rules?: {
18
- flatCompilation?: boolean;
19
- };
20
- }
@@ -1,12 +0,0 @@
1
- export declare const DOWNLOAD_HOST = "https://www.amxmodx.org";
2
- export declare const SCRIPTING_DIR = "addons/amxmodx/scripting/";
3
- export declare const EXTENSIONS_IGNORE_LIST: string[];
4
- export declare enum CompilerPlatform {
5
- Windows = "windows",
6
- Linux = "linux",
7
- Mac = "mac"
8
- }
9
- export declare enum DistSource {
10
- Dev = "amxxdrop",
11
- Release = "release"
12
- }
@@ -1,2 +0,0 @@
1
- import { IDownloadCompilerOptions } from './types';
2
- export default function downloadCompiler(options: IDownloadCompilerOptions): Promise<void>;
@@ -1,22 +0,0 @@
1
- {
2
- "compiler": {
3
- "executable": "./compiler/amxxpc",
4
- "include": [
5
- "./compiler/include"
6
- ]
7
- },
8
- "input": {
9
- "scripts": "./src/scripts",
10
- "include": "./src/include",
11
- "assets": "./assets"
12
- },
13
- "output": {
14
- "scripts": "./dist/addons/amxmodx/scripting",
15
- "plugins": "./dist/addons/amxmodx/plugins",
16
- "include": "./dist/addons/amxmodx/scripting/include",
17
- "assets": "./dist"
18
- },
19
- "rules": {
20
- "flatCompilation": true
21
- }
22
- }