Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Commit

Permalink
feat(bower): removes bower options, support, tests, references
Browse files Browse the repository at this point in the history
bower is technically maintained, but not recommended by anyone, including bower; just use the npm
registry

fixes #101
  • Loading branch information
edm00se committed Sep 30, 2018
1 parent 5889b5f commit fe14251
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 75 deletions.
28 changes: 9 additions & 19 deletions __tests__/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var helpers = require('yeoman-test');
var testProjName = 'SomeApp';

describe('generator-xsp:app', function () {
describe('app without bower or npm deps', function () {
describe('app without npm deps', function () {
beforeEach(function () {
return helpers
.run(path.join(__dirname, '../generators/app'))
Expand All @@ -14,13 +14,12 @@ describe('generator-xsp:app', function () {
basetheme: 'Bootstrap3',
ddeplugins: ['com.ibm.xsp.extlib.library'],
starterResources: false,
installBower: false,
useNpm: false
})
.toPromise();
});

it('creates base ODP files without bower, npm, or starter resources', function () {
it('creates base ODP files without npm, or starter resources', function () {
assert.file([
'ODP/.project',
'ODP/AppProperties/database.properties',
Expand All @@ -31,16 +30,15 @@ describe('generator-xsp:app', function () {
'ODP/Resources/StyleSheets/app.css',
'ODP/Code/ScriptLibraries/app.js',
'ODP/Code/ScriptLibraries/app.jss',
'package.json',
'bower.json'
'package.json'
]);
assert.noFileContent('ODP/Resources/Themes/app.theme', 'app.css');
assert.noFileContent('ODP/Resources/Themes/app.theme', 'app.js');
assert.noFileContent('ODP/Resources/Themes/app.theme', 'app.jss');
});
});

describe('app with npm, no bower, with starter theme components', function () {
describe('app with npm, with starter theme components', function () {
beforeEach(function () {
return helpers
.run(path.join(__dirname, '../generators/app'))
Expand All @@ -51,7 +49,6 @@ describe('generator-xsp:app', function () {
basetheme: 'webstandard',
ddeplugins: [],
starterResources: true,
installBower: false,
useNpm: true
})
.toPromise();
Expand All @@ -69,14 +66,13 @@ describe('generator-xsp:app', function () {
'ODP/Resources/IconNote',
'package.json'
]);
assert.noFile(['bower.json']);
assert.fileContent('ODP/Resources/Themes/app.theme', 'app.css');
assert.fileContent('ODP/Resources/Themes/app.theme', 'app.js');
assert.fileContent('ODP/Resources/Themes/app.theme', 'app.jss');
});
});

describe('app with bower no npm, alt ODP path', function () {
describe('app with no npm, alt ODP path', function () {
beforeEach(function () {
return helpers
.run(path.join(__dirname, '../generators/app'))
Expand All @@ -88,19 +84,17 @@ describe('generator-xsp:app', function () {
basetheme: 'Bootstrap3',
ddeplugins: ['com.ibm.xsp.extlib.library'],
starterResources: false,
installBower: true,
useNpm: false
})
.toPromise();
});

it('creates base ODP files with bower support', function () {
it('creates base ODP files', function () {
assert.file([
'NSF/.project',
'NSF/AppProperties/database.properties',
'NSF/plugin.xml',
'NSF/Resources/IconNote',
'bower.json'
'NSF/Resources/IconNote'
]);
assert.noFile([
'NSF/Resources/StyleSheets/app.css',
Expand Down Expand Up @@ -136,7 +130,7 @@ describe('generator-xsp:app', function () {
});

describe('CLI options power invocation', function () {
describe(' basic setup with bower no npm scripts', function () {
describe(' basic setup with no npm scripts', function () {
beforeEach(function () {
return helpers
.run(path.join(__dirname, '../generators/app'))
Expand All @@ -145,7 +139,6 @@ describe('generator-xsp:app', function () {
t: 'webstandard',
r: true,
'dde-plugins': 'ExtLib',
b: true,
'skip-npm': true,
p: 'ODP'
})
Expand All @@ -158,15 +151,14 @@ describe('generator-xsp:app', function () {
'ODP/AppProperties/database.properties',
'ODP/plugin.xml',
'ODP/Resources/IconNote',
'bower.json',
'ODP/Resources/StyleSheets/app.css',
'ODP/Code/ScriptLibraries/app.js',
'ODP/Code/ScriptLibraries/app.jss'
]);
assert.noFile(['package.json']);
});
});
describe(' basic setup with npm scripts, no bower, starter resources', function () {
describe(' basic setup with npm scripts, starter resources', function () {
beforeEach(function () {
return helpers
.run(path.join(__dirname, '../generators/app'))
Expand All @@ -175,7 +167,6 @@ describe('generator-xsp:app', function () {
t: 'Bootstrap3',
'no-res': true,
d: 'ODA',
'skip-bower': true,
npm: true,
p: 'ODP'
})
Expand All @@ -191,7 +182,6 @@ describe('generator-xsp:app', function () {
'package.json'
]);
assert.noFile([
'bower.json',
'ODP/Resources/StyleSheets/app.css',
'ODP/Code/ScriptLibraries/app.js',
'ODP/Code/ScriptLibraries/app.jss'
Expand Down
49 changes: 1 addition & 48 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,6 @@ module.exports = class extends Generator {
this.ddeplugins = ar;
}

this.option('use-bower', {
desc: 'opts-in to using Bower for client-side dependency management',
type: Boolean,
alias: 'b'
});
this.option('skip-bower', {
desc: 'opts-out of using Bower, use instead of --use-bower',
type: Boolean
});
if (this.options['use-bower']) {
this.useBower = true;
this.config.set('installBower', true);
}
if (this.options['skip-bower']) {
this.useBower = false;
this.config.set('installBower', false);
}

this.option('use-npm', {
desc:
'opts-in to using npm for dependency management and adds a dora cleaning script to package.json',
Expand Down Expand Up @@ -262,16 +244,6 @@ module.exports = class extends Generator {
return undefined === ctx.ddeplugins;
}
},
{
type: 'confirm',
name: 'installBower',
message: 'Would you like to use Bower for dependency management?',
default: false,
store: true,
when: function () {
return undefined === ctx.useBower;
}
},
{
type: 'confirm',
name: 'useNpm',
Expand Down Expand Up @@ -318,20 +290,6 @@ module.exports = class extends Generator {
this.destinationPath('.gitignore')
);
}
// Only load Bower files if requested
if (this.props.installBower || this.useBower) {
this.fs.copyTpl(
this.templatePath('_bower.json'),
this.destinationPath('bower.json'),
{
name: this.props.name
}
);
this.fs.copy(
this.templatePath('_bowerrc'),
this.destinationPath('.bowerrc')
);
}
}

// Copy ODP's application files
Expand Down Expand Up @@ -413,18 +371,13 @@ module.exports = class extends Generator {
return;
}
let depOpt = {
bower: false,
npm: false
};
/* istanbul ignore else */
if (this.props.installBower) {
depOpt.bower = true;
}
/* istanbul ignore else */
if (this.props.useNpm) {
depOpt.npm = true;
}
if (depOpt.bower === false && depOpt.npm === false) {
if (depOpt.npm === false) {
// Intentionally left blank
} else {
this.installDependencies(depOpt);
Expand Down
5 changes: 0 additions & 5 deletions generators/app/templates/_bower.json

This file was deleted.

3 changes: 0 additions & 3 deletions generators/app/templates/_bowerrc

This file was deleted.

0 comments on commit fe14251

Please sign in to comment.