Skip to content

Commit

Permalink
Merge pull request halfzebra#272 from halfzebra/next
Browse files Browse the repository at this point in the history
Create Elm App v2
  • Loading branch information
halfzebra authored Sep 2, 2018
2 parents 5f9f1b7 + 9eaf05c commit 06ad2d8
Show file tree
Hide file tree
Showing 31 changed files with 447 additions and 8,278 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trim_trailing_whitespace = true
[*.html]
indent_size = 4

[elm-package.json]
[elm.json]
indent_size = 4

[*.md]
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module.exports = {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 6
},
extends: ['eslint:recommended'],
plugins: ['prettier'],
rules: {
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
singleQuote: true
}
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ sudo: required
node_js:
- '9'
- '8'
- '7'
- '6'
addons:
apt:
packages:
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Create a production build with `elm-app build`

### Installation

**Node >=6** is required for installation.
**Node >=8** is required for installation.

#### Yarn

Expand Down Expand Up @@ -51,7 +51,7 @@ Create a new `my-app` folder with files for your future project.
my-app/
├── .gitignore
├── README.md
├── elm-package.json
├── elm.json
├── elm-stuff
├── public
│ ├── favicon.ico
Expand All @@ -64,8 +64,7 @@ my-app/
│ ├── main.css
│ └── registerServiceWorker.js
└── tests
├── Tests.elm
└── elm-package.json
└── Tests.elm
```

You are ready to employ the full power of Create Elm App!
Expand Down
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ image: Visual Studio 2017
platform:
- x64

# Test against these versions of Node.js.
environment:
matrix:
# node.js
- nodejs_version: "8"
- nodejs_version: "9"

install:
- ps: Install-Product node $env:nodejs_version $env:platform

Expand Down
4 changes: 2 additions & 2 deletions bin/create-elm-app-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const version = require('../package.json').version;
const elmPlatformVersion = require('elm/package.json').version;
const elmVersion = require('elm/package.json').version;
const commands = argv._;

if (commands.length === 0) {
console.log('\nUsage: create-elm-app <project-directory>\n');
console.log(
'where <project-directory> is the name of the directory with your future project'
);
console.log('\nElm Platform ' + elmPlatformVersion + '\n');
console.log('\nElm Platform ' + elmVersion + '\n');
console.log(
'create-elm-app@' + version + ' ' + path.resolve(__dirname, '..')
);
Expand Down
19 changes: 8 additions & 11 deletions bin/elm-app-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const executablePaths = require('elm/platform').executablePaths;
const elmExecutable = path.resolve(__dirname, '../node_modules/.bin/elm')
const version = require('../package.json').version;
const elmPlatformVersion = require('elm/package.json').version;
const elmVersion = require('elm/package.json').version;

const commands = argv._;

Expand Down Expand Up @@ -37,7 +37,7 @@ switch (script) {

args = args.concat([
'--compiler',
path.normalize(executablePaths['elm-make'])
elmExecutable
]);

const cp = spawn.sync(require.resolve('elm-test/bin/elm-test'), args, {
Expand All @@ -51,18 +51,15 @@ switch (script) {
break;
}
case 'install': {
const executable = executablePaths['elm-package'];
spawn.sync(path.normalize(executable), process.argv.slice(2), {
spawn.sync(elmExecutable, process.argv.slice(2), {
stdio: 'inherit'
});
break;
}
default:
// Proxy elm-platform cli commands.
if (['package', 'reactor', 'make', 'repl'].indexOf(script) !== -1) {
const executable = executablePaths['elm-' + script];

spawn.sync(path.normalize(executable), process.argv.slice(3), {
if (['reactor', 'make', 'repl'].indexOf(script) !== -1) {
spawn.sync(elmExecutable, process.argv.slice(2), {
stdio: 'inherit'
});
break;
Expand All @@ -84,7 +81,7 @@ function help(version) {
console.log(
' create, build, start, install, test, eject, package, reactor, make, repl\n'
);
console.log('\nElm ' + elmPlatformVersion + '\n');
console.log('\nElm ' + elmVersion + '\n');
console.log(
'create-elm-app@' + version + ' ' + path.resolve(__dirname, '..')
);
Expand All @@ -94,7 +91,7 @@ function help(version) {
* Spawn separate node process with specified script
*
* @param {string} script Path to script
* @param {Arrays} args Script arguments
* @param {Array} args Script arguments
* @return {undefined}
*/
function spawnSyncNode(script, args) {
Expand Down
8 changes: 4 additions & 4 deletions config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ module.exports = {
dotenv: resolveApp('./.env'),
entry: resolveApp('./src/index.js'),
appBuild: resolveApp('./build'),
elmPackageJson: resolveApp('./elm-package.json'),
elmMake: require('elm/platform').executablePaths['elm-make'],
publicUrl: getPublicUrl(resolveApp('elm-package.json')),
servedPath: getServedPath(resolveApp('elm-package.json'))
elmJson: resolveApp('./elm.json'),
elm: path.resolve(__dirname, '../node_modules/.bin/elm'),
publicUrl: getPublicUrl(resolveApp('elm.json')),
servedPath: getServedPath(resolveApp('elm.json'))
};
16 changes: 16 additions & 0 deletions config/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}

// fetch() polyfill for making API calls.
require('whatwg-fetch');

// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');
Loading

0 comments on commit 06ad2d8

Please sign in to comment.