Skip to content

Commit 7745402

Browse files
committed
generate sample README on package generation
1 parent 0264460 commit 7745402

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

tools/README.md.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
3+
* This program and the accompanying materials are made
4+
* available under the terms of the Eclipse Public License 2.0
5+
* which is available at https://www.eclipse.org/legal/epl-2.0/
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Contributors: Smart City Jena
9+
*/
10+
11+
export const readme = (config)=> {
12+
13+
let goUp ='';
14+
const parts = config.name.split('.');
15+
const steps = (parts.length);
16+
for(let a=0;a<=steps;a++){
17+
goUp+='../'
18+
}
19+
return `# org.eclipse.daanse.board.app.xxx
20+
## Description
21+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
22+
23+
## If Lib/Core Package
24+
How to use the Package
25+
describe EntryPoint
26+
27+
## If UI-Widget
28+
### Widget
29+
30+
![Example Widget](${goUp}tools/assets/widget.png)
31+
32+
Describe what the Widget is showing in configured state.
33+
34+
### Widget Settings
35+
36+
![Example Widget Settings](${goUp}tools/assets/settings.png)
37+
38+
39+
40+
Describe what each Setting is doing.
41+
Describe what minimal has to setted up for a working example.
42+
43+
eg:
44+
45+
| Field | required | explanation | hints |
46+
|---------|----------|------------------------------|----------------------------------|
47+
| Name | x | Name of receiver | less than 255 unicode-characters |
48+
| Email | x | Emailaddress of reciver | valid pattern aaa.bbb@ccc.dd |
49+
| Subject | x | Short description of content | less than 255 unicode-characters |
50+
| Message | x | Text to send | less than 750 unicode-characters |
51+
| Send | |if valid trys to send the Email |triggers the validation of above marked fields|
52+
53+
### Examples
54+
55+
Show Widget in Wildlife
56+
`
57+
}

tools/assets/settings.png

31.9 KB
Loading

tools/assets/widget.png

61 KB
Loading

tools/createPackage.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { fileURLToPath } from 'url';
1717
import path,{ dirname } from 'path';
1818
import {exec} from "node:child_process";
1919
import {vite} from "./vite.config.js";
20+
import {readme} from "./README.md.js";
2021

2122
const __filename = fileURLToPath(import.meta.url);
2223
const __dirname = dirname(__filename);
@@ -102,6 +103,15 @@ try {
102103
console.log(error('couldn t vite.config.ts'));
103104
process.exit(1);
104105
}
106+
console.log(notice('create README.md...'))
107+
try {
108+
fs.writeFileSync('README.md', readme(config))
109+
console.log(notice('[✓]'))
110+
} catch (err) {
111+
console.error(err)
112+
console.log(error('couldn t create README.md'));
113+
process.exit(1);
114+
}
105115

106116
if(config.withBoilerplate){
107117
console.log(notice('copy base Code...'))

0 commit comments

Comments
 (0)