diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/README.md | 2 | ||||
-rw-r--r-- | example/bower.json | 2 | ||||
-rw-r--r-- | example/package.json | 2 | ||||
-rw-r--r-- | example/src/Foo.purs | 5 | ||||
-rw-r--r-- | example/src/Foo/Bar.purs | 2 | ||||
-rw-r--r-- | example/src/Test.purs | 2 | ||||
-rw-r--r-- | example/src/entry.js | 6 | ||||
-rw-r--r-- | example/webpack.config.js | 21 |
8 files changed, 32 insertions, 10 deletions
diff --git a/example/README.md b/example/README.md index 87b9bc7..bac4f6c 100644 --- a/example/README.md +++ b/example/README.md | |||
@@ -1,6 +1,6 @@ | |||
1 | ```bash | 1 | ```bash |
2 | bower install | 2 | bower install |
3 | npm install | 3 | npm install |
4 | npm run-script webpack | 4 | npm run-script build |
5 | npm run-script run | 5 | npm run-script run |
6 | ``` | 6 | ``` |
diff --git a/example/bower.json b/example/bower.json index b4a1c78..c83e735 100644 --- a/example/bower.json +++ b/example/bower.json | |||
@@ -2,6 +2,6 @@ | |||
2 | "name": "example", | 2 | "name": "example", |
3 | "private": true, | 3 | "private": true, |
4 | "devDependencies": { | 4 | "devDependencies": { |
5 | "purescript-maybe": "~0.2.1" | 5 | "purescript-prelude": "~0.1.0" |
6 | } | 6 | } |
7 | } | 7 | } |
diff --git a/example/package.json b/example/package.json index 915eb27..df3e74f 100644 --- a/example/package.json +++ b/example/package.json | |||
@@ -3,7 +3,7 @@ | |||
3 | "version": "0.0.0", | 3 | "version": "0.0.0", |
4 | "private": true, | 4 | "private": true, |
5 | "scripts": { | 5 | "scripts": { |
6 | "webpack": "./node_modules/.bin/webpack", | 6 | "build": "mkdir -p output && ./node_modules/.bin/webpack", |
7 | "run": "node bundle.js", | 7 | "run": "node bundle.js", |
8 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" | 8 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" |
9 | }, | 9 | }, |
diff --git a/example/src/Foo.purs b/example/src/Foo.purs index 3e3a04c..b234e0d 100644 --- a/example/src/Foo.purs +++ b/example/src/Foo.purs | |||
@@ -1,6 +1,9 @@ | |||
1 | module Foo (foo) where | 1 | module Foo (foo) where |
2 | 2 | ||
3 | import Data.Maybe | 3 | import Prelude |
4 | |||
4 | import qualified Foo.Bar as B | 5 | import qualified Foo.Bar as B |
5 | 6 | ||
6 | foo = "b" | 7 | foo = "b" |
8 | |||
9 | foo' = "c" | ||
diff --git a/example/src/Foo/Bar.purs b/example/src/Foo/Bar.purs index 4ae100d..6932902 100644 --- a/example/src/Foo/Bar.purs +++ b/example/src/Foo/Bar.purs | |||
@@ -1,3 +1,5 @@ | |||
1 | module Foo.Bar (bar) where | 1 | module Foo.Bar (bar) where |
2 | 2 | ||
3 | bar = "c" | 3 | bar = "c" |
4 | |||
5 | bar' = "d" | ||
diff --git a/example/src/Test.purs b/example/src/Test.purs index 8a5cb88..d9f1b96 100644 --- a/example/src/Test.purs +++ b/example/src/Test.purs | |||
@@ -1,5 +1,5 @@ | |||
1 | module Test (test) where | 1 | module Test (test) where |
2 | 2 | ||
3 | import Data.Maybe | 3 | import Prelude |
4 | 4 | ||
5 | test = "a" | 5 | test = "a" |
diff --git a/example/src/entry.js b/example/src/entry.js index cc09034..344d4c6 100644 --- a/example/src/entry.js +++ b/example/src/entry.js | |||
@@ -1,7 +1,11 @@ | |||
1 | var Prelude = require('Prelude'); | ||
2 | |||
1 | var test = require('./Test'); | 3 | var test = require('./Test'); |
2 | 4 | ||
3 | var foo = require('./Foo'); | 5 | var foo = require('./Foo'); |
4 | 6 | ||
5 | var baz = require('./Foo/Baz'); | 7 | var baz = require('./Foo/Baz'); |
6 | 8 | ||
7 | console.log(test, foo, baz); | 9 | var bar = require('./Foo/Bar'); |
10 | |||
11 | console.log(Prelude, test, foo, baz, bar); | ||
diff --git a/example/webpack.config.js b/example/webpack.config.js index f67e83a..9294904 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js | |||
@@ -1,14 +1,27 @@ | |||
1 | var path = require('path'); | 1 | var path = require('path'); |
2 | 2 | ||
3 | var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs']; | ||
4 | |||
5 | var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js']; | ||
6 | |||
7 | var output = 'output'; | ||
8 | |||
9 | var modulesDirectories = [ | ||
10 | 'node_modules', | ||
11 | 'bower_components/purescript-prelude/src', | ||
12 | output | ||
13 | ]; | ||
14 | |||
3 | var config | 15 | var config |
4 | = { entry: './src/entry' | 16 | = { entry: './src/entry' |
5 | , output: { path: __dirname | 17 | , output: { path: __dirname |
18 | , pathinfo: true | ||
6 | , filename: 'bundle.js' | 19 | , filename: 'bundle.js' |
7 | } | 20 | } |
8 | , module: { loaders: [ { test: /\.purs$/, loader: 'purs-loader?src[]=src' } ] } | 21 | , module: { loaders: [ { test: /\.purs$/ |
9 | , resolve: { modulesDirectories: [ 'node_modules', | 22 | , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&') |
10 | 'output' | 23 | } ] } |
11 | ] | 24 | , resolve: { modulesDirectories: modulesDirectories |
12 | , extensions: ['', '.js', '.purs'] | 25 | , extensions: ['', '.js', '.purs'] |
13 | } | 26 | } |
14 | , resolveLoader: { root: path.join(__dirname, 'node_modules') } | 27 | , resolveLoader: { root: path.join(__dirname, 'node_modules') } |