@n42/cli 0.2.76 → 0.2.90
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/dist/assets/discover.html.template +50 -0
- package/dist/assets/discover.js +48 -0
- package/dist/assets/github.svg +33 -0
- package/dist/assets/insomnia.svg +19 -0
- package/dist/assets/node42-logo.svg +22 -0
- package/dist/assets/validator-light.css +49 -0
- package/dist/assets/validator.html.template +44 -0
- package/dist/assets/wrapper-light.css +257 -0
- package/dist/assets/wrapper.js +54 -0
- package/dist/n42 +135 -0
- package/package.json +3 -3
- package/src/assets/discover.html.template +19 -2
- package/src/assets/github.svg +33 -0
- package/src/assets/insomnia.svg +19 -0
- package/src/assets/validator.html.template +18 -1
- package/src/assets/wrapper-light.css +54 -0
- package/src/assets/wrapper.js +54 -0
- package/src/cli.js +0 -2
- package/test/asserts/validate_tests.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n42/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.90",
|
|
4
4
|
"description": "Node42 CLI – Command-line interface for Peppol eDelivery path discovery, diagnostics, and tooling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node42",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"author": "Node42 @n42",
|
|
20
20
|
"type": "commonjs",
|
|
21
21
|
"bin": {
|
|
22
|
-
"n42": "
|
|
22
|
+
"n42": "dist/n42"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"lint": "eslint src",
|
|
26
26
|
"test": "mocha",
|
|
27
27
|
"test:coverage": "c8 --reporter=text-summary --reporter=lcov mocha",
|
|
28
28
|
"test:watch": "mocha --watch",
|
|
29
|
-
"build": "esbuild src/cli.js --bundle --platform=node --target=node20 --outfile=dist/n42 --format=cjs --minify --banner:js='#!/usr/bin/env node'"
|
|
29
|
+
"build": "esbuild src/cli.js --bundle --platform=node --target=node20 --outfile=dist/n42 --format=cjs --minify --banner:js='#!/usr/bin/env node' && cp -rf src/assets/* dist/assets"
|
|
30
30
|
},
|
|
31
31
|
"prepublishOnly": "npm run build",
|
|
32
32
|
"c8": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<body>
|
|
9
9
|
<div id="app-header">
|
|
10
10
|
<div class="header-left">
|
|
11
|
-
<img id="appBtn" src="../../assets/node42-logo.svg" alt="Node42"
|
|
11
|
+
<img id="appBtn" src="../../assets/node42-logo.svg" alt="Node42">
|
|
12
12
|
</div>
|
|
13
13
|
<div class="header-right"></div>
|
|
14
14
|
</div>
|
|
@@ -28,6 +28,23 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
|
-
<
|
|
31
|
+
<div id="app-menu" class="app-menu">
|
|
32
|
+
<div class="app-grid">
|
|
33
|
+
<div class="app-tile" title="GitHub" onclick="window.open('https://github.com/node42-dev', '_blank');">
|
|
34
|
+
<div class="icon-box">
|
|
35
|
+
<img src="../../assets/github.svg" class="icon-box-svg" alt="GitHub">
|
|
36
|
+
</div>
|
|
37
|
+
<div class="label">GitHub</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="app-tile" title="Insomina Collection" onclick="downloadInsomniaCollection();">
|
|
40
|
+
<div class="icon-box">
|
|
41
|
+
<img src="../../assets/insomnia.svg" class="icon-box-svg" alt="Insomnia">
|
|
42
|
+
</div>
|
|
43
|
+
<div class="label">Insomnia</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<script src="../../assets/discover.js" defer></script>
|
|
48
|
+
<script src="../../assets/wrapper.js" defer></script>
|
|
32
49
|
</body>
|
|
33
50
|
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
width="512"
|
|
4
|
+
height="512"
|
|
5
|
+
viewBox="0 0 512 512"
|
|
6
|
+
fill="none"
|
|
7
|
+
version="1.1"
|
|
8
|
+
id="svg11"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
11
|
+
<g
|
|
12
|
+
clip-path="url(#clip0_730_27126)"
|
|
13
|
+
id="g4"
|
|
14
|
+
transform="matrix(5.04,0,0,5.04,9.04,16.786544)">
|
|
15
|
+
<path
|
|
16
|
+
d="M 41.4395,69.3848 C 28.8066,67.8535 19.9062,58.7617 19.9062,46.9902 c 0,-4.7851 1.7227,-9.9531 4.5938,-13.3984 -1.2441,-3.1582 -1.0527,-9.8574 0.3828,-12.6328 3.8281,-0.4785 8.9961,1.5312 12.0586,4.3066 3.6367,-1.1484 7.4648,-1.7226 12.1543,-1.7226 4.6895,0 8.5176,0.5742 11.9629,1.6269 2.9668,-2.6797 8.2305,-4.6894 12.0586,-4.2109 1.3398,2.584 1.5312,9.2832 0.2871,12.5371 3.0625,3.6367 4.6894,8.5176 4.6894,13.4941 0,11.7715 -8.9003,20.6719 -21.7246,22.2989 3.2539,2.1054 5.4551,6.6992 5.4551,11.9629 v 9.9531 c 0,2.8711 2.3926,4.498 5.2637,3.3496 C 84.4102,87.9512 98,70.6289 98,49.1914 98,22.1074 75.9883,6.69539e-7 48.9043,4.309e-7 21.8203,1.92261e-7 -1.9479e-7,22.1074 -4.3343e-7,49.1914 -6.20631e-7,70.4375 13.4941,88.0469 31.6777,94.6504 c 2.584,0.957 5.0723,-0.7656 5.0723,-3.3496 v -7.6563 c -1.3398,0.5743 -3.0625,0.9571 -4.5938,0.9571 -6.3164,0 -10.0488,-3.4453 -12.7285,-9.8575 -1.0527,-2.5839 -2.2011,-4.1152 -4.4023,-4.4023 -1.1484,-0.0957 -1.5313,-0.5742 -1.5313,-1.1484 0,-1.1485 1.9141,-2.0098 3.8282,-2.0098 2.7754,0 5.1679,1.7227 7.6562,5.2637 1.9141,2.7754 3.9238,4.0195 6.3164,4.0195 2.3926,0 3.9238,-0.8613 6.125,-3.0625 1.627,-1.627 2.8711,-3.0625 4.0196,-4.0195 z"
|
|
17
|
+
fill="#000000"
|
|
18
|
+
id="path2" />
|
|
19
|
+
</g>
|
|
20
|
+
<defs
|
|
21
|
+
id="defs9">
|
|
22
|
+
<clipPath
|
|
23
|
+
id="clip0_730_27126">
|
|
24
|
+
<rect
|
|
25
|
+
width="98"
|
|
26
|
+
height="96"
|
|
27
|
+
fill="#ffffff"
|
|
28
|
+
id="rect6"
|
|
29
|
+
x="0"
|
|
30
|
+
y="0" />
|
|
31
|
+
</clipPath>
|
|
32
|
+
</defs>
|
|
33
|
+
</svg>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
fill="#000000"
|
|
4
|
+
width="128"
|
|
5
|
+
height="128"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
role="img"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg6"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
13
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
14
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
15
|
+
<path
|
|
16
|
+
d="M 12,1.17 C 6.0588425,1.17 1.17,6.0588425 1.17,12 1.17,17.941157 6.0588425,22.83 12,22.83 17.941157,22.83 22.83,17.941157 22.83,12 22.83,6.0588425 17.941157,1.17 12,1.17 Z m 0,2.236395 c 4.74354,0 8.593605,3.850065 8.593605,8.593605 0,4.74354 -3.850065,8.593605 -8.593605,8.593605 -4.74354,0 -8.593605,-3.850065 -8.593605,-8.593605 0,-0.798713 0.1083,-1.571253 0.3131675,-2.304985 A 4.2959,4.2959 0 0 0 7.261875,11.55958 4.29951,4.29951 0 0 0 11.55958,7.261875 4.294095,4.294095 0 0 0 9.6941125,3.7195625 8.597215,8.597215 0 0 1 12,3.406395 Z"
|
|
17
|
+
id="path4"
|
|
18
|
+
style="stroke-width:0.9025" />
|
|
19
|
+
</svg>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<body>
|
|
10
10
|
<div id="app-header">
|
|
11
11
|
<div class="header-left">
|
|
12
|
-
<img id="appBtn" src="../../assets/node42-logo.svg" alt="Node42"
|
|
12
|
+
<img id="appBtn" src="../../assets/node42-logo.svg" alt="Node42">
|
|
13
13
|
</div>
|
|
14
14
|
<div class="header-right"></div>
|
|
15
15
|
</div>
|
|
@@ -22,6 +22,23 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div id="app-menu" class="app-menu">
|
|
27
|
+
<div class="app-grid">
|
|
28
|
+
<div class="app-tile" title="GitHub" onclick="window.open('https://github.com/node42-dev', '_blank');">
|
|
29
|
+
<div class="icon-box">
|
|
30
|
+
<img src="../../assets/github.svg" class="icon-box-svg" alt="GitHub">
|
|
31
|
+
</div>
|
|
32
|
+
<div class="label">GitHub</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="app-tile" title="Insomina Collection" onclick="downloadInsomniaCollection();">
|
|
35
|
+
<div class="icon-box">
|
|
36
|
+
<img src="../../assets/insomnia.svg" class="icon-box-svg" alt="Insomnia">
|
|
37
|
+
</div>
|
|
38
|
+
<div class="label">Insomnia</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
25
41
|
</div>
|
|
42
|
+
<script src="../../assets/wrapper.js" defer></script>
|
|
26
43
|
</body>
|
|
27
44
|
</html>
|
|
@@ -53,6 +53,60 @@ body {
|
|
|
53
53
|
z-index: 100;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.app-menu {
|
|
57
|
+
position: fixed;
|
|
58
|
+
width: 150px;
|
|
59
|
+
background: #ffffff;
|
|
60
|
+
border-radius: 12px;
|
|
61
|
+
border: 1px solid var(--border);
|
|
62
|
+
padding: 4px 0 0 0;
|
|
63
|
+
box-shadow: 0 2px 8px rgba(0,0,0,.08);
|
|
64
|
+
display: none;
|
|
65
|
+
z-index: 1000;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.app-grid {
|
|
69
|
+
display: grid;
|
|
70
|
+
grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
|
|
71
|
+
gap: 8px;
|
|
72
|
+
padding: 12px;
|
|
73
|
+
max-width: 260px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.app-tile {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 6px;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.label {
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
color: #222;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.app-tile:hover .icon-box {
|
|
91
|
+
background: var(--brand-soft);
|
|
92
|
+
border: 1px solid var(--brand);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.icon-box {
|
|
96
|
+
width: 48px;
|
|
97
|
+
height: 48px;
|
|
98
|
+
border-radius: 12px;
|
|
99
|
+
border: 1px solid #d0d4d9;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
background: #fff;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.icon-box-svg {
|
|
107
|
+
width: 26px;
|
|
108
|
+
}
|
|
109
|
+
|
|
56
110
|
.header-left {
|
|
57
111
|
gap: 16px;
|
|
58
112
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
let appBtn;
|
|
2
|
+
let appMenu;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function placeMenu(menu, btn, offset) {
|
|
6
|
+
menu.style.display = "block";
|
|
7
|
+
|
|
8
|
+
const b = btn.getBoundingClientRect();
|
|
9
|
+
const m = menu.getBoundingClientRect();
|
|
10
|
+
|
|
11
|
+
const openLeft = b.left > window.innerWidth / 2;
|
|
12
|
+
|
|
13
|
+
let left = openLeft
|
|
14
|
+
? b.left - m.width - offset // open LEFT (user menu)
|
|
15
|
+
: b.right + offset; // open RIGHT (settings)
|
|
16
|
+
|
|
17
|
+
left = Math.max(offset, Math.min(left, window.innerWidth - m.width - offset));
|
|
18
|
+
|
|
19
|
+
let top = b.bottom + offset;
|
|
20
|
+
const spaceBelow = window.innerHeight - b.bottom;
|
|
21
|
+
|
|
22
|
+
if (spaceBelow < m.height + (offset + 4) && b.top > m.height + (offset + 4)) {
|
|
23
|
+
top = b.top - m.height - offset;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
top = Math.max(offset, Math.min(top, window.innerHeight - m.height - offset));
|
|
27
|
+
|
|
28
|
+
menu.style.left = `${left}px`;
|
|
29
|
+
menu.style.top = `${top}px`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function toggleMenu(menu, btn, offset) {
|
|
33
|
+
const isOpen = menu.style.display === "block";
|
|
34
|
+
menu.style.display = isOpen ? "none" : "block";
|
|
35
|
+
if (!isOpen) placeMenu(menu, btn, offset);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function hideMenu(menu) {
|
|
39
|
+
menu.style.display = "none";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function downloadInsomniaCollection() {
|
|
43
|
+
// Create an invisible link element
|
|
44
|
+
var link = document.createElement('a');
|
|
45
|
+
link.href = 'https://www.node42.dev/insomnia.yaml';
|
|
46
|
+
link.download = 'node42-insomnia.yaml'; // Triggered download filename
|
|
47
|
+
link.click();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
51
|
+
appBtn = document.getElementById("appBtn");
|
|
52
|
+
appMenu = document.getElementById("app-menu");
|
|
53
|
+
appBtn.onclick = () => toggleMenu(appMenu, appBtn, 0);
|
|
54
|
+
});
|
package/src/cli.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
const { execSync } = require("child_process");
|
|
2
2
|
|
|
3
|
+
function hasGlobal(cmd) {
|
|
4
|
+
try {
|
|
5
|
+
execSync(`command -v ${cmd}`, { stdio: "ignore" });
|
|
6
|
+
return true;
|
|
7
|
+
} catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
function run(cmd) {
|
|
4
13
|
console.log(`> ${cmd}`);
|
|
5
14
|
return execSync(cmd, { stdio: "pipe" }).toString();
|
|
6
15
|
}
|
|
7
16
|
|
|
8
|
-
|
|
9
|
-
const CLI = process.env.N42_GLOBAL ? "n42" : "npx n42";
|
|
17
|
+
const CLI = hasGlobal("n42") ? "n42" : "npx n42";
|
|
10
18
|
|
|
11
19
|
try {
|
|
12
20
|
// 1. binary exists
|