amxxpack 0.1.2 → 1.0.0
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 +26 -21
- package/lib/builder/amxxpc.d.ts +27 -27
- package/lib/builder/amxxpc.js +122 -122
- package/lib/builder/builder.d.ts +21 -22
- package/lib/builder/builder.js +379 -400
- package/lib/builder/constants.d.ts +3 -3
- package/lib/builder/constants.js +6 -6
- package/lib/builder/index.d.ts +1 -2
- package/lib/builder/index.js +9 -20
- package/lib/cli/controller.d.ts +20 -16
- package/lib/cli/controller.js +238 -181
- package/lib/cli/index.d.ts +3 -2
- package/lib/cli/index.js +13 -8
- package/lib/cli/program.d.ts +4 -4
- package/lib/cli/program.js +174 -118
- package/lib/cli/services/project-creator.d.ts +21 -0
- package/lib/cli/services/project-creator.js +274 -0
- package/lib/cli/services/template-builder.d.ts +11 -0
- package/lib/cli/services/template-builder.js +104 -0
- package/lib/cli/types.d.ts +12 -0
- package/lib/{compiler-downloader → cli}/types.js +2 -2
- package/lib/config/index.d.ts +8 -0
- package/lib/config/index.js +14 -0
- package/lib/downloaders/compiler/constants.d.ts +9 -0
- package/lib/{compiler-downloader → downloaders/compiler}/constants.js +14 -17
- package/lib/downloaders/compiler/downloader.d.ts +3 -0
- package/lib/{compiler-downloader → downloaders/compiler}/downloader.js +151 -174
- package/lib/{compiler-downloader → downloaders/compiler}/index.d.ts +1 -1
- package/lib/{compiler-downloader → downloaders/compiler}/index.js +9 -9
- package/lib/{compiler-downloader → downloaders/compiler}/resolvers.d.ts +6 -6
- package/lib/{compiler-downloader → downloaders/compiler}/resolvers.js +40 -39
- package/lib/{compiler-downloader → downloaders/compiler}/types.d.ts +16 -16
- package/lib/{builder → downloaders/compiler}/types.js +2 -2
- package/lib/downloaders/thirdparty/downloader.d.ts +3 -0
- package/lib/downloaders/thirdparty/downloader.js +69 -0
- package/lib/downloaders/thirdparty/index.d.ts +1 -0
- package/lib/downloaders/thirdparty/index.js +9 -0
- package/lib/downloaders/thirdparty/types.d.ts +5 -0
- package/lib/downloaders/thirdparty/types.js +2 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +20 -20
- package/lib/logger/constants.d.ts +7 -0
- package/lib/logger/constants.js +12 -0
- package/lib/{services → logger}/logger.d.ts +16 -22
- package/lib/{services → logger}/logger.js +96 -104
- package/lib/logger/types.d.ts +3 -0
- package/lib/logger/types.js +2 -0
- package/lib/project-config/defaults.d.ts +3 -0
- package/lib/project-config/defaults.js +38 -0
- package/lib/project-config/index.d.ts +6 -0
- package/lib/project-config/index.js +8 -0
- package/lib/project-config/resolve.d.ts +3 -0
- package/lib/project-config/resolve.js +110 -0
- package/lib/types/index.d.ts +45 -0
- package/lib/types/index.js +2 -0
- package/lib/utils/accumulator.d.ts +2 -1
- package/lib/utils/accumulator.js +10 -10
- package/lib/utils/download.d.ts +6 -0
- package/lib/utils/download.js +63 -0
- package/package.json +7 -1
- package/resources/templates/include-directive.txt +1 -0
- package/resources/templates/include.txt +5 -0
- package/resources/templates/library-include.txt +6 -0
- package/resources/templates/library-script.txt +10 -0
- package/resources/templates/script.txt +5 -0
- package/lib/builder/types.d.ts +0 -20
- package/lib/compiler-downloader/constants.d.ts +0 -12
- package/lib/compiler-downloader/downloader.d.ts +0 -2
- package/resources/default-config.json +0 -22
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SCRIPTS_PATH_PATTERN = "**/*.sma";
|
|
2
|
-
export declare const INCLUDE_PATH_PATTERN = "**/*.inc";
|
|
3
|
-
export declare const ASSETS_PATH_PATTERN = "**/*.*";
|
|
1
|
+
export declare const SCRIPTS_PATH_PATTERN = "**/*.sma";
|
|
2
|
+
export declare const INCLUDE_PATH_PATTERN = "**/*.inc";
|
|
3
|
+
export declare const ASSETS_PATH_PATTERN = "**/*.*";
|
package/lib/builder/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ASSETS_PATH_PATTERN = exports.INCLUDE_PATH_PATTERN = exports.SCRIPTS_PATH_PATTERN = void 0;
|
|
4
|
-
exports.SCRIPTS_PATH_PATTERN = '**/*.sma';
|
|
5
|
-
exports.INCLUDE_PATH_PATTERN = '**/*.inc';
|
|
6
|
-
exports.ASSETS_PATH_PATTERN = '**/*.*';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ASSETS_PATH_PATTERN = exports.INCLUDE_PATH_PATTERN = exports.SCRIPTS_PATH_PATTERN = void 0;
|
|
4
|
+
exports.SCRIPTS_PATH_PATTERN = '**/*.sma';
|
|
5
|
+
exports.INCLUDE_PATH_PATTERN = '**/*.inc';
|
|
6
|
+
exports.ASSETS_PATH_PATTERN = '**/*.*';
|
package/lib/builder/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default } from './builder';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export { default } from './builder';
|
package/lib/builder/index.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.default = void 0;
|
|
17
|
-
// eslint-disable-next-line no-restricted-exports
|
|
18
|
-
var builder_1 = require("./builder");
|
|
19
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(builder_1).default; } });
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// eslint-disable-next-line no-restricted-exports
|
|
8
|
+
var builder_1 = require("./builder");
|
|
9
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(builder_1).default; } });
|
package/lib/cli/controller.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import AmxxBuilder
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
createBuilder(configPath: string): Promise<AmxxBuilder>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import AmxxBuilder from '../builder';
|
|
2
|
+
import { IProjectOptions } from './types';
|
|
3
|
+
declare class Controller {
|
|
4
|
+
createBuilder(configPath: string): Promise<AmxxBuilder>;
|
|
5
|
+
create(options: IProjectOptions): Promise<void>;
|
|
6
|
+
config(projectDir: string): Promise<void>;
|
|
7
|
+
compile(scriptPath: string, configPath: string): Promise<void>;
|
|
8
|
+
build(configPath: string, watch: boolean): Promise<void>;
|
|
9
|
+
install(configPath: string): Promise<void>;
|
|
10
|
+
add(configPath: string, type: string, fileName: string, options: {
|
|
11
|
+
name?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
author?: string;
|
|
14
|
+
library?: string;
|
|
15
|
+
overwrite: boolean;
|
|
16
|
+
include: string[];
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: Controller;
|
|
20
|
+
export default _default;
|
package/lib/cli/controller.js
CHANGED
|
@@ -1,181 +1,238 @@
|
|
|
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
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var Controller = /** @class */ (function () {
|
|
51
|
-
function Controller() {
|
|
52
|
-
}
|
|
53
|
-
Controller.prototype.
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
var
|
|
56
|
-
return __generator(this, function (_a) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return [2 /*return
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
Controller.prototype.
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
var
|
|
85
|
-
return __generator(this, function (
|
|
86
|
-
switch (
|
|
87
|
-
case 0:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
case
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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 builder_1 = __importDefault(require("../builder"));
|
|
44
|
+
var compiler_1 = __importDefault(require("../downloaders/compiler"));
|
|
45
|
+
var thirdparty_1 = __importDefault(require("../downloaders/thirdparty"));
|
|
46
|
+
var project_creator_1 = __importDefault(require("./services/project-creator"));
|
|
47
|
+
var template_builder_1 = __importDefault(require("./services/template-builder"));
|
|
48
|
+
var project_config_1 = __importDefault(require("../project-config"));
|
|
49
|
+
var logger_1 = __importDefault(require("../logger/logger"));
|
|
50
|
+
var Controller = /** @class */ (function () {
|
|
51
|
+
function Controller() {
|
|
52
|
+
}
|
|
53
|
+
Controller.prototype.createBuilder = function (configPath) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var projectConfig, builder;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, project_config_1.default.resolve(configPath)];
|
|
59
|
+
case 1:
|
|
60
|
+
projectConfig = _a.sent();
|
|
61
|
+
builder = new builder_1.default(projectConfig);
|
|
62
|
+
return [2 /*return*/, builder];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
Controller.prototype.create = function (options) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var projectCreator;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
projectCreator = new project_creator_1.default(options);
|
|
74
|
+
return [4 /*yield*/, projectCreator.createProject()];
|
|
75
|
+
case 1:
|
|
76
|
+
_a.sent();
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
Controller.prototype.config = function (projectDir) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var projectCreator;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
projectCreator = new project_creator_1.default();
|
|
89
|
+
projectCreator.projectDir = projectDir;
|
|
90
|
+
return [4 /*yield*/, projectCreator.createProject()];
|
|
91
|
+
case 1:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
Controller.prototype.compile = function (scriptPath, configPath) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var builder, matches;
|
|
101
|
+
var _this = this;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0: return [4 /*yield*/, this.createBuilder(configPath)];
|
|
105
|
+
case 1:
|
|
106
|
+
builder = _a.sent();
|
|
107
|
+
return [4 /*yield*/, builder.findPlugins(scriptPath)];
|
|
108
|
+
case 2:
|
|
109
|
+
matches = _a.sent();
|
|
110
|
+
matches.map(function (filePath) { return __awaiter(_this, void 0, void 0, function () {
|
|
111
|
+
var srcPath;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
srcPath = path_1.default.resolve(filePath);
|
|
116
|
+
return [4 /*yield*/, builder.compilePlugin(srcPath)];
|
|
117
|
+
case 1:
|
|
118
|
+
_a.sent();
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); });
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
Controller.prototype.build = function (configPath, watch) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var builder;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, this.createBuilder(configPath)];
|
|
134
|
+
case 1:
|
|
135
|
+
builder = _a.sent();
|
|
136
|
+
return [4 /*yield*/, builder.build()];
|
|
137
|
+
case 2:
|
|
138
|
+
_a.sent();
|
|
139
|
+
if (!watch) return [3 /*break*/, 4];
|
|
140
|
+
return [4 /*yield*/, builder.watch()];
|
|
141
|
+
case 3:
|
|
142
|
+
_a.sent();
|
|
143
|
+
_a.label = 4;
|
|
144
|
+
case 4: return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
Controller.prototype.install = function (configPath) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var projectConfig, _i, _a, dependency;
|
|
152
|
+
return __generator(this, function (_b) {
|
|
153
|
+
switch (_b.label) {
|
|
154
|
+
case 0: return [4 /*yield*/, project_config_1.default.resolve(configPath)];
|
|
155
|
+
case 1:
|
|
156
|
+
projectConfig = _b.sent();
|
|
157
|
+
return [4 /*yield*/, (0, compiler_1.default)({
|
|
158
|
+
path: projectConfig.compiler.dir,
|
|
159
|
+
dists: projectConfig.compiler.addons,
|
|
160
|
+
version: projectConfig.compiler.version,
|
|
161
|
+
dev: projectConfig.compiler.dev
|
|
162
|
+
})];
|
|
163
|
+
case 2:
|
|
164
|
+
_b.sent();
|
|
165
|
+
_i = 0, _a = projectConfig.thirdparty.dependencies;
|
|
166
|
+
_b.label = 3;
|
|
167
|
+
case 3:
|
|
168
|
+
if (!(_i < _a.length)) return [3 /*break*/, 6];
|
|
169
|
+
dependency = _a[_i];
|
|
170
|
+
return [4 /*yield*/, (0, thirdparty_1.default)({
|
|
171
|
+
name: dependency.name,
|
|
172
|
+
url: dependency.url,
|
|
173
|
+
dir: projectConfig.thirdparty.dir
|
|
174
|
+
})];
|
|
175
|
+
case 4:
|
|
176
|
+
_b.sent();
|
|
177
|
+
_b.label = 5;
|
|
178
|
+
case 5:
|
|
179
|
+
_i++;
|
|
180
|
+
return [3 /*break*/, 3];
|
|
181
|
+
case 6: return [2 /*return*/];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
Controller.prototype.add = function (configPath, type, fileName, options) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
+
var projectConfig, includeName, templateBuilder, _a;
|
|
189
|
+
return __generator(this, function (_b) {
|
|
190
|
+
switch (_b.label) {
|
|
191
|
+
case 0: return [4 /*yield*/, project_config_1.default.resolve(configPath)];
|
|
192
|
+
case 1:
|
|
193
|
+
projectConfig = _b.sent();
|
|
194
|
+
includeName = path_1.default.parse(fileName).base;
|
|
195
|
+
templateBuilder = new template_builder_1.default(projectConfig, {
|
|
196
|
+
FILE_NAME: fileName,
|
|
197
|
+
PLUGIN_NAME: options.name,
|
|
198
|
+
PLUGIN_VERSION: options.version,
|
|
199
|
+
PLUGIN_AUTHOR: options.author,
|
|
200
|
+
LIBRARY_NAME: options.library || includeName.replace(/-/g, '_'),
|
|
201
|
+
INCLUDES: options.include,
|
|
202
|
+
INCLUDE_NAME: includeName
|
|
203
|
+
}, { PLUGIN_NAME: fileName });
|
|
204
|
+
_a = type;
|
|
205
|
+
switch (_a) {
|
|
206
|
+
case 'script': return [3 /*break*/, 2];
|
|
207
|
+
case 'include': return [3 /*break*/, 4];
|
|
208
|
+
case 'lib': return [3 /*break*/, 6];
|
|
209
|
+
}
|
|
210
|
+
return [3 /*break*/, 9];
|
|
211
|
+
case 2: return [4 /*yield*/, templateBuilder.createFileFromTemplate(path_1.default.join(projectConfig.input.scripts, "".concat(fileName, ".sma")), 'script', options.overwrite)];
|
|
212
|
+
case 3:
|
|
213
|
+
_b.sent();
|
|
214
|
+
return [3 /*break*/, 10];
|
|
215
|
+
case 4: return [4 /*yield*/, templateBuilder.createFileFromTemplate(path_1.default.join(projectConfig.input.include, "".concat(fileName, ".inc")), 'include', options.overwrite)];
|
|
216
|
+
case 5:
|
|
217
|
+
_b.sent();
|
|
218
|
+
return [3 /*break*/, 10];
|
|
219
|
+
case 6: return [4 /*yield*/, templateBuilder.createFileFromTemplate(path_1.default.join(projectConfig.input.scripts, "".concat(fileName, ".sma")), 'library-script', options.overwrite)];
|
|
220
|
+
case 7:
|
|
221
|
+
_b.sent();
|
|
222
|
+
return [4 /*yield*/, templateBuilder.createFileFromTemplate(path_1.default.join(projectConfig.input.include, "".concat(includeName, ".inc")), 'library-include', options.overwrite)];
|
|
223
|
+
case 8:
|
|
224
|
+
_b.sent();
|
|
225
|
+
return [3 /*break*/, 10];
|
|
226
|
+
case 9:
|
|
227
|
+
{
|
|
228
|
+
logger_1.default.error("Invalid file type \"".concat(type, "\"!"));
|
|
229
|
+
}
|
|
230
|
+
_b.label = 10;
|
|
231
|
+
case 10: return [2 /*return*/];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
return Controller;
|
|
237
|
+
}());
|
|
238
|
+
exports.default = new Controller();
|
package/lib/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export { default as program } from './program';
|
|
3
|
+
export { default as controller } from './controller';
|
package/lib/cli/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
|
|
8
|
-
program_1
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.controller = exports.program = void 0;
|
|
8
|
+
var program_1 = __importDefault(require("./program"));
|
|
9
|
+
program_1.default.parse();
|
|
10
|
+
var program_2 = require("./program");
|
|
11
|
+
Object.defineProperty(exports, "program", { enumerable: true, get: function () { return __importDefault(program_2).default; } });
|
|
12
|
+
var controller_1 = require("./controller");
|
|
13
|
+
Object.defineProperty(exports, "controller", { enumerable: true, get: function () { return __importDefault(controller_1).default; } });
|
package/lib/cli/program.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
declare const program: Command;
|
|
4
|
-
export default program;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
declare const program: Command;
|
|
4
|
+
export default program;
|