Skip to content

Commit 1a68ce6

Browse files
authored
chore: cleanup of new files (#1388)
1 parent e6bdf50 commit 1a68ce6

19 files changed

+54
-221
lines changed

addon/ng2/blueprints/ng2/files/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app w
77

88
## Code scaffolding
99

10-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/route/class`.
10+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`.
1111

1212
## Build
1313

addon/ng2/blueprints/ng2/files/__path__/app/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// The file for the current environment will overwrite this one during build
2-
// Different environments can be found in config/environment.{dev|prod}.ts
2+
// Different environments can be found in ./environment.{dev|prod}.ts
33
// The build system defaults to the dev environment
44

55
export const environment = {

addon/ng2/blueprints/ng2/files/__path__/tsconfig.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
"declaration": false,
55
"emitDecoratorMetadata": true,
66
"experimentalDecorators": true,
7+
"mapRoot": "./",
78
"module": "es6",
89
"moduleResolution": "node",
9-
"outDir": "./dist/",
10-
"rootDir": ".",
1110
"sourceMap": true,
12-
"target": "es5",
13-
"mapRoot": "/"
11+
"target": "es5"
1412
},
1513
"compileOnSave": false,
1614
"buildOnSave": false,

addon/ng2/blueprints/ng2/files/e2e/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"experimentalDecorators": true,
77
"module": "commonjs",
88
"moduleResolution": "node",
9-
"noEmitOnError": true,
10-
"noImplicitAny": false,
11-
"rootDir": ".",
129
"sourceMap": true,
1310
"target": "es5"
1411
}

addon/ng2/commands/build.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const Command = require('ember-cli/lib/models/command');
2-
const WebpackBuild = require('../tasks/build-webpack');
3-
const WebpackBuildWatch = require('../tasks/build-webpack-watch');
1+
import * as Command from 'ember-cli/lib/models/command';
2+
import * as WebpackBuild from '../tasks/build-webpack';
3+
import * as WebpackBuildWatch from '../tasks/build-webpack-watch';
44

55
interface BuildOptions {
66
environment?: string;

addon/ng2/commands/serve.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
const assign = require('lodash/assign');
2-
const Command = require('ember-cli/lib/models/command');
3-
const Promise = require('ember-cli/lib/ext/promise');
4-
const SilentError = require('silent-error');
5-
const PortFinder = require('portfinder');
6-
const EOL = require('os').EOL;
1+
import * as assign from 'lodash/assign';
2+
import * as Command from 'ember-cli/lib/models/command';
3+
import * as Promise from 'ember-cli/lib/ext/promise';
4+
import * as SilentError from 'silent-error';
5+
import * as PortFinder from 'portfinder';
6+
import * as EOL from 'os';
7+
import * as ServeWebpackTask from '../tasks/serve-webpack.ts';
78

89
PortFinder.basePort = 49152;
910

@@ -53,7 +54,6 @@ module.exports = Command.extend({
5354

5455
run: function(commandOptions: ServeTaskOptions) {
5556

56-
5757
commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;
5858

5959
return this._checkExpressPort(commandOptions)
@@ -71,8 +71,6 @@ module.exports = Command.extend({
7171
}
7272
}
7373

74-
const ServeWebpackTask = (require('../tasks/serve-webpack.ts'))
75-
7674
var serve = new ServeWebpackTask({
7775
ui: this.ui,
7876
analytics: this.analytics,

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
'use strict';
2-
3-
const TestCommand = require('ember-cli/lib/commands/test');
4-
const config = require('../models/config');
5-
const TestTask = require('../tasks/test');
1+
import * as TestCommand from 'ember-cli/lib/commands/test';
2+
import * as config from '../models/config';
3+
import * as TestTask from '../tasks/test';
64

75
module.exports = TestCommand.extend({
86
availableOptions: [
@@ -27,7 +25,7 @@ module.exports = TestCommand.extend({
2725
if (!commandOptions.watch) {
2826
// if not watching ensure karma is doing a single run
2927
commandOptions.singleRun = true;
30-
}
28+
}
3129
return testTask.run(commandOptions);
3230
}
3331
});

addon/ng2/models/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const schema = require(schemaPath);
77
export const CLI_CONFIG_FILE_NAME = 'angular-cli.json';
88
export const ARRAY_METHODS = ['push', 'splice', 'sort', 'reverse', 'pop', 'shift'];
99

10-
1110
function _findUp(name: string, from: string) {
1211
let currentDir = from;
1312
while (currentDir && currentDir !== path.parse(currentDir).root) {

addon/ng2/models/webpack-build-common.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
import * as path from 'path';
2+
import * as CopyWebpackPlugin from 'copy-webpack-plugin';
3+
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
14
import * as webpack from 'webpack';
2-
import {LoaderConfig, PathsPlugin} from '../utilities/ts-path-mappings-webpack-plugin';
5+
import { ForkCheckerPlugin } from 'awesome-typescript-loader';
6+
import { LoaderConfig, PathsPlugin } from '../utilities/ts-path-mappings-webpack-plugin';
37
import { CliConfig } from './config';
48

5-
const path = require('path');
6-
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
7-
const CopyWebpackPlugin = require('copy-webpack-plugin');
8-
const HtmlWebpackPlugin = require('html-webpack-plugin');
9-
109
export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
1110
const awesomeTypescriptLoaderConfig: LoaderConfig | any = {
1211
useWebpackText: true,

addon/ng2/models/webpack-build-production.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import * as path from 'path';
2+
import * as webpackMerge from 'webpack-merge'; // used to merge webpack configs
3+
import * as WebpackMd5Hash from 'webpack-md5-hash';
4+
import * as CompressionPlugin from 'compression-webpack-plugin';
15
import * as webpack from 'webpack';
26
import { CliConfig } from './config';
37

4-
const path = require('path');
5-
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
6-
const WebpackMd5Hash = require('webpack-md5-hash');
7-
const CompressionPlugin = require("compression-webpack-plugin");
8-
98
export const getWebpackProdConfigPartial = function(projectRoot: string, sourceDir: string) {
109
return {
1110
debug: false,
@@ -27,8 +26,8 @@ export const getWebpackProdConfigPartial = function(projectRoot: string, sourceD
2726
comments: false //prod
2827
}),
2928
new CompressionPlugin({
30-
asset: "[path].gz[query]",
31-
algorithm: "gzip",
29+
asset: '[path].gz[query]',
30+
algorithm: 'gzip',
3231
test: /\.js$|\.html$/,
3332
threshold: 10240,
3433
minRatio: 0.8

addon/ng2/models/webpack-build-test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as webpack from 'webpack';
2+
import * as path from 'path';
23
import { CliConfig } from './config';
34

4-
const path = require('path');
5-
65
export const getWebpackTestConfig = function(projectRoot: string, sourceDir: string) {
76
return {
87
devtool: 'inline-source-map',

addon/ng2/models/webpack-build-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path');
1+
import * as path from 'path';
22

33
export const ngAppResolve = (resolvePath: string): string => {
44
return path.resolve(process.cwd(), resolvePath);

addon/ng2/models/webpack-config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as path from 'path';
2+
import * as webpackMerge from 'webpack-merge';
13
import { CliConfig } from './config';
24
import { NgCliEnvironmentPlugin } from '../utilities/environment-plugin';
35
import {
@@ -8,9 +10,6 @@ import {
810
getWebpackMobileProdConfigPartial
911
} from './';
1012

11-
const webpackMerge = require('webpack-merge');
12-
const path = require('path');
13-
1413
export class NgCliWebpackConfig {
1514
// TODO: When webpack2 types are finished lets replace all these any types
1615
// so this is more maintainable in the future for devs
@@ -58,7 +57,7 @@ export class NgCliWebpackConfig {
5857

5958
default:
6059
//TODO: Not sure what to put here. We have a default env passed anyways.
61-
this.ngCliProject.ui.writeLine("Envrionment could not be determined while configuring your build system.", 3)
60+
this.ngCliProject.ui.writeLine("Environment could not be determined while configuring your build system.", 3)
6261
break;
6362
}
6463
}

addon/ng2/tasks/build-watch.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

addon/ng2/tasks/build.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

addon/ng2/tasks/serve-webpack.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
import {webpackDevServerOutputOptions} from '../models/';
2-
import {NgCliWebpackConfig} from '../models/webpack-config';
3-
import {ServeTaskOptions} from '../commands/serve';
1+
import * as path from 'path';
2+
import * as chalk from 'chalk';
3+
import * as Task from 'ember-cli/lib/models/task';
4+
import * as webpack from 'webpack';
5+
import * as WebpackDevServer from 'webpack-dev-server';
6+
import * as ProgressPlugin from 'webpack/lib/ProgressPlugin';
7+
import { webpackDevServerOutputOptions } from '../models/';
8+
import { NgCliWebpackConfig } from '../models/webpack-config';
9+
import { ServeTaskOptions } from '../commands/serve';
410
import { CliConfig } from '../models/config';
511

6-
const path = require('path');
7-
const chalk = require('chalk');
8-
9-
10-
const Task = require('ember-cli/lib/models/task');
11-
const webpack = require('webpack');
12-
const WebpackDevServer = require('webpack-dev-server');
13-
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
14-
15-
16-
17-
let lastHash = null;
18-
1912
module.exports = Task.extend({
2013
run: function(commandOptions: ServeTaskOptions) {
21-
14+
15+
let lastHash = null;
2216
let webpackCompiler: any;
2317

2418
var config: NgCliWebpackConfig = new NgCliWebpackConfig(this.project, commandOptions.environment).config;
@@ -44,7 +38,7 @@ module.exports = Task.extend({
4438
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
4539

4640
return new Promise((resolve, reject) => {
47-
server.listen(commandOptions.port, "localhost", function(err, stats) {
41+
server.listen(commandOptions.port, 'localhost', function(err, stats) {
4842
if(err) {
4943
lastHash = null;
5044
console.error(err.stack || err);
@@ -54,7 +48,7 @@ module.exports = Task.extend({
5448

5549
if(stats && stats.hash && stats.hash !== lastHash) {
5650
lastHash = stats.hash;
57-
process.stdout.write(stats.toString(webpackOutputOptions) + "\n" + serveMessage + "\n");
51+
process.stdout.write(stats.toString(webpackOutputOptions) + '\n' + serveMessage + '\n');
5852
}
5953

6054
process.stdout.write(serveMessage);

0 commit comments

Comments
 (0)