@needle-tools/needle-component-compiler 3.0.5 → 3.0.6-next.d5c7949
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/dist/BaseWriter.d.ts +1 -1
- package/dist/BaseWriter.js +3 -2
- package/dist/cli.js +13 -13
- package/dist/impl/csharp-compiler.js +1 -1
- package/package.json +3 -2
package/dist/BaseWriter.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export declare abstract class BaseWriter implements IWriter {
|
|
|
19
19
|
private _createdSchemesPerFile;
|
|
20
20
|
begin(filePath: string | null): void;
|
|
21
21
|
end(filePath: string | null): void;
|
|
22
|
-
protected writeScheme(processingFilePath: string | null, component: string): void;
|
|
22
|
+
protected writeScheme(processingFilePath: string | null, component: string, extension?: string): void;
|
|
23
23
|
}
|
package/dist/BaseWriter.js
CHANGED
|
@@ -75,8 +75,9 @@ var BaseWriter = /** @class */ (function () {
|
|
|
75
75
|
}
|
|
76
76
|
delete this._currentlyProcessingFiles[filePath];
|
|
77
77
|
};
|
|
78
|
-
BaseWriter.prototype.writeScheme = function (processingFilePath, component) {
|
|
79
|
-
|
|
78
|
+
BaseWriter.prototype.writeScheme = function (processingFilePath, component, extension) {
|
|
79
|
+
if (extension === void 0) { extension = ".component.json"; }
|
|
80
|
+
var res = this.sink.flush(component + extension, this.writer.flush());
|
|
80
81
|
// if an output path is returned it means a file has been written to that path
|
|
81
82
|
if (res && (0, fs_1.existsSync)(res)) {
|
|
82
83
|
(0, commands_1.sendFileWrittenCommand)(res);
|
package/dist/cli.js
CHANGED
|
@@ -8,12 +8,12 @@ var base_compiler_1 = require("./base-compiler");
|
|
|
8
8
|
var csharp_compiler_1 = require("./impl/csharp-compiler");
|
|
9
9
|
var blender_compiler_1 = require("./impl/blender-compiler");
|
|
10
10
|
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8"));
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
11
|
+
var rawArgs = process.argv.slice(2);
|
|
12
|
+
if (rawArgs.includes("--version") || rawArgs.includes("-v")) {
|
|
13
13
|
console.log("needle-component-compiler v".concat(pkg.version));
|
|
14
14
|
process.exit(0);
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
16
|
+
if (rawArgs.includes("--help") || rawArgs.includes("-h") || rawArgs.length < 3) {
|
|
17
17
|
console.log("needle-component-compiler v".concat(pkg.version));
|
|
18
18
|
console.log("");
|
|
19
19
|
console.log("Usage: needle-component-compiler <target> <output_dir> [options] <input_files...>");
|
|
@@ -28,25 +28,25 @@ if (args.includes("--help") || args.includes("-h") || args.length < 3) {
|
|
|
28
28
|
console.log("Flags:");
|
|
29
29
|
console.log(" --version, -v print version");
|
|
30
30
|
console.log(" --help, -h print this help");
|
|
31
|
-
if (
|
|
31
|
+
if (rawArgs.length < 3 && !rawArgs.includes("--help") && !rawArgs.includes("-h")) {
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
process.exit(0);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
var outputDir = args[1];
|
|
38
|
-
// Parse --types flag from remaining args
|
|
36
|
+
// Extract --types flag from anywhere in the args
|
|
39
37
|
var typesPath;
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
typesPath = remaining[++i];
|
|
38
|
+
var positionalArgs = [];
|
|
39
|
+
for (var i = 0; i < rawArgs.length; i++) {
|
|
40
|
+
if (rawArgs[i] === "--types" && i + 1 < rawArgs.length) {
|
|
41
|
+
typesPath = rawArgs[++i];
|
|
45
42
|
}
|
|
46
43
|
else {
|
|
47
|
-
|
|
44
|
+
positionalArgs.push(rawArgs[i]);
|
|
48
45
|
}
|
|
49
46
|
}
|
|
47
|
+
var target = positionalArgs[0];
|
|
48
|
+
var outputDir = positionalArgs[1];
|
|
49
|
+
var inputFiles = positionalArgs.slice(2);
|
|
50
50
|
if (target !== "csharp" && target !== "blender") {
|
|
51
51
|
console.error("Error: unknown target \"".concat(target, "\". Use \"csharp\" or \"blender\"."));
|
|
52
52
|
process.exit(1);
|
|
@@ -359,7 +359,7 @@ var CSharpWriter = /** @class */ (function (_super) {
|
|
|
359
359
|
};
|
|
360
360
|
/** Override writeScheme to use .cs extension instead of .component.json */
|
|
361
361
|
CSharpWriter.prototype.writeCSharpScheme = function (processingFilePath, component) {
|
|
362
|
-
|
|
362
|
+
this.writeScheme(processingFilePath, component, ".cs");
|
|
363
363
|
};
|
|
364
364
|
return CSharpWriter;
|
|
365
365
|
}(BaseWriter_1.BaseWriter));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/needle-component-compiler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6-next.d5c7949",
|
|
4
4
|
"description": "Compile Editor components for Needle Engine for C# and Blender",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "dist/cli.js",
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
"dev": "npm-watch compile",
|
|
10
10
|
"compile": "tsc -p tsconfig.build.json",
|
|
11
11
|
"prepublishOnly": "npm run compile",
|
|
12
|
-
"test": "npm run test:csharp && npm run test:blender",
|
|
12
|
+
"test": "npm run test:csharp && npm run test:blender && npm run test:cli",
|
|
13
13
|
"test:csharp": "mocha -r ts-node/register 'test/csharp/**/*.test.ts'",
|
|
14
14
|
"test:blender": "mocha -r ts-node/register 'test/blender/**/*.test.ts'",
|
|
15
|
+
"test:cli": "mocha -r ts-node/register 'test/cli/**/*.test.ts'",
|
|
15
16
|
"test:single": "mocha"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|