diff --git a/bin/elm-app-cli.js b/bin/elm-app-cli.js index 314f829e..a31856a7 100755 --- a/bin/elm-app-cli.js +++ b/bin/elm-app-cli.js @@ -50,6 +50,13 @@ switch (script) { break; } + case 'install': { + const executable = executablePaths['elm-package']; + spawn.sync(path.normalize(executable), process.argv.slice(2), { + stdio: 'inherit' + }); + break; + } default: // Proxy elm-platform cli commands. if (['package', 'reactor', 'make', 'repl'].indexOf(script) !== -1) { @@ -74,7 +81,9 @@ switch (script) { function help(version) { console.log('\nUsage: elm-app \n'); console.log('where is one of:'); - console.log(' create, build, start, package, reactor, make, repl\n'); + console.log( + ' create, build, start, install, package, reactor, make, repl\n' + ); console.log('\nElm ' + elmPlatformVersion + '\n'); console.log( 'create-elm-app@' + version + ' ' + path.resolve(__dirname, '..') diff --git a/scripts/utils/webpackHotDevClient.js b/scripts/utils/webpackHotDevClient.js index dd41d8a0..d3e08af6 100644 --- a/scripts/utils/webpackHotDevClient.js +++ b/scripts/utils/webpackHotDevClient.js @@ -159,7 +159,7 @@ var connection = new SockJS( hostname: window.location.hostname, port: window.location.port, // Hardcoded in WebpackDevServer - pathname: '/sockjs-node', + pathname: '/sockjs-node' }) ); @@ -218,7 +218,7 @@ function handleWarnings(warnings) { // Print warnings to the console. var formatted = formatWebpackMessages({ warnings: warnings, - errors: [], + errors: [] }); if (typeof console !== 'undefined' && typeof console.warn === 'function') { @@ -259,10 +259,12 @@ function handleErrors(errors) { hasCompileErrors = true; // "Massage" webpack messages. - var formatted = highlightElmCompilerErrors(formatWebpackMessages({ - errors: errors, - warnings: [], - })); + var formatted = highlightElmCompilerErrors( + formatWebpackMessages({ + errors: errors, + warnings: [] + }) + ); // Only show the first error. showErrorOverlay(formatted.errors[0]); diff --git a/template/README.md b/template/README.md index 772242d6..1c95887e 100644 --- a/template/README.md +++ b/template/README.md @@ -11,6 +11,7 @@ You can find the most recent version of this guide [here](https://github.com/hal - [Available scripts](#available-scripts) - [elm-app build](#elm-app-build) - [elm-app start](#elm-app-start) + - [elm-app install](#elm-app-install) - [elm-app test](#elm-app-test) - [elm-app eject](#elm-app-eject) - [elm-app ](#elm-app-elm-platform-comand) @@ -41,9 +42,11 @@ You are very welcome with any [feedback](https://github.com/halfzebra/create-elm ## Installing Elm packages ```sh -elm-app package install +elm-app install ``` +Other `elm-package` commands are also [available.](#package) + ## Installing JavaScript packages To use JavaScript packages from npm, you'll need to add a `package.json`, install the dependencies, and you're ready to go. @@ -102,6 +105,10 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits. You will also see any lint errors in the console. +### `elm-app install` + +An alias for [`elm-app package install`](#package) + ### `elm-app test` Run tests with [node-test-runner](https://github.com/rtfeldman/node-test-runner/tree/master) @@ -111,6 +118,7 @@ elm-app test --watch ``` ### `elm-app eject` + **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. @@ -120,20 +128,25 @@ Instead, it will copy all the configuration files and the transitive dependencie You don’t have to use 'eject' The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However, we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ### `elm-app ` + Create Elm App does not rely on the global installation of Elm Platform, but you still can use it's local Elm Platform to access default command line tools: #### `package` + Alias for [elm-package](http://guide.elm-lang.org/get_started.html#elm-package) Use it for installing Elm packages from [package.elm-lang.org](http://package.elm-lang.org/) #### `repl` + Alias for [elm-repl](http://guide.elm-lang.org/get_started.html#elm-repl) #### `make` + Alias for [elm-make](http://guide.elm-lang.org/get_started.html#elm-make) #### `reactor` + Alias for [elm-reactor](http://guide.elm-lang.org/get_started.html#elm-reactor) diff --git a/tests/elm-app.build.spec.js b/tests/elm-app.build.spec.js index 19ffb0e3..eaefa6f3 100644 --- a/tests/elm-app.build.spec.js +++ b/tests/elm-app.build.spec.js @@ -40,24 +40,21 @@ describe('Building Elm application with `elm-app build`', function() { expect(fs.existsSync(path.join(testAppDir, 'build'))).to.be.equal(true); }).timeout(12 * 60 * 1000); - it( - '`elm-app build` should exit with non zero status code when build failed', - function() { - const normalFile = path.join(testAppDir, 'src/Main.elm'); - const malformedFile = path.join(rootDir, './tests/fixtures/Main.elm'); + it('`elm-app build` should exit with non zero status code when build failed', function() { + const normalFile = path.join(testAppDir, 'src/Main.elm'); + const malformedFile = path.join(rootDir, './tests/fixtures/Main.elm'); - copyFileSync(normalFile, 'Main.elm-normal'); - copyFileSync(malformedFile, normalFile); + copyFileSync(normalFile, 'Main.elm-normal'); + copyFileSync(malformedFile, normalFile); - const result = spawn.sync('node', [elmAppCmd, 'build']); + const result = spawn.sync('node', [elmAppCmd, 'build']); - const oldNormalFile = path.resolve('Main.elm-normal'); - copyFileSync(oldNormalFile, normalFile); - fs.unlink(oldNormalFile); + const oldNormalFile = path.resolve('Main.elm-normal'); + copyFileSync(oldNormalFile, normalFile); + fs.unlink(oldNormalFile); - expect(result.status).to.be.at.least(1); - } - ).timeout(2 * 60 * 1000); + expect(result.status).to.be.at.least(1); + }).timeout(2 * 60 * 1000); }); function copyFileSync(from, to) { diff --git a/tests/elm-app.eject.spec.js b/tests/elm-app.eject.spec.js index dd99fa11..4b8b4491 100644 --- a/tests/elm-app.eject.spec.js +++ b/tests/elm-app.eject.spec.js @@ -70,18 +70,15 @@ describe('Ejecting Elm application. (Please wait...)', () => { expect(same).to.be.equal(true); }); - it( - 'It should be possible to build ejected applitaction, using npm scripts', - () => { - const result = spawn.sync('npm', ['run', 'build']); - const outputString = result.output - .map(function(out) { - return out !== null ? out.toString() : ''; - }) - .join(''); + it('It should be possible to build ejected applitaction, using npm scripts', () => { + const result = spawn.sync('npm', ['run', 'build']); + const outputString = result.output + .map(function(out) { + return out !== null ? out.toString() : ''; + }) + .join(''); - expect(result.status).to.be.equal(0); - expect(outputString).to.have.string('Compiled successfully'); - } - ).timeout(5 * 60 * 1000); + expect(result.status).to.be.equal(0); + expect(outputString).to.have.string('Compiled successfully'); + }).timeout(5 * 60 * 1000); });