Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Webpack 5 #1225

Merged
merged 6 commits into from
May 23, 2022
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

This file was deleted.

43 changes: 23 additions & 20 deletions config/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,32 @@ const db = {
},
};

// eslint-disable-next-line no-undef
const path = require('path');

if (process.env.NODE_ENV === 'test') {
db.client = 'sqlite3';
}
if (path.resolve) {
if (process.env.NODE_ENV === 'test') {
db.client = 'sqlite3';
}

if (db.client === 'sqlite3') {
db.connection = {
development: {
filename: path.resolve('./dev-db.sqlite3'),
},
production: {
filename: path.resolve('./prod-db.sqlite3'),
},
test: {
filename: ':memory:',
},
}[process.env.NODE_ENV || 'development'];
db.pool = {
afterCreate: (conn, cb) => {
conn.run('PRAGMA foreign_keys = ON', cb);
},
};
if (db.client === 'sqlite3') {
db.connection = {
development: {
filename: path.resolve('./dev-db.sqlite3'),
},
production: {
filename: path.resolve('./prod-db.sqlite3'),
},
test: {
filename: ':memory:',
},
}[process.env.NODE_ENV || 'development'];
db.pool = {
afterCreate: (conn, cb) => {
conn.run('PRAGMA foreign_keys = ON', cb);
},
};
}
}

export default db;
3 changes: 2 additions & 1 deletion modules/upload/client-react/netLink.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { BatchHttpLink } from 'apollo-link-batch-http';
import { ApolloLink } from 'apollo-link';
import { createUploadLink } from 'apollo-upload-client';
import { extractFiles } from 'extract-files';

const { extractFiles } = require('extract-files');

export default (uri) =>
ApolloLink.split(
Expand Down
75 changes: 35 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"tests:watch": "lerna run --parallel tests:watch --stream",
"lint": "yarn eslint",
"eslint": "eslint --fix --ext .js,.jsx,.ts,.tsx,.json .",
"heroku-postbuild": "lerna run --parallel heroku-postbuild --stream",
"heroku-postbuild": "yarn workspaces foreach -pv run heroku-postbuild",
"precommit": "lint-staged",
"postinstall": "opencollective postinstall"
},
Expand Down Expand Up @@ -108,18 +108,19 @@
"@loadable/webpack-plugin": "^5.7.1",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"autoprefixer": "^9.5.0",
"@webpack-cli/serve": "^1.6.1",
"autoprefixer": "10.4.5",
"babel-core": "^7.0.0-0",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-import": "^1.7.0",
"babel-preset-minify": "^0.5.0-alpha.5a128fd5",
"babel-preset-vue": "^2.0.2",
"clean-webpack-plugin": "^1.0.1",
"clean-webpack-plugin": "^4.0.0",
"core-js": "^3.1.3",
"cross-env": "^5.1.8",
"css-loader": "^1.0.0",
"css-loader": "^6.7.1",
"eslint": "^8.0.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
Expand All @@ -129,55 +130,49 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.5.0",
"file-loader": "^2.0.0",
"fork-ts-checker-webpack-plugin": "^0.4.9",
"hard-source-webpack-plugin": "^0.13.1",
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.19.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^7.2.11",
"html-webpack-plugin": "^5.5.0",
"husky": "^1.1.2",
"ignore-loader": "^0.1.2",
"isomorphic-style-loader": "^4.0.0",
"isomorphic-style-loader": "^5.3.2",
"jest": "^26.2.2",
"jest-transform-graphql": "^2.1.0",
"jest-transform-stub": "^2.0.0",
"lerna": "^3.4.0",
"less": "^3.0.2",
"less-loader": "^4.1.0",
"less": "^4.1.2",
"less-loader": "^11.0.0",
"lint-staged": "^7.1.2",
"mini-css-extract-plugin": "^0.4.1",
"mini-css-extract-plugin": "^2.6.0",
"node-hmr-plugin": "^1.0.1",
"node-sass": "^6.0.1",
"node-sass": "^7.0.1",
"npm-run-all": "^4.1.5",
"openurl": "^1.1.1",
"postcss-loader": "^3.0.0",
"postcss-loader": "^7.0.0",
"prettier": "^2.6.2",
"qrcode-terminal": "^0.12.0",
"raw-loader": "^0.5.1",
"raw-loader": "^4.0.2",
"regenerator-runtime": "^0.13.2",
"sass-loader": "^10.0.0",
"sass-loader": "^13.0.0",
"shelljs": "^0.8.1",
"source-list-map": "^2.0.0",
"style-loader": "^1.0.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"ts-loader": "^4.5.0",
"source-list-map": "^2.0.1",
"style-loader": "^3.3.1",
"stylus": "^0.57.0",
"stylus-loader": "^7.0.0",
"ts-loader": "^9.3.0",
"typescript": "^4.6.4",
"uglifyjs-webpack-plugin": "^1.3.0",
"url-loader": "^1.0.1",
"vue-loader": "^15.5.1",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.5.22",
"wait-on": "^3.2.0",
"webpack": "^4.33.0",
"webpack-cli": "^3.3.3",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-server": "^3.1.5",
"webpack-hot-middleware": "^2.22.3",
"webpack-manifest-plugin": "^2.0.3",
"webpack-merge": "^4.1.4",
"webpack-node-externals": "^1.7.2",
"webpack-sources": "^1.1.0",
"webpack-virtual-modules": "^0.1.10",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^4.1.1",
"vue-loader": "^17.0.0",
"vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.6.14",
"wait-on": "^6.0.1",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0",
"webpack-manifest-plugin": "^5.0.0",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0",
"webpack-sources": "^3.2.3",
"whatwg-fetch": "^2.0.4"
},
"dependencies": {
Expand All @@ -188,6 +183,6 @@
"resolutions": {
"card-validator": "8.1.1",
"@react-native-picker/picker": "1.16.8",
"hard-source-webpack-plugin@0.13.1": "patch:hard-source-webpack-plugin@npm:0.13.1#.yarn/patches/hard-source-webpack-plugin-npm-0.13.1-5fa3f8bf90.patch"
"extract-files": "6.0.0"
}
}
6 changes: 4 additions & 2 deletions packages/client-angular/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const config = {
__SERVER__: false,
__DEV__: process.env.NODE_ENV !== 'production',
__TEST__: false,
'process.env.NODE_ENV': process.env.NODE_ENV || 'development',
'process.env': {
NODE_ENV: process.env.NODE_ENV || '"development"',
STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY,
},
__API_URL__: process.env.API_URL || '/graphql',
'process.env.STRIPE_PUBLIC_KEY': process.env.STRIPE_PUBLIC_KEY,
};

module.exports = config;
3 changes: 1 addition & 2 deletions packages/client-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"apollo-link-ws": "^1.0.17",
"apollo-logger": "^0.3.3",
"apollo-upload-client": "^10.0.1",
"graphql": "^14.3.1",
"graphql": "^15.0.0",
"minilog": "^3.1.0",
"rxjs": "^6.5.2",
"subscriptions-transport-ws": "^0.9.16",
Expand All @@ -75,7 +75,6 @@
"@types/lodash": "^4.14.118",
"@types/webpack-env": "^1.13.6",
"angular2-template-loader": "^0.6.2",
"autoprefixer": "^8.3.0",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
"cross-env": "^5.1.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/client-angular/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const config = {
unsafeCache: false,
},
resolve: {
symlinks: false,
symlinks: true,
cacheWithContext: false,
unsafeCache: false,
extensions: [
Expand Down Expand Up @@ -180,12 +180,12 @@ const config = {
new webpack.DefinePlugin(
Object.assign(
...Object.entries(buildConfig).map(([k, v]) => ({
[k]: typeof v !== 'string' ? v : `'${v.replace(/\\/g, '\\\\')}'`,
[k]: typeof v !== 'string' ? v : `"${v.replace(/\\/g, '\\\\')}"`,
}))
)
),
new ManifestPlugin({ fileName: 'assets.json' }),
new HtmlWebpackPlugin({ template: './html-plugin-template.ejs', inject: true }),
new HtmlWebpackPlugin({ template: './html-plugin-template.ejs', inject: true, cache: false }),
new HardSourceWebpackPlugin({
cacheDirectory: path.join(__dirname, `../../node_modules/.cache/hard-source-${path.basename(__dirname)}`),
}),
Expand Down
6 changes: 4 additions & 2 deletions packages/client-vue/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const config = {
__SERVER__: false,
__DEV__: process.env.NODE_ENV !== 'production',
__TEST__: false,
'process.env.NODE_ENV': process.env.NODE_ENV || 'development',
'process.env': {
NODE_ENV: process.env.NODE_ENV || '"development"',
STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY,
},
__API_URL__: process.env.API_URL || '/graphql',
'process.env.STRIPE_PUBLIC_KEY': process.env.STRIPE_PUBLIC_KEY,
};

module.exports = config;
7 changes: 3 additions & 4 deletions packages/client-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
"apollo-logger": "^0.3.3",
"apollo-upload-client": "^10.0.0",
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.3.1",
"bootstrap": "^5.1.3",
"bootstrap-vue": "^2.0.0-rc.19",
"error-stack-parser": "^2.0.1",
"extract-files": "^5.0.0",
"extract-files": "^6.0.0",
"filesize": "^3.5.11",
"graphql": "^14.3.1",
"graphql": "^15.0.0",
"graphql-iso-date": "^3.5.0",
"graphql-tag": "^2.6.0",
"history": "^4.7.2",
Expand All @@ -78,7 +78,6 @@
"@types/lodash": "^4.14.112",
"@types/webpack-env": "^1.13.6",
"apollo-utilities": "^1.0.3",
"autoprefixer": "^8.3.0",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-jsx-event-modifiers": "^2.0.5",
"babel-plugin-jsx-v-model": "^2.0.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/client-vue/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const config = {
unsafeCache: false,
},
resolve: {
symlinks: false,
symlinks: true,
cacheWithContext: false,
unsafeCache: false,
extensions: [
Expand Down Expand Up @@ -149,13 +149,13 @@ const config = {
new webpack.DefinePlugin(
Object.assign(
...Object.entries(buildConfig).map(([k, v]) => ({
[k]: typeof v !== 'string' ? v : `'${v.replace(/\\/g, '\\\\')}'`,
[k]: typeof v !== 'string' ? v : `"${v.replace(/\\/g, '\\\\')}"`,
}))
)
),
new ManifestPlugin({ fileName: 'assets.json' }),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({ template: './html-plugin-template.ejs', inject: true }),
new HtmlWebpackPlugin({ template: './html-plugin-template.ejs', inject: true, cache: false }),
new HardSourceWebpackPlugin({
cacheDirectory: path.join(__dirname, `../../node_modules/.cache/hard-source-${path.basename(__dirname)}`),
}),
Expand Down
6 changes: 4 additions & 2 deletions packages/client/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const config = {
__SERVER__: false,
__DEV__: process.env.NODE_ENV !== 'production',
__TEST__: false,
'process.env.NODE_ENV': process.env.NODE_ENV,
'process.env': {
NODE_ENV: '"' + (process.env.NODE_ENV || 'development') + '"',
STRIPE_PUBLIC_KEY: '"' + process.env.STRIPE_PUBLIC_KEY + '"',
},
__API_URL__: process.env.API_URL || '/graphql',
'process.env.STRIPE_PUBLIC_KEY': process.env.STRIPE_PUBLIC_KEY,
};

module.exports = config;
14 changes: 6 additions & 8 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"version": "1.0.0",
"main": "src",
"scripts": {
"build": "cross-env NODE_ENV=production webpack",
"build": "NODE_ENV=production run -T webpack",
"clean": "rimraf build .tmp",
"tests": "jest",
"tests:watch": "jest --watch",
"test": "yarn tests && yarn lint",
"lint": "eslint --fix --ext .js,.jsx,.ts,.tsx,.json .",
"watch": "webpack-dev-server",
"watch": "run -T webpack-dev-server --stats-error-details",
"heroku-postbuild": "yarn build",
"cli": "node ../../tools/cli",
"storybook": "start-storybook -p 6006",
Expand Down Expand Up @@ -64,13 +64,13 @@
"apollo-logger": "^0.3.3",
"apollo-upload-client": "^10.0.0",
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.3.1",
"bootstrap": "^5.1.3",
"connected-react-router": "^6.5.2",
"error-stack-parser": "^2.0.1",
"extract-files": "^5.0.0",
"extract-files": "^6.0.0",
"filesize": "^3.5.11",
"formik": "^1.5.8",
"graphql": "^14.3.1",
"graphql": "^15.0.0",
"graphql-iso-date": "^3.5.0",
"graphql-tag": "^2.6.0",
"history": "^4.7.2",
Expand Down Expand Up @@ -131,7 +131,6 @@
"@types/styled-components": "^4.1.14",
"@types/webpack-env": "^1.13.6",
"apollo-utilities": "^1.0.3",
"autoprefixer": "^8.3.0",
"babel-loader": "^8.0.6",
"babel-plugin-styled-components": "^1.10.0",
"chai": "^4.1.2",
Expand All @@ -146,8 +145,7 @@
"react-test-renderer": "16.11.0",
"request": "^2.83.0",
"rimraf": "^2.6.2",
"storybook-addon-locale": "^0.3.0",
"webpack-cli": "^3.3.4"
"storybook-addon-locale": "^0.3.0"
},
"optionalDependencies": {
"@expo/vector-icons": "^13.0.0",
Expand Down
Loading