Skip to content

Commit

Permalink
38.0.1. Bundle file fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
breck7 committed Aug 17, 2019
1 parent 5c2ee03 commit dca4136
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 22 deletions.
12 changes: 7 additions & 5 deletions core/GrammarLanguage.ts
Expand Up @@ -1900,7 +1900,7 @@ ${rootNodeDef.getDescription()}
## Quick Example
${example ? example.getContent() + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
${example ? (example.getContent() || "") + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
## Quick facts about ${languageName}
Expand Down Expand Up @@ -1929,8 +1929,10 @@ This readme was auto-generated using the [JTree library](https://github.com/tree

toBundle() {
const files: jTreeTypes.stringMap = {}
const languageName = this.getGrammarName()
const sampleCode = this.getExamples()[0] || ""
const rootNodeDef = this._getRootNodeTypeDefinitionNode()
const languageName = this.getExtensionName()
const example = rootNodeDef.getExamples()[0]
const sampleCode = example ? example.childrenToString() : ""

files[GrammarBundleFiles.package] = JSON.stringify(
{
Expand Down Expand Up @@ -1960,12 +1962,12 @@ if (errors.length)
files[GrammarBundleFiles.indexHtml] = `<script src="node_modules/jtree/products/jtree.browser.js"></script>
<script src="${browserPath}"></script>
<script>
const sampleCode = \`${sampleCode}\`
const sampleCode = \`${sampleCode.toString()}\`
${testCode}
</script>`

const samplePath = "sample." + this.getExtensionName()
files[samplePath] = sampleCode
files[samplePath] = sampleCode.toString()
files[GrammarBundleFiles.testJs] = `const ${languageName} = require("./index.js")
/*keep-line*/ const sampleCode = require("fs").readFileSync("${samplePath}", "utf8")
${testCode}`
Expand Down
2 changes: 1 addition & 1 deletion core/TreeNode.ts
Expand Up @@ -2381,7 +2381,7 @@ class TreeNode extends AbstractNode {
return str ? indent + str.replace(/\n/g, indent) : ""
}

static getVersion = () => "38.0.0"
static getVersion = () => "38.0.1"

static fromDisk(path: string): TreeNode {
const format = this._getFileFormat(path)
Expand Down
2 changes: 1 addition & 1 deletion designer/DesignerApp.ts
Expand Up @@ -147,7 +147,7 @@ class DesignerApp {
zip.file(key, bundle[key])
})

const languageName = grammarProgram.getGrammarName()
const languageName = grammarProgram.getExtensionName()

zip.generateAsync({ type: "blob" }).then((content: any) => {
// see FileSaver.js
Expand Down
3 changes: 3 additions & 0 deletions langs/stump/stump.grammar
Expand Up @@ -3,6 +3,9 @@ stumpNode
description A Tree Language that compiles to HTML.
catchAllNodeType errorNode
inScope abstractHtmlTagNode
example
div
h1 hello world
compilesTo html
javascript
compile() { return this.toHtml() }
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "jtree",
"version": "38.0.0",
"version": "38.0.1",
"description": "Simplify your code with Tree Notation. This jtree package includes a Tree Notation parser, compiler-compiler, and virtual machine for Tree Languages, as well as sample languages, implemented in TypeScript.",
"main": "index.js",
"types": "./built/jtree.node.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion products/DesignerApp.browser.js
Expand Up @@ -113,7 +113,7 @@ class DesignerApp {
Object.keys(bundle).forEach(key => {
zip.file(key, bundle[key])
})
const languageName = grammarProgram.getGrammarName()
const languageName = grammarProgram.getExtensionName()
zip.generateAsync({ type: "blob" }).then(content => {
// see FileSaver.js
saveAs(content, languageName + ".zip")
Expand Down
14 changes: 8 additions & 6 deletions products/jtree.browser.js
Expand Up @@ -2426,7 +2426,7 @@ TreeNode.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
TreeNode.getVersion = () => "38.0.0"
TreeNode.getVersion = () => "38.0.1"
window.TreeNode = TreeNode
var GrammarConstantsCompiler
;(function(GrammarConstantsCompiler) {
Expand Down Expand Up @@ -3956,7 +3956,7 @@ ${rootNodeDef.getDescription()}
## Quick Example
${example ? example.getContent() + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
${example ? (example.getContent() || "") + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
## Quick facts about ${languageName}
Expand Down Expand Up @@ -3984,8 +3984,10 @@ This readme was auto-generated using the [JTree library](https://github.com/tree
}
toBundle() {
const files = {}
const languageName = this.getGrammarName()
const sampleCode = this.getExamples()[0] || ""
const rootNodeDef = this._getRootNodeTypeDefinitionNode()
const languageName = this.getExtensionName()
const example = rootNodeDef.getExamples()[0]
const sampleCode = example ? example.childrenToString() : ""
files[GrammarBundleFiles.package] = JSON.stringify(
{
name: languageName,
Expand All @@ -4011,11 +4013,11 @@ if (errors.length)
files[GrammarBundleFiles.indexHtml] = `<script src="node_modules/jtree/products/jtree.browser.js"></script>
<script src="${browserPath}"></script>
<script>
const sampleCode = \`${sampleCode}\`
const sampleCode = \`${sampleCode.toString()}\`
${testCode}
</script>`
const samplePath = "sample." + this.getExtensionName()
files[samplePath] = sampleCode
files[samplePath] = sampleCode.toString()
files[GrammarBundleFiles.testJs] = `const ${languageName} = require("./index.js")
/*keep-line*/ const sampleCode = require("fs").readFileSync("${samplePath}", "utf8")
${testCode}`
Expand Down
14 changes: 8 additions & 6 deletions products/jtree.node.js
Expand Up @@ -2416,7 +2416,7 @@ TreeNode.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
TreeNode.getVersion = () => "38.0.0"
TreeNode.getVersion = () => "38.0.1"
var GrammarConstantsCompiler
;(function(GrammarConstantsCompiler) {
GrammarConstantsCompiler["stringTemplate"] = "stringTemplate"
Expand Down Expand Up @@ -3945,7 +3945,7 @@ ${rootNodeDef.getDescription()}
## Quick Example
${example ? example.getContent() + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
${example ? (example.getContent() || "") + "\n\n" + TreeNode.nest(example.childrenToString(), 4) : ""}
## Quick facts about ${languageName}
Expand Down Expand Up @@ -3973,8 +3973,10 @@ This readme was auto-generated using the [JTree library](https://github.com/tree
}
toBundle() {
const files = {}
const languageName = this.getGrammarName()
const sampleCode = this.getExamples()[0] || ""
const rootNodeDef = this._getRootNodeTypeDefinitionNode()
const languageName = this.getExtensionName()
const example = rootNodeDef.getExamples()[0]
const sampleCode = example ? example.childrenToString() : ""
files[GrammarBundleFiles.package] = JSON.stringify(
{
name: languageName,
Expand All @@ -4000,11 +4002,11 @@ if (errors.length)
files[GrammarBundleFiles.indexHtml] = `<script src="node_modules/jtree/products/jtree.browser.js"></script>
<script src="${browserPath}"></script>
<script>
const sampleCode = \`${sampleCode}\`
const sampleCode = \`${sampleCode.toString()}\`
${testCode}
</script>`
const samplePath = "sample." + this.getExtensionName()
files[samplePath] = sampleCode
files[samplePath] = sampleCode.toString()
files[GrammarBundleFiles.testJs] = `const ${languageName} = require("./index.js")
/*keep-line*/ const sampleCode = require("fs").readFileSync("${samplePath}", "utf8")
${testCode}`
Expand Down
5 changes: 5 additions & 0 deletions releaseNotes.md
@@ -1,3 +1,8 @@
38.0.1 / 2019-08-17
===================
- Fix: cleanup to bundle filenames
- Fix: sample code fix in bundle files

38.0.0 / 2019-08-17
===================
- New: toReadMe method on GrammarProgram
Expand Down

0 comments on commit dca4136

Please sign in to comment.