@stepzen/transpiler 0.28.0-experimental.dd6fead → 0.28.0-experimental.f225ee8
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/actions/configure.js +3 -3
- package/lib/actions/configure.js.map +1 -1
- package/lib/actions/lint.d.ts.map +1 -1
- package/lib/actions/lint.js +20 -12
- package/lib/actions/lint.js.map +1 -1
- package/lib/actions/merge.d.ts +7 -6
- package/lib/actions/merge.d.ts.map +1 -1
- package/lib/actions/merge.js +42 -26
- package/lib/actions/merge.js.map +1 -1
- package/lib/actions/stitch.d.ts +2 -2
- package/lib/actions/stitch.d.ts.map +1 -1
- package/lib/actions/stitch.js +30 -12
- package/lib/actions/stitch.js.map +1 -1
- package/lib/actions/transpile.d.ts.map +1 -1
- package/lib/actions/transpile.js +9 -3
- package/lib/actions/transpile.js.map +1 -1
- package/lib/actions/validate.js +4 -4
- package/lib/actions/validate.js.map +1 -1
- package/lib/utils/copy-workspace-content.js +4 -4
- package/lib/utils/copy-workspace-content.js.map +1 -1
- package/lib/utils/merge-helpers.d.ts.map +1 -1
- package/lib/utils/merge-helpers.js +23 -18
- package/lib/utils/merge-helpers.js.map +1 -1
- package/lib/utils/rmtemp.d.ts +11 -0
- package/lib/utils/rmtemp.d.ts.map +1 -0
- package/lib/utils/rmtemp.js +43 -0
- package/lib/utils/rmtemp.js.map +1 -0
- package/lib/utils/set-files-in-sdl.d.ts +2 -2
- package/lib/utils/set-files-in-sdl.d.ts.map +1 -1
- package/lib/utils/set-files-in-sdl.js +12 -12
- package/lib/utils/set-files-in-sdl.js.map +1 -1
- package/package.json +14 -12
- package/src/actions/configure.ts +3 -3
- package/src/actions/lint.ts +20 -17
- package/src/actions/merge.ts +70 -39
- package/src/actions/stitch.ts +32 -15
- package/src/actions/transpile.ts +9 -4
- package/src/actions/validate.ts +4 -4
- package/src/utils/copy-workspace-content.ts +4 -4
- package/src/utils/merge-helpers.ts +23 -19
- package/src/utils/rmtemp.ts +48 -0
- package/src/utils/set-files-in-sdl.ts +16 -13
package/lib/actions/configure.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const debug = require("debug");
|
|
4
|
-
const
|
|
4
|
+
const fsx = require("fs-extra");
|
|
5
5
|
const glob = require("glob");
|
|
6
6
|
const inquirer = require("inquirer");
|
|
7
7
|
const path = require("path");
|
|
@@ -27,7 +27,7 @@ exports.default = async (source, silent = false, answers = {}) => {
|
|
|
27
27
|
let configYamlCount = 0;
|
|
28
28
|
for (const y of glob.sync('**/config.yaml', { cwd: source })) {
|
|
29
29
|
const filePath = path.join(source, y);
|
|
30
|
-
const file =
|
|
30
|
+
const file = fsx.readFileSync(filePath, 'utf8');
|
|
31
31
|
let asYAML;
|
|
32
32
|
try {
|
|
33
33
|
asYAML = yaml.parse(file, { schema: 'failsafe' });
|
|
@@ -63,7 +63,7 @@ exports.default = async (source, silent = false, answers = {}) => {
|
|
|
63
63
|
cwd: source,
|
|
64
64
|
})) {
|
|
65
65
|
const filePath = path.join(source, j);
|
|
66
|
-
const file =
|
|
66
|
+
const file = fsx.readFileSync(filePath, 'utf8');
|
|
67
67
|
const asJSON = JSON.parse(file);
|
|
68
68
|
configJsonCount += 1;
|
|
69
69
|
debug('stepzen:transpiler:config')(`adding stepzen.config.json ${filePath}:` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/actions/configure.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/actions/configure.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,gCAA+B;AAC/B,6BAA4B;AAC5B,qCAAoC;AACpC,6BAA4B;AAC5B,6BAA4B;AAE5B;;;;;;;;GAQG;AACH,kBAAe,KAAK,EAAE,MAAc,EAAE,MA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C,SAAS,CAAC,UAAU,CAAC,CAAA;QAChD,KAAK,CAAC,2BAA2B,CAAC,CAAC,sBAAsB,aAAa,EAAE,CAAC,CAAA;QACzE,OAAO,aAAa,CAAA;KACrB;IAED,KAAK,CAAC,2BAA2B,CAAC,CAChC,+DAA+D;QAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;QAC7C,wDAAwD,CAC3D,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/actions/lint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/actions/lint.ts"],"names":[],"mappings":"iCAUU,MAAM,YACL;IACP,UAAU,EAAE,MAAM,CAAA;CACnB;AAJH,wBAqCC"}
|
package/lib/actions/lint.js
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const fsx = require("fs-extra");
|
|
4
4
|
const os = require("os");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const shell = require("shelljs");
|
|
7
7
|
const stitch_1 = require("../actions/stitch");
|
|
8
8
|
const merge_helpers_1 = require("../utils/merge-helpers");
|
|
9
|
+
const rmtemp_1 = require("../utils/rmtemp");
|
|
9
10
|
exports.default = async (source, options = {
|
|
10
11
|
extensions: '',
|
|
11
12
|
}) => {
|
|
12
|
-
if (!
|
|
13
|
+
if (!fsx.existsSync(source)) {
|
|
13
14
|
throw new Error(`Cannot find source directory ${source}`);
|
|
14
15
|
}
|
|
15
16
|
let extensions = options.extensions;
|
|
16
17
|
if (!extensions) {
|
|
17
18
|
extensions = await (0, merge_helpers_1.getExtensions)();
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
let stitched, tmp;
|
|
21
|
+
try {
|
|
22
|
+
stitched = (0, stitch_1.default)(source);
|
|
23
|
+
const index = path.join(stitched, 'index.graphql');
|
|
24
|
+
const graphql = fsx.readFileSync(index, 'utf8');
|
|
25
|
+
tmp = path.join(os.tmpdir(), `stepzen-lint-${Date.now()}`);
|
|
26
|
+
fsx.ensureDirSync(tmp, 0o700);
|
|
27
|
+
const lintFile = path.join(tmp, 'index.graphql');
|
|
28
|
+
fsx.writeFileSync(lintFile, `${extensions}${os.EOL}${os.EOL}${graphql}`);
|
|
29
|
+
const { stdout } = shell.exec(`npx graphql-schema-linter ${lintFile}`, {
|
|
30
|
+
silent: true,
|
|
31
|
+
});
|
|
27
32
|
console.log(stdout);
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
(0, rmtemp_1.rmtemp)(stitched);
|
|
36
|
+
(0, rmtemp_1.rmtemp)(tmp);
|
|
37
|
+
}
|
|
30
38
|
};
|
|
31
39
|
//# sourceMappingURL=lint.js.map
|
package/lib/actions/lint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/actions/lint.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/actions/lint.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAC/B,yBAAwB;AACxB,6BAA4B;AAC5B,iCAAgC;AAEhC,8CAAsC;AACtC,0DAAoD;AACpD,4CAAsC;AAEtC,kBAAe,KAAK,EAClB,MAAc,EACd,UAEI;IACF,UAAU,EAAE,EAAE;CACf,EACD,EAAE;IACF,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAA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
|
1
|
+
export declare type MergeOptions = {
|
|
5
2
|
answers: any;
|
|
6
3
|
output: string | null;
|
|
7
4
|
silent: boolean;
|
|
@@ -10,6 +7,10 @@ declare const _default: (original: string, imported: {
|
|
|
10
7
|
/** merge behaviour when a schema with the given name exists in the source */
|
|
11
8
|
onConflict?: 'overwrite' | 'append';
|
|
12
9
|
extensions?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
10
|
+
};
|
|
11
|
+
declare const merge: (original: string, imported: {
|
|
12
|
+
name: string;
|
|
13
|
+
source: string;
|
|
14
|
+
}, options?: MergeOptions) => Promise<string>;
|
|
15
|
+
export default merge;
|
|
15
16
|
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/actions/merge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/actions/merge.ts"],"names":[],"mappings":"AA4CA,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,GAAG,CAAA;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;IACf,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAwLD,QAAA,MAAM,KAAK,aACC,MAAM,YACN;IACR,MAAM,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,YACQ,YAAY,oBA4BtB,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/lib/actions/merge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const fsx = require("fs-extra");
|
|
4
4
|
const glob = require("glob");
|
|
5
5
|
const merge_1 = require("@graphql-tools/merge");
|
|
6
6
|
const graphql_1 = require("graphql");
|
|
@@ -12,6 +12,7 @@ const set_files_in_sdl_1 = require("../utils/set-files-in-sdl");
|
|
|
12
12
|
const strip_empty_queries_and_mutations_1 = require("../utils/strip-empty-queries-and-mutations");
|
|
13
13
|
const copy_workspace_content_1 = require("../utils/copy-workspace-content");
|
|
14
14
|
const constants_1 = require("../utils/constants");
|
|
15
|
+
const rmtemp_1 = require("../utils/rmtemp");
|
|
15
16
|
// It's safe to use this special placeholder value here: in case of a failure
|
|
16
17
|
// in the merge / import process it will not reach the workspace folder.
|
|
17
18
|
// All intermediary steps are carried out in a temp folder, and only when all
|
|
@@ -27,19 +28,9 @@ type Query {
|
|
|
27
28
|
__query: String
|
|
28
29
|
}
|
|
29
30
|
`.trim();
|
|
30
|
-
|
|
31
|
-
answers: {},
|
|
32
|
-
output: null,
|
|
33
|
-
silent: false,
|
|
34
|
-
mergeTypes: true,
|
|
35
|
-
onConflict: 'append',
|
|
36
|
-
extensions: '',
|
|
37
|
-
}) => {
|
|
38
|
-
// Make sure there is an output directory
|
|
31
|
+
const doMerge = async (original, imported, options) => {
|
|
39
32
|
if (!options.answers)
|
|
40
33
|
options.answers = {};
|
|
41
|
-
if (!options.output)
|
|
42
|
-
options.output = path.join(os.tmpdir(), `stepzen-tmp-${Date.now()}`);
|
|
43
34
|
if (!options.silent)
|
|
44
35
|
options.silent = false;
|
|
45
36
|
if (options.mergeTypes === undefined)
|
|
@@ -52,17 +43,17 @@ exports.default = async (original, imported, options = {
|
|
|
52
43
|
// C:\Users\Darren\AppData\Local\Temp\stepzen-tmp-config-1638293497187\C:\Users\Darren\AppData\Local\Temp\stepzen-tmp-1638293496286
|
|
53
44
|
options.output = (0, merge_helpers_1.dedupeTempFolder)(options.output);
|
|
54
45
|
// Ensure original, importing and output directories exist
|
|
55
|
-
if (!
|
|
46
|
+
if (!fsx.existsSync(original))
|
|
56
47
|
throw new Error(`Cannot find original directory ${original}`);
|
|
57
|
-
if (!
|
|
48
|
+
if (!fsx.existsSync(imported.source))
|
|
58
49
|
throw new Error(`Cannot find imported source directory ${imported.source}`);
|
|
59
|
-
|
|
50
|
+
fsx.ensureDirSync(options.output, 0o700);
|
|
60
51
|
// Copy the original into the output.
|
|
61
52
|
(0, copy_workspace_content_1.default)(original, options.output);
|
|
62
53
|
// Ensure an index.graphql exists
|
|
63
54
|
const outputIndex = path.join(options.output, 'index.graphql');
|
|
64
|
-
if (!
|
|
65
|
-
|
|
55
|
+
if (!fsx.existsSync(outputIndex)) {
|
|
56
|
+
fsx.writeFileSync(outputIndex, options.mergeTypes
|
|
66
57
|
? // (2022-03-09, vluakshov) Not sure what'd break without the
|
|
67
58
|
// blank Query type, but that's why I do not want to remove it
|
|
68
59
|
// from the default code path.
|
|
@@ -96,11 +87,11 @@ exports.default = async (original, imported, options = {
|
|
|
96
87
|
});
|
|
97
88
|
const details = {
|
|
98
89
|
original: glob.sync('**/*.graphql', { cwd: options.output }).map(file => {
|
|
99
|
-
const content =
|
|
90
|
+
const content = fsx.readFileSync(`${options.output}/${file}`, 'utf8');
|
|
100
91
|
return { ast: (0, graphql_1.parse)(content), file };
|
|
101
92
|
}),
|
|
102
93
|
imported: glob.sync('**/*.graphql', { cwd: imported.source }).map(file => {
|
|
103
|
-
const content =
|
|
94
|
+
const content = fsx.readFileSync(`${imported.source}/${file}`, 'utf8');
|
|
104
95
|
return { ast: (0, graphql_1.parse)(content), file };
|
|
105
96
|
}),
|
|
106
97
|
};
|
|
@@ -142,15 +133,15 @@ exports.default = async (original, imported, options = {
|
|
|
142
133
|
// eslint-disable-next-line
|
|
143
134
|
const file = path.join(options.output, a.file);
|
|
144
135
|
const deduped = (0, merge_helpers_1.dedupeTempFolder)(file);
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
fsx.ensureFileSync(deduped);
|
|
137
|
+
fsx.writeFileSync(deduped, (0, print_1.default)(a.ast));
|
|
147
138
|
});
|
|
148
139
|
cleaned.imported.forEach(a => {
|
|
149
140
|
// eslint-disable-next-line
|
|
150
141
|
const file = path.join(options.output, targetSubfolder, a.file);
|
|
151
142
|
const deduped = (0, merge_helpers_1.dedupeTempFolder)(file);
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
fsx.ensureFileSync(deduped);
|
|
144
|
+
fsx.writeFileSync(deduped, (0, print_1.default)(a.ast));
|
|
154
145
|
importedGraphQLFiles.push(path.relative(options.output, deduped));
|
|
155
146
|
});
|
|
156
147
|
}
|
|
@@ -158,8 +149,8 @@ exports.default = async (original, imported, options = {
|
|
|
158
149
|
glob.sync('**/*.graphql', { cwd: imported.source }).forEach(relativePath => {
|
|
159
150
|
const importedFullPath = path.join(imported.source, relativePath);
|
|
160
151
|
const targetFullPath = path.join(options.output, targetSubfolder, relativePath);
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
fsx.ensureDirSync(path.dirname(targetFullPath));
|
|
153
|
+
fsx.copyFileSync(importedFullPath, targetFullPath);
|
|
163
154
|
importedGraphQLFiles.push(path.relative(options.output, targetFullPath));
|
|
164
155
|
});
|
|
165
156
|
}
|
|
@@ -169,9 +160,34 @@ exports.default = async (original, imported, options = {
|
|
|
169
160
|
const config = await (0, merge_helpers_1.getConfiguration)([options.output, imported.source], options.silent, options.answers);
|
|
170
161
|
if (config) {
|
|
171
162
|
const configFile = path.join(options.output, 'config.yaml');
|
|
172
|
-
|
|
163
|
+
fsx.writeFileSync(configFile, config, { mode: 0o600 });
|
|
173
164
|
}
|
|
174
165
|
// Return a merged schema!
|
|
175
166
|
return options.output;
|
|
176
167
|
};
|
|
168
|
+
const merge = (original, imported, options = {
|
|
169
|
+
answers: {},
|
|
170
|
+
output: null,
|
|
171
|
+
silent: false,
|
|
172
|
+
mergeTypes: true,
|
|
173
|
+
onConflict: 'append',
|
|
174
|
+
extensions: '',
|
|
175
|
+
}) => {
|
|
176
|
+
// Make sure there is an output directory
|
|
177
|
+
if (options.output) {
|
|
178
|
+
return doMerge(original, imported, options);
|
|
179
|
+
}
|
|
180
|
+
const output = path.join(os.tmpdir(), `stepzen-tmp-${Date.now()}`);
|
|
181
|
+
try {
|
|
182
|
+
return doMerge(original, imported, { ...options, output });
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
// In case of an error delete the temp output folder created earlier so that
|
|
186
|
+
// it does not "leak". In case of a success, deleting the output folder is
|
|
187
|
+
// the caller responsibility.
|
|
188
|
+
(0, rmtemp_1.rmtemp)(output);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
exports.default = merge;
|
|
177
193
|
//# sourceMappingURL=merge.js.map
|
package/lib/actions/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/actions/merge.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/actions/merge.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAC/B,6BAA4B;AAC5B,gDAAkD;AAClD,qCAAoC;AACpC,yBAAwB;AACxB,6BAA4B;AAE5B,0DAY+B;AAC/B,mCAA2B;AAC3B,gEAAqD;AACrD,kGAAsF;AACtF,4EAAkE;AAClE,kDAAoD;AACpD,4CAAsC;AAEtC,6EAA6E;AAC7E,wEAAwE;AACxE,6EAA6E;AAC7E,uEAAuE;AACvE,oBAAoB;AACpB,MAAM,oBAAoB,GAAG;uBACN,6BAAiB;;;CAGvC,CAAC,IAAI,EAAE,CAAA;AAER,MAAM,gBAAgB,GAAG;;;;CAIxB,CAAC,IAAI,EAAE,CAAA;AAaR,MAAM,OAAO,GAAG,KAAK,EACnB,QAAgB,EAChB,QAGC,EACD,OAAwC,EACxC,EAAE;IACF,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,CAAC,OAAO,GAAG,EAAE,CAAA;IAC1C,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,MA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C,GAAG,OAAO,EAAE,MAAM,EAAC,CAAC,CAAA;KACzD;IAAC,OAAO,KAAK,EAAE;QACd,4EAA4E;QAC5E,0EAA0E;QAC1E,6BAA6B;QAC7B,IAAA,eAAM,EAAC,MAAM,CAAC,CAAA;QACd,MAAM,KAAK,CAAA;KACZ;AACH,CAAC,CAAA;AAED,kBAAe,KAAK,CAAA"}
|
package/lib/actions/stitch.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const stitch: (source: string, output?: string) => string;
|
|
2
|
+
export default stitch;
|
|
3
3
|
//# sourceMappingURL=stitch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stitch.d.ts","sourceRoot":"","sources":["../../src/actions/stitch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stitch.d.ts","sourceRoot":"","sources":["../../src/actions/stitch.ts"],"names":[],"mappings":"AAgHA,QAAA,MAAM,MAAM,WAAY,MAAM,WAAW,MAAM,WAe9C,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/lib/actions/stitch.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const lodash_1 = require("lodash");
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
|
-
const
|
|
5
|
+
const fsx = require("fs-extra");
|
|
6
6
|
const glob = require("glob");
|
|
7
7
|
const os = require("os");
|
|
8
8
|
const path = require("path");
|
|
@@ -10,18 +10,19 @@ const prettier = require("prettier");
|
|
|
10
10
|
const dedupe_query_and_mutation_types_1 = require("../utils/dedupe-query-and-mutation-types");
|
|
11
11
|
const constants_1 = require("../utils/constants");
|
|
12
12
|
const copy_workspace_content_1 = require("../utils/copy-workspace-content");
|
|
13
|
-
|
|
13
|
+
const rmtemp_1 = require("../utils/rmtemp");
|
|
14
|
+
const doStitch = (source, output) => {
|
|
14
15
|
// Ensure source and output directories exist
|
|
15
|
-
if (!
|
|
16
|
+
if (!fsx.existsSync(source))
|
|
16
17
|
throw new Error(`Cannot find source directory ${source}`);
|
|
17
|
-
|
|
18
|
+
fsx.ensureDirSync(output, 0o700);
|
|
18
19
|
// Get a list of files.
|
|
19
20
|
let ast;
|
|
20
21
|
let files = [];
|
|
21
22
|
// If there's an index.graphQL - get files argument in @sdl directive
|
|
22
23
|
const sourceIndex = path.join(source, 'index.graphql');
|
|
23
|
-
if (
|
|
24
|
-
const index =
|
|
24
|
+
if (fsx.existsSync(sourceIndex)) {
|
|
25
|
+
const index = fsx.readFileSync(sourceIndex, 'utf8');
|
|
25
26
|
ast = (0, graphql_1.parse)(index);
|
|
26
27
|
ast = (0, graphql_1.visit)(ast, {
|
|
27
28
|
Directive(node) {
|
|
@@ -50,7 +51,7 @@ exports.default = (source, output = path.join(os.tmpdir(), `stepzen-tmp-${Date.n
|
|
|
50
51
|
const content = glob
|
|
51
52
|
.sync('**/*.graphql', { cwd: source })
|
|
52
53
|
.map((file) => {
|
|
53
|
-
const graphql =
|
|
54
|
+
const graphql = fsx.readFileSync(`${source}/${file}`, 'utf8');
|
|
54
55
|
return graphql;
|
|
55
56
|
});
|
|
56
57
|
ast = (0, graphql_1.parse)(content.join(os.EOL));
|
|
@@ -65,7 +66,7 @@ exports.default = (source, output = path.join(os.tmpdir(), `stepzen-tmp-${Date.n
|
|
|
65
66
|
// Check all the files exist
|
|
66
67
|
for (const file of files) {
|
|
67
68
|
const find = path.join(source, file);
|
|
68
|
-
if (!
|
|
69
|
+
if (!fsx.existsSync(find)) {
|
|
69
70
|
throw new Error(`Cannot find file ${file} referenced in the @sdl directive in index.graphql`);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -74,7 +75,7 @@ exports.default = (source, output = path.join(os.tmpdir(), `stepzen-tmp-${Date.n
|
|
|
74
75
|
let stitched = `${printed}${os.EOL}`;
|
|
75
76
|
for (const file of files) {
|
|
76
77
|
const find = path.join(source, file);
|
|
77
|
-
const content =
|
|
78
|
+
const content = fsx.readFileSync(find, 'utf8');
|
|
78
79
|
stitched += `${content}${os.EOL}`;
|
|
79
80
|
}
|
|
80
81
|
// Dedupe Query and Mutation types
|
|
@@ -83,14 +84,31 @@ exports.default = (source, output = path.join(os.tmpdir(), `stepzen-tmp-${Date.n
|
|
|
83
84
|
stitched = prettier.format(stitched, { parser: 'graphql' });
|
|
84
85
|
// Write to output folder
|
|
85
86
|
const outputIndex = path.join(output, 'index.graphql');
|
|
86
|
-
|
|
87
|
+
fsx.writeFileSync(outputIndex, stitched);
|
|
87
88
|
// Copy config if exists, too
|
|
88
89
|
const sourceConfig = path.join(source, 'config.yaml');
|
|
89
90
|
const outputConfig = path.join(output, 'config.yaml');
|
|
90
|
-
if (
|
|
91
|
-
|
|
91
|
+
if (fsx.existsSync(sourceConfig)) {
|
|
92
|
+
fsx.copyFileSync(sourceConfig, outputConfig);
|
|
92
93
|
}
|
|
93
94
|
// Return output folder
|
|
94
95
|
return output;
|
|
95
96
|
};
|
|
97
|
+
const stitch = (source, output) => {
|
|
98
|
+
if (output) {
|
|
99
|
+
return doStitch(source, output);
|
|
100
|
+
}
|
|
101
|
+
output = path.join(os.tmpdir(), `stepzen-tmp-${Date.now()}`);
|
|
102
|
+
try {
|
|
103
|
+
return doStitch(source, output);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
// In case of an error delete the temp output folder created earlier so that
|
|
107
|
+
// it does not "leak". In case of a success, deleting the output folder is
|
|
108
|
+
// the caller responsibility.
|
|
109
|
+
(0, rmtemp_1.rmtemp)(output);
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.default = stitch;
|
|
96
114
|
//# sourceMappingURL=stitch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stitch.js","sourceRoot":"","sources":["../../src/actions/stitch.ts"],"names":[],"mappings":";;AAAA,mCAAuC;AACvC,qCAA2C;AAC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AAG,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;KAC7C;IAED,uBAAuB;IACvB,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,MAAe,EAAE,EAAE;IACjD,IAAI,MAAM,EAAE;QACV,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC;IAED,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC5D,IAAI;QACF,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC;IAAC,OAAO,KAAK,EAAE;QACd,4EAA4E;QAC5E,0EAA0E;QAC1E,6BAA6B;QAC7B,IAAA,eAAM,EAAC,MAAM,CAAC,CAAA;QACd,MAAM,KAAK,CAAA;KACZ;AACH,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;iCAC2B,MAAM;;;;;AAApC,wBAsDC"}
|
package/lib/actions/transpile.js
CHANGED
|
@@ -10,6 +10,7 @@ const print_1 = require("../actions/print");
|
|
|
10
10
|
const stitch_1 = require("../actions/stitch");
|
|
11
11
|
const configure_1 = require("./configure");
|
|
12
12
|
const config_1 = require("../mutations/config");
|
|
13
|
+
const rmtemp_1 = require("../utils/rmtemp");
|
|
13
14
|
/**
|
|
14
15
|
* Read a StepZen workspace directory, apply StepZen-specific schema and config
|
|
15
16
|
* transformations, and return its effective GraphQL schema and configuration
|
|
@@ -49,9 +50,14 @@ exports.default = async (source) => {
|
|
|
49
50
|
let schema = '';
|
|
50
51
|
if (graphqlFiles.length > 0) {
|
|
51
52
|
const stitched = await (0, stitch_1.default)(source);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
try {
|
|
54
|
+
const index = path.join(stitched, 'index.graphql');
|
|
55
|
+
const graphql = fs.readFileSync(index, 'utf8');
|
|
56
|
+
schema = (0, print_1.default)((0, graphql_1.parse)(graphql));
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
(0, rmtemp_1.rmtemp)(stitched);
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
62
|
return {
|
|
57
63
|
config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpile.js","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"transpile.js","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":";;AAAA,qCAA6B;AAC7B,iCAAgC;AAChC,+BAA8B;AAC9B,yBAAwB;AACxB,6BAA4B;AAC5B,6BAA4B;AAE5B,4CAAoC;AACpC,8CAAsC;AACtC,2CAAmC;AAEnC,gDAAiD;AACjD,4CAAsC;AAEtC;;;;;;;;;GASG;AACH,kBAAe,KAAK,EAAE,MAAc,EAAE,EAAE;IACtC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,qDAAqD;IACrD,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,OAAO,CAAC,GAAG,EAAE,6CAA6C,CAChF,CAAA;IACD,MAAM,CAAC,MAAM,EAAE,CAAA;IACf,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzC,6CAA6C,CAChD,CAAA;IACD,MAAM,CAAC,MAAM,CAAC,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use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const graphql_1 = require("graphql");
|
|
4
|
-
const
|
|
4
|
+
const fsx = require("fs-extra");
|
|
5
5
|
const os = require("os");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const ensure_query_and_mutation_types_1 = require("../utils/ensure-query-and-mutation-types");
|
|
@@ -11,16 +11,16 @@ exports.default = (source, options = {
|
|
|
11
11
|
extensions: '',
|
|
12
12
|
}) => {
|
|
13
13
|
// Ensure source and output directories exist
|
|
14
|
-
if (!
|
|
14
|
+
if (!fsx.existsSync(source)) {
|
|
15
15
|
throw new Error(`Cannot find source directory ${source}`);
|
|
16
16
|
}
|
|
17
17
|
// Ensure index.graphql exists
|
|
18
|
-
if (!
|
|
18
|
+
if (!fsx.existsSync(`${source}/index.graphql`)) {
|
|
19
19
|
throw new Error(`Cannot find index.graphql in ${source}`);
|
|
20
20
|
}
|
|
21
21
|
// Get the index.graphql file
|
|
22
22
|
const file = path.join(source, 'index.graphql');
|
|
23
|
-
const index =
|
|
23
|
+
const index = fsx.readFileSync(file, 'utf8');
|
|
24
24
|
// Parse
|
|
25
25
|
let ast = (0, graphql_1.parse)(`${constants_1.EXPERIMENTAL_EXTENSIONS}${os.EOL}${options.extensions}${os.EOL}${index}`, {
|
|
26
26
|
noLocation: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":";;AAAA,qCAAkE;AAClE
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":";;AAAA,qCAAkE;AAClE,gCAA+B;AAC/B,yBAAwB;AACxB,6BAA4B;AAE5B,8FAAkF;AAClF,kDAA0D;AAC1D,8CAAsC;AAEtC,kBAAe,CACb,MAAc,EACd,UAEI;IACF,UAAU,EAAE,EAAE;CACf,EACD,EAAE;IACF,6CAA6C;IAC7C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,8BAA8B;IAC9B,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,gBAAgB,CAAC,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,6BAA6B;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAE5C,QAAQ;IACR,IAAI,GAAG,GAAiB,IAAA,eAAK,EAC3B,GAAG,mCAAuB,GAAG,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,EAC3E;QACE,UAAU,EAAE,IAAI;KACjB,CACF,CAAA;IAED,iEAAiE;IACjE,GAAG,GAAG,IAAA,yCAA2B,EAAC,GAAG,CAAC,CAAA;IAEtC,+BAA+B;IAC/B,IAAA,wBAAc,EAAC,GAAG,CAAC,CAAA;IACnB,IAAA,eAAK,EAAC,GAAG,CAAC,CAAA;IAEV,oBAAoB;IACpB,KAAK,MAAM,SAAS,IAAI,oBAAU,EAAE;QAClC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;KACvB;IAED,cAAc;IACd,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAllGraphQLFiles = void 0;
|
|
4
|
-
const
|
|
4
|
+
const fsx = require("fs-extra");
|
|
5
5
|
const glob = require("glob");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
@@ -24,7 +24,7 @@ const IGNORED_PATTERNS = ['node_modules/**'];
|
|
|
24
24
|
* Exclude special folders, e.g. node_modules
|
|
25
25
|
*/
|
|
26
26
|
exports.default = (srcPath, dstPath) => {
|
|
27
|
-
if (!
|
|
27
|
+
if (!fsx.existsSync(srcPath)) {
|
|
28
28
|
throw new Error(`Cannot find source directory ${srcPath}`);
|
|
29
29
|
}
|
|
30
30
|
(0, lodash_1.flatMap)(WORKSPACE_FILE_PATTERNS, pattern => glob.sync(pattern, {
|
|
@@ -33,8 +33,8 @@ exports.default = (srcPath, dstPath) => {
|
|
|
33
33
|
})).forEach(relativePath => {
|
|
34
34
|
const srcFileFullPath = path.join(srcPath, relativePath);
|
|
35
35
|
const dstFileFullPath = path.join(dstPath, relativePath);
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
fsx.ensureDirSync(path.dirname(dstFileFullPath));
|
|
37
|
+
fsx.copyFileSync(srcFileFullPath, dstFileFullPath);
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
const getAllGraphQLFiles = (srcPath) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-workspace-content.js","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"copy-workspace-content.js","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":";;;AAAA,gCAA+B;AAC/B,6BAA4B;AAC5B,6BAA4B;AAC5B,mCAA8B;AAC9B,2CAA6C;AAE7C,MAAM,uBAAuB,GAAG;IAC9B,cAAc;IACd,qBAAqB;IACrB,aAAa;CACd,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,kBAAe,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;IAClD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAA;KAC3D;IAED,IAAA,gBAAO,EAAC,uBAAuB,EAAE,OAAO,CAAC,EAAE,CACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACjB,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,gBAAgB;KACzB,CAAC,CACH,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACvB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACxD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACxD,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;QAChD,GAAG,CAAC,YAAY,CAAC,eAAe,EAAE,eAAe,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEM,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE;IACpD,OAAO,IAAI;SACR,IAAI,CAAC,6BAAiB,EAAE,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC;SACvC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,eAAe,CAAC,CAAA;AAC7C,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/merge-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,aAAa,EAAQ,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"merge-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/merge-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,aAAa,EAAQ,MAAM,SAAS,CAAA;AAgBnD,eAAO,MAAM,gBAAgB,YAAa,MAAM,WAQ/C,CAAA;AAED,eAAO,MAAM,0BAA0B,WAAY,MAAM,QAAQ,MAAM,WAStE,CAAA;AAED,eAAO,MAAM,yBAAyB,SAC9B,MAAM,SACL,GAAG,KACT,OAcF,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAU,MAAM,SAAS,GAAG,KAAG,OAc3D,CAAA;AAED,eAAO,MAAM,gBAAgB,gBACd,MAAM,EAAE,WACb,OAAO,YACN,GAAG,KACX,QAAQ,MAAM,GAAG,OAAO,CA6B1B,CAAA;AAED,eAAO,MAAM,aAAa,QAAa,QAAQ,MAAM,CAuBpD,CAAA;AAED,eAAO,MAAM,SAAS,cACT,MAAM,cACL,MAAM,KACjB,QAAQ,aAAa,CAGvB,CAAA;AAED,eAAO,MAAM,4BAA4B,SAAU,GAAG,SAAS,GAAG,QAiBjE,CAAA;AAED,eAAO,MAAM,mBAAmB,SAAU,GAAG,SAAS,GAAG,QAmBxD,CAAA;AAED,eAAO,MAAM,6BAA6B,SAAU,MAAM,SAAS,GAAG,QAcrE,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAU,MAAM,SAAS,GAAG,QAc5D,CAAA"}
|