Skip to content

Commit

Permalink
pushet til next12.1 og gått vekk fra babel (#196)
Browse files Browse the repository at this point in the history
* pushet til next12.1 og gått vekk fra babel
styled-components kompileres nå av swc

* lagt på reader token for navikt pakkker hos gpr
  • Loading branch information
kmriise authored May 19, 2022
1 parent 6859334 commit b27ccd9
Show file tree
Hide file tree
Showing 58 changed files with 4,796 additions and 7,943 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

!sentry*
!*.json
!.npmrc
!.babelrc
!.sentryclirc

Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,22 @@ jobs:
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "16.x"
cache: "npm"
registry-url: "https://npm.pkg.github.com"

- name: Cache node modules
uses: actions/cache@v2
- name: Install
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
TZ: Europe/Oslo
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
run: npm install --no-save --no-audit

- name: Test
env:
TZ: Europe/Oslo
run: |
npm install --no-save --no-audit
npm test
npm run typeCheck
Expand All @@ -52,9 +45,11 @@ jobs:
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "16.x"
cache: "npm"
registry-url: "https://npm.pkg.github.com"

- name: Cypress run
uses: cypress-io/github-action@v2
Expand All @@ -64,6 +59,7 @@ jobs:
env:
SANITY_READ_TOKEN: ${{ secrets.CYPRESS_READ_TOKEN_SANITY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}

- uses: actions/upload-artifact@v1
if: failure()
Expand Down Expand Up @@ -102,6 +98,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: |
"NODE_AUTH_TOKEN=${{ secrets.READER_TOKEN }}"
"SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}"
- name: Archive NAIS yaml
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ logs
.DS_Store

# Sentry
.sentryclirc
.sentryclirc

#testfile-output being generated
tsconfig.tsbuildinfo
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@navikt:registry=https://npm.pkg.github.com

4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ENV CI=true

COPY package*.json /home/node/app/
COPY prepare.js /home/node/app/
COPY .npmrc /home/node/app/

RUN --mount=type=secret,id=NODE_AUTH_TOKEN \
echo '//npm.pkg.github.com/:_authToken='$(cat /run/secrets/NODE_AUTH_TOKEN) >> .npmrc

RUN npm ci

Expand Down
12 changes: 10 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module.exports = {
const customJestConfig = {
collectCoverageFrom: ["**/*.{js,jsx,ts,tsx}", "!**/*.d.ts", "!**/node_modules/**"],
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testPathIgnorePatterns: ["/node_modules/", "/.next/", ".+test.utils+"], // For å hindre next i å kompilere test-hjelpefiler må vi legge til .test. i filnavn, men da prøver jest å kjøre filene og feiler fordi den ikke finner tester der. Legger derfor til .utils. i filnavn, og ignorerer dette i jest-config. Alt dette for å slippe å installere dev-deps i pipeline
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.(css|less)$": "jest-transform-stub",
},
transformIgnorePatterns: ["/node_modules/(?!(nav-.+)/)", "^.+\\.module\\.(css|sass|scss)$"],
Expand All @@ -15,3 +14,12 @@ module.exports = {
},
testEnvironment: "jsdom",
};

// jest.config.js
const nextJest = require("next/jest");

// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: "src" });

// createJestConfig is exported in this way to ensure that next/jest can load the Next.js configuration, which is async
module.exports = createJestConfig(customJestConfig);
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
9 changes: 5 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const csp = require("./csp");
const { withSentryConfig } = require("@sentry/nextjs");
const withTranspileModules = require("next-transpile-modules")(["@navikt/ds-react", "@navikt/ds-icons"]);

const config = {
compiler: {
// ssr and displayName are configured by default
styledComponents: true,
},
basePath: "/arbeid",
productionBrowserSourceMaps: true,
i18n: {
Expand Down Expand Up @@ -35,13 +38,11 @@ const config = {
},
};

const moduleExports = withTranspileModules(config);

// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.

const sentryWebpackPluginOptions = {
silent: true, // Suppresses all logs
};

module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions);
module.exports = withSentryConfig(config, sentryWebpackPluginOptions);
Loading

0 comments on commit b27ccd9

Please sign in to comment.