Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Keep things up to date, support Node 12 #77

Merged
merged 8 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"accessor-pairs": 2,
Expand Down Expand Up @@ -180,4 +177,4 @@
"globals": {
"nockLoad": false
}
}
}
76 changes: 38 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "themis-graphql",
"version": "0.3.0-beta.13",
"version": "0.4.0-beta.1",
"description": "GQL Data Aggregation CLI",
"main": "./src/index.js",
"module": "./src/index.js",
Expand All @@ -9,51 +9,51 @@
"themis": "index.js"
},
"dependencies": {
"@hapi/joi": "15.1.1",
"apollo-errors": "1.9.0",
"apollo-link": "1.2.8",
"apollo-link-context": "1.0.14",
"apollo-link-error": "1.1.7",
"apollo-link-http": "1.5.11",
"apollo-link-ws": "1.0.14",
"apollo-server-express": "2.4.0",
"body-parser": "1.18.3",
"casual": "1.5.19",
"commander": "2.19.0",
"dotenv": "6.2.0",
"express": "4.16.4",
"apollo-link": "1.2.13",
"apollo-link-context": "1.0.19",
"apollo-link-error": "1.1.12",
"apollo-link-http": "1.5.16",
"apollo-link-ws": "1.0.19",
"apollo-server-express": "2.10.1",
"body-parser": "1.19.0",
"casual": "1.6.2",
"commander": "4.1.1",
"dotenv": "8.2.0",
"express": "4.17.1",
"express-nock": "0.1.1",
"express-winston": "2.5.1",
"fast-safe-stringify": "2.0.6",
"graphql": "14.3.1",
"graphql-tag": "2.10.1",
"graphql-tools": "4.0.4",
"graphql-voyager": "1.0.0-rc.26",
"jest": "24.9.0",
"jest-cli": "24.9.0",
"express-winston": "4.0.3",
"fast-safe-stringify": "2.0.7",
"graphql": "14.6.0",
"graphql-tag": "2.10.3",
"graphql-tools": "4.0.6",
"graphql-voyager": "1.0.0-rc.29",
"jest": "25.1.0",
"jest-cli": "25.1.0",
"jest-nock": "0.1.7",
"joi": "13.4.0",
"json-stable-stringify": "^1.0.1",
"mkdirp": "0.5.1",
"nock": "10.0.6",
"subscriptions-transport-ws": "0.9.15",
"supertest": "3.4.2",
"uuid": "3.3.2",
"mkdirp": "1.0.3",
"nock": "12.0.0",
"subscriptions-transport-ws": "0.9.16",
"supertest": "4.0.2",
"uuid": "3.4.0",
"validate-npm-package-name": "3.0.0",
"winston": "3.2.1",
"ws": "6.1.3"
"ws": "7.2.1"
},
"devDependencies": {
"apollo-cache-inmemory": "1.4.2",
"apollo-client": "2.4.12",
"apollo-utilities": "1.1.2",
"babel-eslint": "8.2.3",
"eslint": "4.19.1",
"node-fetch": "2.3.0",
"nodemon": "1.18.9",
"prettier": "1.16.4",
"request": "2.88.0",
"request-promise-native": "1.0.5",
"rimraf": "2.6.3"
"apollo-cache-inmemory": "1.6.5",
"apollo-client": "2.6.8",
"apollo-utilities": "1.3.3",
"babel-eslint": "10.0.3",
"eslint": "6.8.0",
"node-fetch": "2.6.0",
"nodemon": "2.0.2",
"prettier": "1.19.1",
"request": "2.88.2",
"request-promise-native": "1.0.8",
"rimraf": "3.0.2"
},
"scripts": {
"test": "jest --config test/config/jest.config.json",
Expand Down
3 changes: 1 addition & 2 deletions src/build-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { makeRemoteHTTPLink, loadIntrospectionSchema, distPathForConfig } = requi
const { promisify } = require('util');
const fs = require('fs');
const mkdirp = require('mkdirp');
const makeDir = promisify(mkdirp);
const writeFile = promisify(fs.writeFile);

const buildRemote = async (config, sourcePath, { pretty }) => {
Expand All @@ -14,7 +13,7 @@ const buildRemote = async (config, sourcePath, { pretty }) => {
const introspectionSchema = await loadIntrospectionSchema(http, context);
const { schemaDistPath, schemaFilePath } = distPathForConfig({ schemaPath }, sourcePath);

await makeDir(schemaDistPath);
await mkdirp(schemaDistPath);
rajeshdavidbabu marked this conversation as resolved.
Show resolved Hide resolved
const schemaStr = pretty ?
JSON.stringify(introspectionSchema, null, 2) :
JSON.stringify(introspectionSchema);
Expand Down
7 changes: 5 additions & 2 deletions src/load-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ function resolveMergeStrategyPath (strategy) {
if (/^.\//.test(strategy)) {
return path.resolve(process.cwd(), strategy);
}
return require.resolve(strategy, {

const localStrategy = `./${path.normalize(strategy)}`;

return require.resolve(localStrategy, {
paths: [
...require.resolve.paths(strategy),
...require.resolve.paths(localStrategy),
path.resolve(__dirname, 'strategies'),
],
});
Expand Down
1 change: 1 addition & 0 deletions src/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('Server', () => {
exception: {
invalidArgs: ['foo'],
},
invalidArgs: ['foo'],
},
locations: [],
message:
Expand Down
4 changes: 2 additions & 2 deletions src/validate-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('joi');
const Joi = require('@hapi/joi');

const middleware = Joi.alternatives([
Joi.func(),
Expand Down Expand Up @@ -27,7 +27,7 @@ const schema = Joi.object().keys({
});

module.exports = function validateConfig (config, configPath) {
const { error, value } = Joi.validate(config, schema);
const { error, value } = schema.validate(config);

if (error) {
error.message = `${error.message} at ${configPath}`;
Expand Down
12 changes: 6 additions & 6 deletions src/validate-env.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const Joi = require('joi');
const Joi = require('@hapi/joi');

const schema = Joi.object().keys({
PORT: Joi.string().alphanum().min(2).max(5),
NODE_ENV: Joi
.string()
.valid([ 'production', 'development', 'test' ]),
.valid('production', 'development', 'test'),
LOG_LEVEL: Joi
.string()
.valid([ 'debug', 'warn', 'error', 'info' ]),
.valid('debug', 'warn', 'error', 'info'),
GQL_TRACING: Joi
.string()
.valid([ 'true', 'false' ]),
.valid('true', 'false'),
GQL_CACHE_CONTROL: Joi
.string()
.valid([ 'true', 'false' ]),
.valid('true', 'false'),
}).unknown();

module.exports = function validateEnv () {
const { error } = Joi.validate(process.env, schema);
const { error } = schema.validate(process.env);

if (error) {
throw new Error(error);
Expand Down
8 changes: 4 additions & 4 deletions src/validate-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/**
* Checks if the imported module exports the needed data to stitch and mount it.
*/
const BaseJoi = require('joi');
const BaseJoi = require('@hapi/joi');
const packageNameExtension = require('./joi-extensions/npm-package-name');
const Joi = BaseJoi.extend(packageNameExtension);

const schema = Joi.alternatives().try([
const schema = Joi.alternatives().try(
Joi.object().keys({
name: Joi.string().packageName().required(),
namespace: Joi.string(),
Expand Down Expand Up @@ -41,10 +41,10 @@ const schema = Joi.alternatives().try([
onStartup: Joi.func(),
onShutdown: Joi.func(),
}),
]);
);

module.exports = function validateModule (source, sourcePath) {
const { error, value } = Joi.validate(source, schema);
const { error, value } = schema.validate(source);

if (error) {
error.message = `${error.message} at ${sourcePath}`;
Expand Down
4 changes: 2 additions & 2 deletions src/validate-strategy.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

const Joi = require('joi');
const Joi = require('@hapi/joi');

const schema = Joi.object().keys({
merge: Joi.func(),
});

module.exports = function validateStrategy (strategy, strategyPath) {
const { error, value } = Joi.validate(strategy, schema);
const { error, value } = schema.validate(strategy);

if (error) {
error.message = `${error.message} at ${strategyPath}`;
Expand Down
Loading