@nl-design-system-community/theme-wizard-server 1.1.1 → 1.2.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/README.md +3 -3
- package/dist/server.js +16 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Try the server
|
|
4
4
|
|
|
5
|
-
Open the [Swagger UI on http://localhost:
|
|
5
|
+
Open the [Swagger UI on http://localhost:8080/api/docs](http://localhost:8080/api/docs) to use the server and see all the options in the REST API.
|
|
6
6
|
|
|
7
7
|
## From a website URL to design tokens JSON
|
|
8
8
|
|
|
@@ -10,10 +10,10 @@ If you want to use the design for an existing website for a new project, you can
|
|
|
10
10
|
|
|
11
11
|
For example, use the following API to get a Design Tokens JSON with all design token values found in the CSS of a the website.
|
|
12
12
|
|
|
13
|
-
Example: [http://localhost:
|
|
13
|
+
Example: [http://localhost:8080/api/v1/css-design-tokens?url=https://example.com/](http://localhost:8080/api/v1/css-design-tokens?url=https://example.com/)
|
|
14
14
|
|
|
15
15
|
## Get all CSS from a website URL
|
|
16
16
|
|
|
17
17
|
For example, use the following API to get a Design Tokens JSON with all design token values found in the CSS of a the website.
|
|
18
18
|
|
|
19
|
-
Example: [http://localhost:
|
|
19
|
+
Example: [http://localhost:8080/api/v1/css?url=https://example.com/](http://localhost:8080/api/v1/css?url=https://example.com/)
|
package/dist/server.js
CHANGED
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
import { serve } from '@hono/node-server';
|
|
3
3
|
import app from './index.js';
|
|
4
4
|
const port = process.env['PORT'] ? Number.parseInt(process.env['PORT'], 10) : 8080;
|
|
5
|
-
console.log(
|
|
5
|
+
console.log('Starting Theme Wizard server...');
|
|
6
6
|
const server = serve({ port, ...app });
|
|
7
|
+
// Unfortunately Safari 26.2 doesn't support IPv6 addresses, such as: http://[::]:8080/
|
|
8
|
+
// https://discussions.apple.com/thread/255221411
|
|
9
|
+
// Firefox 147 and Chrome 143 support the IPv6 URLs.
|
|
10
|
+
const formatAddressInfo = (addressInfo) => addressInfo
|
|
11
|
+
? typeof addressInfo === 'string'
|
|
12
|
+
? addressInfo
|
|
13
|
+
: addressInfo.family === 'IPv6'
|
|
14
|
+
? `http://[${addressInfo.address}]:${addressInfo.port}/`
|
|
15
|
+
: `http://${addressInfo.address}:${addressInfo.port}/`
|
|
16
|
+
: '';
|
|
17
|
+
server.on('listening', () => {
|
|
18
|
+
const address = formatAddressInfo(server.address());
|
|
19
|
+
console.log(`API:\n${address}`);
|
|
20
|
+
console.log(`Documentation:\n${address}api/docs`);
|
|
21
|
+
});
|
|
7
22
|
// graceful shutdown
|
|
8
23
|
process.on('SIGINT', () => {
|
|
9
24
|
console.log('Stopping Theme Wizard server...');
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEnF,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAE/C,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;AAEvC,uFAAuF;AACvF,iDAAiD;AACjD,oDAAoD;AACpD,MAAM,iBAAiB,GAAG,CAAC,WAAwC,EAAU,EAAE,CAC7E,WAAW;IACT,CAAC,C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|
|
2
2
|
"name": "@nl-design-system-community/theme-wizard-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"author": "Community for NL Design System",
|
|
5
5
|
"description": "Web server with REST API for scraping websites to extract design tokens",
|
|
6
6
|
"license": "EUPL-1.2",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@vercel/related-projects": "1.0.0",
|
|
43
43
|
"hono": "4.11.3",
|
|
44
44
|
"zod": "4.3.4",
|
|
45
|
-
"@nl-design-system-community/css-scraper": "1.1.
|
|
45
|
+
"@nl-design-system-community/css-scraper": "1.1.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"start": "node dist/server.js",
|