@toptal/davinci-graphql-codegen 0.4.1 → 0.4.2-alpha-chore-improve-packages-building-4fb91e1f.10
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/bin/davinci-graphql-codegen.js +2 -2
- package/dist/commands/generate-operations.d.ts +9 -0
- package/dist/commands/generate-operations.js +117 -0
- package/dist/commands/generate-schema.d.ts +9 -0
- package/dist/commands/generate-schema.js +117 -0
- package/dist/config/config.d.ts +33 -0
- package/dist/config/config.js +47 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +3 -0
- package/dist/generate/index.d.ts +3 -0
- package/dist/generate/index.js +4 -0
- package/dist/generate/operations.d.ts +7 -0
- package/dist/generate/operations.js +134 -0
- package/dist/generate/schema.d.ts +6 -0
- package/dist/generate/schema.js +132 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +8 -0
- package/dist/read-config/index.d.ts +2 -0
- package/dist/read-config/index.js +3 -0
- package/dist/read-config/read-config.d.ts +2 -0
- package/dist/read-config/read-config.js +62 -0
- package/dist/services/get-monolith-schema-path.d.ts +6 -0
- package/dist/services/get-monolith-schema-path.js +7 -0
- package/dist/services/get-monorepo-schema-path.d.ts +6 -0
- package/dist/services/get-monorepo-schema-path.js +10 -0
- package/dist/services/get-schema-path.d.ts +6 -0
- package/dist/services/get-schema-path.js +10 -0
- package/dist/services/gs-schema-loader.d.ts +2 -0
- package/dist/services/gs-schema-loader.js +60 -0
- package/dist/services/schema-loader.d.ts +5 -0
- package/dist/services/schema-loader.js +76 -0
- package/dist/utils/detect-schema-source.d.ts +3 -0
- package/dist/utils/detect-schema-source.js +15 -0
- package/dist/utils/get-relative-file-path.d.ts +2 -0
- package/dist/utils/get-relative-file-path.js +5 -0
- package/dist/utils/parse-gs-uri.d.ts +5 -0
- package/dist/utils/parse-gs-uri.js +14 -0
- package/dist/utils/process-args.d.ts +2 -0
- package/dist/utils/process-args.js +17 -0
- package/dist/utils/to-array.d.ts +2 -0
- package/dist/utils/to-array.js +8 -0
- package/package.json +14 -9
- package/CHANGELOG.md +0 -260
- package/dist-package/package.json +0 -43
- package/esbuild.js +0 -16
- package/src/commands/generate-operations.js +0 -43
- package/src/commands/generate-schema.js +0 -39
- package/src/config/config.js +0 -50
- package/src/config/index.js +0 -3
- package/src/generate/index.js +0 -4
- package/src/generate/operations.js +0 -68
- package/src/generate/schema.js +0 -67
- package/src/index.js +0 -8
- package/src/read-config/index.js +0 -3
- package/src/read-config/read-config.js +0 -33
- package/src/services/get-monolith-schema-path.js +0 -11
- package/src/services/get-monorepo-schema-path.js +0 -14
- package/src/services/get-schema-path.js +0 -14
- package/src/services/get-schema-path.test.js +0 -71
- package/src/services/gs-schema-loader.js +0 -20
- package/src/services/schema-loader.js +0 -44
- package/src/utils/detect-schema-source.js +0 -17
- package/src/utils/detect-schema-source.test.js +0 -29
- package/src/utils/get-relative-file-path.js +0 -5
- package/src/utils/parse-gs-uri.js +0 -16
- package/src/utils/parse-gs-uri.test.js +0 -12
- package/src/utils/process-args.js +0 -22
- package/src/utils/process-args.test.js +0 -10
- package/src/utils/to-array.js +0 -9
- package/src/utils/to-array.test.js +0 -15
- package/tsconfig.json +0 -8
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import config = require("./config/config");
|
|
2
|
+
export declare const commands: {
|
|
3
|
+
command: string;
|
|
4
|
+
description: string;
|
|
5
|
+
options: {
|
|
6
|
+
label: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
action: ({ options }: {
|
|
10
|
+
options: any;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
}[];
|
|
13
|
+
export { config };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var codegenGenerateSchemaCreator = require('./commands/generate-schema');
|
|
3
|
+
var codegenGenerateOperationsCreator = require('./commands/generate-operations');
|
|
4
|
+
var config = require('./config');
|
|
5
|
+
module.exports = {
|
|
6
|
+
commands: [codegenGenerateSchemaCreator, codegenGenerateOperationsCreator],
|
|
7
|
+
config: config,
|
|
8
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 chalk = require('chalk');
|
|
39
|
+
var getRelativeFilePath = require('../utils/get-relative-file-path');
|
|
40
|
+
var toArray = require('../utils/to-array');
|
|
41
|
+
var readConfig = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var codegenPath, configFileName, codegenConfig;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
configFileName = config ? config.split('/').pop() : 'codegen.json';
|
|
45
|
+
if (config) {
|
|
46
|
+
console.log("\uD83D\uDD0D Searching for ".concat(chalk.bold(configFileName), " file from custom configuration"));
|
|
47
|
+
codegenPath = getRelativeFilePath(config);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.log("\uD83D\uDD0D Searching for ".concat(chalk.bold(configFileName), " file"));
|
|
51
|
+
codegenPath = getRelativeFilePath(configFileName);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
codegenConfig = require(codegenPath);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error("\u274C There is no ".concat(chalk.bold(configFileName), " file"));
|
|
58
|
+
}
|
|
59
|
+
return [2 /*return*/, toArray(codegenConfig)];
|
|
60
|
+
});
|
|
61
|
+
}); };
|
|
62
|
+
module.exports = readConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var getRelativeFilePath = require('../utils/get-relative-file-path');
|
|
3
|
+
var getMonolithSchemaPath = function (schemaPath) {
|
|
4
|
+
var schemaPathResolution = getRelativeFilePath("".concat(schemaPath, "/schema.graphql"));
|
|
5
|
+
return { target: schemaPath, schemaPath: schemaPath, schemaPathResolution: schemaPathResolution };
|
|
6
|
+
};
|
|
7
|
+
module.exports = getMonolithSchemaPath;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var getMonorepoSchemaPath = function (schema) {
|
|
3
|
+
// @toptal/modularity-template-graphql/talent -> talent
|
|
4
|
+
var target = schema.split('/').pop();
|
|
5
|
+
// @toptal/modularity-template-graphql/talent -> @toptal/modularity-template-graphql
|
|
6
|
+
var schemaPath = schema.split('/').slice(0, 2).join('/');
|
|
7
|
+
var schemaPathResolution = require.resolve("".concat(schemaPath, "/").concat(target, "/schema.graphql"));
|
|
8
|
+
return { target: target, schemaPath: schemaPath, schemaPathResolution: schemaPathResolution };
|
|
9
|
+
};
|
|
10
|
+
module.exports = getMonorepoSchemaPath;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var checkIfMonorepo = require('@toptal/davinci-monorepo').utils.checkIfMonorepo;
|
|
3
|
+
var getMonorepoSchemaPath = require('./get-monorepo-schema-path');
|
|
4
|
+
var getMonolithSchemaPath = require('./get-monolith-schema-path');
|
|
5
|
+
var getSchemaPath = function (schema) {
|
|
6
|
+
return checkIfMonorepo({ considerYarnWorkspaces: true })
|
|
7
|
+
? getMonorepoSchemaPath(schema)
|
|
8
|
+
: getMonolithSchemaPath(schema);
|
|
9
|
+
};
|
|
10
|
+
module.exports = getSchemaPath;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 Storage = require('@google-cloud/storage').Storage;
|
|
39
|
+
var getRelativeFilePath = require('../utils/get-relative-file-path');
|
|
40
|
+
var parseGSURI = require('../utils/parse-gs-uri');
|
|
41
|
+
var gsSchemaLoader = function (projectId, source, destination) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var storage, _a, bucketName, fileName;
|
|
43
|
+
return __generator(this, function (_b) {
|
|
44
|
+
switch (_b.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
storage = new Storage({ projectId: projectId });
|
|
47
|
+
_a = parseGSURI(source), bucketName = _a.bucketName, fileName = _a.fileName;
|
|
48
|
+
return [4 /*yield*/, storage
|
|
49
|
+
.bucket(bucketName)
|
|
50
|
+
.file(fileName)
|
|
51
|
+
.download({
|
|
52
|
+
destination: getRelativeFilePath(destination),
|
|
53
|
+
})];
|
|
54
|
+
case 1:
|
|
55
|
+
_b.sent();
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); };
|
|
60
|
+
module.exports = gsSchemaLoader;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 chalk = require('chalk');
|
|
39
|
+
var _a = require('fs'), existsSync = _a.existsSync, copyFileSync = _a.copyFileSync, mkdirSync = _a.mkdirSync;
|
|
40
|
+
var gsSchemaLoader = require('./gs-schema-loader');
|
|
41
|
+
var getRelativeFilePath = require('../utils/get-relative-file-path');
|
|
42
|
+
var _b = require('../utils/detect-schema-source'), isSchemaFromBucket = _b.isSchemaFromBucket, isLocalSchema = _b.isLocalSchema, isSchemaFromHttp = _b.isSchemaFromHttp;
|
|
43
|
+
module.exports = function (schema, target, projectId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var schemaPath, destinationPathTs;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
if (!existsSync(target)) {
|
|
49
|
+
console.log("📁 Destination target doesn't exist, creating one for you...");
|
|
50
|
+
mkdirSync(target);
|
|
51
|
+
console.log("\u2705 Successfully created [".concat(chalk.green(target), "] target folder"));
|
|
52
|
+
}
|
|
53
|
+
schemaPath = isSchemaFromHttp(schema)
|
|
54
|
+
? schema
|
|
55
|
+
: getRelativeFilePath("".concat(target, "/schema.graphql"));
|
|
56
|
+
if (!isSchemaFromBucket(schema)) return [3 /*break*/, 2];
|
|
57
|
+
return [4 /*yield*/, gsSchemaLoader(projectId, schema, "".concat(target, "/schema.graphql"))];
|
|
58
|
+
case 1:
|
|
59
|
+
_a.sent();
|
|
60
|
+
_a.label = 2;
|
|
61
|
+
case 2:
|
|
62
|
+
if (isLocalSchema(schema)) {
|
|
63
|
+
if (!existsSync(schema)) {
|
|
64
|
+
console.log("Couldn't find a source schema file ".concat(schema));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
copyFileSync(schema, "".concat(target, "/schema.graphql"));
|
|
68
|
+
}
|
|
69
|
+
destinationPathTs = getRelativeFilePath("".concat(target, "/schema.ts"));
|
|
70
|
+
return [2 /*return*/, {
|
|
71
|
+
schema: schemaPath,
|
|
72
|
+
destination: destinationPathTs,
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}); };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var isSchemaFromBucket = function (schema) {
|
|
3
|
+
return schema.startsWith('gs://');
|
|
4
|
+
};
|
|
5
|
+
var isSchemaFromHttp = function (schema) {
|
|
6
|
+
return schema.startsWith('https://');
|
|
7
|
+
};
|
|
8
|
+
var isLocalSchema = function (schema) {
|
|
9
|
+
return !isSchemaFromBucket(schema) && !isSchemaFromHttp(schema);
|
|
10
|
+
};
|
|
11
|
+
module.exports = {
|
|
12
|
+
isSchemaFromBucket: isSchemaFromBucket,
|
|
13
|
+
isSchemaFromHttp: isSchemaFromHttp,
|
|
14
|
+
isLocalSchema: isLocalSchema,
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var parseGSURI = function (source) {
|
|
3
|
+
// Eg: Source Parts -> ['gqlgw-introspection', 'staging_talent_schema', '.graphql']
|
|
4
|
+
var sourceParts = source
|
|
5
|
+
.split(/(?:gs:\/\/)([a-zA-Z-]*)(?:\/)([a-zA-Z-_]*)([.a-zA-Z]*)/)
|
|
6
|
+
.filter(Boolean);
|
|
7
|
+
var bucketName = sourceParts[0];
|
|
8
|
+
var fileName = "".concat(sourceParts.slice(-2).join(''));
|
|
9
|
+
return {
|
|
10
|
+
bucketName: bucketName,
|
|
11
|
+
fileName: fileName,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
module.exports = parseGSURI;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var processArgs = function (args) {
|
|
3
|
+
var obj = {};
|
|
4
|
+
args.forEach(function (arg) {
|
|
5
|
+
if (arg.includes('generate-')) {
|
|
6
|
+
obj.operation = arg;
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// Eg: Parts -> ['projectId', 'toptal-hub']
|
|
10
|
+
var _a = arg
|
|
11
|
+
.split(/(?:--)([a-zA-Z]*)(?:=)([a-zA-Z-]*)/i)
|
|
12
|
+
.filter(Boolean), key = _a[0], value = _a[1];
|
|
13
|
+
obj[key] = value;
|
|
14
|
+
});
|
|
15
|
+
return obj;
|
|
16
|
+
};
|
|
17
|
+
module.exports = processArgs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-graphql-codegen",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2-alpha-chore-improve-packages-building-4fb91e1f.10+4fb91e1f",
|
|
4
4
|
"description": "Codegen",
|
|
5
5
|
"author": "Toptal",
|
|
6
6
|
"license": "ISC",
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
"bin": {
|
|
12
12
|
"davinci-graphql-codegen": "./bin/davinci-graphql-codegen.js"
|
|
13
13
|
},
|
|
14
|
-
"main": "
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"bin"
|
|
18
|
+
],
|
|
15
19
|
"scripts": {
|
|
16
|
-
"build:package": "
|
|
17
|
-
"prepublishOnly": "
|
|
20
|
+
"build:package": "tsc --project tsconfig.json",
|
|
21
|
+
"prepublishOnly": "yarn build:package",
|
|
18
22
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
23
|
},
|
|
20
24
|
"sideEffects": false,
|
|
@@ -29,15 +33,16 @@
|
|
|
29
33
|
"@graphql-codegen/typescript-operations": "^2.3.5",
|
|
30
34
|
"@graphql-codegen/typescript-resolvers": "^2.2.1",
|
|
31
35
|
"@graphql-typed-document-node/core": "^3.1.0",
|
|
32
|
-
"@toptal/davinci-cli-shared": "
|
|
33
|
-
"@toptal/davinci-monorepo": "6.8.
|
|
36
|
+
"@toptal/davinci-cli-shared": "1.10.2-alpha-chore-improve-packages-building-4fb91e1f.10+4fb91e1f",
|
|
37
|
+
"@toptal/davinci-monorepo": "6.8.8-alpha-chore-improve-packages-building-4fb91e1f.10+4fb91e1f",
|
|
34
38
|
"chalk": "^4.1.2",
|
|
35
39
|
"deepmerge": "^4.2.2",
|
|
40
|
+
"fs-extra": "^10.1.0",
|
|
36
41
|
"graphql": "^15.7.1",
|
|
37
|
-
"prettier": "^2.6.2"
|
|
38
|
-
"fs-extra": "^10.1.0"
|
|
42
|
+
"prettier": "^2.6.2"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
45
|
"prettier": "^2.6.2"
|
|
42
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "4fb91e1f662d67db54bd398517433d8c4b994732"
|
|
43
48
|
}
|