@luvio/cli 0.83.0 → 0.84.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/lib/commands/generate.d.ts +1 -0
- package/lib/commands/generate.js +20 -15
- package/lib/commands/generate.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/lib/commands/generate.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compile = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const compiler_1 = require("@luvio/compiler");
|
|
@@ -12,21 +13,7 @@ class Generate extends core_1.Command {
|
|
|
12
13
|
if (flags.plugin) {
|
|
13
14
|
plugin = await Promise.resolve().then(() => (0, tslib_1.__importStar)(require(path_1.default.resolve(flags.plugin))));
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
const compilerBaseOutputDir = path_1.default.parse(args.outputDir);
|
|
17
|
-
const sourceWriter = new compiler_1.FileSystemSourceWriter(args.outputDir);
|
|
18
|
-
const parser = new compiler_1.LuvioRamlFileParser(filePath);
|
|
19
|
-
const restAdapterSourcePrinter = new compiler_1.RestAdapterSourcePrinter('adapters', compilerBaseOutputDir, plugin);
|
|
20
|
-
const restSourcePrinter = new compiler_1.RestSourcePrinter(restAdapterSourcePrinter, compilerBaseOutputDir, plugin);
|
|
21
|
-
// Constructing the type, resource, adapter printers here allows the CLI to configure the compiler so we can use the right implementations.
|
|
22
|
-
// You might imagine a GraphQLSourcePrinter that is configured to print some extra code for each Type.
|
|
23
|
-
const graphQLSourcePrinter = new compiler_1.GraphQLSourcePrinter(new compiler_1.GraphQLTypeSourcePrinter(), new compiler_1.GraphQLResourceSourcePrinter(), new compiler_1.GraphQLAdapterSourcePrinter(), compilerBaseOutputDir);
|
|
24
|
-
const compiler = new compiler_1.LuvioRamlCompiler(parser, sourceWriter, [graphQLSourcePrinter, restSourcePrinter], compilerBaseOutputDir, plugin);
|
|
25
|
-
const parseErrors = await compiler.generate();
|
|
26
|
-
if (Array.isArray(parseErrors)) {
|
|
27
|
-
// eslint-disable-next-line no-console
|
|
28
|
-
console.log((0, reporter_1.default)(filePath, parseErrors));
|
|
29
|
-
}
|
|
16
|
+
await compile(args.input, args.outputDir, plugin);
|
|
30
17
|
}
|
|
31
18
|
}
|
|
32
19
|
exports.default = Generate;
|
|
@@ -49,4 +36,22 @@ Generate.flags = {
|
|
|
49
36
|
char: 'p',
|
|
50
37
|
}),
|
|
51
38
|
};
|
|
39
|
+
async function compile(input, outputDir, plugin) {
|
|
40
|
+
const filePath = input;
|
|
41
|
+
const compilerBaseOutputDir = path_1.default.parse(outputDir);
|
|
42
|
+
const sourceWriter = new compiler_1.FileSystemSourceWriter(outputDir);
|
|
43
|
+
const parser = new compiler_1.LuvioRamlFileParser(filePath);
|
|
44
|
+
const restAdapterSourcePrinter = new compiler_1.RestAdapterSourcePrinter('adapters', compilerBaseOutputDir, plugin);
|
|
45
|
+
const restSourcePrinter = new compiler_1.RestSourcePrinter(restAdapterSourcePrinter, compilerBaseOutputDir, plugin);
|
|
46
|
+
// Constructing the type, resource, adapter printers here allows the CLI to configure the compiler so we can use the right implementations.
|
|
47
|
+
// You might imagine a GraphQLSourcePrinter that is configured to print some extra code for each Type.
|
|
48
|
+
const graphQLSourcePrinter = new compiler_1.GraphQLSourcePrinter(new compiler_1.GraphQLTypeSourcePrinter(), new compiler_1.GraphQLResourceSourcePrinter(), new compiler_1.GraphQLAdapterSourcePrinter(), compilerBaseOutputDir, plugin);
|
|
49
|
+
const compiler = new compiler_1.LuvioRamlCompiler(parser, sourceWriter, [graphQLSourcePrinter, restSourcePrinter], compilerBaseOutputDir, plugin);
|
|
50
|
+
const parseErrors = await compiler.generate();
|
|
51
|
+
if (Array.isArray(parseErrors)) {
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
console.log((0, reporter_1.default)(filePath, parseErrors));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.compile = compile;
|
|
52
57
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":";;;;AAAA,sCAA6C;AAC7C,8CAUyB;AACzB,6DAAwB;AACxB,wEAAmC;AACnC,MAAqB,QAAS,SAAQ,cAAO;IAwBzC,KAAK,CAAC,GAAG;QACL,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,CAAC;QACX,IAAI,KAAK,CAAC,MAAM,EAAE;YACd,MAAM,GAAG,qEAAa,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAC,CAAC;SACrD;QAED,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;;AAhCL,2BAiCC;AAhCU,oBAAW,GAAG,4DAA4D,CAAC;AAE3E,iBAAQ,GAAG,CAAC,0CAA0C,CAAC,CAAC;AAExD,aAAI,GAAG;IACV;QACI,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,YAAY;KAC5B;IACD;QACI,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,kBAAkB;KAClC;CACJ,CAAC;AAEK,cAAK,GAAG;IACX,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;KACZ,CAAC;CACL,CAAC;AAaC,KAAK,UAAU,OAAO,CAAC,KAAa,EAAE,SAAiB,EAAE,MAAY;IACxE,MAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,MAAM,qBAAqB,GAAG,cAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,IAAI,iCAAsB,CAAC,SAAS,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,8BAAmB,CAAC,QAAQ,CAAC,CAAC;IAEjD,MAAM,wBAAwB,GAAG,IAAI,mCAAwB,CACzD,UAAU,EACV,qBAAqB,EACrB,MAAM,CACT,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAI,4BAAiB,CAC3C,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,CACT,CAAC;IAEF,2IAA2I;IAC3I,sGAAsG;IACtG,MAAM,oBAAoB,GAAG,IAAI,+BAAoB,CACjD,IAAI,mCAAwB,EAAE,EAC9B,IAAI,uCAA4B,EAAE,EAClC,IAAI,sCAA2B,EAAE,EACjC,qBAAqB,EACrB,MAAM,CACT,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAClC,MAAM,EACN,YAAY,EACZ,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,EACzC,qBAAqB,EACrB,MAAM,CACT,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC5B,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAA,kBAAQ,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;KAChD;AACL,CAAC;AAvCD,0BAuCC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run = void 0;
|
|
3
|
+
exports.compile = exports.run = void 0;
|
|
4
4
|
var core_1 = require("@oclif/core");
|
|
5
5
|
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
|
|
6
|
+
var generate_1 = require("./commands/generate");
|
|
7
|
+
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return generate_1.compile; } });
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oCAAkC;AAAzB,2FAAA,GAAG,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oCAAkC;AAAzB,2FAAA,GAAG,OAAA;AACZ,gDAA8C;AAArC,mGAAA,OAAO,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/cli",
|
|
3
3
|
"description": "CLI for Luvio Compiler",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.84.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"luvio": "./bin/run"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@luvio/compiler": "0.
|
|
9
|
+
"@luvio/compiler": "0.84.0",
|
|
10
10
|
"@oclif/core": "^1.0.11",
|
|
11
11
|
"chalk": "^4.0.0",
|
|
12
12
|
"strip-ansi": "^6.0.0",
|