Skip to content

Commit

Permalink
Support versioning of ramda-repl js file
Browse files Browse the repository at this point in the history
- also added a util script to generate the repl/index.html from handlerbars
  • Loading branch information
Zehua Liu committed Sep 25, 2017
1 parent a49a701 commit 86d5a5a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
27 changes: 27 additions & 0 deletions make_repl_index_html_hb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var fs = require('fs')

var get_ramda_file = require('./get_ramda_file')

var handlebars = require('handlebars')

var marked = require('marked')

var devDependencies = require('./package.json').devDependencies
var version = devDependencies.ramda
var repl_tag = devDependencies['ramda-repl']

get_ramda_file('README.md')
.catch((err) => console.error(err))
.then((readme_md) => {
var readme_html = marked(readme_md)

var template = fs.readFileSync('repl/index.html.handlebars', {encoding: 'utf8'})

var html = handlebars.compile(template)({
version: version,
repl_tag: repl_tag
})

fs.writeFileSync('repl/index.html', html, {encoding: 'utf8'})
console.log('Generated repl/index.html');
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"marked": "0.3.x",
"pug": "^2.0.0-beta6",
"ramda": "0.24.1",
"ramda-repl": "1.1.0",
"semver-compare": "1.0.x",
"walk": "2.3.x"
},
Expand Down
8 changes: 5 additions & 3 deletions repl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<link href="css/page.css" rel="stylesheet">

<!-- Style for the REPL -->
<link href="https://cdn.rawgit.com/ramda/repl/master/dist/bundle.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/ramda/repl/1.1.0/dist/bundle.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
Expand All @@ -25,6 +25,7 @@
<![endif]-->

</head>

<body>
<!-- Fixed navbar -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
Expand Down Expand Up @@ -53,7 +54,7 @@
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.1/URI.min.js"></script>
<script src="https://cdn.rawgit.com/ramda/repl/master/dist/bundle.js"></script>
<script src="https://cdn.rawgit.com/ramda/repl/1.1.0/dist/bundle.js"></script>

<script>

Expand Down Expand Up @@ -113,7 +114,6 @@
// Optional.
// Here we can declare a list of libraries that we wish to have
// loaded and exposed in the repl.

scripts: [
{
src : '//wzrd.in/standalone/sanctuary@latest',
Expand All @@ -136,6 +136,7 @@
]
}
]

});

}());
Expand All @@ -146,4 +147,5 @@
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>

</body>

</html>
6 changes: 3 additions & 3 deletions repl/index.html.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<link href="css/page.css" rel="stylesheet">

<!-- Style for the REPL -->
<link href="https://cdn.rawgit.com/ramda/repl/master/dist/bundle.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/ramda/repl/{{repl_tag}}/dist/bundle.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
Expand Down Expand Up @@ -54,7 +54,7 @@
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.1/URI.min.js"></script>
<script src="https://cdn.rawgit.com/ramda/repl/master/dist/bundle.js"></script>
<script src="https://cdn.rawgit.com/ramda/repl/{{repl_tag}}/dist/bundle.js"></script>

<script>
Expand All @@ -77,7 +77,7 @@
var version = location.search.substr(1).split('&').reduce(toVersion, 'latest');
var ramdaUrl = '//cdn.jsdelivr.net/ramda/' + version + '/ramda.min.js';
var ramdaUrl = '//cdn.jsdelivr.net/npm/ramda@' + version + '/dist/ramda.min.js';
// --------------------------------------------------------------------
Expand Down

0 comments on commit 86d5a5a

Please sign in to comment.