Skip to content

Commit

Permalink
Merge pull request #182 from aktos-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ceremcem authored May 2, 2019
2 parents ac9e534 + b83fc84 commit 50d3725
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 15 deletions.
14 changes: 12 additions & 2 deletions components/router/index.ls
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require! 'aea': {sleep}
require! 'prelude-ls': {take, drop, split, find}
require! 'actors': {RactiveActor}

basename = (.split(/[\\/]/).pop!) # https://stackoverflow.com/questions/3820381#comment29942319_15270931

get-offset = ->
$ 'body' .scrollTop!
Expand Down Expand Up @@ -88,8 +89,17 @@ Ractive.components['a'] = Ractive.extend do
return eval that

if href?
link = parse-link href
if link.external
link = if @get('download') then {+download} else parse-link href
if link.download
filename = basename(href)
link = document.createElement("a")
link.setAttribute("target","_blank")
link.setAttribute("href", href)
link.setAttribute("download",filename)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
else if link.external
if @get \curr-window
window.open href, "_self"
else
Expand Down
11 changes: 11 additions & 0 deletions doc/Pug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Using Markdown

```
:markdown-it
# Markdown
Markdown document with http://links.com and
```js
var codeBlocks;
```
1 change: 1 addition & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Here you can find useful links and cheatsheets:

* [CouchDB](./CouchDB)
* [Ractive](./Ractive)
* [Pug](./Pug)
* [Available Libraries](./available-libraries.md)
* [Publishing Static Content](./publishing-static-content.md)
* [Supported Development Platforms](./supported-development-platforms.md)
Expand Down
27 changes: 16 additions & 11 deletions gulpfile.ls
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ my-buble = (input) ->
es5.code

browserify-cache = {}

extra-time = 0
get-bundler = (entry) ->
b = browserify do
entries: [entry]
Expand All @@ -256,9 +256,11 @@ get-bundler = (entry) ->
..transform (file) ->
through (buf, enc, next) ->
content = buf.to-string \utf8
t0 = Date.now!
try
#@push "__DEPENDENCIES__ = #{__DEPENDENCIES__}; \n #{content}"
@push content.replace /__DEPENDENCIES__/g, JSON.stringify(__DEPENDENCIES__)
extra-time += Date.now! - t0
next!
catch _ex
@emit 'error', _ex
Expand Down Expand Up @@ -329,6 +331,8 @@ gulp.task \browserify, ->
b-count-- if b-count > 0
if b-count is 0
log-info \browserify, "Browserify finished"
console.log "Extra time: #{extra-time / 1000}s"
extra-time := 0
first-browserify-done := yes
b-count := files.length
console.log "------------------------------------------"
Expand Down Expand Up @@ -474,20 +478,21 @@ gulp.task \dependencyTrack, ->
dump-file "tmp-browserify-cache", browserify-cache
*/

# invalidate all dependencies to refresh __DEPENDENCIES__ string
console.log "=== Invalidating all Browserify cache due to commit change: "
console.log "===", JSON.stringify(__DEPENDENCIES__)
processed.length = 0
for f, c of browserify-cache
if f.ends-with ".ls" and f not in processed
processed.push f
#console.log "invalidating : #{f}"
touch.sync f
unless _browserify_change_flag
# invalidate all dependencies to refresh __DEPENDENCIES__ string
console.log "=== Invalidating all Browserify cache due to commit change: "
console.log " ", JSON.stringify(__DEPENDENCIES__)
processed.length = 0
for f, c of browserify-cache
if f.ends-with ".ls" and f not in processed
processed.push f
#console.log "invalidating : #{f}"
touch.sync f

#console.log preparserify-dep-list
gulp.start \browserify
_browserify_change_flag := false
processing := no

<~ sleep 1000ms
lo(op)
lo(op) unless argv.production
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"gulp-util": "^3.0.8",
"jquery": "^3.2.1",
"jquery-mousewheel": "^3.1.13",
"jstransformer-markdown-it": "^2.1.0",
"livescript": "~1.6.0",
"marked": "^0.3.12",
"mathjs": "^4.2.2",
Expand Down
13 changes: 13 additions & 0 deletions production-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -eu -o pipefail
safe_source () { [[ ! -z ${1:-} ]] && source $1; _dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; _sdir=$(dirname "$(readlink -f "$0")"); }; safe_source
# end of bash boilerplate

app=${1:-}
if [[ -z $app ]]; then
echo "Usage: "
echo " $(basename $0) your-app-name"
exit 3
fi
cd $_sdir
gulp --production --webapp $app
2 changes: 1 addition & 1 deletion watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ restart(){
fi
done
}

cd $_sdir
rm -r $_sdir/build/$1 2> /dev/null
compile $1 &
restart
Expand Down

0 comments on commit 50d3725

Please sign in to comment.