@helsenorge/library-build 34.1.2 → 36.0.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 +26 -31
- package/package.json +19 -19
- package/setupTests.vite.d.ts +0 -1
- package/setupTests.vite.d.ts.map +1 -1
- package/setupTests.vite.js +0 -1
- package/vite.config.d.ts +5 -0
- package/vite.config.d.ts.map +1 -0
- package/vite.config.js +9 -0
- 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
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
|
+
import yargs from 'yargs';
|
|
5
|
+
import { hideBin } from 'yargs/helpers';
|
|
4
6
|
const require = createRequire(import.meta.url);
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
case 'start':
|
|
12
|
-
case 'build':
|
|
13
|
-
case 'copy': {
|
|
14
|
-
const result = sync('node', nodeArgs.concat(require.resolve('./' + script)).concat(args.slice(scriptIndex + 1)), {
|
|
7
|
+
const args = hideBin(process.argv);
|
|
8
|
+
yargs(args)
|
|
9
|
+
.command({
|
|
10
|
+
command: 'build',
|
|
11
|
+
handler: () => {
|
|
12
|
+
const result = spawnSync('node', [require.resolve('./build'), ...args.slice(1)], {
|
|
15
13
|
stdio: 'inherit',
|
|
16
14
|
});
|
|
17
|
-
if (result.
|
|
18
|
-
|
|
19
|
-
console.log('The build failed because the process exited too early. ' +
|
|
20
|
-
'This probably means the system ran out of memory or someone called ' +
|
|
21
|
-
'`kill -9` on the process.');
|
|
22
|
-
}
|
|
23
|
-
else if (result.signal === 'SIGTERM') {
|
|
24
|
-
console.log('The build failed because the process exited too early. ' +
|
|
25
|
-
'Someone might have called `kill` or `killall`, or the system could ' +
|
|
26
|
-
'be shutting down.');
|
|
27
|
-
}
|
|
28
|
-
process.exit(1);
|
|
15
|
+
if (result.status) {
|
|
16
|
+
process.exit(result.status);
|
|
29
17
|
}
|
|
30
|
-
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.command({
|
|
21
|
+
command: 'copy',
|
|
22
|
+
handler: () => {
|
|
23
|
+
const result = spawnSync('node', [require.resolve('./copy'), ...args.slice(1)], {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
});
|
|
26
|
+
if (result.status) {
|
|
31
27
|
process.exit(result.status);
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.demandCommand()
|
|
32
|
+
.help()
|
|
33
|
+
.parse();
|
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": "36.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": {
|
|
@@ -17,27 +17,27 @@
|
|
|
17
17
|
"react-dom": "^18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@helsenorge/eslint-config": "^
|
|
21
|
-
"@
|
|
22
|
-
"@testing-library/
|
|
23
|
-
"@testing-library/
|
|
20
|
+
"@helsenorge/eslint-config": "^36.0.1",
|
|
21
|
+
"@helsenorge/typed-scss-modules": "^9.0.4",
|
|
22
|
+
"@testing-library/jest-dom": "^6.8.0",
|
|
23
|
+
"@testing-library/react": "^16.3.0",
|
|
24
|
+
"@testing-library/user-event": "^14.6.1",
|
|
24
25
|
"@types/copyfiles": "^2.4.4",
|
|
25
|
-
"@types/react": "^18.3.
|
|
26
|
-
"@types/react-dom": "^18.3.
|
|
27
|
-
"@
|
|
26
|
+
"@types/react": "^18.3.24",
|
|
27
|
+
"@types/react-dom": "^18.3.7",
|
|
28
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
29
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
28
30
|
"copyfiles": "^2.4.1",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"esbuild-sass-plugin": "^3.3.1",
|
|
32
|
-
"jsdom": "^25.0.1",
|
|
33
|
-
"postcss": "^8.5.1",
|
|
34
|
-
"postcss-modules": "^6.0.1",
|
|
31
|
+
"esbuild": "~0.25.9",
|
|
32
|
+
"jsdom": "^26.1.0",
|
|
35
33
|
"rimraf": "^6.0.1",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
34
|
+
"sass": "^1.91.0",
|
|
35
|
+
"sass-embedded": "^1.91.0",
|
|
36
|
+
"typescript": "~5.9.2",
|
|
37
|
+
"vite": "^6.3.5",
|
|
38
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
39
|
+
"vitest": "^3.2.4",
|
|
40
|
+
"yargs": "^18.0.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
package/setupTests.vite.d.ts
CHANGED
package/setupTests.vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupTests.vite.d.ts","sourceRoot":"","sources":["../src/setupTests.vite.ts"],"names":[],"mappings":"AACA,OAAO,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"setupTests.vite.d.ts","sourceRoot":"","sources":["../src/setupTests.vite.ts"],"names":[],"mappings":"AACA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC7B;CACF"}
|
package/setupTests.vite.js
CHANGED
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/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
|
-
})();
|