MCPcopy Create free account
hub / github.com/breck7/scroll / ScrollCli

Class ScrollCli

scroll.js:16–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14const ensureFolderEndsInSlash = folder => folder.replace(/\/$/, "") + "/"
15
16class ScrollCli extends SimpleCLI {
17 welcomeMessage = `\n📜 WELCOME TO SCROLL (v${packageJson.version})`
18 async initCommand(cwd) {
19 // todo: use stamp for this.
20 const initFolder = {
21 ".gitignore": `*.html
22*.rss
23*.txt
24.*.js
25.*.css
26feed.xml`,
27 "header.scroll": `importOnly
28metaTags
29buildTxt
30buildHtml
31theme gazette
32homeButton
33leftRightButtons
34editButton
35printTitle`,
36 "feed.scroll": `buildRss
37printFeed All`,
38 "footer.scroll": `importOnly
39center
40editButton
41scrollVersionLink`,
42 "helloWorld.scroll": `tags All
43header.scroll
44thinColumn
45This is my first blog post using Scroll.
46
47****
48
49footer.scroll`,
50 "index.scroll": `title My Blog
51header.scroll
52printSnippets All
53footer.scroll`
54 }
55
56 this.log(`Initializing scroll in "${cwd}"`)
57 Disk.writeObjectToDisk(cwd, initFolder)
58 require("child_process").execSync("git init", { cwd })
59 return this.log(`\n✅ Initialized new scroll in '${cwd}'. Build your new site with: scroll build`)
60 }
61
62 async scrollToHtml(scrollCode) {
63 const file = this.sfs.newFile(scrollCode)
64 await file.singlePassFuse()
65 return file.scrollProgram.asHtml
66 }
67
68 sfs = new ScrollFileSystem(undefined, path.join(__dirname, "parsers"))
69 initFs(obj) {
70 // for testing
71 this.sfs = new ScrollFileSystem(obj, path.join(__dirname, "parsers"))
72 return this.sfs
73 }

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected