Skip to content

Commit

Permalink
Remove elm/platform references
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian committed Aug 26, 2018
1 parent be86924 commit f8a65d7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
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
17 changes: 7 additions & 10 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 Down
2 changes: 1 addition & 1 deletion config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
entry: resolveApp('./src/index.js'),
appBuild: resolveApp('./build'),
elmJson: resolveApp('./elm.json'),
elm: require('elm/platform').executablePaths['elm'],
elm: path.resolve(__dirname, '../node_modules/.bin/elm'),
publicUrl: getPublicUrl(resolveApp('elm.json')),
servedPath: getServedPath(resolveApp('elm.json'))
};
7 changes: 3 additions & 4 deletions scripts/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const chalk = require('chalk');
const spawnSync = require('child_process').spawnSync;
const argv = require('minimist')(process.argv.slice(2));
const commands = argv._;
const executablePaths = require('elm/platform').executablePaths;

if (commands.length === 0 || commands[0] === '') {
console.error('\nUsage: elm-app create <project-directory>');
Expand Down Expand Up @@ -40,10 +39,10 @@ function createElmApp(name) {

process.chdir(root);

// Run initial `elm-package install -y`
// Run initial `elm make`
const spawnElmPkgResult = spawnSync(
executablePaths['elm-package'],
['install', '-y'],
path.resolve(__dirname, '../node_modules/.bin/elm'),
['make', 'src/Main.elm'],
{ stdio: 'inherit' }
);

Expand Down

0 comments on commit f8a65d7

Please sign in to comment.