Skip to content

Commit 1d7808c

Browse files
committed
Update packages, fix es6 build, remove babel-runtime
1 parent 3831476 commit 1d7808c

24 files changed

+80
-78
lines changed

.babelrc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
2-
"presets": ["es2015", "stage-0"],
3-
"plugins": [
4-
"syntax-async-functions",
5-
"transform-class-properties",
6-
"transform-flow-strip-types",
7-
"transform-object-rest-spread",
8-
"transform-regenerator",
9-
"transform-runtime",
10-
],
11-
122
"env": {
133
"cjs": {
14-
"presets": ["es2015-loose", "stage-0"],
15-
"plugins": ["add-module-exports"]
4+
"presets": ["es2015"],
5+
"plugins": [
6+
"syntax-async-functions",
7+
"transform-regenerator",
8+
"transform-class-properties",
9+
"transform-object-rest-spread",
10+
"transform-flow-strip-types",
11+
]
1612
},
1713
"es": {
18-
"presets": ["es2015-loose-native-modules", "stage-0"]
14+
"plugins": [
15+
"syntax-async-functions",
16+
"transform-regenerator",
17+
"transform-class-properties",
18+
"transform-object-rest-spread",
19+
"transform-flow-comments",
20+
]
1921
}
2022
}
2123
}

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"arrow-body-style": 0
88
},
99
"env": {
10-
"jasmine": true,
1110
"mocha": true
1211
}
1312
}

.flowconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ module.name_mapper='^graphql-compose/lib/definition.js$' -> '/Users/nod/www/_npm
1919
module.name_mapper='^graphql-compose\(.*\)$' -> '/Users/nod/www/_npm/graphql-compose/src\1'
2020
module.name_mapper='^graphql$' -> '/Users/nod/www/_npm/graphql-compose/__forks__/graphql-js/src'
2121
module.name_mapper='^graphql/type/definition.js$' -> '/Users/nod/www/_npm/graphql-compose/__forks__/graphql-js/src/type/definition.js'
22+
23+
[version]
24+
0.28.0

package.json

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,53 +24,41 @@
2424
},
2525
"homepage": "https://github.com/nodkz/graphql-compose-mongoose",
2626
"dependencies": {
27-
"babel-runtime": "^6.6.1",
27+
"graphql": "^0.5.0",
2828
"graphql-compose": ">=0.0.2",
29-
"mongoose": "^4.4.20",
30-
"object-path": "^0.9.2"
31-
},
32-
"peerDependencies": {
33-
"graphql": "^0.5.0"
29+
"object-path": "^0.9.2",
30+
"mongoose": "^4.4.20"
3431
},
3532
"devDependencies": {
36-
"babel-cli": "^6.7.7",
37-
"babel-core": "^6.7.7",
38-
"babel-eslint": "^6.0.3",
39-
"babel-loader": "^6.2.4",
40-
"babel-plugin-add-module-exports": "^0.1.2",
41-
"babel-plugin-dev-expression": "^0.2.1",
42-
"babel-plugin-syntax-async-functions": "^6.8.0",
43-
"babel-plugin-transform-class-properties": "^6.10.2",
44-
"babel-plugin-transform-flow-strip-types": "^6.8.0",
45-
"babel-plugin-transform-object-rest-spread": "^6.8.0",
46-
"babel-plugin-transform-regenerator": "^6.9.0",
47-
"babel-plugin-transform-runtime": "^6.7.5",
48-
"babel-polyfill": "^6.7.4",
49-
"babel-preset-es2015": "^6.6.0",
50-
"babel-preset-es2015-loose": "^7.0.0",
51-
"babel-preset-es2015-loose-native-modules": "^1.0.0",
52-
"babel-preset-stage-0": "^6.5.0",
53-
"babel-register": "^6.7.2",
54-
"chai": "^3.5.0",
55-
"chai-as-promised": "^5.3.0",
56-
"chai-spies": "^0.7.1",
57-
"eslint": "^2.8.0",
58-
"eslint-config-airbnb": "^7.0.0",
59-
"eslint-plugin-jsx-a11y": "^0.6.2",
60-
"eslint-plugin-react": "^4.3.0",
61-
"flow": "^0.2.3",
62-
"flow-bin": "^0.27.0",
63-
"mocha": "^2.5.3",
64-
"rimraf": "^2.5.2",
65-
"sane": "^1.3.4"
33+
"babel-cli": "6.10.1",
34+
"babel-eslint": "6.1.0",
35+
"babel-plugin-syntax-async-functions": "6.8.0",
36+
"babel-plugin-transform-class-properties": "6.10.2",
37+
"babel-plugin-transform-flow-comments": "6.8.0",
38+
"babel-plugin-transform-flow-strip-types": "6.8.0",
39+
"babel-plugin-transform-object-rest-spread": "6.8.0",
40+
"babel-plugin-transform-regenerator": "6.9.0",
41+
"babel-preset-es2015": "6.9.0",
42+
"chai": "3.5.0",
43+
"chai-as-promised": "5.3.0",
44+
"chai-spies": "0.7.1",
45+
"eslint": "2.13.1",
46+
"eslint-config-airbnb": "9.0.1",
47+
"eslint-plugin-flow-vars": "0.4.0",
48+
"eslint-plugin-flowtype": "2.2.7",
49+
"eslint-plugin-import": "1.10.2",
50+
"flow-bin": "0.28.0",
51+
"mocha": "2.5.3",
52+
"rimraf": "2.5.2",
53+
"sane": "1.3.4"
6654
},
6755
"scripts": {
6856
"build": "npm run build-cjs && npm run build-es",
6957
"build-cjs": "rimraf lib && BABEL_ENV=cjs babel src --ignore __tests__,__mocks__ -d lib && cp src/definition.js lib/definition.js",
7058
"build-es": "rimraf es && BABEL_ENV=es babel src --ignore __tests__,__mocks__ -d es && cp src/definition.js es/definition.js",
7159
"lint": "eslint src test *.js",
7260
"prepublish": "npm run build",
73-
"test": "mocha --compilers js:babel-core/register --reporter dot --require ./resources/mocha-bootload src/**/__tests__/**/*-test.js",
74-
"watch": "babel-node ./resources/watch.js"
61+
"test": "BABEL_ENV=cjs babel-node ./node_modules/.bin/_mocha --compilers js:babel-core/register --reporter dot --require ./resources/mocha-bootload src/**/__tests__/**/*-test.js",
62+
"watch": "BABEL_ENV=cjs babel-node ./resources/watch.js"
7563
}
7664
}

resources/mocha-bootload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable */
22

3-
import chai from 'chai';
4-
import chaiAsPromised from 'chai-as-promised';
5-
import chaiSpies from 'chai-spies';
3+
var chai = require('chai');
4+
var chaiAsPromised = require('chai-as-promised');
5+
var chaiSpies = require('chai-spies');
66

77
chai.use(chaiAsPromised);
88
chai.use(chaiSpies);

resources/watch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ function exec(command, options) {
1313
return new Promise((resolve, reject) => {
1414
var child = spawn(command, options, {
1515
cmd: cmd,
16-
env: process.env,
16+
env: {
17+
...process.env,
18+
BABEL_ENV: 'cjs',
19+
},
1720
stdio: 'inherit'
1821
});
1922
child.on('exit', code => {

src/__mocks__/languagesSchema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const LanguagesSchema = new Schema(
2626
description: 'Language skills',
2727
enum: Object.keys(enumLanguageSkill),
2828
},
29-
},
29+
}
3030
);
3131

3232
export default LanguagesSchema;

src/__mocks__/mongooseCommon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import mongoose, { Schema } from 'mongoose';
33
const dbName = 'gqc-mongoose-test';
44
const uri = `mongodb://127.0.0.1:27017/${dbName}`;
55

6+
mongoose.Promise = Promise;
67
mongoose.connect(uri);
78

89
mongoose.connection.on('error', (err) => {

src/__tests__/modelConverter-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('modelConverter', () => {
137137
it('should not provide resolver if opts.resolvers.[resolverName] === false', () => {
138138
const tc2 = mm2tc(UserModel, {
139139
resolvers: {
140-
findById: false,
140+
count: false,
141141
removeById: false,
142142
findMany: {},
143143
updateOne: {
@@ -146,7 +146,7 @@ describe('modelConverter', () => {
146146
},
147147
});
148148
const resolverKeys = tc2.getResolvers().getKeys();
149-
expect(resolverKeys).to.not.include('findById');
149+
expect(resolverKeys).to.not.include('count');
150150
expect(resolverKeys).to.not.include('removeById');
151151
expect(resolverKeys).include.members(['findMany', 'updateOne', 'updateMany']);
152152
});

src/fieldsConverter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function getFieldsFromModel(model: MongooseModelT): MongooseFieldMapT {
119119

120120
export function convertModelToGraphQL(
121121
model: MongooseModelT,
122-
typeName: string,
122+
typeName: string
123123
): GraphQLOutputType {
124124
if (!typeName) {
125125
throw new Error('You provide empty name for type. '
@@ -241,7 +241,7 @@ export function arrayToGraphQL(field: MongooseFieldT, prefix: string = ''): Grap
241241

242242
export function embeddedToGraphQL(
243243
field: MongooseFieldT,
244-
prefix: string = '',
244+
prefix: string = ''
245245
): GraphQLOutputType {
246246
const fieldName = _getFieldName(field);
247247
const fieldType = _getFieldType(field);
@@ -266,7 +266,7 @@ export function embeddedToGraphQL(
266266

267267
export function enumToGraphQL(
268268
field: MongooseFieldT,
269-
prefix: string = '',
269+
prefix: string = ''
270270
): GraphQLOutputType {
271271
const valueList = _getFieldEnums(field);
272272
if (!valueList) {
@@ -289,7 +289,7 @@ export function enumToGraphQL(
289289

290290
export function documentArrayToGraphQL(
291291
field: MongooseFieldT,
292-
prefix: string = '',
292+
prefix: string = ''
293293
): GraphQLOutputType {
294294
if (!(field instanceof mongoose.Schema.Types.DocumentArray)) {
295295
throw new Error('You provide incorrect mongoose field to `documentArrayToGraphQL()`. '
@@ -308,7 +308,7 @@ export function documentArrayToGraphQL(
308308

309309
export function referenceToGraphQL(
310310
field: MongooseFieldT,
311-
prefix: string = '',
311+
prefix: string = ''
312312
): GraphQLOutputType {
313313
const fieldType = _getFieldType(field);
314314
if (fieldType !== 'ObjectID') {

0 commit comments

Comments
 (0)