node-riner 1.1.0 → 1.1.2

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.
Files changed (5) hide show
  1. package/README.md +10 -0
  2. package/index.ts +18 -3
  3. package/package.json +1 -1
  4. package/t.rd +0 -0
  5. package/t.ts +0 -0
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # Ride Framework
2
+
3
+ XMLファイルをベースに動的なHTMLページを生成し、Expressサーバーとして配信する軽量なSSR(Server-Side Rendering)ユーティリティです。
4
+
5
+ ## 📦 インストール
6
+
7
+ プロジェクトのルートディレクトリで以下のコマンドを実行してください。
8
+
9
+ ```bash
10
+ npm i node-riner@latest
package/index.ts CHANGED
@@ -48,10 +48,25 @@ export default class Ride {
48
48
  this.pages[route] = `<title>${this.name}</title>` + generatedhtml
49
49
  });
50
50
  } else {
51
+ let page = this.parsedJson["Root"]["Page"]
51
52
  let route = this.parsedJson["Root"]["Page"]['@_route']
52
- let generatedhtml = Object.keys(this.parsedJson["Root"]["Page"]['Content']).map(tags => {
53
- return `<${tags}>${this.parsedJson["Root"]["Page"]['Content'][tags]}</${tags}>`
54
- }).join('');
53
+ let generatedhtml = Object.keys(page['Content']).map(tags => {
54
+ let match = page['Content'][tags].match(/{.*}/g)
55
+ console.log(match)
56
+
57
+ if(match) {
58
+ console.log("matched")
59
+ let matched : string = match[0]
60
+ matched = matched.replace("{", "")
61
+ matched = matched.replace("}", "")
62
+ writeFileSync("./runs.js", matched)
63
+ let out = execSync("node runs.js").toString()
64
+ console.log(matched)
65
+ page['Content'][tags] = page['Content'][tags].replace(/{.*}/, out)
66
+ }
67
+ console.log("e:" + page['Content'][tags])
68
+ return `<${tags}>${page['Content'][tags]}</${tags}>`
69
+ }).join('')
55
70
  this.pages[route] = generatedhtml
56
71
  }
57
72
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-riner",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/t.rd ADDED
File without changes
package/t.ts ADDED
File without changes