Skip to content

Commit

Permalink
feat: upgrade cosmiconfig-typescript-loader (#1126)
Browse files Browse the repository at this point in the history
* feat: upgrade cosmiconfig-typescript-loader

* format stuff

* chore(dependencies): updated changesets for modified dependencies

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
n1ru4l and github-actions[bot] committed Aug 26, 2022
1 parent 318c9fd commit cc781c4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .changeset/graphql-config-1126-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"graphql-config": patch
---

dependencies updates:

- Updated dependency [`cosmiconfig-typescript-loader@^4.0.0` ↗︎](https://www.npmjs.com/package/cosmiconfig-typescript-loader/v/null) (from `^3.1.0`, in `dependencies`)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@graphql-tools/utils": "^8.6.5",
"cosmiconfig": "7.0.1",
"cosmiconfig-toml-loader": "1.0.0",
"cosmiconfig-typescript-loader": "^3.1.0",
"cosmiconfig-typescript-loader": "^4.0.0",
"minimatch": "4.2.1",
"ts-node": "^10.8.1",
"string-env-interpolation": "1.0.1",
Expand Down
6 changes: 2 additions & 4 deletions src/helpers/cosmiconfig.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { cosmiconfig, cosmiconfigSync, Loader, defaultLoaders } from 'cosmiconfig';
import unsecure_loadTs from 'cosmiconfig-typescript-loader';
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader';
import { loadToml } from 'cosmiconfig-toml-loader';
import { env } from 'string-env-interpolation';

/** The underlying module gives us { default: } on ESM but no default on CJS :) */
const loadTs: typeof unsecure_loadTs = (unsecure_loadTs as any)?.default ?? unsecure_loadTs;
export interface ConfigSearchResult {
config: any;
filepath: string;
Expand Down Expand Up @@ -83,7 +81,7 @@ function prepareCosmiconfig(moduleName: string, { legacy }: { legacy: boolean })
return {
searchPlaces: searchPlaces.map((place) => place.replace('#', moduleName)),
loaders: {
'.ts': loadTs(),
'.ts': TypeScriptLoader(),
'.js': defaultLoaders['.js'],
'.json': loadJson,
'.yaml': loadYaml,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export { GraphQLExtensionDeclaration } from './extension.js';
export { Source, Loader } from '@graphql-tools/utils';
export * from './types.js';
export * from './errors.js';
export { LoadersRegistry } from "./loaders.js"
export { LoadersRegistry } from './loaders.js';
8 changes: 1 addition & 7 deletions test/loaders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock('@graphql-tools/load', () => {
}
`);

schema.isTheOne = true
schema.isTheOne = true;

return {
loadTypedefs: jest.fn(() => {
Expand All @@ -36,9 +36,6 @@ jest.mock('@graphql-tools/load', () => {
};
});




describe('middlewares', () => {
test('loads Sources instead of GraphQLSchema when middlewares are defined', () => {
const registry = new LoadersRegistry({ cwd: __dirname });
Expand Down Expand Up @@ -78,12 +75,9 @@ describe('middlewares', () => {

expect(received.isTheOne).toEqual(true);
expect(receivedAsync.isTheOne).toEqual(true);

});
});



class CustomLoader implements Loader {
private schema: GraphQLSchema;

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2790,10 +2790,10 @@ cosmiconfig-toml-loader@1.0.0:
dependencies:
"@iarna/toml" "^2.2.5"

cosmiconfig-typescript-loader@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-3.1.1.tgz#9cdc2ae1a219cf52b0bc0647596c6691b9ab56a3"
integrity sha512-SR5/NciF0vyYqcGsmB9WJ4QOKkcSSSzcBPLrnT6094BYahMy0eImWvlH3zoEOYqpF2zgiyAKHtWTXTo+fqgxPg==
cosmiconfig-typescript-loader@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.0.0.tgz#4a6d856c1281135197346a6f64dfa73a9cd9fefa"
integrity sha512-cVpucSc2Tf+VPwCCR7SZzmQTQkPbkk4O01yXsYqXBIbjE1bhwqSyAgYQkRK1un4i0OPziTleqFhdkmOc4RQ/9g==

cosmiconfig@7.0.1:
version "7.0.1"
Expand Down

1 comment on commit cc781c4

@vercel
Copy link

@vercel vercel bot commented on cc781c4 Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.