Skip to content

Commit c87dc70

Browse files
committed
Update test commands. Update Changelog
1 parent 902d36a commit c87dc70

File tree

6 files changed

+36
-30
lines changed

6 files changed

+36
-30
lines changed

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
### Added
1010
- `super`
1111
- `defoverridable`
12+
- `Elixir.load` for loading generated JavaScript modules in bundled output.
13+
Unlike `Elixir.start`, this will only call `__load` on the module and return the functions on it
14+
15+
```javascript
16+
const exports = Elixir.load(Elixir.MyApp);
17+
exports.hello();
18+
```
1219

1320
### Changed
1421
- `-ex` alias is now `-e`
1522
- A filename can be specified for output
1623

24+
### Fixed
25+
- Make sure mix compiler works in umbrella apps
26+
1727
## [0.26.1] - 2017-02-27
1828

1929
### Fixed
@@ -46,7 +56,7 @@ elixirscript "app/elixirscript" -o dist --js-module React:react --js-module Reac
4656
- Now bundles all output, including the boostrap code.
4757
The exported object has Elixir modules in JavaScript namespaces that are lazily loaded when called.
4858

49-
To start your application import the bundle according to whichever module format was selected and
59+
To start your application import the bundle according to whichever module format was selected and
5060
then call start giving it the module and the initial args
5161

5262
```javascript
@@ -67,7 +77,7 @@ elixirscript "app/elixirscript" -o dist --js-module React:react --js-module Reac
6777
- Updated elixir_script mix compiler to support compiling elixir_script paths in dependencies if dependency has mix compiler defined as well
6878
- Add `Collectable` protocol implementations
6979
- Updated `for` implementation to use `Collectable`
70-
- `format` option. Can now specify the module format of output.
80+
- `format` option. Can now specify the module format of output.
7181
Choices are:
7282
* `:es` (default) for ES Modules
7383
* `:umd` for UMD

GettingStarted.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ This is the help output of elixirscript
3030
the elixir code string if passed the -e flag
3131
options:
3232
--js-module [<identifer>:<path>] A js module used in your code. ex: React:react
33-
Multiple can be defined
33+
Multiple can be defined
3434
-f --format [format] module format of output. options: es (default), common, umd
35-
-o --output [path] places output at the given path.
35+
-o --output [path] places output at the given path.
3636
Can be a directory or filename.
3737
-e --elixir read input as elixir code string
3838
--full-build informs the compiler to do a full build instead of an incremental one
@@ -49,10 +49,10 @@ elixirscript also takes a path to your `.ex` files as well:
4949

5050
If you look in the dist folder you'll see a file called `Elixir.App.js`
5151

52-
To start your application import the bundle according to whichever module format was selected and
52+
To start your application import the bundle according to whichever module format was selected and
5353
then call start giving it the module and the initial args.
5454

55-
Ex. If you have a module like so
55+
Ex. If you have a module like so
5656
```elixir
5757
defmodule Example do
5858
start(type, args) do
@@ -87,14 +87,14 @@ Add dependency to your deps in mix.exs:
8787
version: "0.1.0",
8888
elixir: "~> 1.0",
8989
deps: deps,
90-
elixir_script: [
91-
input: "lib/elixirscript",
92-
output: "priv/elixirscript/Elixir.App.js",
90+
elixir_script: [
91+
input: "lib/elixirscript",
92+
output: "priv/elixirscript/Elixir.App.js",
9393
format: :es,
9494
js_modules: [
9595
{React, "react"},
9696
{ReactDOM, "react-dom"}
97-
]
97+
]
9898
],
9999
compilers: [:elixir_script] ++ Mix.compilers
100100
]
@@ -160,6 +160,6 @@ There is an [elixirscript frontend boilerplate project](https://github.com/elixi
160160

161161
There is an Brunch plugin, [elixirscript-brunch](https://www.npmjs.com/package/elixirscript-brunch).
162162

163-
####
163+
#### elixirscript-loader
164164

165-
There is also a webpack loader, [elixirscript-loader](https://www.npmjs.com/package/elixirscript-loader).
165+
There is also a webpack loader, [elixirscript-loader](https://www.npmjs.com/package/elixirscript-loader).

lib/elixir_script/passes/handle_output.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule ElixirScript.Passes.HandleOutput do
2222
code -> code
2323
end
2424

25-
IO.write(concat(code))
25+
IO.write(concat(code))
2626
end
2727

2828
defp out(compiler_output, %{output: output_path, core_path: _}) do

lib/elixir_script/translator/kernel/special_forms/call.ex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule ElixirScript.Translator.Call do
2222
)
2323

2424
{ast, env}
25-
end
25+
end
2626

2727
def make_local_function_call(function_name, params, env) do
2828
ast = JS.call_expression(
@@ -42,7 +42,7 @@ defmodule ElixirScript.Translator.Call do
4242
Identifier.make_namespace_members(members),
4343
[JS.identifier("Elixir")]
4444
),
45-
Identifier.make_identifier(function_name)
45+
Identifier.make_identifier(function_name)
4646
),
4747
Enum.map(params, &Translator.translate!(&1, env))
4848
)
@@ -52,7 +52,7 @@ defmodule ElixirScript.Translator.Call do
5252

5353
def make_module_function_call(module_name, function_name, env) do
5454
make_module_function_call(module_name, function_name, [], env)
55-
end
55+
end
5656

5757
def make_extern_function_or_property_call(module_name, function_name, env) do
5858
members = Module.split(module_name)
@@ -87,7 +87,7 @@ defmodule ElixirScript.Translator.Call do
8787
)
8888

8989
{ast, env}
90-
end
90+
end
9191

9292
def make_function_or_property_call(module_name, function_name, env) do
9393
js_ast = JS.call_expression(
@@ -128,19 +128,19 @@ defmodule ElixirScript.Translator.Call do
128128
]
129129
)
130130

131-
{js_ast, env}
131+
{js_ast, env}
132132
end
133133

134134
def make_function_call(module_name, function_name, params, env) when is_atom(module_name) and is_atom(function_name) do
135135
js_ast = JS.call_expression(
136136
JS.member_expression(
137137
Identifier.make_identifier(module_name),
138-
Identifier.make_identifier(function_name)
138+
Identifier.make_identifier(function_name)
139139
),
140140
Enum.map(params, &Translator.translate!(&1, env))
141141
)
142142

143-
{js_ast, env}
143+
{js_ast, env}
144144
end
145145

146146
def make_function_call({{:., _, _}, _, _} = module_name, function_name, [], env) do
@@ -161,19 +161,19 @@ defmodule ElixirScript.Translator.Call do
161161
]
162162
)
163163

164-
{js_ast, env}
164+
{js_ast, env}
165165
end
166166

167167
def make_function_call({{:., _, _}, _, _} = module_name, function_name, params, env) do
168168
js_ast = JS.call_expression(
169169
JS.member_expression(
170170
Translator.translate!(module_name, env),
171-
Identifier.make_identifier(function_name)
171+
Identifier.make_identifier(function_name)
172172
),
173173
Enum.map(params, &Translator.translate!(&1, env))
174174
)
175175

176-
{js_ast, env}
176+
{js_ast, env}
177177
end
178178

179179
def make_function_call(module_name, function_name, [], env) do
@@ -195,7 +195,7 @@ defmodule ElixirScript.Translator.Call do
195195
)
196196

197197
{js_ast, env}
198-
end
198+
end
199199

200200
def make_function_call(module_name, function_name, params, env) do
201201
call = JS.call_expression(

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build": "rollup -c rollup.config.js",
1313
"clean": "rm -rf priv/build",
1414
"test": "mocha src/javascript/tests --recursive --compilers js:babel-core/register",
15-
"test-app": "./test/app/convert-exjs && NODE_ENV=test mocha 'test/app/spec/*.spec.js'"
15+
"build:test-app": "mix elixirscript test/app/src/ -f common -o test/app/build/",
16+
"test-app": "yarn run build:test-app && NODE_ENV=test mocha 'test/app/spec/*.spec.js'"
1617
},
1718
"repository": {
1819
"type": "git",

test/app/convert-exjs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)