(data, root = null, isVariables = false, isReusables = false)
| 52 | } |
| 53 | |
| 54 | create(data, root = null, isVariables = false, isReusables = false) { |
| 55 | const here = root || this.root |
| 56 | |
| 57 | for (const [key, value] of Object.entries(data)) { |
| 58 | if (isReusables) { |
| 59 | if (typeof value === 'string') { |
| 60 | fs.writeFileSync(path.join(here, `${key}.md`), value, 'utf-8') |
| 61 | } else { |
| 62 | fs.mkdirSync(path.join(here, key)) |
| 63 | this.create(value, path.join(here, key), false, true) |
| 64 | } |
| 65 | } else if (isVariables) { |
| 66 | fs.writeFileSync(path.join(here, `${key}.yml`), yaml.dump(value), 'utf-8') |
| 67 | } else { |
| 68 | if (key === 'ui') { |
| 69 | fs.writeFileSync(path.join(here, `${key}.yml`), yaml.dump(value), 'utf-8') |
| 70 | } else { |
| 71 | const there = path.join(here, key) |
| 72 | fs.mkdirSync(there) |
| 73 | if (key === 'reusables') { |
| 74 | this.create(value, there, false, true) |
| 75 | } else if (key === 'variables') { |
| 76 | this.create(value, there, true, false) |
| 77 | } else { |
| 78 | this.create(value, there) |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | destroy() { |
| 86 | fs.rmSync(this.root, { recursive: true }) |
no outgoing calls
no test coverage detected