From b18d2b5c563a7a23e1e6ad3b4580d90bddb1a0f1 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Tue, 7 Mar 2023 09:45:14 +0100 Subject: [PATCH] fix sync-env-files.ts, remove `glob` package (#1556) --- package.json | 1 - pnpm-lock.yaml | 28 +++++++++++++--------------- scripts/sync-env-files.ts | 22 +++++----------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index c1a514bdb..ae4fcb4e3 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,6 @@ "eslint-plugin-cypress": "2.12.1", "eslint-plugin-hive": "file:./rules", "eslint-plugin-tailwindcss": "3.10.1", - "glob": "9.2.1", "graphql": "16.6.0", "husky": "8.0.3", "jest-snapshot-serializer-raw": "1.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d20e4b804..2b93bf874 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,27 +5,27 @@ overrides: tsup: 6.5.0 patchedDependencies: - '@tgriesser/schemats@7.0.1': - hash: u3kbucfchakklx3sci2vh6wjau - path: patches/@tgriesser__schemats@7.0.1.patch '@theguild/buddy@0.1.0': hash: ryylgra5xglhidfoiaxehn22hq path: patches/@theguild__buddy@0.1.0.patch + '@tgriesser/schemats@7.0.1': + hash: u3kbucfchakklx3sci2vh6wjau + path: patches/@tgriesser__schemats@7.0.1.patch mjml-core@4.13.0: hash: zxxsxbqejjmcwuzpigutzzq6wa path: patches/mjml-core@4.13.0.patch - '@oclif/core@1.23.0': - hash: zhte2hlj7lfobytjpalcwwo474 - path: patches/@oclif__core@1.23.0.patch - '@graphql-inspector/core@4.0.0': - hash: wf35oaq7brzyeva5aoncxac66a - path: patches/@graphql-inspector__core@4.0.0.patch oclif@3.7.0: hash: rxmtqiusuyruv7tkwux5gvotbm path: patches/oclif@3.7.0.patch '@slonik/migrator@0.11.3': hash: yfpv2xzdmnkrtu2wvaktxf5mmq path: patches/@slonik__migrator@0.11.3.patch + '@oclif/core@1.23.0': + hash: zhte2hlj7lfobytjpalcwwo474 + path: patches/@oclif__core@1.23.0.patch + '@graphql-inspector/core@4.0.0': + hash: wf35oaq7brzyeva5aoncxac66a + path: patches/@graphql-inspector__core@4.0.0.patch '@apollo/federation@0.38.1': hash: rjgakkkphrejw6qrtph4ar24zq path: patches/@apollo__federation@0.38.1.patch @@ -65,7 +65,6 @@ importers: eslint-plugin-cypress: 2.12.1 eslint-plugin-hive: file:./rules eslint-plugin-tailwindcss: 3.10.1 - glob: 9.2.1 graphql: 16.6.0 husky: 8.0.3 jest-snapshot-serializer-raw: 1.2.0 @@ -106,7 +105,6 @@ importers: eslint-plugin-cypress: 2.12.1_eslint@8.35.0 eslint-plugin-hive: file:rules eslint-plugin-tailwindcss: 3.10.1 - glob: 9.2.1 graphql: 16.6.0 husky: 8.0.3 jest-snapshot-serializer-raw: 1.2.0 @@ -13198,16 +13196,16 @@ packages: - '@types/node' dev: false - /@whatwg-node/server/0.7.4: - resolution: {integrity: sha512-0+c3Y1tmMTIz3+cM8GCOXZuJclHlOZrq2uWb9WVnv1sd98pcFQBW9163nmN7cUTyD84c/yMJmEW3F+Ka6zRZgQ==} + /@whatwg-node/server/0.7.3: + resolution: {integrity: sha512-ToaxdIXka8WHre92b1n9Wne/jXPOgg5w17Hx/UqFtL+HM2+0M+AAEz31kY9bjHGaKBfWE8YZwVVIYvGMgb3ARA==} dependencies: '@whatwg-node/fetch': 0.8.2 tslib: 2.5.0 transitivePeerDependencies: - '@types/node' - /@whatwg-node/server/0.7.3: - resolution: {integrity: sha512-ToaxdIXka8WHre92b1n9Wne/jXPOgg5w17Hx/UqFtL+HM2+0M+AAEz31kY9bjHGaKBfWE8YZwVVIYvGMgb3ARA==} + /@whatwg-node/server/0.7.4: + resolution: {integrity: sha512-0+c3Y1tmMTIz3+cM8GCOXZuJclHlOZrq2uWb9WVnv1sd98pcFQBW9163nmN7cUTyD84c/yMJmEW3F+Ka6zRZgQ==} dependencies: '@whatwg-node/fetch': 0.8.2 tslib: 2.5.0 diff --git a/scripts/sync-env-files.ts b/scripts/sync-env-files.ts index 98d1cd13b..f350f4b05 100755 --- a/scripts/sync-env-files.ts +++ b/scripts/sync-env-files.ts @@ -6,14 +6,14 @@ import { constants } from 'fs'; import { access, readFile, writeFile } from 'fs/promises'; import { dirname, join, relative } from 'path'; import { parse } from 'dotenv'; -import glob from 'glob'; +import fg from 'fast-glob'; if (process.env.CI) { console.log('[sync-env-files] CI Detected, skipping'); process.exit(0); } -const force = ['--force', '-f'].includes(process.argv[2] || ''); +const force = ['--force', '-f'].includes(process.argv[2]); const cwd = process.cwd(); async function main() { @@ -79,21 +79,9 @@ async function exists(file: string) { } function findLocalEnvFiles(): Promise { - return new Promise((resolve, reject) => { - glob( - '{packages/**/*/.env.template,integration-tests/.env.template}', - { - ignore: ['**/node_modules/**', '**/dist/**'], - cwd, - }, - (err, files) => { - if (err) { - reject(err); - } else { - resolve(files); - } - }, - ); + return fg('**/.env.template', { + ignore: ['**/node_modules/**', '**/dist/**'], + cwd, }); }