Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit e19ea80

Browse files
build: rename dist directory to match 'graphql-js' (#683)
1 parent 9f67ff0 commit e19ea80

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copied from '.gitignore', please keep it in sync.
22
/node_modules
33
/coverage
4-
/dist
4+
/npmDist
55

66
# Ignore TS files inside integration test
77
/integrationTests/ts/*.ts

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
/node_modules
99
/coverage
10-
/dist
10+
/npmDist

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copied from '.gitignore', please keep it in sync.
22
/node_modules
33
/coverage
4-
/dist
4+
/npmDist

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
".eslintcache",
66
"node_modules",
77
"coverage",
8-
"dist",
8+
"npmDist",
99

1010
// Excluded from spelling check
1111
"cspell.json",

integrationTests/integration-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Integration Tests', () => {
1919
fs.rmdirSync(tmpDir, { recursive: true });
2020
fs.mkdirSync(tmpDir);
2121

22-
const distDir = path.resolve('./dist');
22+
const distDir = path.resolve('./npmDist');
2323
exec(`npm pack ${distDir} && cp express-graphql-*.tgz express-graphql.tgz`, {
2424
cwd: tmpDir,
2525
});

resources/build.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ const tsConfig = require('../tsconfig.json');
1212
const {
1313
transformLoadFileStaticallyFromNPM,
1414
} = require('./load-statically-from-npm');
15-
const { rmdirRecursive, readdirRecursive, showStats } = require('./utils');
15+
const { rmdirRecursive, readdirRecursive, showDirStats } = require('./utils');
1616

1717
if (require.main === module) {
18-
rmdirRecursive('./dist');
19-
fs.mkdirSync('./dist');
18+
rmdirRecursive('./npmDist');
19+
fs.mkdirSync('./npmDist');
2020

2121
const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
2222
const { options } = ts.convertCompilerOptionsFromJson(
23-
tsConfig.compilerOptions,
23+
{ ...tsConfig.compilerOptions, outDir: 'npmDist' },
2424
process.cwd(),
2525
);
2626
const program = ts.createProgram({
@@ -30,16 +30,19 @@ if (require.main === module) {
3030
program.emit(undefined, undefined, undefined, undefined, {
3131
after: [transformLoadFileStaticallyFromNPM],
3232
});
33-
downlevel('./dist', './dist/ts3.4');
33+
downlevel('./npmDist', './npmDist/ts3.4');
3434

35-
fs.copyFileSync('./LICENSE', './dist/LICENSE');
36-
fs.copyFileSync('./README.md', './dist/README.md');
35+
fs.copyFileSync('./LICENSE', './npmDist/LICENSE');
36+
fs.copyFileSync('./README.md', './npmDist/README.md');
3737

3838
// Should be done as the last step so only valid packages can be published
3939
const packageJSON = buildPackageJSON();
40-
fs.writeFileSync('./dist/package.json', JSON.stringify(packageJSON, null, 2));
40+
fs.writeFileSync(
41+
'./npmDist/package.json',
42+
JSON.stringify(packageJSON, null, 2),
43+
);
4144

42-
showStats();
45+
showDirStats('./npmDist');
4346
}
4447

4548
function buildPackageJSON() {

resources/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ function readdirRecursive(dirPath, opts = {}) {
6767
return result;
6868
}
6969

70-
function showStats() {
70+
function showDirStats(dirPath) {
7171
const fileTypes = {};
7272
let totalSize = 0;
7373

74-
for (const filepath of readdirRecursive('./dist')) {
74+
for (const filepath of readdirRecursive(dirPath)) {
7575
const name = filepath.split(path.sep).pop();
7676
const [base, ...splitExt] = name.split('.');
7777
const ext = splitExt.join('.');
7878

7979
const filetype = ext ? '*.' + ext : base;
8080
fileTypes[filetype] = fileTypes[filetype] || { filepaths: [], size: 0 };
8181

82-
const { size } = fs.lstatSync(path.join('./dist', filepath));
82+
const { size } = fs.lstatSync(path.join(dirPath, filepath));
8383
totalSize += size;
8484
fileTypes[filetype].size += size;
8585
fileTypes[filetype].filepaths.push(filepath);
@@ -118,5 +118,5 @@ module.exports = {
118118
execAsync,
119119
rmdirRecursive,
120120
readdirRecursive,
121-
showStats,
121+
showDirStats,
122122
};

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"noImplicitThis": true,
1111
"strictNullChecks": true,
1212
"strictFunctionTypes": true,
13-
"outDir": "dist",
1413
"declaration": true
1514
}
1615
}

0 commit comments

Comments
 (0)