rb-homer 1.6.13 → 1.6.15
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/index.js +14 -1
- package/npm-shrinkwrap.json +16 -12
- package/package.json +2 -2
- package/src/extract.js +1 -1
- package/templates/rex2/build.js +33 -0
- package/templates/rex2/config.js +1 -1
- package/templates/rex2/readme.md +37 -8
- package/templates/rex2/rex-project/component.ts +34 -0
- package/templates/rex2/rex-project/package.json +16 -0
- package/templates/rex2/rex-project/rollup.config.js +21 -0
- package/templates/rex2/rex-project/test.html +9 -0
- package/templates/rex2/rex-project/test.json +3 -0
- package/templates/rex2/rex-project/tsconfig.json +12 -0
- package/templates/rex2/rex-project/typings.ts +4 -0
package/index.js
CHANGED
|
@@ -419,8 +419,21 @@ function createTemplate(appNo, componentName, createWithinFolder, componenttype)
|
|
|
419
419
|
if (componenttype === "rex2") {
|
|
420
420
|
var configContent = fs.readFileSync(createPath + "config.js", 'utf8');
|
|
421
421
|
configContent = configContent.replace("111111111", appNo);
|
|
422
|
-
configContent = configContent.replace("
|
|
422
|
+
configContent = configContent.replace("rexComponentNameHere", componentName);
|
|
423
423
|
fs.writeFileSync(createPath + "config.js", configContent, 'utf8');
|
|
424
|
+
|
|
425
|
+
//Update component.ts to include web component name
|
|
426
|
+
var hyphenizedComponentName = componentName.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`);
|
|
427
|
+
if (hyphenizedComponentName[0] === "-") {
|
|
428
|
+
hyphenizedComponentName = hyphenizedComponentName.slice(1);
|
|
429
|
+
}
|
|
430
|
+
var componentContent = fs.readFileSync(createPath + "rex-project/component.ts", 'utf8');
|
|
431
|
+
componentContent = componentContent.replace("rex-222222222", hyphenizedComponentName).replace(/rexComponentNameHere/g, componentName);
|
|
432
|
+
fs.writeFileSync(createPath + "rex-project/component.ts", componentContent, 'utf8');
|
|
433
|
+
|
|
434
|
+
var buildContent = fs.readFileSync(createPath + "build.js", 'utf8');
|
|
435
|
+
buildContent = buildContent.replace("rex-222222222", hyphenizedComponentName).replace(/rexComponentNameHere/g, componentName);
|
|
436
|
+
fs.writeFileSync(createPath + "build.js", buildContent, 'utf8');
|
|
424
437
|
return;
|
|
425
438
|
}
|
|
426
439
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rb-homer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"
|
|
8
|
+
"name": "rb-homer",
|
|
9
|
+
"version": "1.6.15",
|
|
9
10
|
"hasInstallScript": true,
|
|
10
11
|
"license": "ISC",
|
|
11
12
|
"dependencies": {
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"wcf.js": "0.0.x",
|
|
28
29
|
"websocket": "1.0.x",
|
|
29
30
|
"xml2js": "0.4.x",
|
|
30
|
-
"zip-dir": "
|
|
31
|
+
"zip-dir": "2.0.x"
|
|
31
32
|
},
|
|
32
33
|
"bin": {
|
|
33
34
|
"rb": "index.js"
|
|
@@ -73,9 +74,9 @@
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
"node_modules/async": {
|
|
76
|
-
"version": "3.2.
|
|
77
|
-
"resolved": "https://registry.npmjs.org/async/-/async-3.2.
|
|
78
|
-
"integrity": "sha512-
|
|
77
|
+
"version": "3.2.4",
|
|
78
|
+
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
|
79
|
+
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
|
79
80
|
},
|
|
80
81
|
"node_modules/asynckit": {
|
|
81
82
|
"version": "0.4.0",
|
|
@@ -806,8 +807,9 @@
|
|
|
806
807
|
}
|
|
807
808
|
},
|
|
808
809
|
"node_modules/nth-check": {
|
|
809
|
-
"version": "2.
|
|
810
|
-
"
|
|
810
|
+
"version": "2.1.1",
|
|
811
|
+
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
|
|
812
|
+
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
|
|
811
813
|
"dependencies": {
|
|
812
814
|
"boolbase": "^1.0.0"
|
|
813
815
|
},
|
|
@@ -1360,9 +1362,9 @@
|
|
|
1360
1362
|
"version": "1.0.0"
|
|
1361
1363
|
},
|
|
1362
1364
|
"async": {
|
|
1363
|
-
"version": "3.2.
|
|
1364
|
-
"resolved": "https://registry.npmjs.org/async/-/async-3.2.
|
|
1365
|
-
"integrity": "sha512-
|
|
1365
|
+
"version": "3.2.4",
|
|
1366
|
+
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
|
1367
|
+
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
|
1366
1368
|
},
|
|
1367
1369
|
"asynckit": {
|
|
1368
1370
|
"version": "0.4.0"
|
|
@@ -1832,7 +1834,9 @@
|
|
|
1832
1834
|
"version": "3.0.0"
|
|
1833
1835
|
},
|
|
1834
1836
|
"nth-check": {
|
|
1835
|
-
"version": "2.
|
|
1837
|
+
"version": "2.1.1",
|
|
1838
|
+
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
|
|
1839
|
+
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
|
|
1836
1840
|
"requires": {
|
|
1837
1841
|
"boolbase": "^1.0.0"
|
|
1838
1842
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rb-homer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"description": "Create and synchronize Rambase applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"wcf.js": "0.0.x",
|
|
31
31
|
"websocket": "1.0.x",
|
|
32
32
|
"xml2js": "0.4.x",
|
|
33
|
-
"zip-dir": "
|
|
33
|
+
"zip-dir": "2.0.x"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/extract.js
CHANGED
|
@@ -11,7 +11,7 @@ var noContext = '$$noContext';
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
function mkAttrRegex(startDelim, endDelim, attribute) {
|
|
14
|
-
return /('|"|")([\w\s
|
|
14
|
+
return /('|"|")([\w\sæøå!?#=&+.,():;-]{1,})\1\s*\|\s*translate/g;
|
|
15
15
|
/*
|
|
16
16
|
var start = startDelim.replace(escapeRegex, '\\$&');
|
|
17
17
|
var end = endDelim.replace(escapeRegex, '\\$&');
|
package/templates/rex2/build.js
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
export default class rexComponentNameHere extends HTMLElement {
|
|
3
|
+
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
this.attachShadow({ mode: 'open' });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
name = "RamBase";
|
|
11
|
+
|
|
12
|
+
list = [{id:1},{id:2},{id:3}];
|
|
13
|
+
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
|
|
16
|
+
const template = document.createElement('template');
|
|
17
|
+
template.innerHTML = `
|
|
18
|
+
<div>Hello ${this.name}</div>
|
|
19
|
+
${this.list.map(item =>
|
|
20
|
+
`<ul>
|
|
21
|
+
<li>ID: ${item.id} </li>
|
|
22
|
+
</ul>`
|
|
23
|
+
).join("")}
|
|
24
|
+
`
|
|
25
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
customElements.define("rex-222222222", rexComponentNameHere);
|
package/templates/rex2/config.js
CHANGED
package/templates/rex2/readme.md
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
## Required files ##
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**build.js**
|
|
4
|
+
This is the REX component which will be synced to RamBase. The build file has to be a web component.
|
|
4
5
|
|
|
6
|
+
**config.js**
|
|
7
|
+
Config file used to sync code to the correct REX component.
|
|
8
|
+
|
|
9
|
+
**gitignore**
|
|
10
|
+
Makes sure the node_modules folder are not be part of the commit.
|
|
5
11
|
|
|
6
|
-
**rex-project folder**
|
|
7
12
|
|
|
13
|
+
## Optional files ##
|
|
14
|
+
|
|
15
|
+
**rex-project folder**
|
|
8
16
|
Here you can npm install the frontend framework and node_modules you want to use.
|
|
9
|
-
Files inside this folder will not be synced to RamBase.
|
|
10
17
|
|
|
18
|
+
How to use it:
|
|
19
|
+
1) cd into to rex-project folder
|
|
20
|
+
2) type "npm install"
|
|
21
|
+
3) npm install a webcomponent library https://webcomponents.dev/ (optional)
|
|
22
|
+
4) type "npm run watch" or "npm run build" to start the build process
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
Rollup should then compile the files to ../build.js.
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
NB: You don't have to use a build tool or you can use a different one than Rollup.
|
|
27
|
+
The important thing to remember is to place all dev-files in the rex-project folder.
|
|
28
|
+
Files in the rex-project folder will not be synced to RamBase.
|
|
15
29
|
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
## Commands ##
|
|
32
|
+
|
|
33
|
+
**Listen and sync file changes**
|
|
34
|
+
rb rex2
|
|
35
|
+
|
|
36
|
+
## Tips ##
|
|
37
|
+
|
|
38
|
+
Install the vs code extension: es6-string-html
|
|
39
|
+
This will give html and css syntax highlighting for template literals, ex:
|
|
40
|
+
template.innerHTML = /*html*/`
|
|
41
|
+
<style>
|
|
42
|
+
#container {
|
|
43
|
+
color:white;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
46
|
+
`
|
|
47
|
+
|
|
18
48
|
|
|
19
|
-
The node_modules folder will not be part of the commit.
|
|
20
49
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {version} from './test.json'
|
|
2
|
+
|
|
3
|
+
export default class rexComponentNameHere extends HTMLElement {
|
|
4
|
+
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.attachShadow({ mode: 'open' });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
name = "RamBase";
|
|
12
|
+
|
|
13
|
+
list = [{id:1},{id:2},{id:3}];
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
|
|
17
|
+
const template = document.createElement('template');
|
|
18
|
+
template.innerHTML = `
|
|
19
|
+
<div>Hello ${this.name}</div>
|
|
20
|
+
<div>Version: ${version}</div>
|
|
21
|
+
${this.list.map(item =>
|
|
22
|
+
`<ul>
|
|
23
|
+
<li>ID: ${item.id} </li>
|
|
24
|
+
</ul>`
|
|
25
|
+
).join("")}
|
|
26
|
+
`
|
|
27
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
customElements.define("rex-222222222", rexComponentNameHere);
|
|
34
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "name",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "npx rollup --config rollup.config.js",
|
|
6
|
+
"watch": "npx rollup --config rollup.config.js --watch"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"tslib": "^2.4.0",
|
|
10
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
11
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
12
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
13
|
+
"rollup": "^2.63.0",
|
|
14
|
+
"rollup-plugin-html": "^0.2.1"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import typescript from "@rollup/plugin-typescript"
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import json from '@rollup/plugin-json';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
input: "component.ts",
|
|
8
|
+
output: {
|
|
9
|
+
file: "../build.js",
|
|
10
|
+
format: "esm"
|
|
11
|
+
// sourcemap: true
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
typescript({
|
|
15
|
+
tsconfig: "./tsconfig.json"
|
|
16
|
+
}),
|
|
17
|
+
json(),
|
|
18
|
+
resolve()
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"useDefineForClassFields": false,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"typeRoots": ["node/modules/@types/"],
|
|
10
|
+
"resolveJsonModule": true
|
|
11
|
+
}
|
|
12
|
+
}
|