Subject | Hash | Author | Date (UTC) |
---|---|---|---|
cleanup | 444da418ea31cbead2c41ce85d5acfb468faee79 | mucbuc | 2020-01-27 13:17:10 |
reading from prjetect dir | 9b8e0802d9549e52041ffadeb085dae7f2b186b1 | mucbuc | 2020-01-27 06:12:39 |
formt script | f991001a06fa70aed0c656635cf5d1c22b896652 | mucbuc | 2020-01-27 06:07:22 |
format | 820f8f81267baf5de99a0115ff6e79efcc361f7a | mucbuc | 2020-01-27 06:06:19 |
first pass | 0d21989109ebba5aa9ce330612da271998b7a441 | mucbuc | 2020-01-27 06:06:00 |
File | Lines added | Lines deleted |
---|---|---|
index.js | 5 | 6 |
templates/basic | 5 | 1 |
File index.js changed (mode: 100755) (index 2fc5391..794d304) | |||
2 | 2 | ||
3 | 3 | const fs = require("fs"), | const fs = require("fs"), |
4 | 4 | vm = require("vm"), | vm = require("vm"), |
5 | path = require('path'); | ||
5 | path = require("path"); | ||
6 | 6 | ||
7 | 7 | const [, , templatePath, projectPath] = process.argv; | const [, , templatePath, projectPath] = process.argv; |
8 | 8 | ||
9 | 9 | if (templatePath && projectPath) { | if (templatePath && projectPath) { |
10 | let template = fs.readFileSync(templatePath, "utf8"); | ||
11 | const interface = fs.readFileSync(path.join(projectPath,"src", "interface.h" )); | ||
12 | |||
10 | const script = "result = `" + fs.readFileSync(templatePath, "utf8") + "`;", | ||
11 | interface = fs.readFileSync(path.join(projectPath, "src", "interface.h")); | ||
12 | |||
13 | 13 | let context = { title: "Title", interface }; | let context = { title: "Title", interface }; |
14 | 14 | vm.createContext(context); | vm.createContext(context); |
15 | let script = "result = `" + template + "`;"; | ||
16 | |||
17 | 15 | vm.runInContext(script, context); | vm.runInContext(script, context); |
16 | |||
18 | 17 | console.log(context.result); | console.log(context.result); |
19 | 18 | } | } |
File templates/basic changed (mode: 100644) (index 83e1d26..8f060d6) | |||
1 | 1 | # ${title} | # ${title} |
2 | 2 | ||
3 | # ${interface} | ||
3 | # Interface | ||
4 | \`\`\` | ||
5 | ${interface} | ||
6 | \`\`\` | ||
7 | |||
4 | 8 | ||
5 | 9 |