Skip to content

Commit 19c6d7e

Browse files
committed
fix web building for publishing
1 parent 1045918 commit 19c6d7e

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
npm-debug.log
44
lib/
55
.cache
6-
dist/
6+
web-dist/

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Makefile
77
wercker.yml
88
stuff
99
.cache
10+
web/

Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LIB = $(patsubst src/%.ls, lib/%.js, $(SRC))
55

66
MOCHA = ./node_modules/.bin/mocha
77
LSC = ./node_modules/.bin/lsc
8+
PARCEL = ./node_modules/.bin/parcel
89
DOCKER = docker run -v ${PWD}:/usr/src/app -w /usr/src/app -it --rm node:4.0.0
910
NAME = $(shell node -e "console.log(require('./package.json').name)")
1011
REPORTER ?= spec
@@ -20,10 +21,13 @@ lib:
2021
lib/%.js: src/%.ls lib
2122
$(LSC) -c -o "$(@D)" "$<"
2223

23-
all: compile
24+
all: compile build-web
2425

2526
compile: $(LIB) package.json
2627

28+
build-web: clean-web
29+
NODE_ENV=production $(PARCEL) build --no-source-maps --out-dir web-dist web/index.html
30+
2731
install: clean all
2832
npm install -g .
2933

@@ -40,6 +44,9 @@ dev-install: package.json
4044
clean:
4145
rm -rf lib
4246

47+
clean-web:
48+
rm -rf web-dist
49+
4350
publish: all test
4451
git push --tags origin HEAD:master
4552
npm publish

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"test": "make test",
1313
"test-ci": "make test && make test-func",
1414
"test-local": "make test && make docker-test-func",
15-
"build-web:watch": "parcel watch --no-source-maps web/index.html",
15+
"build-web:watch": "parcel watch --no-source-maps --out-dir web-dist web/index.html",
16+
"build-web": "parcel build --no-source-maps --out-dir web-dist web/index.html",
1617
"build:watch": "watchy -w 'src/**' -- make"
1718
},
1819
"bin": {

src/server.ls

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ clear-timer = ->
2222
export start = (log-error, raw-stdin-buf, opts, on-complete) ->
2323
input = null
2424
app = polka!
25-
.use serve-static (Path.join __dirname, '..', 'dist'), {'index': ['index.html']}
25+
.use serve-static (Path.join __dirname, '..', 'web-dist'), {'index': ['index.html']}
2626
.get '/stdin', (req, res) ->
2727
res.write-head 200, 'Content-Type': 'text/plain'
2828
res.end raw-stdin-buf

0 commit comments

Comments
 (0)