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

Upgrading nextjs to 12.3 #1103

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b875158
nextjs 12.3.0
wonjun-opensource Sep 17, 2022
1016bc3
fixing "configuration[0].node has an unknown property 'fs'. These pro…
wonjun-opensource Sep 17, 2022
233f819
yarn add react@latest react-dom@latest
wonjun-opensource Sep 17, 2022
3820d5c
module alias using jsconfig.json
wonjun-opensource Sep 17, 2022
92c9e18
new nextjs doesn't need "babel-plugin-module-resolver", instead it ca…
wonjun-opensource Sep 18, 2022
1ad8ceb
remove "module-resolver" plugin
wonjun-opensource Sep 18, 2022
fe60783
In order to run "babel-plugin-fbt", "babel-plugin-fbt-runtime", we ne…
wonjun-opensource Sep 18, 2022
0af9fc5
cssLoaderOptions is not in the list of allowed properties. nextjs dis…
wonjun-opensource Sep 18, 2022
01cd432
Fix webpack config DefinePlugin warning: Conflicting values for 'proc…
wonjun-opensource Sep 18, 2022
2bcd398
update readme - [email protected]: The engine "node" is incompatible with t…
wonjun-opensource Sep 20, 2022
2f1bc51
Merge branch 'master' into upgrade-nextjs-to-12
wonjun-opensource Sep 20, 2022
2d9d24b
specify engines node & npm version in package.json
wonjun-opensource Sep 22, 2022
d3a645c
Merge branch 'master' into upgrade-nextjs-to-12
wonjun-opensource Dec 4, 2022
4d6c0ec
"node" 14.9
wonjun-opensource Dec 4, 2022
55d67ab
node >= 14.9
wonjun-opensource Dec 4, 2022
4b9db45
add dapp build as part of CT step
sparrowDom Jan 20, 2023
1b9c7c1
fix workflow
sparrowDom Jan 20, 2023
917cf30
Merge remote-tracking branch 'origin/master' into upgrade-nextjs-to-12
sparrowDom Jan 20, 2023
45a7e8c
add custom runtime
sparrowDom Jan 20, 2023
8d267c9
increase memory size
sparrowDom Jan 20, 2023
3ba1def
add a workaround for GAE memory limit
sparrowDom Jan 20, 2023
20937ce
nextjs13 test
sparrowDom Jan 20, 2023
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
19 changes: 19 additions & 0 deletions .github/workflows/ousd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ jobs:
- run: yarn prettier:check
working-directory: ./dapp

dapp-biuld:
name: "DApp Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
cache: "yarn"
cache-dependency-path: dapp/yarn.lock

- run: yarn install --frozen-lockfile
working-directory: ./dapp

- run: yarn build
working-directory: ./dapp

slither:
name: "Slither"
# As long as we need Python 3.6 here in the test, we can only use up to Ubuntu 20.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Checkout our [docs](https://docs.ousd.com) for more details about the product.

## Requirements
- Node Version
- `^8.11.2 >= node <=^14.0.0`
- `^12.22.0 >= node <=^14.0.0`
- Recommended: `^14.0.0`
- Web3 Wallet
- Recommended: [Metamask](https://metamask.io/)
Expand Down
9 changes: 9 additions & 0 deletions dapp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
"next/babel"
],
"plugins": [
"babel-plugin-fbt",
"babel-plugin-fbt-runtime"
]
}
15 changes: 15 additions & 0 deletions dapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16-bullseye

COPY . .

RUN yarn install --non-interactive --frozen-lockfile

ENV NODE_ENV=production
ENV PORT 8080

RUN yarn run gcp-build
RUN rm -Rf node_modules

RUN yarn install --non-interactive --frozen-lockfile --production

CMD yarn start
14 changes: 14 additions & 0 deletions dapp/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"constants/*": ["src/constants/*"],
"components/*": ["src/components/*"],
"hoc/*": ["src/hoc/*"],
"hooks/*": ["src/hooks/*"],
"pages/*": ["src/pages/*"],
"stores/*": ["src/stores/*"],
"utils/*": ["src/utils/*"],
}
}
}
23 changes: 12 additions & 11 deletions dapp/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ try {
const config = {
webpack: (config, { isServer, buildId }) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
}
config.resolve.fallback = { fs: false };
/**
* Returns environment variables as an object
*/
const env = Object.keys(process.env).reduce((acc, curr) => {
acc[`process.env.${curr}`] = JSON.stringify(process.env[curr])
return acc
}, {})
const env = Object.keys(process.env)
.filter(k => !['__NEXT_REACT_ROOT', 'NEXT_RUNTIME'].includes(k))
.reduce((acc, curr) => {
acc[`process.env.${curr}`] = JSON.stringify(process.env[curr])
return acc
}, {})

//console.log("CONFIG: ", JSON.stringify(config.module.rules))

Expand All @@ -59,13 +59,10 @@ const config = {

if (!isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser'
}
}

return config
},
cssLoaderOptions: {
url: false,
},
async redirects() {
return [
{
Expand Down Expand Up @@ -133,4 +130,8 @@ if (process.env.DEPLOY_MODE === 'ipfs') {
config.assetPrefix = './'
}

config.experimental = {
esmExternals: false
};

module.exports = config
35 changes: 7 additions & 28 deletions dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "origin-dollar-dapp",
"version": "0.1.0",
"private": true,
"engines": {
"node": ">=14.9",
"npm": "6.x"
},
"description": "Origin Dollar Dapp",
"main": "index.js",
"author": "Origin Protocol <[email protected]>",
Expand Down Expand Up @@ -68,7 +72,6 @@
"babel-loader": "8.2.2",
"babel-plugin-fbt": "^0.20.3",
"babel-plugin-fbt-runtime": "^0.9.17",
"babel-plugin-module-resolver": "^4.1.0",
"classnames": "^2.3.1",
"dateformat": "^4.6.1",
"deficonnect": "1.6.14-dev.2",
Expand All @@ -78,21 +81,20 @@
"file-loader": "6.2.0",
"lodash": "^4.17.21",
"mixpanel-browser": "^2.41.0",
"next": "^13.1.3",
"moment": "^2.29.4",
"next": "10.2.3",
"next-cookies": "^2.0.3",
"per-env": "^1.0.2",
"postcss-flexbugs-fixes": "^5.0.0",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.4.0",
"pullstate": "^1.23.0",
"react": "^16.14.0",
"react": "^18.2.0",
"react-autosize-textarea": "^7.1.0",
"react-bootstrap": "^1.6.2",
"react-cookie": "^4.1.0",
"react-copy-to-clipboard": "^5.0.3",
"react-countdown": "^2.3.2",
"react-dom": "^17.0.2",
"react-dom": "^18.2.0",
"react-facebook-pixel": "^1.0.4",
"react-query": "^3.34.16",
"react-router-dom": "5.3.0",
Expand All @@ -101,29 +103,6 @@
"sass": "^1.39.2",
"use-analytics": "^0.0.5"
},
"babel": {
"presets": [
"next/babel"
],
"plugins": [
[
"module-resolver",
{
"alias": {
"components": "./src/components",
"constants": "./src/constants",
"utils": "./src/utils",
"pages": "./src/pages",
"hoc": "./src/hoc",
"stores": "./src/stores",
"hooks": "./src/hooks"
}
}
],
"babel-plugin-fbt",
"babel-plugin-fbt-runtime"
]
},
"husky": {
"hooks": {
"pre-push": "yarn run prettier:check"
Expand Down
2 changes: 1 addition & 1 deletion dapp/prod.app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
runtime: nodejs
env: flex
instance_class: B2
instance_class: B4
manual_scaling:
instances: 3
service: ousd-prod
Expand Down
2 changes: 1 addition & 1 deletion dapp/scripts/fbtToCrowdin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function b64Encode(str) {
return new Buffer.from(str).toString('base64')
.replace(/=/g, '') // Strip base64 padding. It is not essential.
.replace(/\//g, 'SLASH') // Replace '/' since otherwise MT alters the string.
.replace(/\+/g, 'PLUS') // Replace '+' since otherwise MT alters the string.
.replace(/\+/g, 'PLUS'); // Replace '+' since otherwise MT alters the string.
}

function encodeVarName(varName) {
Expand Down
Loading