@graphql-codegen/cli 2.6.0-alpha-679ebe9ab.0 → 2.6.0-alpha-3f811f314.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/bin.js +8 -7
- package/index.js +8 -7
- package/index.mjs +3 -2
- package/package.json +2 -2
- package/utils/file-system.d.ts +2 -2
package/bin.js
CHANGED
|
@@ -57,7 +57,8 @@ const os = require('os');
|
|
|
57
57
|
const Listr = _interopDefault(require('listr'));
|
|
58
58
|
const isGlob = _interopDefault(require('is-glob'));
|
|
59
59
|
const debounce = _interopDefault(require('debounce'));
|
|
60
|
-
const
|
|
60
|
+
const promises = require('fs/promises');
|
|
61
|
+
const mkdirp = _interopDefault(require('mkdirp'));
|
|
61
62
|
const crypto = require('crypto');
|
|
62
63
|
const inquirer = _interopDefault(require('inquirer'));
|
|
63
64
|
const detectIndent = _interopDefault(require('detect-indent'));
|
|
@@ -1257,21 +1258,21 @@ const createWatcher = (initalContext, onNext) => {
|
|
|
1257
1258
|
};
|
|
1258
1259
|
|
|
1259
1260
|
function writeFile(filepath, content) {
|
|
1260
|
-
return
|
|
1261
|
+
return promises.writeFile(filepath, content);
|
|
1261
1262
|
}
|
|
1262
1263
|
function readFile(filepath) {
|
|
1263
|
-
return
|
|
1264
|
+
return promises.readFile(filepath, 'utf-8');
|
|
1264
1265
|
}
|
|
1265
1266
|
async function fileExists(filePath) {
|
|
1266
1267
|
try {
|
|
1267
|
-
return (await
|
|
1268
|
+
return (await promises.stat(filePath)).isFile();
|
|
1268
1269
|
}
|
|
1269
1270
|
catch (err) {
|
|
1270
1271
|
return false;
|
|
1271
1272
|
}
|
|
1272
1273
|
}
|
|
1273
1274
|
function unlinkFile(filePath, cb) {
|
|
1274
|
-
|
|
1275
|
+
fs.unlink(filePath, cb);
|
|
1275
1276
|
}
|
|
1276
1277
|
|
|
1277
1278
|
const hash = (content) => crypto.createHash('sha1').update(content).digest('base64');
|
|
@@ -1331,7 +1332,7 @@ async function generate(input, saveToFile = true) {
|
|
|
1331
1332
|
const basedir = path.dirname(result.filename);
|
|
1332
1333
|
await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
|
|
1333
1334
|
await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
|
|
1334
|
-
await
|
|
1335
|
+
await mkdirp(basedir);
|
|
1335
1336
|
const absolutePath = path.isAbsolute(result.filename)
|
|
1336
1337
|
? result.filename
|
|
1337
1338
|
: path.join(input.cwd || process.cwd(), result.filename);
|
|
@@ -1362,7 +1363,7 @@ async function generate(input, saveToFile = true) {
|
|
|
1362
1363
|
const basedir = path.dirname(result.filename);
|
|
1363
1364
|
await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
|
|
1364
1365
|
await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
|
|
1365
|
-
|
|
1366
|
+
mkdirp.sync(basedir);
|
|
1366
1367
|
const absolutePath = path.isAbsolute(result.filename)
|
|
1367
1368
|
? result.filename
|
|
1368
1369
|
: path.join(input.cwd || process.cwd(), result.filename);
|
package/index.js
CHANGED
|
@@ -58,7 +58,8 @@ const Listr = _interopDefault(require('listr'));
|
|
|
58
58
|
const child_process = require('child_process');
|
|
59
59
|
const isGlob = _interopDefault(require('is-glob'));
|
|
60
60
|
const debounce = _interopDefault(require('debounce'));
|
|
61
|
-
const
|
|
61
|
+
const promises = require('fs/promises');
|
|
62
|
+
const mkdirp = _interopDefault(require('mkdirp'));
|
|
62
63
|
const crypto = require('crypto');
|
|
63
64
|
const inquirer = _interopDefault(require('inquirer'));
|
|
64
65
|
const detectIndent = _interopDefault(require('detect-indent'));
|
|
@@ -1258,21 +1259,21 @@ const createWatcher = (initalContext, onNext) => {
|
|
|
1258
1259
|
};
|
|
1259
1260
|
|
|
1260
1261
|
function writeFile(filepath, content) {
|
|
1261
|
-
return
|
|
1262
|
+
return promises.writeFile(filepath, content);
|
|
1262
1263
|
}
|
|
1263
1264
|
function readFile(filepath) {
|
|
1264
|
-
return
|
|
1265
|
+
return promises.readFile(filepath, 'utf-8');
|
|
1265
1266
|
}
|
|
1266
1267
|
async function fileExists(filePath) {
|
|
1267
1268
|
try {
|
|
1268
|
-
return (await
|
|
1269
|
+
return (await promises.stat(filePath)).isFile();
|
|
1269
1270
|
}
|
|
1270
1271
|
catch (err) {
|
|
1271
1272
|
return false;
|
|
1272
1273
|
}
|
|
1273
1274
|
}
|
|
1274
1275
|
function unlinkFile(filePath, cb) {
|
|
1275
|
-
|
|
1276
|
+
fs.unlink(filePath, cb);
|
|
1276
1277
|
}
|
|
1277
1278
|
|
|
1278
1279
|
const hash = (content) => crypto.createHash('sha1').update(content).digest('base64');
|
|
@@ -1332,7 +1333,7 @@ async function generate(input, saveToFile = true) {
|
|
|
1332
1333
|
const basedir = path.dirname(result.filename);
|
|
1333
1334
|
await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
|
|
1334
1335
|
await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
|
|
1335
|
-
await
|
|
1336
|
+
await mkdirp(basedir);
|
|
1336
1337
|
const absolutePath = path.isAbsolute(result.filename)
|
|
1337
1338
|
? result.filename
|
|
1338
1339
|
: path.join(input.cwd || process.cwd(), result.filename);
|
|
@@ -1363,7 +1364,7 @@ async function generate(input, saveToFile = true) {
|
|
|
1363
1364
|
const basedir = path.dirname(result.filename);
|
|
1364
1365
|
await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
|
|
1365
1366
|
await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
|
|
1366
|
-
|
|
1367
|
+
mkdirp.sync(basedir);
|
|
1367
1368
|
const absolutePath = path.isAbsolute(result.filename)
|
|
1368
1369
|
? result.filename
|
|
1369
1370
|
: path.join(input.cwd || process.cwd(), result.filename);
|
package/index.mjs
CHANGED
|
@@ -25,13 +25,14 @@ import { JsonFileLoader } from '@graphql-tools/json-file-loader';
|
|
|
25
25
|
import { UrlLoader } from '@graphql-tools/url-loader';
|
|
26
26
|
import yaml from 'yaml';
|
|
27
27
|
import { createRequire } from 'module';
|
|
28
|
-
import fs, { promises, writeFileSync, readFileSync } from 'fs';
|
|
28
|
+
import fs, { promises, unlink, writeFileSync, readFileSync } from 'fs';
|
|
29
29
|
import { cpus } from 'os';
|
|
30
30
|
import Listr from 'listr';
|
|
31
31
|
import { exec } from 'child_process';
|
|
32
32
|
import isGlob from 'is-glob';
|
|
33
33
|
import debounce from 'debounce';
|
|
34
|
-
import { writeFile as writeFile$1, readFile as readFile$1, stat
|
|
34
|
+
import { writeFile as writeFile$1, readFile as readFile$1, stat } from 'fs/promises';
|
|
35
|
+
import mkdirp from 'mkdirp';
|
|
35
36
|
import { createHash } from 'crypto';
|
|
36
37
|
import inquirer from 'inquirer';
|
|
37
38
|
import detectIndent from 'detect-indent';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "2.6.0-alpha-
|
|
3
|
+
"version": "2.6.0-alpha-3f811f314.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
6
|
},
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"debounce": "^1.2.0",
|
|
27
27
|
"dependency-graph": "^0.11.0",
|
|
28
28
|
"detect-indent": "^6.0.0",
|
|
29
|
-
"fs-extra": "^9.1.0",
|
|
30
29
|
"glob": "^7.1.6",
|
|
31
30
|
"globby": "^11.0.4",
|
|
32
31
|
"graphql-config": "^4.1.0",
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
"listr-update-renderer": "^0.5.0",
|
|
39
38
|
"log-symbols": "^4.0.0",
|
|
40
39
|
"minimatch": "^3.0.4",
|
|
40
|
+
"mkdirp": "^1.0.4",
|
|
41
41
|
"string-env-interpolation": "^1.0.1",
|
|
42
42
|
"ts-log": "^2.2.3",
|
|
43
43
|
"tslib": "~2.3.0",
|
package/utils/file-system.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function writeFile(filepath: string, content: string):
|
|
2
|
-
export declare function readFile(filepath: string):
|
|
1
|
+
export declare function writeFile(filepath: string, content: string): Promise<void>;
|
|
2
|
+
export declare function readFile(filepath: string): Promise<string>;
|
|
3
3
|
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
4
4
|
export declare function unlinkFile(filePath: string, cb?: (err?: Error) => any): void;
|