Skip to content

Commit f29c098

Browse files
committed
chore: cleanup of new files
1 parent 86c425c commit f29c098

19 files changed

+50
-217
lines changed

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

+1-1
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

+1-1
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

+2-4
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

-3
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

+3-3
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

+7-9
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

+4-6
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

-1
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

+5-6
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

+4-5
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,

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

+1-2
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

+1-1
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

+3-4
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

-30
This file was deleted.

addon/ng2/tasks/build.ts

-55
This file was deleted.

addon/ng2/tasks/serve-webpack.ts

+11-17
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;

addon/ng2/tasks/serve.ts

-64
This file was deleted.

addon/ng2/tasks/test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const Promise = require('ember-cli/lib/ext/promise');
2-
const Task = require('ember-cli/lib/models/task');
3-
const path = require('path');
4-
const webpackTestConfig = require('../models/webpack-build-test').getWebpackTestConfig;
1+
import * as Promise from "ember-cli/lib/ext/promise";
2+
import * as Task from "ember-cli/lib/models/task";
3+
import * as path from "path";
4+
import { getWebpackTestConfig } from "../models/webpack-build-test";
55

66
// require dependencies within the target project
77
function requireDependency(root, moduleName) {
@@ -34,7 +34,7 @@ module.exports = Task.extend({
3434
// Single test entry file. Will run the test.ts bundle and track it.
3535
options.files = [{ pattern: testFile, watched: false }];
3636
options.preprocessors = { [testFile]: ['webpack','sourcemap'] };
37-
options.webpack = webpackTestConfig(projectRoot, this.project.ngConfig.defaults.sourceDir);
37+
options.webpack = getWebpackTestConfig(projectRoot, this.project.ngConfig.defaults.sourceDir);
3838
options.webpackMiddleware = {
3939
noInfo: true, // Hide webpack output because its noisy.
4040
stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors.

0 commit comments

Comments
 (0)