Skip to content

Commit 94689fc

Browse files
authored
Allow choosing config at build time (#156)
1 parent ebfdc13 commit 94689fc

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ cd trypurescript/client
4848

4949
npm install
5050
npm run build
51-
npm run bundle
5251

5352
cd public
5453
httpserver 8080 #eg with: alias httpserver='python -m SimpleHTTPServer'

ci/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ case $COMPONENT in
1212
client)
1313
cd client
1414
npm install
15-
npm run build
16-
npm run bundle
15+
# Use production config, since we want to use these bundles for deploys
16+
npm_config_configpath="config/prod/*.purs" npm run build
1717
;;
1818
*)
1919
echo >&2 "Unrecognised component: $COMPONENT"
File renamed without changes.

client/config/prod/Try.Config.purs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Try.Config where
2+
3+
loaderUrl :: String
4+
loaderUrl = "https://compile.purescript.org/output"
5+
6+
compileUrl :: String
7+
compileUrl = "https://compile.purescript.org"
8+
9+
mainGist :: String
10+
mainGist = "7ad2b2eef11ac7dcfd14aa1585dd8f69"

client/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"private": true,
3+
"config": {
4+
"configpath": "config/dev/*.purs"
5+
},
36
"scripts": {
47
"clean": "rimraf output",
5-
"build": "spago build --purs-args '--censor-lib --strict'",
6-
"bundle": "spago bundle-app --to public/js/index.js"
8+
"build": "spago bundle-app --path $npm_package_config_configpath --purs-args '--censor-lib --strict' --to public/js/index.js"
79
},
810
"devDependencies": {
911
"purescript": "^0.13.6",

0 commit comments

Comments
 (0)