@graphql-codegen/cli 2.6.0-alpha-dfbea14f8.0 → 2.6.0-alpha-aa96076e9.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.
Files changed (4) hide show
  1. package/bin.js +4 -34
  2. package/index.js +4 -34
  3. package/index.mjs +4 -34
  4. package/package.json +1 -1
package/bin.js CHANGED
@@ -1310,39 +1310,9 @@ async function generate(input, saveToFile = true) {
1310
1310
  }
1311
1311
  await context.profiler.run(async () => {
1312
1312
  await lifecycleHooks(config.hooks).beforeAllFileWrite(generationResult.map(r => r.filename));
1313
- await Promise.all(generationResult.map(async (result) => {
1314
- const exists = await fileExists(result.filename);
1315
- if (!shouldOverwrite(config, result.filename) && exists) {
1316
- return;
1317
- }
1318
- const content = result.content || '';
1319
- const currentHash = hash(content);
1320
- let previousHash = recentOutputHash.get(result.filename);
1321
- if (!previousHash && exists) {
1322
- previousHash = hash(await readFile(result.filename));
1323
- }
1324
- if (previousHash && currentHash === previousHash) {
1325
- debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1326
- return;
1327
- }
1328
- if (content.length === 0) {
1329
- return;
1330
- }
1331
- recentOutputHash.set(result.filename, currentHash);
1332
- const basedir = path.dirname(result.filename);
1333
- await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1334
- await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1335
- await mkdirp(basedir);
1336
- const absolutePath = path.isAbsolute(result.filename)
1337
- ? result.filename
1338
- : path.join(input.cwd || process.cwd(), result.filename);
1339
- await writeFile(absolutePath, result.content);
1340
- await lifecycleHooks(result.hooks).afterOneFileWrite(result.filename);
1341
- await lifecycleHooks(config.hooks).afterOneFileWrite(result.filename);
1342
- }));
1343
1313
  }, 'Lifecycle: beforeAllFileWrite');
1344
- await context.profiler.run(() => Promise.all(generationResult.map(async (result) => {
1345
- const exists = fileExists(result.filename);
1314
+ await context.profiler.run(async () => await Promise.all(generationResult.map(async (result) => {
1315
+ const exists = await fileExists(result.filename);
1346
1316
  if (!shouldOverwrite(config, result.filename) && exists) {
1347
1317
  return;
1348
1318
  }
@@ -1353,7 +1323,7 @@ async function generate(input, saveToFile = true) {
1353
1323
  previousHash = hash(await readFile(result.filename));
1354
1324
  }
1355
1325
  if (previousHash && currentHash === previousHash) {
1356
- debugLog(`Skipping file (${result.filename}) writing due to identical hash...`);
1326
+ debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1357
1327
  return;
1358
1328
  }
1359
1329
  if (content.length === 0) {
@@ -1363,7 +1333,7 @@ async function generate(input, saveToFile = true) {
1363
1333
  const basedir = path.dirname(result.filename);
1364
1334
  await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1365
1335
  await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1366
- mkdirp.sync(basedir);
1336
+ await mkdirp(basedir);
1367
1337
  const absolutePath = path.isAbsolute(result.filename)
1368
1338
  ? result.filename
1369
1339
  : path.join(input.cwd || process.cwd(), result.filename);
package/index.js CHANGED
@@ -1311,39 +1311,9 @@ async function generate(input, saveToFile = true) {
1311
1311
  }
1312
1312
  await context.profiler.run(async () => {
1313
1313
  await lifecycleHooks(config.hooks).beforeAllFileWrite(generationResult.map(r => r.filename));
1314
- await Promise.all(generationResult.map(async (result) => {
1315
- const exists = await fileExists(result.filename);
1316
- if (!shouldOverwrite(config, result.filename) && exists) {
1317
- return;
1318
- }
1319
- const content = result.content || '';
1320
- const currentHash = hash(content);
1321
- let previousHash = recentOutputHash.get(result.filename);
1322
- if (!previousHash && exists) {
1323
- previousHash = hash(await readFile(result.filename));
1324
- }
1325
- if (previousHash && currentHash === previousHash) {
1326
- debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1327
- return;
1328
- }
1329
- if (content.length === 0) {
1330
- return;
1331
- }
1332
- recentOutputHash.set(result.filename, currentHash);
1333
- const basedir = path.dirname(result.filename);
1334
- await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1335
- await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1336
- await mkdirp(basedir);
1337
- const absolutePath = path.isAbsolute(result.filename)
1338
- ? result.filename
1339
- : path.join(input.cwd || process.cwd(), result.filename);
1340
- await writeFile(absolutePath, result.content);
1341
- await lifecycleHooks(result.hooks).afterOneFileWrite(result.filename);
1342
- await lifecycleHooks(config.hooks).afterOneFileWrite(result.filename);
1343
- }));
1344
1314
  }, 'Lifecycle: beforeAllFileWrite');
1345
- await context.profiler.run(() => Promise.all(generationResult.map(async (result) => {
1346
- const exists = fileExists(result.filename);
1315
+ await context.profiler.run(async () => await Promise.all(generationResult.map(async (result) => {
1316
+ const exists = await fileExists(result.filename);
1347
1317
  if (!shouldOverwrite(config, result.filename) && exists) {
1348
1318
  return;
1349
1319
  }
@@ -1354,7 +1324,7 @@ async function generate(input, saveToFile = true) {
1354
1324
  previousHash = hash(await readFile(result.filename));
1355
1325
  }
1356
1326
  if (previousHash && currentHash === previousHash) {
1357
- debugLog(`Skipping file (${result.filename}) writing due to identical hash...`);
1327
+ debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1358
1328
  return;
1359
1329
  }
1360
1330
  if (content.length === 0) {
@@ -1364,7 +1334,7 @@ async function generate(input, saveToFile = true) {
1364
1334
  const basedir = path.dirname(result.filename);
1365
1335
  await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1366
1336
  await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1367
- mkdirp.sync(basedir);
1337
+ await mkdirp(basedir);
1368
1338
  const absolutePath = path.isAbsolute(result.filename)
1369
1339
  ? result.filename
1370
1340
  : path.join(input.cwd || process.cwd(), result.filename);
package/index.mjs CHANGED
@@ -1284,39 +1284,9 @@ async function generate(input, saveToFile = true) {
1284
1284
  }
1285
1285
  await context.profiler.run(async () => {
1286
1286
  await lifecycleHooks(config.hooks).beforeAllFileWrite(generationResult.map(r => r.filename));
1287
- await Promise.all(generationResult.map(async (result) => {
1288
- const exists = await fileExists(result.filename);
1289
- if (!shouldOverwrite(config, result.filename) && exists) {
1290
- return;
1291
- }
1292
- const content = result.content || '';
1293
- const currentHash = hash(content);
1294
- let previousHash = recentOutputHash.get(result.filename);
1295
- if (!previousHash && exists) {
1296
- previousHash = hash(await readFile(result.filename));
1297
- }
1298
- if (previousHash && currentHash === previousHash) {
1299
- debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1300
- return;
1301
- }
1302
- if (content.length === 0) {
1303
- return;
1304
- }
1305
- recentOutputHash.set(result.filename, currentHash);
1306
- const basedir = dirname(result.filename);
1307
- await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1308
- await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1309
- await mkdirp(basedir);
1310
- const absolutePath = isAbsolute(result.filename)
1311
- ? result.filename
1312
- : join(input.cwd || process.cwd(), result.filename);
1313
- await writeFile(absolutePath, result.content);
1314
- await lifecycleHooks(result.hooks).afterOneFileWrite(result.filename);
1315
- await lifecycleHooks(config.hooks).afterOneFileWrite(result.filename);
1316
- }));
1317
1287
  }, 'Lifecycle: beforeAllFileWrite');
1318
- await context.profiler.run(() => Promise.all(generationResult.map(async (result) => {
1319
- const exists = fileExists(result.filename);
1288
+ await context.profiler.run(async () => await Promise.all(generationResult.map(async (result) => {
1289
+ const exists = await fileExists(result.filename);
1320
1290
  if (!shouldOverwrite(config, result.filename) && exists) {
1321
1291
  return;
1322
1292
  }
@@ -1327,7 +1297,7 @@ async function generate(input, saveToFile = true) {
1327
1297
  previousHash = hash(await readFile(result.filename));
1328
1298
  }
1329
1299
  if (previousHash && currentHash === previousHash) {
1330
- debugLog(`Skipping file (${result.filename}) writing due to identical hash...`);
1300
+ debugLog(`Skipping file (${result.filename}) writing due to indentical hash...`);
1331
1301
  return;
1332
1302
  }
1333
1303
  if (content.length === 0) {
@@ -1337,7 +1307,7 @@ async function generate(input, saveToFile = true) {
1337
1307
  const basedir = dirname(result.filename);
1338
1308
  await lifecycleHooks(result.hooks).beforeOneFileWrite(result.filename);
1339
1309
  await lifecycleHooks(config.hooks).beforeOneFileWrite(result.filename);
1340
- mkdirp.sync(basedir);
1310
+ await mkdirp(basedir);
1341
1311
  const absolutePath = isAbsolute(result.filename)
1342
1312
  ? result.filename
1343
1313
  : join(input.cwd || process.cwd(), result.filename);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "2.6.0-alpha-dfbea14f8.0",
3
+ "version": "2.6.0-alpha-aa96076e9.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
  },