@helsenorge/library-build 33.1.0 → 35.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/tsconfig.node.json +9 -0
- package/config/tsconfig.vite.json +28 -0
- package/library-scripts.js +1 -2
- package/package.json +18 -15
- package/vite.config.d.ts +5 -0
- package/vite.config.d.ts.map +1 -0
- package/vite.config.js +9 -0
- package/vitest.config.d.ts.map +1 -1
- package/vitest.config.js +3 -1
- package/index.html +0 -36
- package/start.d.ts +0 -2
- package/start.d.ts.map +0 -1
- package/start.js +0 -70
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
/* Linting */
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true,
|
|
24
|
+
|
|
25
|
+
/* https://vitest.dev/config/#globals */
|
|
26
|
+
"types": ["vitest/globals", "@testing-library/jest-dom"]
|
|
27
|
+
}
|
|
28
|
+
}
|
package/library-scripts.js
CHANGED
|
@@ -4,11 +4,10 @@ import { createRequire } from 'node:module';
|
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
5
|
const sync = require('cross-spawn').sync;
|
|
6
6
|
const args = process.argv.slice(2);
|
|
7
|
-
const scriptIndex = args.findIndex(x => x === '
|
|
7
|
+
const scriptIndex = args.findIndex(x => x === 'build' || x === 'copy');
|
|
8
8
|
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
|
|
9
9
|
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
|
|
10
10
|
switch (script) {
|
|
11
|
-
case 'start':
|
|
12
11
|
case 'build':
|
|
13
12
|
case 'copy': {
|
|
14
13
|
const result = sync('node', nodeArgs.concat(require.resolve('./' + script)).concat(args.slice(scriptIndex + 1)), {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helsenorge/library-build",
|
|
3
3
|
"author": "Norsk helsenett SF",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "35.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": {
|
|
@@ -17,24 +17,27 @@
|
|
|
17
17
|
"react-dom": "^18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@helsenorge/eslint-config": "^
|
|
20
|
+
"@helsenorge/eslint-config": "^35.1.1",
|
|
21
21
|
"@testing-library/jest-dom": "^6.6.3",
|
|
22
|
-
"@testing-library/react": "^16.0
|
|
23
|
-
"@testing-library/user-event": "^14.
|
|
22
|
+
"@testing-library/react": "^16.3.0",
|
|
23
|
+
"@testing-library/user-event": "^14.6.1",
|
|
24
24
|
"@types/copyfiles": "^2.4.4",
|
|
25
|
-
"@types/react": "^18.3.
|
|
26
|
-
"@types/react-dom": "^18.3.
|
|
27
|
-
"@
|
|
25
|
+
"@types/react": "^18.3.18",
|
|
26
|
+
"@types/react-dom": "^18.3.5",
|
|
27
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
28
|
+
"@vitest/coverage-v8": "^3.1.2",
|
|
28
29
|
"copyfiles": "^2.4.1",
|
|
29
|
-
"cross-spawn": "^7.0.
|
|
30
|
-
"esbuild": "
|
|
31
|
-
"
|
|
32
|
-
"postcss": "^8.4.47",
|
|
33
|
-
"postcss-modules": "^6.0.0",
|
|
30
|
+
"cross-spawn": "^7.0.6",
|
|
31
|
+
"esbuild": "~0.25.3",
|
|
32
|
+
"jsdom": "^26.1.0",
|
|
34
33
|
"rimraf": "^6.0.1",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
34
|
+
"sass": "^1.87.0",
|
|
35
|
+
"sass-embedded": "^1.87.0",
|
|
36
|
+
"typed-scss-modules": "^8.1.1",
|
|
37
|
+
"typescript": "~5.8.3",
|
|
38
|
+
"vite": "^6.3.3",
|
|
39
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
40
|
+
"vitest": "^3.1.2",
|
|
38
41
|
"whatwg-fetch": "^3.6.20",
|
|
39
42
|
"yargs": "^17.7.2"
|
|
40
43
|
},
|
package/vite.config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../src/vite.config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAgB,MAAM,MAAM,CAAC;AAGzD,eAAO,MAAM,SAAS,EAAE,mBAIvB,CAAC;;AAEF,wBAAyD"}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
4
|
+
export const getConfig = async () => {
|
|
5
|
+
return {
|
|
6
|
+
plugins: [react(), tsconfigPaths()],
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default defineConfig(async (env) => getConfig(env));
|
package/vitest.config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../src/vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../src/vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwC,MAAM,eAAe,CAAC;AAEnF,eAAO,MAAM,SAAS,EAAE,YAkCvB,CAAC;;AAEF,wBAAmD"}
|
package/vitest.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
1
|
+
import { coverageConfigDefaults, defineConfig } from 'vitest/config';
|
|
2
2
|
export const getConfig = () => {
|
|
3
3
|
return {
|
|
4
4
|
test: {
|
|
@@ -19,6 +19,8 @@ export const getConfig = () => {
|
|
|
19
19
|
coverage: {
|
|
20
20
|
enabled: true,
|
|
21
21
|
reporter: ['cobertura', 'lcov', 'json'],
|
|
22
|
+
include: ['src/**'],
|
|
23
|
+
exclude: [...coverageConfigDefaults.exclude, '**/__devonly__/**', '**/__mocks__/**', '**/mocks/**'],
|
|
22
24
|
},
|
|
23
25
|
reporters: ['default', 'junit'],
|
|
24
26
|
outputFile: {
|
package/index.html
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="no">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
7
|
-
<title>Helsenorge</title>
|
|
8
|
-
<!-- IMPORT TEMPLATE FOR WEBCOMP-->
|
|
9
|
-
|
|
10
|
-
<template id="hn-webcomp-header-footer-template">
|
|
11
|
-
<link href="https://static-hn-mas-01.int-hn.nhn.no/core/static/css/helsenorge/helsenorge.css" rel="stylesheet" />
|
|
12
|
-
<link
|
|
13
|
-
type="text/css"
|
|
14
|
-
rel="stylesheet"
|
|
15
|
-
href="https://static-hn-mas-01.int-hn.nhn.no/header-footer/static/css/header-footer/header-footer.css"
|
|
16
|
-
/>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<!-- ADDING RESET CSS -->
|
|
20
|
-
<link href="https://static-hn-mas-01.int-hn.nhn.no/core/static/css/helsenorge/helsenorge.css" rel="stylesheet" />
|
|
21
|
-
|
|
22
|
-
<link type="text/css" rel="stylesheet" href="index.css" />
|
|
23
|
-
</head>
|
|
24
|
-
|
|
25
|
-
<body id="helsenorge">
|
|
26
|
-
<hn-webcomp-header></hn-webcomp-header>
|
|
27
|
-
<div id="main-content-wrapper"></div>
|
|
28
|
-
|
|
29
|
-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.development.js"></script>
|
|
30
|
-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.development.js"></script>
|
|
31
|
-
|
|
32
|
-
<!-- IMPORT header-footer script -->
|
|
33
|
-
<script type="module" src="https://static-hn-mas-01.int-hn.nhn.no/header-footer/static/js/header-footer/header-footer.js"></script>
|
|
34
|
-
<script type="module" src="index.js"></script>
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|
package/start.d.ts
DELETED
package/start.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":""}
|
package/start.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, copyFileSync } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import url from 'url';
|
|
4
|
-
import esbuild from 'esbuild';
|
|
5
|
-
import { sassPlugin, postcssModules } from 'esbuild-sass-plugin';
|
|
6
|
-
import yargs from 'yargs';
|
|
7
|
-
import { hideBin } from 'yargs/helpers';
|
|
8
|
-
const __filename = url.fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
(async () => {
|
|
11
|
-
const { entry, outDir } = await yargs(hideBin(process.argv))
|
|
12
|
-
.options({
|
|
13
|
-
entry: { type: 'string', default: 'src/__devonly__/index.tsx' },
|
|
14
|
-
outDir: { type: 'string', default: 'dist' },
|
|
15
|
-
})
|
|
16
|
-
.parse();
|
|
17
|
-
if (!existsSync(outDir)) {
|
|
18
|
-
mkdirSync(outDir);
|
|
19
|
-
}
|
|
20
|
-
copyFileSync(__dirname + '/index.html', outDir + '/index.html');
|
|
21
|
-
const context = await esbuild.context({
|
|
22
|
-
format: 'esm',
|
|
23
|
-
logLevel: 'debug',
|
|
24
|
-
entryPoints: [entry],
|
|
25
|
-
outdir: outDir,
|
|
26
|
-
bundle: true,
|
|
27
|
-
define: {
|
|
28
|
-
global: 'window',
|
|
29
|
-
'import.meta.env': '{}',
|
|
30
|
-
},
|
|
31
|
-
loader: {
|
|
32
|
-
'.svg': 'dataurl',
|
|
33
|
-
'.woff': 'dataurl',
|
|
34
|
-
'.woff2': 'dataurl',
|
|
35
|
-
},
|
|
36
|
-
plugins: [
|
|
37
|
-
sassPlugin({
|
|
38
|
-
filter: /.module.(s[ac]ss|css)$/,
|
|
39
|
-
type: 'css',
|
|
40
|
-
transform: postcssModules({
|
|
41
|
-
// ...put here the options for postcss-modules: https://github.com/madyankin/postcss-modules
|
|
42
|
-
}),
|
|
43
|
-
importMapper: path => (path.endsWith('styles.module') ? path + '.scss' : path),
|
|
44
|
-
precompile(source, pathname) {
|
|
45
|
-
const basedir = path.dirname(pathname);
|
|
46
|
-
return source.replace(/(url\(['"]?)(\.\.?\/)([^'")]+['"]?\))/g, '$1'.concat(basedir.replace(/\\/g, '\\\\'), '/$2$3'));
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
sassPlugin({
|
|
50
|
-
filter: /.(s[ac]ss|css)$/,
|
|
51
|
-
type: 'style',
|
|
52
|
-
}),
|
|
53
|
-
{
|
|
54
|
-
name: 'resolve-fonts',
|
|
55
|
-
setup(build) {
|
|
56
|
-
build.onResolve({ filter: /\.woff2?$/ }, ({ path }) => {
|
|
57
|
-
return { path };
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
});
|
|
63
|
-
await context.watch();
|
|
64
|
-
await context.serve({
|
|
65
|
-
port: 3000,
|
|
66
|
-
host: 'localhost',
|
|
67
|
-
servedir: outDir,
|
|
68
|
-
fallback: outDir + '/index.html',
|
|
69
|
-
});
|
|
70
|
-
})();
|