Skip to content

Commit 2c568f1

Browse files
renovate[bot]n1ru4lgithub-actions[bot]
authored
chore(deps): update dependency bob-the-bundler to v4 (#1103)
* chore(deps): update dependency bob-the-bundler to v4 * v4 ready * use jest resolver :) * pretty shit * feat: add missing deps + modernize env * fix: workaround esm/cjs madness :) * add changeset * chore(dependencies): updated changesets for modified dependencies Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Laurin Quast <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent a1845a4 commit 2c568f1

23 files changed

Lines changed: 1329 additions & 266 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"graphql-config": patch
3+
---
4+
5+
dependencies updates:
6+
7+
- Added dependency [`tslib@^2.4.0` ↗︎](https://www.npmjs.com/package/tslib/v/null) (to `dependencies`)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-config': patch
3+
---
4+
5+
Proper ESM/CJS support on Node.js

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: Build
3131
run: yarn build
3232

33+
- name: Integrity check
34+
run: yarn bob check
35+
3336
lint:
3437
name: Lint
3538
uses: the-guild-org/shared-config/.github/workflows/lint.yml@main

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ out.txt
77
package-lock.json
88
.next/
99
*.log
10+
.bob

babel.config.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', { targets: { node: process.versions.node.split('.')[0] } }],
4+
'@babel/preset-typescript',
5+
],
6+
};

jest.config.cjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
const { pathsToModuleNameMapper } = require('ts-jest');
2+
const { resolve } = require('path');
3+
4+
const ROOT_DIR = __dirname;
5+
const TSCONFIG = resolve(ROOT_DIR, 'tsconfig.json');
6+
const tsconfig = require(TSCONFIG);
7+
18
// For a detailed explanation regarding each configuration property, visit:
29
// https://jestjs.io/docs/en/configuration.html
3-
410
module.exports = {
511
// Automatically clear mock calls and instances between every test
612
clearMocks: true,
@@ -17,6 +23,8 @@ module.exports = {
1723

1824
// An array of file extensions your modules use
1925
moduleFileExtensions: ['ts', 'js'],
26+
modulePathIgnorePatterns: ['dist', '.bob'],
27+
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: `${ROOT_DIR}/` }),
2028

2129
// The test environment that will be used for testing
2230
testEnvironment: 'node',
@@ -25,9 +33,9 @@ module.exports = {
2533
testMatch: ['**/test/**/*.spec.ts'],
2634

2735
// A map from regular expressions to paths to transformers
28-
transform: {
29-
'^.+\\.ts$': 'ts-jest',
30-
},
36+
transform: { '^.+\\.tsx?$': 'babel-jest' },
3137

3238
errorOnDeprecated: true,
39+
40+
resolver: 'bob-the-bundler/jest-resolver.js',
3341
};

package.json

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,40 @@
33
"version": "4.3.3",
44
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)",
55
"sideEffects": false,
6-
"main": "dist/index.js",
7-
"module": "dist/index.mjs",
8-
"typings": "dist/index.d.ts",
6+
"main": "dist/cjs/index.js",
7+
"module": "dist/esm/index.js",
98
"exports": {
109
".": {
11-
"require": "./dist/index.js",
12-
"import": "./dist/index.mjs"
10+
"require": {
11+
"types": "./dist/typings/index.d.cts",
12+
"default": "./dist/cjs/index.js"
13+
},
14+
"import": {
15+
"types": "./dist/typings/index.d.ts",
16+
"default": "./dist/esm/index.js"
17+
},
18+
"default": {
19+
"types": "./dist/typings/index.d.ts",
20+
"default": "./dist/esm/index.js"
21+
}
1322
},
14-
"./*": {
15-
"require": "./dist/*.js",
16-
"import": "./dist/*.mjs"
17-
}
23+
"./package.json": "./package.json"
1824
},
25+
"typings": "dist/typings/index.d.ts",
1926
"typescript": {
20-
"definition": "dist/index.d.ts"
27+
"definition": "dist/typings/index.d.ts"
28+
},
29+
"publishConfig": {
30+
"directory": "dist",
31+
"access": "public"
2132
},
33+
"type": "module",
2234
"scripts": {
2335
"prepublishOnly": "yarn build",
2436
"clean": "rimraf dist",
2537
"postinstall": "patch-package",
2638
"prebuild": "yarn clean && yarn json-schema",
27-
"build": "bob build --single",
28-
"prepack": "bob prepack",
39+
"build": "bob build",
2940
"prettier": "prettier --ignore-path .gitignore --write --list-different .",
3041
"prettier:check": "prettier --ignore-path .gitignore --check .",
3142
"lint": "eslint --ignore-path .gitignore .",
@@ -50,16 +61,21 @@
5061
"cosmiconfig-typescript-loader": "^3.1.0",
5162
"minimatch": "4.2.1",
5263
"ts-node": "^10.8.1",
53-
"string-env-interpolation": "1.0.1"
64+
"string-env-interpolation": "1.0.1",
65+
"tslib": "^2.4.0"
5466
},
5567
"devDependencies": {
68+
"@babel/core": "7.18.13",
69+
"@babel/preset-env": "7.18.10",
70+
"@babel/preset-typescript": "7.18.6",
5671
"@changesets/cli": "2.24.3",
5772
"@changesets/changelog-github": "0.4.6",
5873
"@types/jest": "28.1.7",
5974
"@types/node": "16.11.54",
6075
"@typescript-eslint/eslint-plugin": "5.34.0",
6176
"@typescript-eslint/parser": "5.34.0",
62-
"bob-the-bundler": "1.7.3",
77+
"babel-jest": "28.1.3",
78+
"bob-the-bundler": "4.0.0",
6379
"del": "6.1.1",
6480
"eslint": "8.22.0",
6581
"eslint-config-prettier": "8.5.0",
@@ -73,7 +89,6 @@
7389
"prettier": "2.7.1",
7490
"rimraf": "3.0.2",
7591
"ts-jest": "28.0.8",
76-
"tslib": "2.4.0",
7792
"typescript": "4.7.4",
7893
"typescript-json-schema": "0.54.0"
7994
},
@@ -94,10 +109,12 @@
94109
"url": "https://github.com/kamilkisiela"
95110
},
96111
"license": "MIT",
97-
"buildOptions": {
98-
"copy": [
99-
"config-schema.json"
100-
]
112+
"bob": {
113+
"build": {
114+
"copy": [
115+
"config-schema.json"
116+
]
117+
}
101118
},
102119
"lint-staged": {
103120
"{src,test}/**/*": [
@@ -109,10 +126,6 @@
109126
"pre-commit": "lint-staged"
110127
}
111128
},
112-
"publishConfig": {
113-
"directory": "dist",
114-
"access": "public"
115-
},
116129
"engines": {
117130
"node": ">= 10.0.0"
118131
}

src/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { dirname } from 'path';
2-
import type { IGraphQLConfig, GraphQLConfigResult } from './types';
3-
import { GraphQLProjectConfig } from './project-config';
2+
import type { IGraphQLConfig, GraphQLConfigResult } from './types.js';
3+
import { GraphQLProjectConfig } from './project-config.js';
44
import {
55
isMultipleProjectConfig,
66
isSingleProjectConfig,
@@ -9,11 +9,11 @@ import {
99
getConfigSync,
1010
findConfigSync,
1111
isLegacyProjectConfig,
12-
} from './helpers';
13-
import { ProjectNotFoundError, ConfigNotFoundError, ConfigEmptyError } from './errors';
14-
import { GraphQLExtensionDeclaration, GraphQLExtensionsRegistry } from './extension';
15-
import { EndpointsExtension } from './extensions/endpoints';
16-
import { isLegacyConfig } from './helpers/cosmiconfig';
12+
} from './helpers/index.js';
13+
import { ProjectNotFoundError, ConfigNotFoundError, ConfigEmptyError } from './errors.js';
14+
import { GraphQLExtensionDeclaration, GraphQLExtensionsRegistry } from './extension.js';
15+
import { EndpointsExtension } from './extensions/endpoints.js';
16+
import { isLegacyConfig } from './helpers/cosmiconfig.js';
1717

1818
const cwd = typeof process !== 'undefined' ? process.cwd() : undefined;
1919
const defaultConfigName = 'graphql';

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
22
import { UrlLoader } from '@graphql-tools/url-loader';
33
import { JsonFileLoader } from '@graphql-tools/json-file-loader';
4-
import { LoadersRegistry } from './loaders';
4+
import { LoadersRegistry } from './loaders.js';
55

66
export type GraphQLExtensionDeclaration = (api: ExtensionAPI) => GraphQLConfigExtension;
77

src/extensions/endpoints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { GraphQLExtensionDeclaration } from '../extension';
2-
import type { WithList } from '../types';
1+
import type { GraphQLExtensionDeclaration } from '../extension.js';
2+
import type { WithList } from '../types.js';
33

44
export interface Endpoint {
55
url: string;

0 commit comments

Comments
 (0)