Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into upstream-updates-12-18-2023
  • Loading branch information
alishaevn committed Dec 18, 2023
2 parents ed8d773 + 2609de2 commit 3477773
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 119 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Build Test Lint'
run-name: Build Test Lint of ${{ github.ref_name }} by @${{ github.actor }}
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
build:
uses: scientist-softserv/actions/.github/workflows/[email protected]
secrets: inherit
with:
platforms: 'linux/amd64'
webTarget: web
cypress:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress e2e
uses: cypress-io/github-action@v6
with:
start: yarn start
wait-on: 'http://localhost:3000'
eslint:
needs: build
uses: scientist-softserv/actions/.github/workflows/[email protected]
with:
lint_cmd: docker compose run web sh -c 'yarn && yarn lint'
24 changes: 0 additions & 24 deletions .github/workflows/build.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/test-suite.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ node_modules/

# Emacs
*.~undo-tree~

# Cypress
cypress/results
cypress/screenshots
cypress/videos
12 changes: 8 additions & 4 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const dotenvFlowPlugin = require('cypress-dotenv-flow')
const { defineConfig } = require("cypress")
const { defineConfig } = require('cypress')

module.exports = defineConfig({
component: {
devServer: {
framework: "next",
bundler: "webpack",
framework: 'next',
bundler: 'webpack',
},
},

e2e: {
baseUrl: 'http://localhost:3000',
chromeWebSecurity: false,
Expand All @@ -27,4 +26,9 @@ module.exports = defineConfig({
NEXT_PUBLIC_PROVIDER_NAME: 'phenovista',
NEXT_PUBLIC_PROVIDER_ID: '12527'
},
reporter: 'junit',
reporterOptions: {
mochaFile: 'cypress/results/results-[hash].xml',
toConsole: true,
},
});
73 changes: 41 additions & 32 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
// This guard clause allows the app to still build in the event another exception handler will be used,
// or the sentry project hasn't been set up yet
if (!process.env.SENTRY_DSN) return

// This file sets a custom webpack configuration to use your Next.js app
// with Sentry.
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
const { withSentryConfig } = require('@sentry/nextjs')
const SENTRY_DSN = process.env.SENTRY_DSN

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

const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, configFile, stripPrefix, urlPrefix, include, ignore

silent: true, // Suppresses all logs
project: process.env.SENTRY_PROJECT,
org: process.env.SENTRY_ORG,
authToken: process.env.SENTRY_AUTH_TOKEN,
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
module.exports = nextConfig

// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = withSentryConfig(
nextConfig,
sentryWebpackPluginOptions
)
let sentryWebpackPluginOptions = {}
if (SENTRY_DSN) {
nextConfig = {
...nextConfig,
sentry: {
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
// for client-side builds. (This will be the default starting in
// `@sentry/nextjs` version 8.0.0.) See
// https://webpack.js.org/configuration/devtool/ and
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
// for more information.
hideSourceMaps: true,
},
}

sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, configFile, stripPrefix, urlPrefix, include, ignore

silent: true, // Suppresses all logs
project: process.env.SENTRY_PROJECT,
org: process.env.SENTRY_ORG,
authToken: process.env.SENTRY_AUTH_TOKEN,
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
}

module.exports = withSentryConfig(
nextConfig,
sentryWebpackPluginOptions
)
}
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
"node": "^18.13.0"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next build && next start",
"cypress:e2e": "start-server-and-test dev http://localhost:3000 \"cypress open --e2e --browser electron\"",
"cypress:headless:e2e": "start-server-and-test dev http://localhost:3000 \"cypress run --e2e --browser electron\"",
"dev": "next dev",
"lint": "next lint --dir pages --dir utils",
"cypress": "cypress run",
"cypress-gui": "cypress open",
"lint:fix": "next lint --dir pages --dir utils --fix",
"jest": "jest",
"jest-watch": "jest --watch",
"release": "release-it"
"release": "release-it",
"start": "next build && next start"
},
"dependencies": {
"@rjsf/core": "^5.0.0-beta.17",
Expand All @@ -24,14 +25,15 @@
"@sentry/nextjs": "^7.42.0",
"axios": "^1.1.3",
"bootstrap": "^5.2.3",
"cookies-next": "^4.0.0",
"eslint": "^8.54.0",
"eslint-config-next": "^14.0.3",
"cookies-next": "^4.0.0",
"next": "12.3.1",
"next-auth": "^4.20.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"sass": "^1.56.1",
"start-server-and-test": "^2.0.3",
"swr": "^1.3.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion pages/requests/[uuid].js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const Request = ({ session }) => {
if (session === null) return unauthorizedUser

const isLoading = isLoadingRequest || isLoadingSOWs || isLoadingFiles || isLoadingMessages
const isError = isRequestError || isSOWError || isFilesError|| isMessagesError || isPOError
const isError = isRequestError || isSOWError || isFilesError || isMessagesError || isPOError
const documents = (allSOWs) ? [...allSOWs, ...allPOs] : []

if (isLoading) return pageLoading
Expand Down
4 changes: 2 additions & 2 deletions utils/api/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const configureMessages = (data) => {
}))
}

export const configureFiles = (data) => {
export const configureFiles = (data) => {
// filter out the notes that do not have attachments
const notesWithFiles = data.filter(d => d.attachments?.length)
let fileArrays = []
Expand Down Expand Up @@ -235,7 +235,7 @@ export const configurePO = (po, requestIdentifier) => ({
...configureDocument(po, requestIdentifier),
turnaroundTime: po.turn_around_time.human,
poNumber: po.po_number,
relatedSOWIdentifier: po.proposal_ref?.identifier,
relatedSOWIdentifier: po.proposal_refs.first?.identifier,
adPO: po.scientist_identifier,
})

Expand Down
4 changes: 2 additions & 2 deletions utils/api/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export const getAllPOs = async (quotedWareId, uuid, requestIdentifier, accessTok
const url = () => accessToken ? `quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders.json` : null
const data = await fetcher(url(), accessToken)
const configuredPOs = data?.purchase_orders.map(async (po) => {
const purchaseOrder = await fetcher(`quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders/${po.id}.json`, accessToken)
return configurePO(purchaseOrder, requestIdentifier)
const res = await fetcher(`quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders/${po.id}.json`, accessToken)
return configurePO(res.purchase_order, requestIdentifier)
})
const allPOs = await Promise.all(configuredPOs).then(res => res)

Expand Down
3 changes: 2 additions & 1 deletion utils/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const enableCookies = () => {

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

export const disableCookies = () => {
Expand Down
Loading

0 comments on commit 3477773

Please sign in to comment.