Skip to content

Commit c999c88

Browse files
committed
more fixes
1 parent eacd37c commit c999c88

File tree

4 files changed

+33
-35
lines changed

4 files changed

+33
-35
lines changed

addon/ng2/commands/init.js renamed to addon/ng2/commands/init.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
'use strict';
22

3-
var Command = require('ember-cli/lib/models/command');
4-
var Promise = require('ember-cli/lib/ext/promise');
5-
var SilentError = require('silent-error');
6-
var validProjectName = require('ember-cli/lib/utilities/valid-project-name');
7-
var normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option');
8-
var GitInit = require('../tasks/git-init');
9-
var LinkCli = require('../tasks/link-cli');
10-
var NpmInstall = require('../tasks/npm-install');
11-
12-
module.exports = Command.extend({
3+
import LinkCli from '../tasks/link-cli';
4+
5+
const Command = require('ember-cli/lib/models/command');
6+
const Promise = require('ember-cli/lib/ext/promise');
7+
const SilentError = require('silent-error');
8+
const validProjectName = require('ember-cli/lib/utilities/valid-project-name');
9+
const normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option');
10+
const GitInit = require('../tasks/git-init');
11+
const NpmInstall = require('../tasks/npm-install');
12+
13+
14+
const InitCommand: any = Command.extend({
1315
name: 'init',
1416
description: 'Creates a new angular-cli project in the current folder.',
1517
aliases: ['i'],
@@ -39,7 +41,7 @@ module.exports = Command.extend({
3941
}
4042
},
4143

42-
run: function (commandOptions, rawArgs) {
44+
run: function (commandOptions: any, rawArgs: string[]) {
4345
if (commandOptions.dryRun) {
4446
commandOptions.skipNpm = true;
4547
commandOptions.skipBower = true;
@@ -94,7 +96,7 @@ module.exports = Command.extend({
9496

9597
return Promise.reject(new SilentError(message));
9698
}
97-
99+
98100
var blueprintOpts = {
99101
dryRun: commandOptions.dryRun,
100102
blueprint: commandOptions.blueprint || this._defaultBlueprint(),
@@ -146,4 +148,5 @@ module.exports = Command.extend({
146148
}
147149
});
148150

149-
module.exports.overrideCore = true;
151+
InitCommand.overrideCore = true;
152+
export default InitCommand;

addon/ng2/commands/new.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const SilentError = require('silent-error');
55
const validProjectName = require('ember-cli/lib/utilities/valid-project-name');
66

77
const normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option');
8-
const InitCommand = require('./init');
8+
import InitCommand from './init';
99

1010
const NewCommand = Command.extend({
1111
name: 'new',

addon/ng2/index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ module.exports = {
1212

1313
includedCommands: function () {
1414
return {
15-
'build': require('./commands/build'),
16-
'serve': require('./commands/serve'),
17-
'new': require('./commands/new'),
18-
'generate': require('./commands/generate'),
19-
'init': require('./commands/init'),
20-
'test': require('./commands/test'),
21-
'e2e': require('./commands/e2e'),
22-
'lint': require('./commands/lint'),
23-
'version': require('./commands/version'),
24-
'completion': require('./commands/completion'),
25-
'doc': require('./commands/doc'),
26-
'github-pages-deploy': require('./commands/github-pages-deploy'),
15+
'build': require('./commands/build').default,
16+
'serve': require('./commands/serve').default,
17+
'new': require('./commands/new').default,
18+
'generate': require('./commands/generate').default,
19+
'init': require('./commands/init').default,
20+
'test': require('./commands/test').default,
21+
'e2e': require('./commands/e2e').default,
22+
'lint': require('./commands/lint').default,
23+
'version': require('./commands/version').default,
24+
'completion': require('./commands/completion').default,
25+
'doc': require('./commands/doc').default,
26+
'github-pages-deploy': require('./commands/github-pages-deploy').default,
2727

2828
// Easter eggs.
29-
'make-this-awesome': require('./commands/easter-egg'),
29+
'make-this-awesome': require('./commands/easter-egg').default,
3030

3131
// Configuration.
32-
'set': require('./commands/set'),
33-
'get': require('./commands/get')
32+
'set': require('./commands/set').default,
33+
'get': require('./commands/get').default,
3434
};
3535
}
3636
};

packages/ast-tools/src/ast-utils.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,31 +122,25 @@ export function getDecoratorMetadata(source: ts.SourceFile, identifier: string,
122122
.filter(expr => {
123123
if (expr.expression.kind == ts.SyntaxKind.Identifier) {
124124
const id = <ts.Identifier>expr.expression;
125-
console.log(1, id.getFullText(source));
126125
const metaData = symbols.resolve(id.getFullText(source));
127-
console.log(metaData);
128126
if (isMetadataImportedSymbolReferenceExpression(metaData)) {
129127
return metaData.name == identifier && metaData.module == module;
130128
}
131129
} else if (expr.expression.kind == ts.SyntaxKind.PropertyAccessExpression) {
132-
console.log(2);
133130
// This covers foo.NgModule when importing * as foo.
134131
const paExpr = <ts.PropertyAccessExpression>expr.expression;
135132
// If the left expression is not an identifier, just give up at that point.
136133
if (paExpr.expression.kind !== ts.SyntaxKind.Identifier) {
137-
console.log(3);
138134
return false;
139135
}
140136

141137
const id = paExpr.name;
142138
const moduleId = <ts.Identifier>paExpr.expression;
143139
const moduleMetaData = symbols.resolve(moduleId.getFullText(source));
144140
if (isMetadataModuleReferenceExpression(moduleMetaData)) {
145-
console.log(4);
146141
return moduleMetaData.module == module && id.getFullText(source) == identifier;
147142
}
148143
}
149-
console.log(5);
150144
return false;
151145
})
152146
.filter(expr => expr.arguments[0]
@@ -210,6 +204,7 @@ function _addSymbolToNgModuleMetadata(ngModulePath: string, metadataField: strin
210204
})
211205
.then((node: ts.Node) => {
212206
if (!node) {
207+
/* eslint-disable no-console */
213208
console.log('No app module found. Please add your new class to your component.');
214209
return new NoopChange();
215210
}

0 commit comments

Comments
 (0)