@gapi/cli 1.8.169 → 1.8.170
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/bash/gql2ts/from-query/dist/subtype.d.ts +1 -1
- package/bash/gql2ts/from-schema/dist/index.d.ts +2 -2
- package/bash/gql2ts/index.js +0 -1
- package/bash/gql2ts/language-typescript/dist/index.d.ts +1 -1
- package/bash/gql2ts/util/dist/index.d.ts +11 -11
- package/bash/gql2ts/util/dist/parser.d.ts +1 -1
- package/bash/gql2ts/util/dist/schema.d.ts +3 -3
- package/bash/gql2ts/util/dist/util.d.ts +1 -1
- package/dist/core/helpers/index.d.ts +1 -1
- package/dist/core/helpers/index.js +10 -4
- package/dist/core/helpers/is-windows.js +2 -1
- package/dist/core/helpers/mkdirp.js +11 -11
- package/dist/core/services/args.service.js +3 -3
- package/dist/core/services/config.service.d.ts +1 -1
- package/dist/core/services/config.service.js +3 -3
- package/dist/core/services/environment.service.js +5 -5
- package/dist/core/services/exec.service.d.ts +0 -1
- package/dist/core/services/exec.service.js +4 -4
- package/dist/core/services/readline.service.d.ts +1 -2
- package/dist/core/services/readline.service.js +8 -7
- package/dist/core/services/root.service.js +8 -8
- package/dist/daemon-server/core/services/ipfs/external-importer-systemjs.d.ts +4 -4
- package/dist/daemon-server/core/services/ipfs-hash-map.service.js +9 -8
- package/dist/daemon-server/daemon.config.js +1 -1
- package/dist/main.js +5 -2
- package/dist/tasks/build.js +15 -15
- package/dist/tasks/cloud-code.js +3 -3
- package/dist/tasks/deploy.d.ts +1 -1
- package/dist/tasks/deploy.js +6 -5
- package/dist/tasks/generate/generate.js +10 -10
- package/dist/tasks/generate/runners/abstract.runner.js +3 -4
- package/dist/tasks/generate/runners/schematic.runner.js +1 -1
- package/dist/tasks/generate/ui/emojis.js +17 -17
- package/dist/tasks/generate/ui/index.js +6 -2
- package/dist/tasks/new.js +5 -5
- package/dist/tasks/plugin.js +12 -12
- package/dist/tasks/schema.js +17 -19
- package/dist/tasks/start.js +36 -33
- package/dist/tasks/test.js +5 -3
- package/package.json +13 -13
|
@@ -35,14 +35,14 @@ let GenerateTask = class GenerateTask {
|
|
|
35
35
|
}
|
|
36
36
|
run() {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
let dryRun = index_1.includes('--dry-run');
|
|
39
|
-
const force = index_1.includes('--force');
|
|
38
|
+
let dryRun = (0, index_1.includes)('--dry-run');
|
|
39
|
+
const force = (0, index_1.includes)('--force');
|
|
40
40
|
let internalArguments = '';
|
|
41
41
|
const args = process.argv.slice(3);
|
|
42
42
|
let method = '';
|
|
43
|
-
const sourceRoot = index_1.nextOrDefault('--source-root', 'src/app');
|
|
44
|
-
const language = index_1.nextOrDefault('--language', 'ts');
|
|
45
|
-
let schematicsName = index_1.nextOrDefault('--schematics-name', '@gapi/schematics');
|
|
43
|
+
const sourceRoot = (0, index_1.nextOrDefault)('--source-root', 'src/app');
|
|
44
|
+
const language = (0, index_1.nextOrDefault)('--language', 'ts');
|
|
45
|
+
let schematicsName = (0, index_1.nextOrDefault)('--schematics-name', '@gapi/schematics');
|
|
46
46
|
const schematicsConfig = this.configService.getSchematicsConfig();
|
|
47
47
|
if (schematicsConfig.name) {
|
|
48
48
|
schematicsName = schematicsConfig.name;
|
|
@@ -89,7 +89,7 @@ let GenerateTask = class GenerateTask {
|
|
|
89
89
|
}
|
|
90
90
|
if (args[0] === 'pg' || args[0] === 'plugin') {
|
|
91
91
|
method = 'plugin';
|
|
92
|
-
internalArguments = `--method=${index_1.nextOrDefault('--method', 'GET')}`;
|
|
92
|
+
internalArguments = `--method=${(0, index_1.nextOrDefault)('--method', 'GET')}`;
|
|
93
93
|
}
|
|
94
94
|
if (!method) {
|
|
95
95
|
throw new Error('Method not specified');
|
|
@@ -103,11 +103,11 @@ let GenerateTask = class GenerateTask {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
+
exports.GenerateTask = GenerateTask;
|
|
106
107
|
__decorate([
|
|
107
|
-
core_1.Injector(config_service_1.ConfigService),
|
|
108
|
+
(0, core_1.Injector)(config_service_1.ConfigService),
|
|
108
109
|
__metadata("design:type", config_service_1.ConfigService)
|
|
109
110
|
], GenerateTask.prototype, "configService", void 0);
|
|
110
|
-
GenerateTask = __decorate([
|
|
111
|
-
core_1.Service()
|
|
111
|
+
exports.GenerateTask = GenerateTask = __decorate([
|
|
112
|
+
(0, core_1.Service)()
|
|
112
113
|
], GenerateTask);
|
|
113
|
-
exports.GenerateTask = GenerateTask;
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AbstractRunner = void 0;
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
14
13
|
const chalk_1 = require("chalk");
|
|
15
14
|
const child_process_1 = require("child_process");
|
|
16
15
|
const ui_1 = require("../ui");
|
|
@@ -18,8 +17,8 @@ class AbstractRunner {
|
|
|
18
17
|
constructor(binary) {
|
|
19
18
|
this.binary = binary;
|
|
20
19
|
}
|
|
21
|
-
run(
|
|
22
|
-
return __awaiter(this,
|
|
20
|
+
run(command_1) {
|
|
21
|
+
return __awaiter(this, arguments, void 0, function* (command, collect = false, cwd = process.cwd()) {
|
|
23
22
|
const args = [command];
|
|
24
23
|
const options = {
|
|
25
24
|
cwd,
|
|
@@ -27,7 +26,7 @@ class AbstractRunner {
|
|
|
27
26
|
shell: true,
|
|
28
27
|
};
|
|
29
28
|
return new Promise((resolve, reject) => {
|
|
30
|
-
const child = child_process_1.spawn(`${this.binary}`, args, options);
|
|
29
|
+
const child = (0, child_process_1.spawn)(`${this.binary}`, args, options);
|
|
31
30
|
if (collect) {
|
|
32
31
|
child.stdout.on('data', (data) => resolve(data.toString().replace(/\r\n|\n/, '')));
|
|
33
32
|
}
|
|
@@ -5,7 +5,7 @@ const path_1 = require("path");
|
|
|
5
5
|
const abstract_runner_1 = require("./abstract.runner");
|
|
6
6
|
class SchematicRunner extends abstract_runner_1.AbstractRunner {
|
|
7
7
|
constructor() {
|
|
8
|
-
super(`"${path_1.join(__dirname, '../../../..', 'node_modules/.bin/schematics')}"`);
|
|
8
|
+
super(`"${(0, path_1.join)(__dirname, '../../../..', 'node_modules/.bin/schematics')}"`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SchematicRunner = SchematicRunner;
|
|
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.emojis = void 0;
|
|
4
4
|
const node_emoji_1 = require("node-emoji");
|
|
5
5
|
exports.emojis = {
|
|
6
|
-
HEART: node_emoji_1.get('heart'),
|
|
7
|
-
COFFEE: node_emoji_1.get('coffee'),
|
|
8
|
-
BEER: node_emoji_1.get('beer'),
|
|
9
|
-
BROKEN_HEART: node_emoji_1.get('broken_heart'),
|
|
10
|
-
CRYING: node_emoji_1.get('crying_cat_face'),
|
|
11
|
-
HEART_EYES: node_emoji_1.get('heart_eyes_cat'),
|
|
12
|
-
JOY: node_emoji_1.get('joy_cat'),
|
|
13
|
-
KISSING: node_emoji_1.get('kissing_cat'),
|
|
14
|
-
SCREAM: node_emoji_1.get('scream_cat'),
|
|
15
|
-
ROCKET: node_emoji_1.get('rocket'),
|
|
16
|
-
SMIRK: node_emoji_1.get('smirk_cat'),
|
|
17
|
-
RAISED_HANDS: node_emoji_1.get('raised_hands'),
|
|
18
|
-
POINT_RIGHT: node_emoji_1.get('point_right'),
|
|
19
|
-
ZAP: node_emoji_1.get('zap'),
|
|
20
|
-
BOOM: node_emoji_1.get('boom'),
|
|
21
|
-
PRAY: node_emoji_1.get('pray'),
|
|
22
|
-
WINE: node_emoji_1.get('wine_glass'),
|
|
6
|
+
HEART: (0, node_emoji_1.get)('heart'),
|
|
7
|
+
COFFEE: (0, node_emoji_1.get)('coffee'),
|
|
8
|
+
BEER: (0, node_emoji_1.get)('beer'),
|
|
9
|
+
BROKEN_HEART: (0, node_emoji_1.get)('broken_heart'),
|
|
10
|
+
CRYING: (0, node_emoji_1.get)('crying_cat_face'),
|
|
11
|
+
HEART_EYES: (0, node_emoji_1.get)('heart_eyes_cat'),
|
|
12
|
+
JOY: (0, node_emoji_1.get)('joy_cat'),
|
|
13
|
+
KISSING: (0, node_emoji_1.get)('kissing_cat'),
|
|
14
|
+
SCREAM: (0, node_emoji_1.get)('scream_cat'),
|
|
15
|
+
ROCKET: (0, node_emoji_1.get)('rocket'),
|
|
16
|
+
SMIRK: (0, node_emoji_1.get)('smirk_cat'),
|
|
17
|
+
RAISED_HANDS: (0, node_emoji_1.get)('raised_hands'),
|
|
18
|
+
POINT_RIGHT: (0, node_emoji_1.get)('point_right'),
|
|
19
|
+
ZAP: (0, node_emoji_1.get)('zap'),
|
|
20
|
+
BOOM: (0, node_emoji_1.get)('boom'),
|
|
21
|
+
PRAY: (0, node_emoji_1.get)('pray'),
|
|
22
|
+
WINE: (0, node_emoji_1.get)('wine_glass'),
|
|
23
23
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./banner"), exports);
|
package/dist/tasks/new.js
CHANGED
|
@@ -74,13 +74,13 @@ let NewTask = class NewTask {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
exec(
|
|
78
|
-
return __awaiter(this,
|
|
77
|
+
exec(repoLink_1) {
|
|
78
|
+
return __awaiter(this, arguments, void 0, function* (repoLink, args = '') {
|
|
79
79
|
yield this.execService.call(`git clone ${repoLink} ${process.argv[3]} && cd ./${process.argv[3]} && npm install ${args ? `&& ${args}` : ''}`);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
NewTask = __decorate([
|
|
84
|
-
core_1.Service()
|
|
85
|
-
], NewTask);
|
|
86
83
|
exports.NewTask = NewTask;
|
|
84
|
+
exports.NewTask = NewTask = __decorate([
|
|
85
|
+
(0, core_1.Service)()
|
|
86
|
+
], NewTask);
|
package/dist/tasks/plugin.js
CHANGED
|
@@ -32,11 +32,11 @@ let PluginTask = class PluginTask {
|
|
|
32
32
|
}
|
|
33
33
|
run() {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (index_1.includes('remove')) {
|
|
36
|
-
return yield this.remove(index_1.nextOrDefault('remove', false));
|
|
35
|
+
if ((0, index_1.includes)('remove')) {
|
|
36
|
+
return yield this.remove((0, index_1.nextOrDefault)('remove', false));
|
|
37
37
|
}
|
|
38
|
-
if (index_1.includes('add')) {
|
|
39
|
-
return yield this.add(index_1.nextOrDefault('add', false));
|
|
38
|
+
if ((0, index_1.includes)('add')) {
|
|
39
|
+
return yield this.add((0, index_1.nextOrDefault)('add', false));
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -67,7 +67,7 @@ let PluginTask = class PluginTask {
|
|
|
67
67
|
yield this.ipfsHashMapService.readHashMap();
|
|
68
68
|
const ipfsModule = this.ipfsHashMapService.find(hash);
|
|
69
69
|
if (ipfsModule) {
|
|
70
|
-
rimraf_1.sync(`${daemon_config_1.GAPI_DAEMON_IPFS_PLUGINS_FOLDER}/${ipfsModule.module.namespace}`);
|
|
70
|
+
(0, rimraf_1.sync)(`${daemon_config_1.GAPI_DAEMON_IPFS_PLUGINS_FOLDER}/${ipfsModule.module.namespace}`);
|
|
71
71
|
this.ipfsHashMapService.remove(hash);
|
|
72
72
|
yield this.ipfsHashMapService.writeHashMapToFile();
|
|
73
73
|
yield this.writeHashesToFile((yield this.readFile()).filter((h) => h !== hash));
|
|
@@ -77,23 +77,23 @@ let PluginTask = class PluginTask {
|
|
|
77
77
|
readFile() {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
let hashes = [];
|
|
80
|
-
if (yield util_1.promisify(fs_1.exists)(daemon_config_1.IPFS_HASHED_MODULES)) {
|
|
81
|
-
hashes = JSON.parse(yield util_1.promisify(fs_1.readFile)(daemon_config_1.IPFS_HASHED_MODULES, { encoding: 'utf8' }));
|
|
80
|
+
if (yield (0, util_1.promisify)(fs_1.exists)(daemon_config_1.IPFS_HASHED_MODULES)) {
|
|
81
|
+
hashes = JSON.parse(yield (0, util_1.promisify)(fs_1.readFile)(daemon_config_1.IPFS_HASHED_MODULES, { encoding: 'utf8' }));
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
yield util_1.promisify(fs_1.writeFile)(daemon_config_1.IPFS_HASHED_MODULES, JSON.stringify([], null, 4), { encoding: 'utf8' });
|
|
84
|
+
yield (0, util_1.promisify)(fs_1.writeFile)(daemon_config_1.IPFS_HASHED_MODULES, JSON.stringify([], null, 4), { encoding: 'utf8' });
|
|
85
85
|
}
|
|
86
86
|
return hashes;
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
writeHashesToFile(hashes) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
yield util_1.promisify(fs_1.writeFile)(daemon_config_1.IPFS_HASHED_MODULES, JSON.stringify(hashes, null, 4), { encoding: 'utf8' });
|
|
91
|
+
yield (0, util_1.promisify)(fs_1.writeFile)(daemon_config_1.IPFS_HASHED_MODULES, JSON.stringify(hashes, null, 4), { encoding: 'utf8' });
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
PluginTask =
|
|
96
|
-
|
|
95
|
+
exports.PluginTask = PluginTask;
|
|
96
|
+
exports.PluginTask = PluginTask = __decorate([
|
|
97
|
+
(0, core_1.Service)(),
|
|
97
98
|
__metadata("design:paramtypes", [ipfs_hash_map_service_1.IpfsHashMapService])
|
|
98
99
|
], PluginTask);
|
|
99
|
-
exports.PluginTask = PluginTask;
|
package/dist/tasks/schema.js
CHANGED
|
@@ -24,7 +24,6 @@ const rxjs_1 = require("rxjs");
|
|
|
24
24
|
const operators_1 = require("rxjs/operators");
|
|
25
25
|
const util_1 = require("util");
|
|
26
26
|
const helpers_1 = require("../core/helpers");
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
28
27
|
const mkdirp_1 = require("../core/helpers/mkdirp");
|
|
29
28
|
const args_service_1 = require("../core/services/args.service");
|
|
30
29
|
const config_service_1 = require("../core/services/config.service");
|
|
@@ -44,7 +43,6 @@ let SchemaTask = class SchemaTask {
|
|
|
44
43
|
return originalConsole.apply(console, [
|
|
45
44
|
'\x1b[36m%s\x1b[0m',
|
|
46
45
|
`${cwd[cwd.length - 1]} =>`,
|
|
47
|
-
// eslint-disable-next-line prefer-rest-params
|
|
48
46
|
...arguments,
|
|
49
47
|
]);
|
|
50
48
|
};
|
|
@@ -73,16 +71,16 @@ let SchemaTask = class SchemaTask {
|
|
|
73
71
|
}
|
|
74
72
|
createDir() {
|
|
75
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
if (!(yield util_1.promisify(fs_1.exists)(this.folder))) {
|
|
77
|
-
yield util_1.promisify(mkdirp_1.mkdirp)(this.folder);
|
|
74
|
+
if (!(yield (0, util_1.promisify)(fs_1.exists)(this.folder))) {
|
|
75
|
+
yield (0, util_1.promisify)(mkdirp_1.mkdirp)(this.folder);
|
|
78
76
|
}
|
|
79
|
-
yield util_1.promisify(mkdirp_1.mkdirp)(daemon_config_1.GAPI_DAEMON_CACHE_FOLDER);
|
|
77
|
+
yield (0, util_1.promisify)(mkdirp_1.mkdirp)(daemon_config_1.GAPI_DAEMON_CACHE_FOLDER);
|
|
80
78
|
});
|
|
81
79
|
}
|
|
82
80
|
collectFragments() {
|
|
83
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
82
|
console.log('[CollectFragments]: fragments collection started');
|
|
85
|
-
return rxjs_1.from(node_fetch_1.default(this.endpoint, {
|
|
83
|
+
return (0, rxjs_1.from)((0, node_fetch_1.default)(this.endpoint, {
|
|
86
84
|
method: 'POST',
|
|
87
85
|
headers: { 'Content-Type': 'application/json' },
|
|
88
86
|
body: JSON.stringify({
|
|
@@ -102,15 +100,15 @@ let SchemaTask = class SchemaTask {
|
|
|
102
100
|
`,
|
|
103
101
|
}),
|
|
104
102
|
}))
|
|
105
|
-
.pipe(operators_1.switchMap((res) => res.json()), operators_1.map((res) => res.data), operators_1.switchMap(({ __schema }) => {
|
|
103
|
+
.pipe((0, operators_1.switchMap)((res) => res.json()), (0, operators_1.map)((res) => res.data), (0, operators_1.switchMap)(({ __schema }) => {
|
|
106
104
|
// here we're filtering out any type information unrelated to unions or interfaces
|
|
107
105
|
const filteredData = __schema.types.filter((type) => type.possibleTypes !== null);
|
|
108
106
|
__schema.types = filteredData;
|
|
109
|
-
return util_1.promisify(fs_1.writeFile)(`${this.folder}/fragmentTypes.ts`, `/* tslint:disable */
|
|
107
|
+
return (0, util_1.promisify)(fs_1.writeFile)(`${this.folder}/fragmentTypes.ts`, `/* tslint:disable */
|
|
110
108
|
/* eslint-disable prettier/prettier */
|
|
111
109
|
export const introspectionQueryResultData = ${JSON.stringify({ __schema }, null, 2)}
|
|
112
110
|
`);
|
|
113
|
-
}), operators_1.tap(() => console.log('[CollectFragments]: fragments collection finished')))
|
|
111
|
+
}), (0, operators_1.tap)(() => console.log('[CollectFragments]: fragments collection finished')))
|
|
114
112
|
.toPromise();
|
|
115
113
|
});
|
|
116
114
|
}
|
|
@@ -121,17 +119,17 @@ export const introspectionQueryResultData = ${JSON.stringify({ __schema }, null,
|
|
|
121
119
|
console.log(`[CollectQueries]: generating temporary documents file ${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`);
|
|
122
120
|
yield this.execService.call(`node ${this.node_modules}/graphql-document-collector/bin/graphql-document-collector '${this.pattern ? this.pattern : '**/*.{graphql,gql}'}' > ${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`);
|
|
123
121
|
console.log(`[CollectQueries]: reading temporary documents file ${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`);
|
|
124
|
-
const readDocumentsTemp = yield util_1.promisify(fs_1.readFile)(`${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`, 'utf-8');
|
|
125
|
-
yield util_1.promisify(fs_1.unlink)(`${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`);
|
|
122
|
+
const readDocumentsTemp = yield (0, util_1.promisify)(fs_1.readFile)(`${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`, 'utf-8');
|
|
123
|
+
yield (0, util_1.promisify)(fs_1.unlink)(`${daemon_config_1.GAPI_DAEMON_CACHE_FOLDER}/${randomString}.json`);
|
|
126
124
|
if (this.argsService.args.includes('--collect-types')) {
|
|
127
125
|
console.log(`[CollectQueries]: generating types`);
|
|
128
126
|
yield this.generateTypes(readDocumentsTemp);
|
|
129
127
|
}
|
|
130
128
|
const parsedDocuments = `/* tslint:disable */\n/* eslint-disable prettier/prettier */ \nexport const DOCUMENTS = ${readDocumentsTemp};`;
|
|
131
129
|
console.log(`[CollectQueries]: writing file to disc ${this.folder}/documents.ts`);
|
|
132
|
-
yield util_1.promisify(fs_1.writeFile)(`${this.folder}/documents.ts`, parsedDocuments, 'utf8');
|
|
130
|
+
yield (0, util_1.promisify)(fs_1.writeFile)(`${this.folder}/documents.ts`, parsedDocuments, 'utf8');
|
|
133
131
|
if (this.argsService.args.includes('--with-compressed')) {
|
|
134
|
-
yield util_1.promisify(fs_1.writeFile)(`${this.folder}/documents.compressed.ts`, 'export const DocumentsCompressed = `' +
|
|
132
|
+
yield (0, util_1.promisify)(fs_1.writeFile)(`${this.folder}/documents.compressed.ts`, 'export const DocumentsCompressed = `' +
|
|
135
133
|
compressor_1.LZWService.compress(JSON.parse(readDocumentsTemp)) +
|
|
136
134
|
'`', 'utf8');
|
|
137
135
|
}
|
|
@@ -141,9 +139,9 @@ export const introspectionQueryResultData = ${JSON.stringify({ __schema }, null,
|
|
|
141
139
|
generateSchema() {
|
|
142
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
141
|
console.log(`[GenerateSchema]: Trying to hit ${this.endpoint} ...`);
|
|
144
|
-
yield this.execService.call(`${helpers_1.isWindows() ? 'set' : 'export'} NODE_TLS_REJECT_UNAUTHORIZED=0 && node ${this.node_modules}/apollo-codegen/lib/cli.js introspect-schema ${this.endpoint} ${this.headers ? `--header "${this.headers}"` : ''} --output ${this.folder}/schema.json`);
|
|
142
|
+
yield this.execService.call(`${(0, helpers_1.isWindows)() ? 'set' : 'export'} NODE_TLS_REJECT_UNAUTHORIZED=0 && node ${this.node_modules}/apollo-codegen/lib/cli.js introspect-schema ${this.endpoint} ${this.headers ? `--header "${this.headers}"` : ''} --output ${this.folder}/schema.json`);
|
|
145
143
|
console.log(`[GenerateSchema]: Endpoint ${this.endpoint} hit!`);
|
|
146
|
-
yield this.execService.call(`${helpers_1.isWindows() ? 'set' : 'export'} NODE_TLS_REJECT_UNAUTHORIZED=0 && node ${this.bashFolder}/gql2ts/index.js ${this.folder}/schema.json -o ${this.folder}/index.ts`);
|
|
144
|
+
yield this.execService.call(`${(0, helpers_1.isWindows)() ? 'set' : 'export'} NODE_TLS_REJECT_UNAUTHORIZED=0 && node ${this.bashFolder}/gql2ts/index.js ${this.folder}/schema.json -o ${this.folder}/index.ts`);
|
|
147
145
|
console.log(`[GenerateSchema]: Typescript interfaces generated inside folder: ${this.folder}/index.d.ts`);
|
|
148
146
|
});
|
|
149
147
|
}
|
|
@@ -177,11 +175,11 @@ export const DocumentTypes = strEnum(${JSON.stringify(savedDocuments)
|
|
|
177
175
|
.replace(/"/g, `'`)
|
|
178
176
|
.replace(/,/g, ',\n')});
|
|
179
177
|
export type DocumentTypes = keyof typeof DocumentTypes;`;
|
|
180
|
-
return yield util_1.promisify(fs_1.writeFile)(`${this.folder}/documentTypes.ts`, types, 'utf8');
|
|
178
|
+
return yield (0, util_1.promisify)(fs_1.writeFile)(`${this.folder}/documentTypes.ts`, types, 'utf8');
|
|
181
179
|
});
|
|
182
180
|
}
|
|
183
181
|
};
|
|
184
|
-
SchemaTask = __decorate([
|
|
185
|
-
core_1.Service()
|
|
186
|
-
], SchemaTask);
|
|
187
182
|
exports.SchemaTask = SchemaTask;
|
|
183
|
+
exports.SchemaTask = SchemaTask = __decorate([
|
|
184
|
+
(0, core_1.Service)()
|
|
185
|
+
], SchemaTask);
|
package/dist/tasks/start.js
CHANGED
|
@@ -16,6 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.StartTask = void 0;
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
19
20
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
21
|
const core_1 = require("@rxdi/core");
|
|
21
22
|
const fs_1 = require("fs");
|
|
@@ -40,8 +41,8 @@ let StartTask = class StartTask {
|
|
|
40
41
|
this.verbose = '';
|
|
41
42
|
this.quiet = true;
|
|
42
43
|
}
|
|
43
|
-
run(
|
|
44
|
-
return __awaiter(this,
|
|
44
|
+
run() {
|
|
45
|
+
return __awaiter(this, arguments, void 0, function* (stop = {}) {
|
|
45
46
|
if (this.argsService.args.includes('--verbose')) {
|
|
46
47
|
this.verbose = ' --verbose';
|
|
47
48
|
this.quiet = false;
|
|
@@ -60,7 +61,8 @@ let StartTask = class StartTask {
|
|
|
60
61
|
console.log(`'${currentConfigKey}' configuration loaded!`);
|
|
61
62
|
}
|
|
62
63
|
else if (currentConfiguration) {
|
|
63
|
-
this.config =
|
|
64
|
+
this.config =
|
|
65
|
+
this.environmentService.setVariables(currentConfiguration);
|
|
64
66
|
this.configOriginal = currentConfiguration;
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
@@ -87,11 +89,11 @@ let StartTask = class StartTask {
|
|
|
87
89
|
}
|
|
88
90
|
const sleep = process.argv[5] ? `${process.argv[5]} &&` : '';
|
|
89
91
|
const cwd = process.cwd();
|
|
90
|
-
const htmlFile = fs_1.existsSync(`${cwd}/src/index.html`);
|
|
92
|
+
const htmlFile = (0, fs_1.existsSync)(`${cwd}/src/index.html`);
|
|
91
93
|
const customPath = process.argv[4]
|
|
92
94
|
? process.argv[4].split('--path=')[1]
|
|
93
95
|
: null;
|
|
94
|
-
const customPathExists = yield util_1.promisify(fs_1.exists)(`${cwd}/${customPath}`);
|
|
96
|
+
const customPathExists = yield (0, util_1.promisify)(fs_1.exists)(`${cwd}/${customPath}`);
|
|
95
97
|
const isLintEnabled = this.argsService.args.toString().includes('--lint');
|
|
96
98
|
if (this.argsService.args.toString().includes('--docker')) {
|
|
97
99
|
return yield this.execService.call(`${this.config} && pm2-docker ${cwd}/${customPathExists ? customPath : 'process.yml'} --only APP`);
|
|
@@ -175,10 +177,10 @@ let StartTask = class StartTask {
|
|
|
175
177
|
// variables,
|
|
176
178
|
// });
|
|
177
179
|
// }
|
|
178
|
-
prepareBundler(
|
|
179
|
-
? 'browser'
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
prepareBundler(file_1, _a) {
|
|
181
|
+
return __awaiter(this, arguments, void 0, function* (file, { original, schema }, start = (0, helpers_1.includes)('--start'), buildOnly = (0, helpers_1.includes)('--buildOnly=false') ? false : true, minify = (0, helpers_1.includes)('--minify=false') ? false : true, target = (0, helpers_1.includes)('--target=browser')
|
|
182
|
+
? 'browser'
|
|
183
|
+
: 'node', excludedFolders = []) {
|
|
182
184
|
console.log(file);
|
|
183
185
|
if (schema.excludedFolders.length) {
|
|
184
186
|
excludedFolders = [...excludedFolders, ...schema.excludedFolders];
|
|
@@ -186,29 +188,29 @@ let StartTask = class StartTask {
|
|
|
186
188
|
if (schema.introspectionOutputFolder) {
|
|
187
189
|
excludedFolders.push(schema.introspectionOutputFolder);
|
|
188
190
|
}
|
|
189
|
-
excludedFolders = excludedFolders.map((f) => path_1.normalize(process.cwd() + f).replace('.', ''));
|
|
191
|
+
excludedFolders = excludedFolders.map((f) => (0, path_1.normalize)(process.cwd() + f).replace('.', ''));
|
|
190
192
|
const bundler = new Bundler(file, {
|
|
191
193
|
target,
|
|
192
|
-
outDir: helpers_1.nextOrDefault('--outDir', './dist'),
|
|
194
|
+
outDir: (0, helpers_1.nextOrDefault)('--outDir', './dist'),
|
|
193
195
|
minify,
|
|
194
|
-
outFile: helpers_1.nextOrDefault('--outFile', null),
|
|
196
|
+
outFile: (0, helpers_1.nextOrDefault)('--outFile', null),
|
|
195
197
|
// contentHash: true,
|
|
196
198
|
// detailedReport: true,
|
|
197
|
-
hmr: helpers_1.nextOrDefault('--hmr', false, (v) => Boolean(v)),
|
|
198
|
-
hmrPort: helpers_1.nextOrDefault('--hmr-port', 0),
|
|
199
|
-
hmrHostname: helpers_1.nextOrDefault('--hmr-hostname', 0),
|
|
200
|
-
publicUrl: helpers_1.nextOrDefault('--public-url', '/'),
|
|
201
|
-
scopeHoist: helpers_1.nextOrDefault('--scope-hoist', false, (v) => Boolean(v)),
|
|
202
|
-
cache: helpers_1.nextOrDefault('--cache', true, (v) => Boolean(v)),
|
|
203
|
-
cacheDir: helpers_1.nextOrDefault('--cache-dir', '.cache'),
|
|
204
|
-
sourceMaps: helpers_1.nextOrDefault('--source-maps', true, (v) => Boolean(v)),
|
|
205
|
-
bundleNodeModules: helpers_1.includes('--bundle-modules'),
|
|
206
|
-
autoInstall: helpers_1.nextOrDefault('--auto-install', true, (v) => Boolean(v)),
|
|
199
|
+
hmr: (0, helpers_1.nextOrDefault)('--hmr', false, (v) => Boolean(v)),
|
|
200
|
+
hmrPort: (0, helpers_1.nextOrDefault)('--hmr-port', 0),
|
|
201
|
+
hmrHostname: (0, helpers_1.nextOrDefault)('--hmr-hostname', 0),
|
|
202
|
+
publicUrl: (0, helpers_1.nextOrDefault)('--public-url', '/'),
|
|
203
|
+
scopeHoist: (0, helpers_1.nextOrDefault)('--scope-hoist', false, (v) => Boolean(v)),
|
|
204
|
+
cache: (0, helpers_1.nextOrDefault)('--cache', true, (v) => Boolean(v)),
|
|
205
|
+
cacheDir: (0, helpers_1.nextOrDefault)('--cache-dir', '.cache'),
|
|
206
|
+
sourceMaps: (0, helpers_1.nextOrDefault)('--source-maps', true, (v) => Boolean(v)),
|
|
207
|
+
bundleNodeModules: (0, helpers_1.includes)('--bundle-modules'),
|
|
208
|
+
autoInstall: (0, helpers_1.nextOrDefault)('--auto-install', true, (v) => Boolean(v)),
|
|
207
209
|
});
|
|
208
210
|
const originalOnChange = bundler.onChange.bind(bundler);
|
|
209
211
|
bundler.onChange = function (path) {
|
|
210
212
|
if (excludedFolders.filter((d) => path.substring(0, path.lastIndexOf('/')).includes(d)).length &&
|
|
211
|
-
!helpers_1.includes('--disable-excluded-folders')) {
|
|
213
|
+
!(0, helpers_1.includes)('--disable-excluded-folders')) {
|
|
212
214
|
return;
|
|
213
215
|
}
|
|
214
216
|
return originalOnChange(path);
|
|
@@ -244,12 +246,13 @@ let StartTask = class StartTask {
|
|
|
244
246
|
if (child) {
|
|
245
247
|
killChild();
|
|
246
248
|
}
|
|
247
|
-
if (helpers_1.includes('--lint')) {
|
|
249
|
+
if ((0, helpers_1.includes)('--lint')) {
|
|
248
250
|
let hasError = false;
|
|
249
251
|
try {
|
|
250
252
|
yield this.execService.call('npm run lint');
|
|
251
253
|
}
|
|
252
254
|
catch (e) {
|
|
255
|
+
console.error(e);
|
|
253
256
|
hasError = true;
|
|
254
257
|
}
|
|
255
258
|
if (hasError) {
|
|
@@ -261,18 +264,18 @@ let StartTask = class StartTask {
|
|
|
261
264
|
// await this.execService.call('sleep 1');
|
|
262
265
|
// }
|
|
263
266
|
}
|
|
264
|
-
if (helpers_1.includes('--target=browser')) {
|
|
267
|
+
if ((0, helpers_1.includes)('--target=browser')) {
|
|
265
268
|
return;
|
|
266
269
|
}
|
|
267
270
|
const childArguments = [];
|
|
268
271
|
function defaultInspectConfig(type) {
|
|
269
|
-
console.log(`${type}=${helpers_1.nextOrDefault('--ihost', '127.0.0.1')}:${helpers_1.nextOrDefault('--iport', '9229')}`);
|
|
270
|
-
return `${type}=${helpers_1.nextOrDefault('--ihost', '127.0.0.1')}:${helpers_1.nextOrDefault('--iport', '9229')}`;
|
|
272
|
+
console.log(`${type}=${(0, helpers_1.nextOrDefault)('--ihost', '127.0.0.1')}:${(0, helpers_1.nextOrDefault)('--iport', '9229')}`);
|
|
273
|
+
return `${type}=${(0, helpers_1.nextOrDefault)('--ihost', '127.0.0.1')}:${(0, helpers_1.nextOrDefault)('--iport', '9229')}`;
|
|
271
274
|
}
|
|
272
|
-
if (helpers_1.includes('--inspect-brk')) {
|
|
275
|
+
if ((0, helpers_1.includes)('--inspect-brk')) {
|
|
273
276
|
childArguments.push(defaultInspectConfig('--inspect-brk'));
|
|
274
277
|
}
|
|
275
|
-
else if (helpers_1.includes('--inspect')) {
|
|
278
|
+
else if ((0, helpers_1.includes)('--inspect')) {
|
|
276
279
|
childArguments.push(defaultInspectConfig('--inspect'));
|
|
277
280
|
}
|
|
278
281
|
process.env = Object.assign(process.env, original);
|
|
@@ -289,7 +292,7 @@ let StartTask = class StartTask {
|
|
|
289
292
|
}
|
|
290
293
|
bundle = null;
|
|
291
294
|
}));
|
|
292
|
-
if (helpers_1.includes('--target=browser') && !buildOnly) {
|
|
295
|
+
if ((0, helpers_1.includes)('--target=browser') && !buildOnly) {
|
|
293
296
|
yield bundler.serve();
|
|
294
297
|
}
|
|
295
298
|
else {
|
|
@@ -307,7 +310,7 @@ let StartTask = class StartTask {
|
|
|
307
310
|
return extendedConfiguration;
|
|
308
311
|
}
|
|
309
312
|
};
|
|
310
|
-
StartTask = __decorate([
|
|
311
|
-
core_1.Service()
|
|
312
|
-
], StartTask);
|
|
313
313
|
exports.StartTask = StartTask;
|
|
314
|
+
exports.StartTask = StartTask = __decorate([
|
|
315
|
+
(0, core_1.Service)()
|
|
316
|
+
], StartTask);
|
package/dist/tasks/test.js
CHANGED
|
@@ -59,6 +59,7 @@ let TestTask = class TestTask {
|
|
|
59
59
|
// await execService.call(`${this.config} && jest --watchAll`);
|
|
60
60
|
}
|
|
61
61
|
catch (e) {
|
|
62
|
+
console.error(e);
|
|
62
63
|
process.exit(1);
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -67,6 +68,7 @@ let TestTask = class TestTask {
|
|
|
67
68
|
yield this.execService.call(`${this.config} && npm run lint && jest`);
|
|
68
69
|
}
|
|
69
70
|
catch (e) {
|
|
71
|
+
console.error(e);
|
|
70
72
|
return process.exit(1);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -141,7 +143,7 @@ let TestTask = class TestTask {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
};
|
|
144
|
-
TestTask = __decorate([
|
|
145
|
-
core_1.Service()
|
|
146
|
-
], TestTask);
|
|
147
146
|
exports.TestTask = TestTask;
|
|
147
|
+
exports.TestTask = TestTask = __decorate([
|
|
148
|
+
(0, core_1.Service)()
|
|
149
|
+
], TestTask);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gapi/cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.170",
|
|
4
4
|
"description": "Gapi command line interface",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -35,10 +35,9 @@
|
|
|
35
35
|
"author": "Kristiyan Tachev (@Stradivario)",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"@
|
|
41
|
-
"node-fetch": "^2.1.2",
|
|
38
|
+
"@gapi/schematics": "^1.8.169",
|
|
39
|
+
"@rxdi/compressor": "^0.7.194",
|
|
40
|
+
"@rxdi/core": "^0.7.194",
|
|
42
41
|
"@zeit/ncc": "^0.22.1",
|
|
43
42
|
"apollo-codegen": "0.20.2",
|
|
44
43
|
"chalk": "2.4.2",
|
|
@@ -46,31 +45,32 @@
|
|
|
46
45
|
"cli-spinner": "0.2.8",
|
|
47
46
|
"commander": "8.2.0",
|
|
48
47
|
"figlet": "1.2.1",
|
|
49
|
-
"
|
|
48
|
+
"graphql": "^16.12.0",
|
|
50
49
|
"graphql-document-collector": "0.2.1",
|
|
51
|
-
"
|
|
50
|
+
"humps": "2.0.1",
|
|
52
51
|
"node-emoji": "1.10.0",
|
|
52
|
+
"node-fetch": "^2.1.2",
|
|
53
53
|
"node-notifier": "^5.4.0",
|
|
54
54
|
"parcel-bundler": "1.12.3",
|
|
55
55
|
"pkg": "^4.4.7",
|
|
56
56
|
"rimraf": "2.6.3",
|
|
57
57
|
"shelljs": "0.8.3",
|
|
58
|
-
"
|
|
58
|
+
"systemjs": "0.21.4",
|
|
59
59
|
"yamljs": "0.3.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@types/node-fetch": "^2.5.7",
|
|
63
|
-
"@types/node": "^13.11.1",
|
|
64
|
-
"@types/shelljs": "0.8.5",
|
|
65
62
|
"@types/chokidar": "^2.1.3",
|
|
66
63
|
"@types/fs-extra": "^5.0.5",
|
|
67
|
-
"@types/graphql": "^14.5.0",
|
|
68
64
|
"@types/hapi": "^18.0.2",
|
|
69
65
|
"@types/mkdirp": "^0.5.2",
|
|
66
|
+
"@types/node": "^25.0.3",
|
|
67
|
+
"@types/node-fetch": "^2.5.7",
|
|
70
68
|
"@types/node-notifier": "^5.4.0",
|
|
71
69
|
"@types/rimraf": "^2.0.2",
|
|
70
|
+
"@types/shelljs": "0.8.5",
|
|
71
|
+
"@types/systemjs": "^6.15.4",
|
|
72
72
|
"@types/yamljs": "^0.2.30",
|
|
73
|
-
"typescript": "^
|
|
73
|
+
"typescript": "^5.9.3"
|
|
74
74
|
},
|
|
75
75
|
"snyk": true
|
|
76
76
|
}
|