Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

fix(gen): add to the generator the --javascript option #1346

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions script-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ var Generator = module.exports = function Generator() {
this.scriptSuffix = '.ts';
}

// add the option to generate javascript files even if we already have coffeescript or typescript or both.
this.env.options.javascript = this.options.javascript;
if (this.env.options.javascript) {
sourceRoot = '/templates/javascript';
this.scriptSuffix = '.js';
}

this.sourceRoot(path.join(__dirname, sourceRoot));
};

Expand Down
16 changes: 16 additions & 0 deletions test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ describe('angular:app', function () {
});
});

describe('--javascript', function () {
beforeEach(function (done) {
this.angular.withOptions({
javascript: true
}).on('end', done);
});

it('generates JavaScript files', function () {
assert.file([].concat(getDefaultFilesForAppPath('app'), [
'app/scripts/app.js',
'app/scripts/controllers/main.js',
'test/spec/controllers/main.js'
]));
});
});

describe('--typescript', function () {
beforeEach(function (done) {
this.angular.withOptions({
Expand Down