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 Next.js and Next.js + Bootstrap templates to Next.js 13 #297

Merged
merged 9 commits into from Jan 1, 2023
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
yarn-error.log
.npmrc
.DS_Store
node_modules/
goldstackLocal/
dist/
.yarn/*
Expand Down
2,550 changes: 1,051 additions & 1,499 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/mime-npm-2.5.2-d3335c8166-dd3c93d433.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -34,6 +34,7 @@
"aws-sdk": "^2.1222.0",
"glob-parent": "5.1.2",
"json-schema": "0.4.0",
"json5": "2.2.2",
"loader-utils": "2.0.4",
"minimatch": "^5.1.0",
"moment": "2.29.4",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/apps/package.json
Expand Up @@ -33,7 +33,7 @@
"eslint-plugin-react": "^7.31.10",
"nodemon": "^2.0.20",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react": "18.2.0",
"typescript": "^4.8.4"
}
}
4 changes: 2 additions & 2 deletions workspaces/apps/packages/goldstack-api/package.json
Expand Up @@ -69,11 +69,11 @@
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.15",
"esbuild": "^0.15.5",
"express": "4.17.3",
"jest": "^28.1.0",
"jest": "^29.3.1",
"rimraf": "^3.0.2",
"supertest": "^4.0.2",
"supertest-session": "^4.0.0",
"ts-jest": "^28.0.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^4.8.4"
Expand Down
4 changes: 2 additions & 2 deletions workspaces/apps/packages/goldstack-email-send/package.json
Expand Up @@ -30,9 +30,9 @@
"@types/jest": "^29.0.1",
"@types/node": "^18.7.13",
"aws-sdk": "^2.1222.0",
"jest": "^28.1.0",
"jest": "^29.3.1",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
}
Expand Down
6 changes: 3 additions & 3 deletions workspaces/apps/packages/goldstack-home/.env.production
@@ -1,3 +1,3 @@
NEXT_PUBLIC_GOLDSTACK_DOCS=https://docs.goldstack.party/docs
NEXT_PUBLIC_STRIPE_PUBLIC_API_KEY=pk_live_51Hd1UtArOjAVQR9vhVCzlap2C2bNTAdFM6D30iZB8xeNmEYSy0Tuw4q0uAaeXL562EZesN7fx0HiG2HMBjenzTqq00y9qiR4WI
NEXT_PUBLIC_GOLDSTACK_DEPLOYMENT=prod
NEXT_PUBLIC_GOLDSTACK_DOCS=https://docs.dev.goldstack.party/docs
NEXT_PUBLIC_STRIPE_PUBLIC_API_KEY=pk_test_51Hd1UtArOjAVQR9vxRvGfIEMGJIvY82W0PHB7ajEjh4kIHXU148UsKthSk5b6itbWR5mSg74NvfmdKdDBqItQ01m00Av3f7gpd
NEXT_PUBLIC_GOLDSTACK_DEPLOYMENT=dev

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion workspaces/apps/packages/goldstack-home/infra/aws/edge.tf
Expand Up @@ -45,7 +45,7 @@ resource "aws_lambda_function" "edge" {
description = "Edge Lambda for CloudFront Routing"
filename = data.archive_file.empty_lambda.output_path
handler = "lambda.handler"
runtime = "nodejs16.x"
runtime = "nodejs18.x"
role = aws_iam_role.lambda_exec.arn
timeout = 30
memory_size = 512
Expand Down
Expand Up @@ -7,7 +7,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "4.16.0"
version = "4.48.0"
}
}
required_version = ">= 0.13"
Expand Down
Binary file modified workspaces/apps/packages/goldstack-home/lambda.zip
Binary file not shown.
48 changes: 31 additions & 17 deletions workspaces/apps/packages/goldstack-home/next.config.js
@@ -1,15 +1,31 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');

const getLocalPackages = require('./scripts/getLocalPackages');

const localPackages = getLocalPackages.getLocalPackages();
const withTM = require('next-transpile-modules')(localPackages);

const nextConfig = {
webpack: (config, options) => {
config.module.rules.push({
test: /\.svg/,
use: {
loader: 'svg-url-loader',
},
});
config.module.rules.push({
test: /\.(png|jpe?g|gif)$/i,
use: {
loader: 'file-loader',
options: {
name: '[path][name].[hash].[ext]',
publicPath: '/_next/static',
outputPath: 'static',
emitFile: !options.isServer,
},
},
});
return config;
},
eslint: {
Expand All @@ -21,18 +37,16 @@ const nextConfig = {
},
};

const config = withPlugins(
[
[withTM()],
[
optimizedImages,
{
// optimisation disabled by default, to enable check https://github.com/cyrilwanner/next-optimized-images
optimizeImages: false,
},
],
],
nextConfig
);
const plugins = [withTM];

module.exports = config;
module.exports = (_phase, { defaultConfig }) => {
return plugins.reduce(
(acc, plugin) => {
if (Array.isArray(plugin)) {
return plugin[0](acc, plugin[1]);
}
return plugin(acc);
},
{ ...nextConfig }
);
};
22 changes: 9 additions & 13 deletions workspaces/apps/packages/goldstack-home/package.json
Expand Up @@ -47,19 +47,15 @@
"@stripe/stripe-js": "^1.10.0",
"ajv": "^6.12.2",
"data-uri-to-buffer": "^3.0.1",
"file-loader": "^6.2.0",
"img-loader": "^4.0.0",
"install": "^0.13.0",
"next": "^12.2.1",
"next-optimized-images": "^2.6.2",
"react": "^18.2.0",
"next": "13.1.1",
"react": "18.2.0",
"react-bootstrap": "^1.6.1",
"react-dom": "^18.2.0",
"react-dom": "18.2.0",
"react-is": "^18.2.0",
"react-scrollable-anchor": "^0.6.1",
"styled-components": "^5.3.5",
"swr": "^0.4.0",
"url-loader": "^4.1.1"
"swr": "^0.4.0"
},
"devDependencies": {
"@goldstack/template-nextjs": "0.5.11",
Expand All @@ -77,16 +73,16 @@
"@types/testing-library__react": "^10.2.0",
"babel-plugin-styled-components": "^2.0.7",
"concurrently": "^7.3.0",
"extracted-loader": "^1.0.7",
"ignore-loader": "^0.1.2",
"jest": "^28.1.0",
"file-loader": "^6.2.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^28.1.3",
"jest-transform-stub": "^2.0.0",
"next-compose-plugins": "^2.2.1",
"next-transpile-modules": "^8.0.0",
"next-transpile-modules": "^10.0.0",
"node-sass": "7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.2",
"svg-url-loader": "^8.0.0",
"ts-jest": "^29.0.3",
"ts-json-schema-generator": "^1.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
Expand Down
Expand Up @@ -18,6 +18,8 @@ const mockRouter: NextRouter = {
pathname: '/',
route: '/',
asPath: '/',
// eslint-disable-next-line @typescript-eslint/no-empty-function
forward: () => {},
query: {},
isReady: true,
push: jest.fn(),
Expand Down
Expand Up @@ -31,7 +31,7 @@ const LinkItem = (props: {
prefetch={false}
shallow={true}
>
<a>{props.title}</a>
{props.title}
</Link>
</span>
</div>
Expand Down
Expand Up @@ -4,8 +4,6 @@ import DesktopComputerImg from 'src/img/desktop_computer.jpg';
import TabletImg from 'src/img/tablet.jpg';
import MeetingImg from 'src/img/meeting.jpg';

import Image from 'next/image';

import { TextSectionProps } from '@goldstack/template-metadata';

const TextSection = (props: TextSectionProps): JSX.Element => {
Expand Down
4 changes: 2 additions & 2 deletions workspaces/apps/packages/goldstack-home/src/pages/build.tsx
Expand Up @@ -225,7 +225,7 @@ const ModuleSelection = (props: { elements: string[] }) => {
<h2 className="h3 mb-0">UI</h2>
</div>
<Checkbox
title="Next.js 12"
title="Next.js 13"
element="nextjs"
icon={NextjsIcon}
disabled={building}
Expand All @@ -234,7 +234,7 @@ const ModuleSelection = (props: { elements: string[] }) => {
onChange={checkboxChange}
></Checkbox>
<Checkbox
title="Next.js 12 + Bootstrap"
title="Next.js 13 + Bootstrap"
icon={BootstrapIcon}
element="bootstrap"
disabled={building}
Expand Down
Expand Up @@ -166,9 +166,13 @@
"routeKeys": {
"template": "template"
},
"dataRouteRegex": "^/_next/data/jiUI6dwNwtV4tXpLY1EZT/templates/([^/]+?)\\.json$",
"namedDataRouteRegex": "^/_next/data/jiUI6dwNwtV4tXpLY1EZT/templates/(?<template>[^/]+?)\\.json$"
"dataRouteRegex": "^/_next/data/ncFkYBMTrl9H3VGdG03FX/templates/([^/]+?)\\.json$",
"namedDataRouteRegex": "^/_next/data/ncFkYBMTrl9H3VGdG03FX/templates/(?<template>[^/]+?)\\.json$"
}
],
"rsc": {
"header": "RSC",
"varyHeader": "RSC, Next-Router-State-Tree, Next-Router-Prefetch"
},
"rewrites": []
}
4 changes: 2 additions & 2 deletions workspaces/apps/packages/template-management-cli/package.json
Expand Up @@ -59,10 +59,10 @@
"@types/yargs": "^17.0.10",
"aws-sdk": "^2.1222.0",
"concurrently": "^7.3.0",
"jest": "^28.1.0",
"jest": "^29.3.1",
"pnp-webpack-plugin": "^1.6.4",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"webpack": "4.43.0",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/docs/package.json
Expand Up @@ -37,7 +37,7 @@
"eslint-plugin-yaml": "^0.5.0",
"nodemon": "^2.0.20",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react": "18.2.0",
"typescript": "^4.8.4"
}
}
4 changes: 2 additions & 2 deletions workspaces/docs/packages/cdn/package.json
Expand Up @@ -33,11 +33,11 @@
"@types/jest": "^29.0.1",
"@types/node": "^18.7.13",
"concurrently": "^7.3.0",
"jest": "^28.1.0",
"jest": "^29.3.1",
"nodemon": "^2.0.20",
"reload": "^3.2.0",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
}
Expand Down
31 changes: 17 additions & 14 deletions workspaces/docs/packages/docs-main/infra/aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion workspaces/docs/packages/docs-main/infra/aws/edge.tf
Expand Up @@ -45,7 +45,7 @@ resource "aws_lambda_function" "edge" {
description = "Edge Lambda for CloudFront Routing"
filename = data.archive_file.empty_lambda.output_path
handler = "lambda.handler"
runtime = "nodejs16.x"
runtime = "nodejs18.x"
role = aws_iam_role.lambda_exec.arn
timeout = 30
memory_size = 512
Expand Down
2 changes: 1 addition & 1 deletion workspaces/docs/packages/docs-main/infra/aws/providers.tf
Expand Up @@ -7,7 +7,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "4.16.0"
version = "4.48.0"
}
}
required_version = ">= 0.13"
Expand Down
Binary file modified workspaces/docs/packages/docs-main/lambda.zip
Binary file not shown.