use parcel-bundler

'moment' and 'marked' can now be required() from purescript FFI
This commit is contained in:
Jon Schoning 2019-01-31 22:31:06 -06:00
parent 80cdc6187d
commit 79ee31dff6
22 changed files with 7179 additions and 14176 deletions

View file

@ -2,10 +2,10 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: 417de4bead54d60a2c091ad91c61dc715571ef7421e702f157a3766daf4f4700
-- hash: 7227333703029085a8041c55bcc653a2b000338e12bb43813bf9b349cfab6a11
name: espial
version: 0.0.7
version: 0.0.8
synopsis: Espial is an open-source, web-based bookmarking server.
description: .
Espial is an open-source, web-based bookmarking server.
@ -45,6 +45,7 @@ extra-source-files:
purs/src/Component/RawHtml.purs
purs/src/Globals.js
purs/src/Globals.purs
purs/src/Main.js
purs/src/Main.purs
purs/src/Marked.js
purs/src/Marked.purs
@ -57,18 +58,14 @@ extra-source-files:
static/css/tachyons.min.css
static/css/tachyons.min.css.gz
static/images/bluepin.gif
static/js/app.js
static/js/app.js.gz
static/js/app.min.js
static/js/app.min.js.gz
static/js/app.min.map
static/js/app.min.map.gz
static/js/html5shiv.min.js
static/js/html5shiv.min.js.gz
static/js/js.cookie-2.2.0.min.js
static/js/js.cookie-2.2.0.min.js.gz
static/js/marked.min.js
static/js/marked.min.js.gz
static/js/moment.min.js
static/js/moment.min.js.gz
templates/change-password.hamlet
templates/default-layout-wrapper.hamlet
templates/default-layout.hamlet

View file

@ -1,6 +1,6 @@
name: espial
synopsis: Espial is an open-source, web-based bookmarking server.
version: "0.0.7"
version: "0.0.8"
description: ! '
Espial is an open-source, web-based bookmarking server.

View file

@ -7,14 +7,14 @@ install:
build:
@spago build
@spago bundle --to dist/app.js
@(cd dist && terser app.js -m -c -o app.min.js)
@spago bundle --to dist/bundle.js
@npm run parcel-build
@rm -f dist/*.gz
@gzip -k dist/app.js
@gzip -k dist/app.min.map
@gzip -k dist/app.min.js
@find dist -type f -printf "%kK\\t%h/%f\\n" | sort -k 2
@cp dist/app.js ../static/js/app.js
@cp dist/app.js.gz ../static/js/app.js.gz
@cp dist/app.min.map ../static/js/app.min.map
@cp dist/app.min.map.gz ../static/js/app.min.map.gz
@cp dist/app.min.js ../static/js/app.min.js
@cp dist/app.min.js.gz ../static/js/app.min.js.gz

View file

@ -1,6 +1,6 @@
## Development (Posix only)
1. Install `purescript`, `purescript-spago`, `terser`:
1. Install `purescript`, `purescript-spago`, `parcel-bundler`:
```
npm install

7127
purs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,12 +4,16 @@
"scripts": {
"make-install": "make install",
"make-watch": "inotifywait -m -r -q -e close_write --format '%T %w%f' --timefmt '%T' src | while read FILE; do echo $FILE; make; done",
"make": "make"
"parcel-build": "parcel build dist/bundle.js --out-file dist/app.min.js --public-url /static/js/"
},
"devDependencies": {
"parcel-bundler": "^1.11.0",
"purescript": "^0.12.1",
"purescript-spago": "^0.6.2",
"terser": "^3.14.1"
},
"dependencies": {}
"dependencies": {
"marked": "^0.6.0",
"moment": "^2.24.0"
}
}

View file

@ -1,5 +1,7 @@
"use strict";
var moment = require("moment");
exports._app = function() {
return app;
}

5
purs/src/Main.js Normal file
View file

@ -0,0 +1,5 @@
"use strict";
exports._mainImpl = function() {
return window.PS = PS;
}

View file

@ -20,8 +20,10 @@ import Web.DOM.ParentNode (QuerySelector(..))
import Web.Event.Event (Event, preventDefault)
import Web.HTML.HTMLElement (toElement)
foreign import _mainImpl :: Effect Unit
main :: Effect Unit
main = pure unit
main = _mainImpl
logoutE :: Event -> Effect Unit
logoutE e = void <<< launchAff <<< logout =<< preventDefault e

View file

@ -1,7 +1,10 @@
var marked = require("marked");
marked.setOptions({
pedantic: false,
gfm: true
});
exports.markedImpl = function(str) {
marked.setOptions({
pedantic: false,
gfm: true
});
return marked(str);
};

View file

@ -118,7 +118,6 @@ isAuthenticated = maybeAuthId >>= \case
addAppScripts :: (MonadWidget m, HandlerSite m ~ App) => m ()
addAppScripts = do
addScript (StaticR js_moment_min_js)
addScript (StaticR js_app_min_js)

View file

@ -44,7 +44,6 @@ getNoteR unamep@(UserNameP uname) slug = do
mnote <- getNote userId slug
maybe notFound pure mnote
defaultLayout $ do
addScript (StaticR js_marked_min_js)
$(widgetFile "note")
toWidgetBody [julius|
app.userR = "@{UserR unamep}";
@ -60,7 +59,6 @@ getAddNoteViewR unamep@(UserNameP uname) = do
let renderEl = "note" :: Text
note <- liftIO $ Entity (NoteKey 0) <$> _toNote userId (NoteForm Nothing Nothing Nothing Nothing Nothing Nothing Nothing)
defaultLayout $ do
addScript (StaticR js_marked_min_js)
$(widgetFile "note")
toWidgetBody [julius|
app.userR = "@{UserR unamep}";

File diff suppressed because it is too large Load diff

Binary file not shown.

17
static/js/app.min.js vendored

File diff suppressed because one or more lines are too long

Binary file not shown.

1
static/js/app.min.map Normal file

File diff suppressed because one or more lines are too long

BIN
static/js/app.min.map.gz Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.