Skip to content

Commit db85166

Browse files
committed
FO-2760 Initial commit
0 parents  commit db85166

37 files changed

+14383
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PORT=3667
2+
SKIP_PREFLIGHT_CHECK=true

.github/workflows/main.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Test, build, push and deploy
2+
on: push
3+
env:
4+
IMAGE_TAG: ${{ github.sha }}
5+
IMAGE: docker.pkg.github.com/${{ github.repository }}/beslutteroversikt
6+
PRINT_PAYLOAD: true
7+
jobs:
8+
test:
9+
name: Run tests
10+
runs-on: ubuntu-latest
11+
if: github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/master'
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
- name: Setup node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '12.x'
19+
- name: Install dependencies
20+
run: npm ci
21+
- name: Run tests
22+
run: npm run test
23+
24+
test-build-and-push:
25+
name: Test, build and push
26+
runs-on: ubuntu-latest
27+
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v1
31+
- name: Setup node
32+
uses: actions/setup-node@v1
33+
with:
34+
node-version: '12.x'
35+
- name: Install dependencies
36+
run: npm ci
37+
- name: Build application
38+
run: npm run build
39+
- name: Build and push Docker image
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
docker build -t ${IMAGE}:${IMAGE_TAG} .
44+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
45+
docker push ${IMAGE}:${IMAGE_TAG}
46+
47+
update-gh-pages:
48+
name: Update GitHub pages
49+
runs-on: ubuntu-latest
50+
if: github.ref == 'refs/heads/dev'
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v1
54+
- name: Setup node
55+
uses: actions/setup-node@v1
56+
with:
57+
node-version: '12.x'
58+
- name: Install dependencies
59+
run: npm ci
60+
- name: Build mock application
61+
run: npm run build:mock
62+
- name: Update GitHub pages
63+
uses: peaceiris/[email protected]
64+
env:
65+
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
66+
PUBLISH_BRANCH: gh-pages
67+
PUBLISH_DIR: build
68+
69+
deploy-q0:
70+
name: Deploy application to Q0
71+
if: github.ref == 'refs/heads/dev'
72+
needs: test-build-and-push
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v1
77+
- name: Deploy application
78+
uses: nais/deploy/actions/deploy@v1
79+
env:
80+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
81+
CLUSTER: dev-fss
82+
RESOURCE: nais-q.yaml
83+
VAR: version=${{ env.IMAGE_TAG }},namespace=q0
84+
deploy-q1:
85+
name: Deploy application to Q1
86+
if: github.ref == 'refs/heads/dev'
87+
needs: test-build-and-push
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v1
92+
- name: Deploy application
93+
uses: nais/deploy/actions/deploy@v1
94+
env:
95+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
96+
CLUSTER: dev-fss
97+
RESOURCE: nais-q.yaml
98+
VAR: version=${{ env.IMAGE_TAG }},namespace=q1
99+
deploy-prod:
100+
name: Deploy application to prod
101+
if: github.ref == 'refs/heads/master'
102+
needs: test-build-and-push
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v1
107+
- name: Deploy application
108+
uses: nais/deploy/actions/deploy@v1
109+
env:
110+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
111+
CLUSTER: prod-fss
112+
RESOURCE: nais.yaml
113+
VAR: version=${{ env.IMAGE_TAG }}
114+
release-dev:
115+
name: Create dev release
116+
needs: [deploy-q0, deploy-q1]
117+
runs-on: ubuntu-latest
118+
steps:
119+
- name: Create release
120+
uses: actions/create-release@v1
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
with:
124+
tag_name: release/dev@${{ env.IMAGE_TAG }}
125+
release_name: Release to dev
126+
prerelease: true
127+
release-prod:
128+
name: Create prod release
129+
needs: deploy-prod
130+
runs-on: ubuntu-latest
131+
steps:
132+
- name: Create release
133+
uses: actions/create-release@v1
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
with:
137+
tag_name: release/prod@${{ env.IMAGE_TAG }}
138+
release_name: Release to prod
139+
prerelease: false

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
.idea/
26+
*.iml

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"semi": true,
5+
"tabWidth": 4,
6+
"useTabs": true,
7+
"trailingComma": "none",
8+
"arrowParens": "avoid"
9+
}

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @navikt/vibe

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM navikt/pus-nginx
2+
COPY build /usr/share/nginx/html/beslutteroversikt

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License
2+
3+
Copyright 2019 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the "Software"),
7+
to deal in the Software without restriction, including without limitation
8+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
and/or sell copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included
13+
in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21+
USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Frontend for beslutteroversikt
2+
3+
Intern applikasjon for å vise oversikt over brukere under kvalitetssikring av 14A vedtak.
4+
5+
Testversjon av løsningen: [https://navikt.github.io/beslutteroversikt](https://navikt.github.io/beslutteroversikt)

craco.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const path = require('path');
2+
const CracoLessPlugin = require('craco-less');
3+
const BUILD_PATH = path.resolve(__dirname, './build');
4+
5+
const removeCssHashPlugin = {
6+
overrideWebpackConfig: ({ webpackConfig, cracoConfig, pluginOptions, context: { env, paths } }) => {
7+
8+
const plugins = webpackConfig.plugins;
9+
plugins.forEach(plugin => {
10+
11+
const options = plugin.options;
12+
13+
if (!options) {
14+
return;
15+
}
16+
17+
if (options.filename && options.filename.endsWith('.css')) {
18+
options.filename = "static/css/[name].css";
19+
}
20+
21+
});
22+
23+
return webpackConfig;
24+
}
25+
};
26+
27+
module.exports = {
28+
plugins: [
29+
{ plugin: CracoLessPlugin },
30+
{ plugin: removeCssHashPlugin },
31+
],
32+
webpack: {
33+
configure: {
34+
optimization: {
35+
splitChunks: {
36+
cacheGroups: {
37+
default: false,
38+
vendors: false
39+
},
40+
},
41+
runtimeChunk: false
42+
},
43+
output: {
44+
path: BUILD_PATH,
45+
filename: 'static/js/[name].js',
46+
},
47+
}
48+
}
49+
};

0 commit comments

Comments
 (0)