Skip to content

Commit bdf3a8f

Browse files
committed
rename develop.js => dev
1 parent bcd0778 commit bdf3a8f

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

resources/build-npm.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function buildPackage(outDir: string): Promise<void> {
8888
extension: '.js',
8989
});
9090

91-
const devHelper = path.join(outDir, 'development.js');
91+
const devHelper = path.join(outDir, 'dev/index.js');
9292

9393
for (const prodFile of emittedTSFiles) {
9494
const { dir, base } = path.parse(prodFile);
@@ -107,8 +107,7 @@ async function buildPackage(outDir: string): Promise<void> {
107107
`${dir}/${name}`,
108108
);
109109

110-
const lines =
111-
ext === 'd.ts' ? [] : [`import '${relativePathToProd}/development.js';`];
110+
const lines = ext === 'd.ts' ? [] : [`import '${relativePathToProd}/dev';`];
112111
lines.push(
113112
`export * from '${relativePathToProd}/${relativePathAndName}.js';`,
114113
);

src/dev/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## GraphQL Dev
2+
3+
The `graphql/dev` module is responsible for enabling development mode.
4+
5+
In development mode, GraphQL.js provides additional checks to help avoid developer errors.
6+
7+
```js
8+
import 'graphql/dev'; // ES6
9+
require('graphql/dev'); // CommonJS
10+
```

src/development.ts renamed to src/dev/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { inspect } from './jsutils/inspect.js';
2-
import type { Constructor } from './jsutils/instanceOf.js';
3-
import { symbolForGraphQLInstanceOfCheck } from './jsutils/instanceOf.js';
1+
import { inspect } from '../jsutils/inspect.js';
2+
import type { Constructor } from '../jsutils/instanceOf.js';
3+
import { symbolForGraphQLInstanceOfCheck } from '../jsutils/instanceOf.js';
44

55
/**
66
* An additional check to be included within instanceOf warning when

src/jsutils/__tests__/instanceOf-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33

4-
import { developmentInstanceOfCheck } from '../../development.js';
4+
import { developmentInstanceOfCheck } from '../../dev/index.js';
55

66
import { symbolForGraphQLInstanceOfCheck } from '../instanceOf.js';
77

src/jsutils/instanceOf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const symbolForGraphQLInstanceOfCheck = Symbol.for(
77
* which throws on multiple versions of graphql-js.
88
*
99
* This additional check will be included:
10-
* 1. if 'graphql/development.js' is imported explicitly prior to all
10+
* 1. if 'graphql/dev' is imported explicitly prior to all
1111
* other imports from this library, or
1212
* 2. if the "development" condition is set.
1313
*/

website/pages/docs/development-mode.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Also, unlike earlier versions, development mode is not configured by use of
1616
environment variables, which are accessed in disparate ways in varying environments.
1717
In particular, the `NODE_ENV` environment variable now has no effect on triggering
1818
development mode. Rather, development mode is either enabled:
19-
1. explicitly, by importing `graphql/development.js` prior to other Graphql.JS imports or
19+
1. explicitly, by importing `graphql/dev` prior to other Graphql.JS imports or
2020
2. implicitly, by setting the 'development' condition, which is possible only in
2121
environments that support `package.json` conditional exports and custom conditions.
2222

@@ -60,20 +60,20 @@ that should catch most cases of multiple GraphQL.js modules being used in the sa
6060
This additional validation is unnecessary in production, where the GraphQL.js library is
6161
expected to be have been setup correctly as a single module. So as to avoid the performance
6262
and bundle size overhead this check entails, it is only included when the `development`
63-
exports condition is explicitly enabled or when the `graphql/development.js` module is
63+
exports condition is explicitly enabled or when the `graphql/dev` module is
6464
explicitly imported before any other GraphQL.JS import.
6565

6666
## Enabling Development Mode
6767

6868
### A Catch-All Option: Explicit Enabling of Development Mode
6969

70-
Development mode is activated by importing the `graphql/development.js` module before
70+
Development mode is activated by importing the `graphql/dev` module before
7171
any other GraphQL.js import. Introducing a new bootstrapping entrypoint simplifies this
7272
workflow:
7373

7474
```js
7575
// bootstrap.js
76-
import 'graphql/development.js';
76+
import 'graphql/dev';
7777
import './path/to/my/original-entry-point.js';
7878
```
7979

@@ -83,7 +83,7 @@ The bootstrapping file can be used to enable development mode conditionally:
8383
import process from 'node:process';
8484
// bootstrap.js
8585
if (process.env.NODE_ENV === 'development') {
86-
await import('graphql/development.js');
86+
await import('graphql/dev');
8787
}
8888
import './path/to/my/entry.js';
8989
```

0 commit comments

Comments
 (0)