Skip to content

Commit

Permalink
Merge nextjs fork (#597)
Browse files Browse the repository at this point in the history
* Add next app

* added sentry .env file to gitignore

* Delete next/.env.sentry-build-plugin

---------

Co-authored-by: Aidan Landen <[email protected]>
Co-authored-by: Aidan Landen <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent e8c8183 commit 8550051
Show file tree
Hide file tree
Showing 113 changed files with 30,398 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# dependencies
/node_modules
react/node_modules
next/.next
next/node_modules
express/node_modules
/.pnp
.pnp.js
Expand All @@ -13,6 +15,8 @@ express/node_modules
# production
/build
react/build
next/dist


# misc
.idea
Expand Down Expand Up @@ -85,6 +89,8 @@ env-config/*
**/local.env
tda/env

next/.env.sentry-build-plugin

# .NET
aspnetcore/bin
aspnetcore/obj
Expand Down
8 changes: 7 additions & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ if ! [[ $proj =~ ^(crons|tda)- ]]; then
export RELEASE="$release"
fi
fi
if [ "$proj" == "react" ]; then
if [[ "$proj" == "react" ]]; then
echo "REACT_APP_RELEASE=$RELEASE" >> .env
fi


if [[ "$proj" == "next" ]]; then
echo "NEXT_PUBLIC_RELEASE=$RELEASE" >> .env
fi


validate_dotenv.sh

if [ "$2" == "" ]; then
Expand Down
1 change: 1 addition & 0 deletions next/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
35 changes: 35 additions & 0 deletions next/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Python pycache:
__pycache__/
# Ignored by the build system
/setup.cfg


env
env/
.env
**/.env

**/.virtualenv

node_modules/
**/node_modules

flask/
tests/
README.md
2 changes: 2 additions & 0 deletions next/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true

3 changes: 3 additions & 0 deletions next/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.next
dist
node_modules
6 changes: 6 additions & 0 deletions next/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
32 changes: 32 additions & 0 deletions next/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM node:18-buster-slim

RUN : \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# for envsusbst
gettext \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g serve

WORKDIR /src
COPY package.json package-lock.json .
RUN npm install

COPY . .

RUN \
REACT_APP_DSN=http://react@localhost:9989/2 \
REACT_APP_RELEASE=2023+compose \
SENTRY_AUTH_TOKEN=ignored \
REACT_APP_ASPNETCORE_BACKEND=http://localhost:8091 \
REACT_APP_EXPRESS_BACKEND=http://localhost:8088 \
REACT_APP_FLASK_BACKEND=http://localhost:8080 \
REACT_APP_LARAVEL_BACKEND=http://localhost:8000 \
REACT_APP_RUBYONRAILS_BACKEND=http://localhost:5000 \
REACT_APP_RUBY_BACKEND=http://localhost:4567 \
REACT_APP_SPRINGBOOT_BACKEND=http://localhost:8090 \
./build.sh

CMD ["serve", "-s", "build"]
7 changes: 7 additions & 0 deletions next/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## About

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Deploy

See [../README.md](../README.md)
16 changes: 16 additions & 0 deletions next/app.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

env: standard
service: <SERVICE>
runtime: nodejs18

handlers:
- url: /static
static_dir: build/static
- url: /(.*\.(json|ico|js|png))$
static_files: build/\1
upload: build/.*\.(json|ico|js|png)$
- url: .*
static_files: build/index.html
upload: build/index.html
http_headers:
Document-Policy: js-profiling
14 changes: 14 additions & 0 deletions next/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Usage: ./build.sh

set -e # exit immediately if any command exits with a non-zero status

envsubst < config-overrides.js.template > config-overrides.js

rm -rf build
# npm ci does not update minor versions ->
# (1) less chance of breaking (2) less noise in PR from package-lock.json
npm ci
npm run dev # defined in 'scripts' in package.json

25 changes: 25 additions & 0 deletions next/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const reactsourceMapPlugin = require('@acemarke/react-prod-sourcemaps');

module.exports = function override(config, env) {
//do stuff with the webpack config...
config.plugins.push(
reactsourceMapPlugin.WebpackReactSourcemapsPlugin({
mode: 'strict',
})
);

config.plugins.push(
SentryWebpackPlugin.sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
include: '.',
org: 'team-se',
project: 'aidan-react-local',
ignoreFile: '.sentrycliignore',
ignore: ['webpack.config.js'],
configFile: 'sentry.properties',
reactComponentAnnotation: { enabled: true },
})
);
return config;
};
25 changes: 25 additions & 0 deletions next/config-overrides.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const reactsourceMapPlugin = require('@acemarke/react-prod-sourcemaps');

module.exports = function override(config, env) {
//do stuff with the webpack config...
config.plugins.push(
reactsourceMapPlugin.WebpackReactSourcemapsPlugin({
mode: 'strict',
})
);

config.plugins.push(
SentryWebpackPlugin.sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
include: '.',
org: '${SENTRY_ORG}',
project: '${REACT_SENTRY_PROJECT}',
ignoreFile: '.sentrycliignore',
ignore: ['webpack.config.js'],
configFile: 'sentry.properties',
reactComponentAnnotation: {enabled:true},
})
);
return config;
};
3 changes: 3 additions & 0 deletions next/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from 'eslint-config-prettier';

export default [...[].concat(config)];
45 changes: 45 additions & 0 deletions next/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { withSentryConfig } from '@sentry/nextjs';
/** @type {import('next').NextConfig} */
const nextConfig = {
distDir: './dist', // Changes the build output directory to `./dist/`.
};

export default withSentryConfig(nextConfig, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

org: 'aidans-test-org',
project: 'javascript-nextjs',

// Only print logs for uploading source maps in CI
silent: !process.env.CI,

// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},

// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
// tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
});
Loading

0 comments on commit 8550051

Please sign in to comment.