-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from navikt/migrere-til-vite
Migrerer fra react-scripts til Vite
- Loading branch information
Showing
94 changed files
with
9,506 additions
and
72,628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:jsx-a11y/recommended", | ||
"prettier" | ||
], | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
}, | ||
"overrides": [], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react", "@typescript-eslint"], | ||
"rules": { | ||
"quotes": ["warn", "single", { "avoidEscape": true }], | ||
"semi": ["error", "always"], | ||
"max-len": [1, { "code": 150, "ignoreComments": true, "ignoreStrings": true }], | ||
"indent": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"react/display-name": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build application | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build application | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
name: Publish beta | ||
on: | ||
workflow_dispatch | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
publish-beta: | ||
name: Publish to package registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.15.0' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Bump version | ||
run: | | ||
git config --global user.name '${{ github.actor }}' | ||
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | ||
npm version prerelease --preid beta | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build package | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test | ||
- name: Publish package | ||
id: publish | ||
run: npm publish --tag beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push new version tag | ||
if: steps.publish.outcome == 'success' | ||
run: git push | ||
publish-beta: | ||
name: Publish to package registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Bump version | ||
run: | | ||
git config --global user.name '${{ github.actor }}' | ||
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | ||
npm version prerelease --preid beta | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build package | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test | ||
- name: Publish package | ||
id: publish | ||
run: npm publish --tag beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push new version tag | ||
if: steps.publish.outcome == 'success' | ||
run: git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
name: Publish release (master only) | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseType: | ||
type: choice | ||
required: true | ||
description: 'Release type' | ||
default: 'patch' | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
releaseBody: | ||
type: string | ||
required: true | ||
description: 'Release description' | ||
workflow_dispatch: | ||
inputs: | ||
releaseType: | ||
type: choice | ||
required: true | ||
description: 'Release type' | ||
default: 'patch' | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
releaseBody: | ||
type: string | ||
required: true | ||
description: 'Release description' | ||
|
||
jobs: | ||
publish: | ||
name: Publish to package registry | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.15.0' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Bump version | ||
run: | | ||
git config --global user.name '${{ github.actor }}' | ||
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | ||
echo "VERSION_TAG=$(npm version ${{ github.event.inputs.releaseType }})" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build package | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test | ||
- name: Publish package | ||
id: publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push new version tag | ||
if: steps.publish.outcome == 'success' | ||
run: git push | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.VERSION_TAG }} | ||
body: ${{ github.event.inputs.releaseBody }} | ||
publish: | ||
name: Publish to package registry | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Setup node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://npm.pkg.github.com' | ||
cache: 'npm' | ||
- name: Bump version | ||
run: | | ||
git config --global user.name '${{ github.actor }}' | ||
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | ||
echo "VERSION_TAG=$(npm version ${{ github.event.inputs.releaseType }})" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Build package | ||
run: npm run build | ||
- name: Run tests | ||
run: npm test | ||
- name: Publish package | ||
id: publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push new version tag | ||
if: steps.publish.outcome == 'success' | ||
run: git push | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.VERSION_TAG }} | ||
body: ${{ github.event.inputs.releaseBody }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
@OWNER:registry=https://npm.pkg.github.com | ||
@navikt:registry=https://npm.pkg.github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,47 +8,24 @@ I terminalen kjør følgende kommandoer | |
|
||
``` | ||
npm install | ||
docker-compose up -d && npm start | ||
docker-compose up -d | ||
npm start | ||
``` | ||
|
||
(docker-compose kjører opp nødvendige mocks og oidc-provider) | ||
(docker-compose starter dekoratøren, mocks og oidc-provider) | ||
|
||
Arbeidsforhold er kun npm-pakker som skal konsumeres av andre applikasjoner. For å vise denne pakken i nettleser, blir den åpnet via eksempelapplikasjonen (ligger i `/example`-mappen). Det er denne eksempelapplikasjonen som starter opp når du kjører `npm start`. | ||
Arbeidsforhold er kun npm-pakker som skal brukes av andre applikasjoner. For å vise denne pakken i nettleser, blir den åpnet via eksempelapplikasjonen som ligger i `/example`-mappen. Det er denne eksempelapplikasjonen som starter opp når du kjører `npm start`. | ||
|
||
Prosjektet støtter hot-reloading, endringer i komponentene vil føre til at test-applikasjonen oppdateres. | ||
Prosjektet støtter hot-reloading, endringer i komponentene vil føre til at eksempel-applikasjonen oppdateres. | ||
|
||
## Publisering | ||
|
||
Merk at pakken publiseres i Github Packages og ikke Npmjs. Dersom du ikke har autentisert npm cli mot GHP, gjør du det med | ||
`npm login --registry=https://npm.pkg.github.com` | ||
Du finner [mer informasjon om autentisering mot Github Packages her](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages). | ||
Benytt fanen "Actions" og deploy-jobben "Beta" for å publisere nye betaer, enten som patch, minor eller major. Merk at pakken publiseres i Github Packages og ikke Npmjs. | ||
|
||
### Publisering av betaversjon | ||
### Versjonering | ||
|
||
1. Husk å oppdatere branchen din slik at den ikke ligger etter master. (`git fetch` henter alle brancher.) | ||
2. For ordens skyld, commit alle endringene i forkant. | ||
3. `npm run publish:prepatch` | `npm run publish:preminor` | `npm run publish:premajor` | ||
Det er viktig å følge semver-prinsippene når du velger hvilken versjon du øker til. Du finner [mer informasjon om semver her](https://docs.npmjs.com/about-semantic-versioning) dersom du er usikker på om du skal velge patch, minor eller major. | ||
|
||
Du finner [mer informasjon om semver her](https://docs.npmjs.com/about-semantic-versioning) dersom du er usikker på om du skal velge prepatch, preminor eller premajor. | ||
|
||
Beta-versjonen du har publisert blir gjort tilgjengelig som `x.x.x-beta.x` og kan hentes inn som en spesifikk versjon i den konsumerende applikasjonen, feks | ||
|
||
`npm install @navikt/[email protected]`. | ||
|
||
## Publisering av flere betaer | ||
|
||
Enkelte ganger er det nødvendig å publisere flere betaer iløpet av testingen, feks `x.x.x-beta.0`, `x.x.x-beta.1`, `x.x.x-beta.2` osv. Etter å ha publisert første beta (se ovenfor) kan du 'betabumpe' pakken med | ||
|
||
`npm version prerelease` | ||
og deretter | ||
`npm publish --access public --tag beta` | ||
|
||
### Publisering av ny versjon | ||
|
||
1. Publisering av ny versjon skjer fra master. Dvs at alle relevante brancher må være merget inn. | ||
2. `npm run build` | ||
3. `npm version patch | minor | major` | ||
4. `npm publish --access public` | ||
|
||
Du finner [mer informasjon om semver her](https://docs.npmjs.com/about-semantic-versioning) dersom du er usikker på om du skal velge patch, minor eller major. | ||
- Major: Arbeidsforhold har såkalte "breaking changes" som kan gjøre at den slutter å fungere hvis man ikke gjør nødvendige tilpassinger i applikasjonen sin. | ||
- Minor: Relativt mange endringer og nye funksjoner, men alle skal i utgangspunktet være bakoverkompatible. | ||
- Patch: Kun feilretting og ingen funksjonsendring eller nye funksjoner. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.