gulp-elm / gulp-elm Goto Github PK
View Code? Open in Web Editor NEWGulp plugin that compiles Elm files to JavaScript.
Gulp plugin that compiles Elm files to JavaScript.
We have a standard project configuration which tries to compile elm files if they exist. When I use this on a directory without any elm files, I get an error:
[11:07:59] Starting 'elm:xyz-theme'...
Success! Compiled 0 modules.
Success! Compiled 0 modules.
{ Error: ENOENT: no such file or directory, open 'C:\Users\bdukes\AppData\Local\Temp\116412-7312-5w65ic.9nsfko6r.js'
at Error (native)
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\bdukes\\AppData\\Local\\Temp\\116412-7312-5w65ic.9nsfko6r.js' }
[11:08:00] gulp-notify: [gulp-elm Error] ENOENT: no such file or directory, open 'C:\Users\bdukes\AppData\Local\Temp\116412-7312-5w65ic.9nsfko6r.js'
[11:08:00] Finished 'elm:xyz-theme' after 401 ms
2.0.3
to 2.0.4
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
through2 is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 4 commits.
e839de7
2.0.4
c778d93
added coverage
0293a9e
replace function into arrow function in README
40d2668
update to latest shiny stuff
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
New feature from 0.18. Hope you can add it soon
Is there any interest in this, such that you get warnings as well as errors when compiling? I'm happy to make the PR.
Now that 0.16 of Elm has been released, I wonder if there's anything that needs to be done to use this wonderful plugin with it?
@philopon, I can't see anything in the code that requires a specific version of Elm, but thought I'd ask :)
Hi,
I'm not getting any js output from gulp-elm, when I have the source code in a sub-directory. It does work if the code is in my root directory
I also found that I had to use return gulp.src("src/*.elm", {cwd: './src'})
to prevent the compiler complaining it could not find files. (I'm wondering whether the process failed because the elm files are now out of sync with the elm-packages directory.)
First of all, thank you for this useful package, it saves a lot of time and works well with browser-sync
!
I would like to configure the build process according to this simplified directory structure:
project
β
ββββelm
β β gulpfile.js
β β
β ββββsamples
β β
β ββββfoo
β β elm.json
β β index.js
β β style.scss
β β src/Main.elm
β β
β ββββbar
β elm.json
β index.js
β style.scss
β src/Main.elm
|
ββββassets
β
ββββsamples
β
ββββfoo
β index.js
β main.js
β style.css
β
ββββbar
index.js
main.js
style.css
β This is my attempt to configure gulp-elm
(the bundle
function is needed because the Elm code is actually more than a single Main.elm
):
src('samples/*/src/Main.elm')
.pipe(elm.bundle('main.js', { cwd: 'samples/*/', debug: true }))
.pipe(dest('../assets/samples/'))
βοΈ Processing scss
files with a similar approach works fine:
src('samples/*/style.scss', { sourcemaps: true })
.pipe(sass().on('error', sass.logError))
.pipe(dest('../assets/samples/', { sourcemaps: true }))
βοΈ Configuring directories one by one works too, e.g this is the directory foo
config:
src('samples/foo/src/Main.elm')
.pipe(elm.bundle('main.js', { cwd: 'samples/foo/', debug: true }))
.pipe(dest('../assets/samples/foo/'))
It seems that using glob patterns in cwd
is not allowed. Are you willing to support this setup?
spawn
failed to find the executable because the cwd
has been changed to a different folder.
I guess this error only happens if your package.json
is not in the same folder as your elm-package.json
Error message:
Message:
The system cannot find the path specified.
I have a pretty simple gulp file:
const gulp = require("gulp")
const elm = require("gulp-elm")
const plumber = require("gulp-plumber")
gulp.task("elm", function() {
return gulp.src("src/Main.elm")
.pipe(plumber(function(err) {
console.log(err)
this.emit("end")
}))
.pipe(elm.bundle("script.js"))
.pipe(gulp.dest("build"))
})
gulp.task("watch", function() {
gulp.watch("src/**/*.elm", ["elm"])
})
Everything works perfectly if I call gulp elm
(I manually tested this ~20
times). If however I run gulp watch
, and then edit Main.elm
(my only
file) it fails ~25% of the time. I did not change the file at all between
saves. I've annotated the following console output with my actions.
[20:16:28] Starting 'elm'... # Triggered a save (works)
[BS] 1 file changed (script.js)
[20:16:29] Finished 'elm' after 957 ms
[20:16:31] Starting 'elm'... # Triggered a save (works)
[BS] 1 file changed (script.js)
[20:16:32] Finished 'elm' after 913 ms
[20:16:33] Starting 'elm'... # Triggered a save (fails)
elm-make: /home/henry/dev/character-sheet/src/Main.elm: openFile: does not exist (No such file or directory)
{ [Error: elm-make: /home/henry/dev/character-sheet/src/Main.elm: openFile: does not exist (No such file or directory)
]
message: 'elm-make: /home/henry/dev/character-sheet/src/Main.elm: openFile: does not exist (No such file or directory)\n',
showStack: false,
showProperties: true,
plugin: 'gulp-elm',
__safety: { toString: [Function: bound ] } }
[20:16:33] Finished 'elm' after 243 ms
[20:16:33] Starting 'elm'... # Did *not* trigger a save, this
[20:16:33] Finished 'elm' after 2.56 ms # it just happens after a failure
[20:16:33] Starting 'elm'... # Didn't trigger this either
[BS] 1 file changed (script.js)
[20:16:34] Finished 'elm' after 1.19 s
node: 6.1.0
elm: 0.18.0
gulp: 3.9.1
gulp-elm: 0.6.1
gulp-plumber: 1.1.0
12.0.0
to 12.1.0
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
jsdom is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 13 commits.
b2994f9
Version 12.1.0
2fd2e89
runVMScript's new options argument does not work in browsers
c294f50
Add options to the dom.runVMScript method
c9c5a05
Add [expected fail] to test output
1bfd7d7
Roll Web Platform Tests
dbff7dd
Remove dead code
31e23ef
Pass through the element to custom resource laoders
96b3787
Fix timing for async scripts
c96decf
Move from sax to saxes for XML parsing
ed11465
Upgrade cssstyle dependency from ^1.0.0 to ^1.1.1
8898b25
Implement fieldset's elements and type properties
6a1722a
Fix "input" and "change" events for HTMLInputElement
0cba358
Minor code and README cleanups; note Node.js version requirement
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Error: Error when searching for modules imported by module 'Main':
Could not find module 'Bar'
Project is layed out as follows:
foo
βββ elm-package.json
βββ gulpfile.js
βββ src
βββ Bar.elm
βββ Main.elm
Main.elm
import Bar
import Graphics.Element exposing (..)
main = empty
Bar.elm
module Bar where
import Graphics.Element exposing (..)
bar = empty
Gulpfile is the one from the README. Works fine with elm-make src/*.elm
.
With the new alpha of Elm 0.17 all the error messages produced by gulp-elm
are in red, instead of in pretty colours like before.
I have added the following:
gulp.task("elm", function(){
return gulp.src('fractal/assets/elm/*.elm', { optimize: true })
.pipe(plumber())
.pipe(elm.bundle('elm.js'))
.pipe(gulp.dest("fractal/assets/js/"))
.pipe(gulp.dest("htdocs/assets/js/"));
});
However, the optimize flag is not working. It is still compiling in dev mode.
I've also tried the example in the README and still the same issue:
gulp.task('elm', function(){
return gulp.src('fractal/assets/elm/Main.elm', { optimize: true })
.pipe(elm())
.pipe(gulp.dest("fractal/assets/js/"));
});
When watching for changes, errors in the code make the compiler return an error, which somewhere gets thrown as an Exception by q
:
[13:16:29] Starting 'compile:elm'...
(node:8191) DeprecationWarning: 'root' is deprecated, use 'global'
(node:8191) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
-- SYNTAX PROBLEM - <source folder>/TagSelect.elm
I ran into something unexpected when parsing your code!
72| let
^
I am looking for one of the following things:
end of input
whitespace
<project folder>/node_modules/q/q.js:155
throw e;
^
This leads to the watch
process stopping and not recompiling anything after further changes.
3.0.5
to 3.0.6
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
ansi-colors is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 7 commits.
afbc01e
update readme
31edac0
expose keys
17097fe
update symbols
eec6225
closes #21
a662b71
Merge pull request #20 from jorgebucaran/master
9387963
docs: remove mention of library which is no longer
3df6661
3.0.5
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
elm-make
is gone, replaced with just a single elm
binary.
As a shim, installing this shell script as elm-make
technically makes it works:
#!/bin/bash
shift # swallow --yes, its gone
[[ "$@" ]] && exec node_modules/.bin/elm make "$@"
We're embedding a small Elm application into our existing React app, and are using gulp-elm for compilation. We noticed that the elm-package.json file must exist in the root directory of the repo, even if the Elm application itself is nested within a few directories.
It would be great to have an option to specify a custom path to elm-package.json, or simply to look for elm-package.json in the same directory that the entry point to the Elm app exists.
EDIT: Can use Gulp's cwd
flag to specify current working directory for elm task.
i.e.
gulp.task 'elm-compile-dev', ['elm-init'], ->
gulp.src config.src, { cwd: 'client/app/public/elm/elm' }
.pipe(elm({debug: true}))
.on('error', _onErr)
.pipe(gulp.dest(config.dest))
.pipe(browserSync.reload({stream : true}))
Right now the output file will be the same as the source .elm file specified with either the extension ".js" or ".html" depending on what you specify for the filetype option. This means that you cannot specify a different file name or just create a lower case filename which is standard for js and html files.
I believe it would make more sense to reflect the options provided by elm make itself and provide an output parameter that defines the output filename and type.
I'm having an issue where the gulp-elm task runs elm-make, and the JavaScript output file is written successfully, but then hangs for 1 - 3 minutes before successfully firing the 'close' event of the spawned elm-make process in node and completing the task.
Swapping out
, spawn = require('cross-spawn')
for
, spawn = require('child_process').spawn
in index.js seems to fix the issue.
The gulpfile.js I'm using is here:
https://github.com/stephenhand/form-editor/blob/gulp-elm/gulpfile.js
Works: gulp.src('../admin-elm/src/users/Users.elm') (Manual array also works)
Fails:
gulp.src('../admin-elm/src/**/*.elm')
.pipe(elm({
cwd: '../admin-elm/',
optimize: true
}))
.pipe(gulp.dest('public/'))
-----
{ Error: ENOENT: no such file or directory, open '/tmp/gulp-elm-tmp-11884-29168-vn8ssn.9eyka/11884-29168-1fb90pi.lblx.js'
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/tmp/gulp-elm-tmp-11884-29168-vn8ssn.9eyka/11884-29168-1fb90pi.lblx.js' }
<removed path>.../node_modules/q/q.js:155
throw e;
^
Error: ENOENT: no such file or directory, open '/tmp/gulp-elm-tmp-11884-29168-vn8ssn.9eyka/11884-29168-1fb90pi.lblx.js'
The recent change to pipe the elm-make
output to stdout
directly means that the output from elm-make
is mixing with the output from gulp (or other elm-make
processes), making the output unreadable when multiple processes are generating output, e.g.
Potential problems could be:
* M[i15:39:47s] spelled tFinished 'hjs:LandoCalrissian-modulee' after 12 sm
odul[e15:39:47 ] nStarting 'aLandoCalrissian-modulem'...
e[
15:39:47 ] *Finished ' LandoCalrissian-moduleN' after e33 ΞΌse
d to add a source directory or new dependency to elm-package.json
I cannot find module 'Effects'.
@philopon, can you enable these services on the GitHub repo (or transfer ownership of the repo to an organization so that I can have access to do it?)
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.