Skip to content

Commit 2609de2

Browse files
authored
Merge pull request #340 from scientist-softserv/339-eslint-production-build
339 eslint production build
2 parents 50fc6ed + d0d5020 commit 2609de2

File tree

10 files changed

+291
-138
lines changed

10 files changed

+291
-138
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Build Test Lint'
2+
run-name: Build Test Lint of ${{ github.ref_name }} by @${{ github.actor }}
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
debug_enabled:
13+
type: boolean
14+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
15+
required: false
16+
default: false
17+
18+
jobs:
19+
build:
20+
uses: scientist-softserv/actions/.github/workflows/[email protected]
21+
secrets: inherit
22+
with:
23+
platforms: 'linux/amd64'
24+
webTarget: web
25+
cypress:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Cypress e2e
31+
uses: cypress-io/github-action@v6
32+
with:
33+
start: yarn start
34+
wait-on: 'http://localhost:3000'
35+
eslint:
36+
needs: build
37+
uses: scientist-softserv/actions/.github/workflows/[email protected]
38+
with:
39+
lint_cmd: docker compose run web sh -c 'yarn && yarn lint'

.github/workflows/build.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
# In order to deploy via github actions instead, please update/confirm the following files:
33
# - ops/production-deploy.tmpl.yaml
44
# - ops/staging-deploy.tmpl.yaml
5-
# Next, uncomment the following lines
65

7-
# name: "Deploy"
8-
# run-name: Deploy (${{ github.ref_name }} -> ${{ inputs.environment }}) by @${{ github.actor }}
9-
# on:
10-
# workflow_dispatch:
11-
# inputs:
12-
# environment:
13-
# description: 'Deploy to Environment'
14-
# required: true
15-
# default: 'staging'
16-
# type: choice
17-
# options:
18-
# - staging
19-
# - production
20-
# debug_enabled:
21-
# type: boolean
22-
# description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
23-
# required: false
24-
# default: false
6+
name: "Deploy"
7+
run-name: Deploy (${{ github.ref_name }} -> ${{ inputs.environment }}) by @${{ github.actor }}
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
environment:
12+
description: 'Deploy to Environment'
13+
required: true
14+
default: 'staging'
15+
type: choice
16+
options:
17+
- staging
18+
- production
19+
debug_enabled:
20+
type: boolean
21+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
22+
required: false
23+
default: false
2524

26-
# jobs:
27-
# deploy:
28-
# uses: scientist-softserv/actions/.github/workflows/[email protected]
29-
# secrets: inherit
25+
jobs:
26+
deploy:
27+
# remove the line below to enable the job
28+
if: false
29+
uses: scientist-softserv/actions/.github/workflows/[email protected]
30+
secrets: inherit

.github/workflows/test-suite.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ node_modules/
1717

1818
# Emacs
1919
*.~undo-tree~
20+
21+
# Cypress
22+
cypress/results
23+
cypress/screenshots
24+
cypress/videos

cypress.config.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
const dotenvFlowPlugin = require('cypress-dotenv-flow')
2-
const { defineConfig } = require("cypress")
2+
const { defineConfig } = require('cypress')
33

44
module.exports = defineConfig({
55
component: {
66
devServer: {
7-
framework: "next",
8-
bundler: "webpack",
7+
framework: 'next',
8+
bundler: 'webpack',
99
},
1010
},
11-
1211
e2e: {
1312
baseUrl: 'http://localhost:3000',
1413
chromeWebSecurity: false,
@@ -18,7 +17,7 @@ module.exports = defineConfig({
1817
...process.env,
1918
...config.env
2019
}
21-
return config
20+
return config
2221
},
2322
},
2423
env: {
@@ -27,4 +26,9 @@ module.exports = defineConfig({
2726
NEXT_PUBLIC_PROVIDER_NAME: 'acme',
2827
NEXT_PUBLIC_PROVIDER_ID: '572'
2928
},
29+
reporter: 'junit',
30+
reporterOptions: {
31+
mochaFile: 'cypress/results/results-[hash].xml',
32+
toConsole: true,
33+
},
3034
});

next.config.js

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,57 @@
1-
// This guard clause allows the app to still build in the event another exception handler will be used,
2-
// or the sentry project hasn't been set up yet
3-
if (!process.env.SENTRY_DSN) return
4-
51
// This file sets a custom webpack configuration to use your Next.js app
62
// with Sentry.
73
// https://nextjs.org/docs/api-reference/next.config.js/introduction
84
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
95
const { withSentryConfig } = require('@sentry/nextjs')
6+
const SENTRY_DSN = process.env.SENTRY_DSN
107

11-
const nextConfig = {
8+
let nextConfig = {
129
output: 'standalone',
1310
reactStrictMode: true,
1411
swcMinify: true,
1512
eslint: {
16-
dirs: ['pages', 'utils'], // Only run ESLint on the 'pages' and 'utils' directories during production builds
17-
},
18-
sentry: {
19-
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
20-
// for client-side builds. (This will be the default starting in
21-
// `@sentry/nextjs` version 8.0.0.) See
22-
// https://webpack.js.org/configuration/devtool/ and
23-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
24-
// for more information.
25-
hideSourceMaps: true,
13+
// Warning: This allows production builds to successfully complete even if
14+
// your project has ESLint errors.
15+
// ref: https://nextjs.org/docs/pages/api-reference/next-config-js/eslint
16+
ignoreDuringBuilds: true,
2617
},
2718
}
2819

29-
const sentryWebpackPluginOptions = {
30-
// Additional config options for the Sentry Webpack plugin. Keep in mind that
31-
// the following options are set automatically, and overriding them is not
32-
// recommended:
33-
// release, url, configFile, stripPrefix, urlPrefix, include, ignore
34-
35-
silent: true, // Suppresses all logs
36-
project: process.env.SENTRY_PROJECT,
37-
org: process.env.SENTRY_ORG,
38-
authToken: process.env.SENTRY_AUTH_TOKEN,
39-
// For all available options, see:
40-
// https://github.com/getsentry/sentry-webpack-plugin#options.
41-
}
20+
module.exports = nextConfig
4221

4322
// Make sure adding Sentry options is the last code to run before exporting, to
4423
// ensure that your source maps include changes from all other Webpack plugins
45-
module.exports = withSentryConfig(
46-
nextConfig,
47-
sentryWebpackPluginOptions
48-
)
24+
let sentryWebpackPluginOptions = {}
25+
if (SENTRY_DSN) {
26+
nextConfig = {
27+
...nextConfig,
28+
sentry: {
29+
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
30+
// for client-side builds. (This will be the default starting in
31+
// `@sentry/nextjs` version 8.0.0.) See
32+
// https://webpack.js.org/configuration/devtool/ and
33+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
34+
// for more information.
35+
hideSourceMaps: true,
36+
},
37+
}
38+
39+
sentryWebpackPluginOptions = {
40+
// Additional config options for the Sentry Webpack plugin. Keep in mind that
41+
// the following options are set automatically, and overriding them is not
42+
// recommended:
43+
// release, url, configFile, stripPrefix, urlPrefix, include, ignore
44+
45+
silent: true, // Suppresses all logs
46+
project: process.env.SENTRY_PROJECT,
47+
org: process.env.SENTRY_ORG,
48+
authToken: process.env.SENTRY_AUTH_TOKEN,
49+
// For all available options, see:
50+
// https://github.com/getsentry/sentry-webpack-plugin#options
51+
}
52+
53+
module.exports = withSentryConfig(
54+
nextConfig,
55+
sentryWebpackPluginOptions
56+
)
57+
}

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
"node": "^18.13.0"
77
},
88
"scripts": {
9-
"dev": "next dev",
109
"build": "next build",
11-
"start": "next build && next start",
10+
"cypress:e2e": "start-server-and-test dev http://localhost:3000 \"cypress open --e2e --browser electron\"",
11+
"cypress:headless:e2e": "start-server-and-test dev http://localhost:3000 \"cypress run --e2e --browser electron\"",
12+
"dev": "next dev",
1213
"lint": "next lint --dir pages --dir utils",
13-
"cypress": "cypress run",
14-
"cypress-gui": "cypress open",
14+
"lint:fix": "next lint --dir pages --dir utils --fix",
1515
"jest": "jest",
1616
"jest-watch": "jest --watch",
17-
"release": "release-it"
17+
"release": "release-it",
18+
"start": "next build && next start"
1819
},
1920
"dependencies": {
2021
"@rjsf/core": "^5.0.0-beta.17",
@@ -24,14 +25,15 @@
2425
"@sentry/nextjs": "^7.42.0",
2526
"axios": "^1.1.3",
2627
"bootstrap": "^5.2.3",
28+
"cookies-next": "^4.0.0",
2729
"eslint": "^8.54.0",
2830
"eslint-config-next": "^14.0.3",
29-
"cookies-next": "^4.0.0",
3031
"next": "12.3.1",
3132
"next-auth": "^4.20.1",
3233
"react": "18.2.0",
3334
"react-dom": "18.2.0",
3435
"sass": "^1.56.1",
36+
"start-server-and-test": "^2.0.3",
3537
"swr": "^1.3.0"
3638
},
3739
"devDependencies": {

utils/cookies.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export const enableCookies = () => {
3535

3636
const nonEssentialCookies = [
3737
// TODO(alishaevn): create this list
38-
// TODO(alishaevn): add these cookies to pages/legal-notices/cookie-policy.js under "Non-essential cookies" with a description and expiration time frame
38+
// TODO(alishaevn): add these cookies to pages/legal-notices/cookie-policy.js under
39+
// "Non-essential cookies" with a description and expiration time frame
3940
]
4041

4142
export const disableCookies = () => {

0 commit comments

Comments
 (0)