Skip to content

Commit 881fa45

Browse files
authored
feat(deps): upgrade postgraphile-core (#1131)
1 parent ec76c65 commit 881fa45

File tree

7 files changed

+220
-193
lines changed

7 files changed

+220
-193
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ PostGraphile uses [Jest](http://facebook.github.io/jest/) for testing to take
178178
advantage of Jest’s snapshot feature. We test against a local database, so
179179
make sure PostgreSQL is running on `localhost:5432`.
180180

181+
```
182+
createdb postgraphile_test
183+
```
184+
181185
### Graphile Engine
182186

183187
Graphile Engine uses a user-configurable test database. For historic reasons,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"pg": ">=6.1.0 <8",
6464
"pg-connection-string": "^2.0.0",
6565
"pg-sql2": "^4.4.1-alpha.2",
66-
"postgraphile-core": "4.4.2",
66+
"postgraphile-core": "4.4.3",
6767
"subscriptions-transport-ws": "^0.9.15",
6868
"tslib": "^1.5.0",
6969
"ws": "^6.1.3"

scripts/make-assets

Lines changed: 99 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ASSETS_SOURCE_DIR = `${__dirname}/../assets/`;
99
const ASSETS_DEST_DIR = `${__dirname}/../src/assets/`;
1010

1111
async function main() {
12-
console.log("... Making sponsors.json");
12+
console.log('... Making sponsors.json');
1313
const sponsorsMd = fs.readFileSync(`${__dirname}/../SPONSORS.md`, 'utf8');
1414
const lines = sponsorsMd.split('\n');
1515
const tiers = [];
@@ -24,10 +24,11 @@ async function main() {
2424
}
2525
tiers.reverse();
2626
const sponsors = [];
27+
let repeats = 0;
2728
for (let tier = 0; tier < tiers.length; tier++) {
29+
repeats += tier + 1;
2830
for (const sponsor of tiers[tier]) {
2931
// Higher tiers are more likely to appear
30-
const repeats = (tier + 1);
3132
for (let i = 0; i < repeats; i++) {
3233
sponsors.push(sponsor);
3334
}
@@ -36,112 +37,119 @@ async function main() {
3637
sponsors.sort();
3738
fs.writeFileSync(`${__dirname}/../sponsors.json`, JSON.stringify(sponsors, null, 2));
3839

39-
40-
console.log("... Building GraphiQL");
40+
console.log('... Building GraphiQL');
4141

4242
// Step 1: compile GraphiQL
4343
await new Promise((resolve, reject) => {
4444
// Install the older version of GraphQL for GraphiQL
4545
execSync('yarn', {
46-
cwd: `${__dirname}/../postgraphiql`
46+
cwd: `${__dirname}/../postgraphiql`,
4747
});
4848
// Webpack up everything
49-
webpack({
50-
mode: 'production',
51-
target: 'web',
52-
entry: `${__dirname}/../postgraphiql/src/index.js`,
53-
node: {
54-
dgram: 'empty',
55-
fs: 'empty',
56-
net: 'empty',
57-
tls: 'empty',
58-
child_process: 'empty',
59-
},
60-
output: {
61-
path: ASSETS_SOURCE_DIR,
62-
filename: 'graphiql.js'
63-
},
64-
module: {
65-
rules: [
66-
{
67-
test: /\.jsx?$/,
68-
exclude: /node_modules/,
69-
use: {
70-
loader: 'babel-loader',
71-
options: {
72-
presets: ['@babel/preset-env', '@babel/preset-react'],
73-
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-runtime'],
49+
webpack(
50+
{
51+
mode: 'production',
52+
target: 'web',
53+
entry: `${__dirname}/../postgraphiql/src/index.js`,
54+
node: {
55+
dgram: 'empty',
56+
fs: 'empty',
57+
net: 'empty',
58+
tls: 'empty',
59+
child_process: 'empty',
60+
},
61+
output: {
62+
path: ASSETS_SOURCE_DIR,
63+
filename: 'graphiql.js',
64+
},
65+
module: {
66+
rules: [
67+
{
68+
test: /\.jsx?$/,
69+
exclude: /node_modules/,
70+
use: {
71+
loader: 'babel-loader',
72+
options: {
73+
presets: ['@babel/preset-env', '@babel/preset-react'],
74+
plugins: [
75+
'@babel/plugin-proposal-class-properties',
76+
'@babel/plugin-transform-runtime',
77+
],
78+
},
7479
},
7580
},
76-
},
77-
{
78-
test: /\.css$/,
79-
use: [
80-
{loader: 'style-loader'},
81-
{loader: 'css-loader'},
82-
],
83-
},
81+
{
82+
test: /\.css$/,
83+
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
84+
},
85+
],
86+
},
87+
plugins: [
88+
new webpack.DefinePlugin({
89+
// Hack required due to https://unpkg.com/[email protected]/jsutils/instanceOf.js
90+
process: 'false',
91+
'process.env': {
92+
NODE_ENV: '"production"',
93+
},
94+
}),
95+
// Prevent webpack from attempting to import flow stuff (dynamic requires in GraphiQL)
96+
new webpack.ContextReplacementPlugin(
97+
/graphql-language-service-interface[\\/]dist$/,
98+
/^\.\/.*\.js$/
99+
),
100+
new HtmlWebpackPlugin({
101+
filename: 'graphiql.html',
102+
template: `${__dirname}/../postgraphiql/public/index.html`,
103+
inlineSource: '.(js|css)$', // embed all javascript and css inline
104+
inject: 'body',
105+
}),
106+
new HtmlWebpackInlineSourcePlugin(),
84107
],
85108
},
86-
plugins: [
87-
new webpack.DefinePlugin({
88-
// Hack required due to https://unpkg.com/[email protected]/jsutils/instanceOf.js
89-
'process': 'false',
90-
'process.env': {
91-
NODE_ENV: '"production"',
92-
},
93-
}),
94-
// Prevent webpack from attempting to import flow stuff (dynamic requires in GraphiQL)
95-
new webpack.ContextReplacementPlugin(
96-
/graphql-language-service-interface[\\/]dist$/,
97-
/^\.\/.*\.js$/
98-
),
99-
new HtmlWebpackPlugin({
100-
filename: 'graphiql.html',
101-
template: `${__dirname}/../postgraphiql/public/index.html`,
102-
inlineSource: '.(js|css)$', // embed all javascript and css inline
103-
inject: 'body',
104-
}),
105-
new HtmlWebpackInlineSourcePlugin()
106-
]
107-
}, (err, stats) => {
108-
if (err) {
109-
console.error(err);
110-
process.exit(1);
111-
}
112-
if (stats.hasErrors()) {
113-
console.log(stats.toString("minimal"));
114-
process.exit(2);
109+
(err, stats) => {
110+
if (err) {
111+
console.error(err);
112+
process.exit(1);
113+
}
114+
if (stats.hasErrors()) {
115+
console.log(stats.toString('minimal'));
116+
process.exit(2);
117+
}
118+
// We only want the HTML file
119+
fs.unlinkSync(`${ASSETS_SOURCE_DIR}/graphiql.js`);
120+
console.log(stats.toString('minimal'));
121+
resolve();
115122
}
116-
// We only want the HTML file
117-
fs.unlinkSync(`${ASSETS_SOURCE_DIR}/graphiql.js`);
118-
console.log(stats.toString("minimal"));
119-
resolve();
120-
});
123+
);
121124
});
122125

123126
const shouldBeBinary = filename => !filename.match(/\.html$/);
124127

125-
console.log("... Compiling the assets");
128+
console.log('... Compiling the assets');
126129
// Step 2: compile the assets
127130
const files = fs.readdirSync(ASSETS_SOURCE_DIR);
128-
files.filter(f => f[0] !== '.').map(filename => {
129-
const fileContent = fs.readFileSync(`${ASSETS_SOURCE_DIR}/${filename}`);
130-
let output;
131-
if (shouldBeBinary(filename)) {
132-
output = `Buffer.from(\n '${fileContent.toString(
133-
'base64',
134-
)}',\n 'base64'\n)`;
135-
} else {
136-
output = `${JSON.stringify(fileContent.toString('utf8'))}`;
137-
}
138-
fs.writeFileSync(`${ASSETS_DEST_DIR}/${filename}.ts`, `export default process.env.POSTGRAPHILE_OMIT_ASSETS === '1'\n ? null\n : ${output};\n`);
139-
});
131+
files
132+
.filter(f => f[0] !== '.')
133+
.map(filename => {
134+
const fileContent = fs.readFileSync(`${ASSETS_SOURCE_DIR}/${filename}`);
135+
let output;
136+
if (shouldBeBinary(filename)) {
137+
output = `Buffer.from(\n '${fileContent.toString('base64')}',\n 'base64'\n)`;
138+
} else {
139+
output = `${JSON.stringify(fileContent.toString('utf8'))}`;
140+
}
141+
fs.writeFileSync(
142+
`${ASSETS_DEST_DIR}/${filename}.ts`,
143+
`export default process.env.POSTGRAPHILE_OMIT_ASSETS === '1'\n ? null\n : ${output};\n`
144+
);
145+
});
140146
}
141147

142-
143-
main().then(() => {}, err => {
144-
console.error("An error occurred");
145-
console.error(err);
146-
process.exit(3);
147-
});
148+
main().then(
149+
() => {},
150+
err => {
151+
console.error('An error occurred');
152+
console.error(err);
153+
process.exit(3);
154+
}
155+
);

sponsors.json

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
[
22
"8th Light",
33
"8th Light",
4-
"Alec Wenzowski",
5-
"Alec Wenzowski",
4+
"8th Light",
65
"Antwaan Harrison",
7-
"BMD Studio",
6+
"Bjørn Michelsen",
7+
"Chad Furman",
8+
"Chad Furman",
9+
"Chad Furman",
810
"Chad Furman",
911
"Chad Furman",
1012
"Chad Furman",
1113
"Chris Watland",
1214
"DOMONDA",
1315
"DOMONDA",
16+
"DOMONDA",
1417
"Dan Lynch",
15-
"Daniel Einspanjer",
16-
"Daniel Einspanjer",
18+
"Daniel Einspanger",
19+
"Daniel Woelfel",
1720
"Frank",
18-
"Gustin Prudner",
19-
"Gustin Prudner",
21+
"Jack Dinker",
22+
"Jack Dinker",
23+
"Jack Dinker",
24+
"James Allain",
2025
"James Allain",
2126
"James Allain",
2227
"James Cavanaugh",
2328
"James Rascoe",
24-
"Jimmy McBroom",
29+
"Joe Dennis",
2530
"Joe Dennis",
2631
"Joe Dennis",
2732
"Mark Lipscombe",
@@ -31,12 +36,22 @@
3136
"Michel Pelletier",
3237
"Nigel Taylor",
3338
"Nigel Taylor",
39+
"Nigel Taylor",
40+
"NodeSource",
3441
"NodeSource",
3542
"NodeSource",
3643
"Sam Levin",
37-
"Simon Elliott",
3844
"Stagency",
3945
"Stagency",
46+
"Stagency",
47+
"Timescale",
48+
"Timescale",
49+
"Timescale",
50+
"Timescale",
51+
"Timescale",
52+
"Timescale",
53+
"cybere",
4054
"innovation.rocks",
55+
"purge",
4156
"stlbucket"
4257
]

src/__tests__/utils/pgPool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Pool } from 'pg';
22
import { parse as parsePgConnectionString } from 'pg-connection-string';
33

4-
const pgUrl = process.env.TEST_PG_URL || 'postgres://localhost:5432/postgraphile_test';
4+
const pgUrl = process.env.TEST_PG_URL || 'postgres:///postgraphile_test';
55

66
const pgPool = new Pool({
77
...parsePgConnectionString(pgUrl),

0 commit comments

Comments
 (0)