Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make elm a peer dependency. #587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: Visual Studio 2017
image: Visual Studio 2019
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build fails in the old windows, but I haven't such OS to debug, hope someone else can help with that.

https://ci.appveyor.com/project/halfzebra/create-elm-app/builds/38540133/job/7duw5ityiktqj1wf


platform:
- x64
Expand All @@ -23,8 +23,13 @@ skip_commits:
- '**/*.md'

test_script:
- node --version
- npm --version
- npm install
- npm link
- npm run test
- ps: node --version
- ps: npm --version
- ps: npm config set loglevel silent
# NPM prefix should be writable by current user.
- ps: npm config set prefix "$home\\.npm-prefix"
- ps: $env:Path += ";$home\\.npm-prefix\\"
- ps: npm install -g [email protected] [email protected]
- ps: npm install
- ps: npm link
- ps: npm run test
4 changes: 3 additions & 1 deletion bin/create-elm-app-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const version = require('../package.json').version;
const elmVersion = require('elm/package.json').version;
const which = require('which');
const elmExecutable = which.sync('elm', {nothrow: true}) || require.resolve('elm/bin/elm');
const elmVersion = spawn.sync(elmExecutable, ['--version']).stdout.toString().trim();
const commands = argv._;

if (commands.length === 0) {
Expand Down
10 changes: 6 additions & 4 deletions bin/elm-app-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const elmExecutable = require.resolve('elm/bin/elm');
const which = require('which');
const elmExecutable = which.sync('elm', {nothrow: true}) || require.resolve('elm/bin/elm');
const elmTestExecutable = which.sync('elm-test', {nothrow: true}) || require.resolve('elm-test/bin/elm-test');
const version = require('../package.json').version;
const elmVersion = require('elm/package.json').version;
const elmVersion = spawn.sync(elmExecutable, ['--version']).stdout.toString().trim();

const commands = argv._;

Expand Down Expand Up @@ -66,8 +68,8 @@ switch (script) {
}
});

args = args.concat(['--compiler', require.resolve('elm/bin/elm')]);
const cp = spawn.sync(require.resolve('elm-test/bin/elm-test'), args, {
args = args.concat(['--compiler', elmExecutable]);
const cp = spawn.sync(elmTestExecutable, args, {
stdio: 'inherit'
});

Expand Down
3 changes: 2 additions & 1 deletion config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path');
const fs = require('fs');
const url = require('url');
const cosmiconfig = require('cosmiconfig');
const which = require('which');

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
Expand Down Expand Up @@ -76,7 +77,7 @@ module.exports = {
entry: resolveApp('./src/index.js'),
appBuild: resolveApp('./build'),
elmJson: resolveApp('./elm.json'),
elm: require.resolve('elm/bin/elm'),
elm: which.sync('elm', {nothrow: true}) || require.resolve('elm/bin/elm'),
publicUrl: getPublicUrl(config),
servedPath: getServedPath(config),
proxy: config.proxy,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
"cross-spawn": "7.0.3",
"css-loader": "4.3.0",
"dotenv": "8.2.0",
"elm": "latest-0.19.1",
"elm-asset-webpack-loader": "1.1.2",
"elm-hot-webpack-loader": "1.1.7",
"elm-test": "latest-0.19.1",
"elm-webpack-loader": "6.0.1",
"file-loader": "6.2.0",
"fs-extra": "6.0.1",
Expand All @@ -65,6 +63,7 @@
"webpack-dev-server": "3.11.0",
"webpack-manifest-plugin": "2.2.0",
"whatwg-fetch": "3.5.0",
"which": "^2.0.2",
"workbox-webpack-plugin": "4.3.1"
},
"devDependencies": {
Expand All @@ -87,6 +86,10 @@
"shelljs": "0.8.3",
"unexpected": "12.0.0"
},
"peerDependencies": {
"elm": "latest-0.19.1",
"elm-test": "latest-0.19.1"
},
"engines": {
"node": ">=8.0.0"
},
Expand Down
4 changes: 3 additions & 1 deletion scripts/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const chalk = require('chalk');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const commands = argv._;
const which = require('which');
const elmExecutable = which.sync('elm', {nothrow: true}) || require.resolve('elm/bin/elm');

const isWindows = process.platform === 'win32';

Expand Down Expand Up @@ -44,7 +46,7 @@ function createElmApp(name) {

// Run initial `elm make`
const spawnElmPkgResult = spawn.sync(
path.resolve(__dirname, '../node_modules/.bin/elm'),
elmExecutable,
// Run elm-make to install the dependencies.
['make', 'src/Main.elm', '--output=/dev/null'],
{ stdio: 'inherit', cwd: appRoot }
Expand Down