Skip to content

Commit

Permalink
Upgrade babel, webpack, eslint, flow, and prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Sep 3, 2018
1 parent 240dbc3 commit e9d7804
Show file tree
Hide file tree
Showing 80 changed files with 4,984 additions and 3,949 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@
"env": {
"development": {
"plugins": [
"flow-react-proptypes"
"@babel/plugin-proposal-class-properties"
]
},
"production": {
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
}
Expand Down
6,676 changes: 3,772 additions & 2,904 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"coverage": "NODE_ENV=test tap --cov --coverage-report=lcov build/tests/*/*.js",
"test-file": "NODE_ENV=test tap",
"flow": "flow",
"prettier": "prettier --write --no-bracket-spacing --trailing-comma=es5 --tab-width=4 --parser=babylon \"src/**/*.js\""
"prettier": "prettier --write \"src/**/*.js\""
},
"repository": {
"type": "git",
Expand All @@ -39,6 +39,7 @@
},
"homepage": "https://github.com/mongaku/mongaku",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0",
"async": "2.6.1",
"bcrypt": "3.0.0",
"body-parser": "1.18.3",
Expand Down Expand Up @@ -85,6 +86,7 @@
"shelljs": "0.8.2",
"unzip-stream": "0.3.0",
"valid-url": "1.0.9",
"webpack-cli": "^3.1.0",
"whatwg-fetch": "2.0.4",
"yearrange": "0.0.5"
},
Expand All @@ -94,27 +96,26 @@
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "8.0.3",
"babel-eslint": "9.0.0",
"babel-jsxgettext": "0.5.0",
"babel-loader": "^8.0.0",
"babel-plugin-flow-react-proptypes": "12.1.0",
"babel-plugin-module-resolver": "3.0.0",
"eslint": "4.13.1",
"eslint-config-prettier": "2.9.0",
"eslint-plugin-flowtype": "2.40.1",
"eslint-plugin-react": "7.5.1",
"exports-loader": "0.6.4",
"flow-bin": "0.61.0",
"migrate": "1.0.0",
"babel-plugin-flow-react-proptypes": "24.1.1",
"babel-plugin-module-resolver": "3.1.1",
"eslint": "5.5.0",
"eslint-config-prettier": "3.0.1",
"eslint-plugin-flowtype": "2.50.0",
"eslint-plugin-react": "7.11.1",
"exports-loader": "0.7.0",
"flow-bin": "0.80.0",
"migrate": "1.6.1",
"mock-fs": "4.6.0",
"null-loader": "0.1.1",
"phantom-pool": "1.2.2",
"pre-commit": "1.2.2",
"prettier": "1.9.2",
"sinon": "4.1.3",
"prettier": "1.14.2",
"sinon": "6.1.5",
"supervisor": "0.12.0",
"tap": "11.0.0",
"webpack": "3.10.0",
"tap": "12.0.1",
"webpack": "4.17.1",
"@babel/preset-flow": "^7.0.0"
},
"pre-commit": [
Expand Down
4 changes: 2 additions & 2 deletions src/bin/mongaku.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (args.v || args.version) {
shell.exec(startCmd);
} else if (cmd === "stop") {
shell.exec(
`${getBinary("naught")} stop --pid-file mongaku.pid mongaku.ipc`
`${getBinary("naught")} stop --pid-file mongaku.pid mongaku.ipc`,
);
} else if (cmd === "restart") {
shell.exec(`${getBinary("naught")} deploy mongaku.ipc`);
Expand Down Expand Up @@ -144,6 +144,6 @@ Commands:
-v: Show program version
-h: Show available commands
`
`,
);
}
2 changes: 1 addition & 1 deletion src/entries/shared/mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = (View: React.ComponentType<*>) => {
<View {...options} />
</Page>
</Wrapper>,
root
root,
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getArgs = (func: Function): Array<string> => {
const serializeValue = (i18n: i18nObject, blacklist: Array<string> = []) => (
value: any,
key: string,
object: Object
object: Object,
) => {
if (blacklist.includes(key)) {
return null;
Expand All @@ -63,7 +63,7 @@ const serializeValue = (i18n: i18nObject, blacklist: Array<string> = []) => (
const cloneObject = (
object: {},
i18n: i18nObject,
blacklist: Array<string> = []
blacklist: Array<string> = [],
) => {
return cloneDeepWith(object, serializeValue(i18n, blacklist));
};
Expand Down
17 changes: 10 additions & 7 deletions src/lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ module.exports = {
return process.nextTick(callback);
}

mongoose.connect(config.MONGODB_URL, {
keepAlive: true,
useNewUrlParser: true,
// Get Mongoose using native promises
promiseLibrary: global.Promise,
reconnectTries: Number.MAX_VALUE,
});
mongoose.connect(
config.MONGODB_URL,
{
keepAlive: true,
useNewUrlParser: true,
// Get Mongoose using native promises
promiseLibrary: global.Promise,
reconnectTries: Number.MAX_VALUE,
},
);

const handleError = err => {
console.error("Mongo Connection Error:", err);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/default-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
} catch (err) {
callback(err);
}
})
}),
);
},
};
2 changes: 1 addition & 1 deletion src/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = callback => {
} else {
resolve();
}
}
},
);
});
};
6 changes: 3 additions & 3 deletions src/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ for (const typeName in options.types) {
options.types[typeName] = Object.assign(
{},
recordOptions,
options.types[typeName]
options.types[typeName],
);
}

Expand All @@ -43,8 +43,8 @@ if (config.NODE_ENV !== "test") {
}
}

options.defaultLocale = options.defaultLocale ||
Object.keys(options.locales)[0] || "en";
options.defaultLocale =
options.defaultLocale || Object.keys(options.locales)[0] || "en";

// Bring in options that could be configured via the config
options.baseURL = options.baseURL || config.BASE_URL;
Expand Down
14 changes: 7 additions & 7 deletions src/lib/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@ module.exports = type => {
if (typeInfo.noImages) {
schemaProps.images = Object.assign(
{required: false},
schemaProps.images
schemaProps.images,
);
schemaProps.defaultImageHash = Object.assign(
{required: false},
schemaProps.defaultImageHash
schemaProps.defaultImageHash,
);
} else if (typeInfo.imagesRequired) {
schemaProps.images = Object.assign(
{required: true},
schemaProps.images
schemaProps.images,
);
schemaProps.defaultImageHash = Object.assign(
{required: true},
schemaProps.defaultImageHash
schemaProps.defaultImageHash,
);
} else {
schemaProps.images = Object.assign(
{recommended: true},
schemaProps.images
schemaProps.images,
);
schemaProps.defaultImageHash = Object.assign(
{recommended: true},
schemaProps.defaultImageHash
schemaProps.defaultImageHash,
);
}

Expand All @@ -68,7 +68,7 @@ module.exports = type => {
{
getDBName: () => dbName,
},
Record.statics
Record.statics,
);

const es = url.parse(config.ELASTICSEARCH_URL);
Expand Down
Loading

0 comments on commit e9d7804

Please sign in to comment.