Skip to content

Commit

Permalink
fix(importer): throw clear unsupported error for webpack projects
Browse files Browse the repository at this point in the history
closes #735
  • Loading branch information
JeroenVinke committed Sep 3, 2017
1 parent 238b863 commit 5b23897
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/commands/import/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

const ImportEngine = require('../../importer/import-engine');
const ArgumentParser = require('../install/package-argument-parser');
const Project = require('../../project').Project;

module.exports = class {

static inject() { return [ImportEngine, ArgumentParser]; }
static inject() { return [ImportEngine, ArgumentParser, Project]; }

constructor(engine, argumentParser) {
constructor(engine, argumentParser, project) {
this.engine = engine;
this.argumentParser = argumentParser;
this.project = project;
}

execute(args) {
if (this.project.model.bundler && this.project.model.bundler.id !== 'cli') {
throw new Error('This command is only available for the Aurelia CLI Bundler');
}

let packages = this.argumentParser.parse(args);

if (packages.length === 0) {
Expand Down
10 changes: 8 additions & 2 deletions lib/commands/install/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
const ImportCommand = require('../import/command');
const PackageInstaller = require('../../importer/package-installer');
const ArgumentParser = require('./package-argument-parser');
const Project = require('../../project').Project;
const logger = require('aurelia-logging').getLogger('Install');

module.exports = class {

static inject() { return [PackageInstaller, ImportCommand, ArgumentParser]; }
static inject() { return [PackageInstaller, ImportCommand, ArgumentParser, Project]; }

constructor(packageInstaller, importCommand, argumentParser) {
constructor(packageInstaller, importCommand, argumentParser, project) {
this.packageInstaller = packageInstaller;
this.importCommand = importCommand;
this.argumentParser = argumentParser;
this.project = project;
}

execute(args) {
if (this.project.model.bundler && this.project.model.bundler.id !== 'cli') {
throw new Error('This command is only available for the Aurelia CLI Bundler');
}

let packages = new ArgumentParser().parse(args);

if (packages.length === 0) {
Expand Down

0 comments on commit 5b23897

Please sign in to comment.