Skip to content

Commit 40ca943

Browse files
authored
Merge branch 'master' into git-author-vars
2 parents 300ab87 + c6268c7 commit 40ca943

File tree

37 files changed

+359
-88
lines changed

37 files changed

+359
-88
lines changed

docs/documentation/generate/component.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@
1919
`--change-detection` (`-cd`) set the change detection strategy
2020

2121
`--skip-import` allows for skipping the module import
22+
23+
`--module` (`-m`) allows specification of the declaring module
24+
25+
`--export` specifies if declaring module exports the component

docs/documentation/generate/directive.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@
1111
`--spec` specifies if a spec file is generated
1212

1313
`--skip-import` allows for skipping the module import
14+
15+
`--module` (`-m`) allows specification of the declaring module
16+
17+
`--export` specifies if declaring module exports the directive

docs/documentation/generate/pipe.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99
`--spec` specifies if a spec file is generated
1010

1111
`--skip-import` allows for skipping the module import
12+
13+
`--module` (`-m`) allows specification of the declaring module
14+
15+
`--export` specifies if declaring module exports the pipe

docs/documentation/generate/service.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
`--flat` flag to indicate if a dir is created
88

99
`--spec` specifies if a spec file is generated
10+
11+
`--module` (`-m`) allows specification of the declaring module
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Include [Bootstrap](http://getbootstrap.com/)
2+
3+
[Bootstrap](http://getbootstrap.com/) is a popular CSS framework which can be used within an Angular project.
4+
This guide will walk you through adding bootstrap to your Angular CLI project and configuring it to use bootstrap.
5+
6+
Create a new project and navigate into the project
7+
```
8+
ng new my-app
9+
cd my-app
10+
```
11+
12+
With the new project created and ready you will next need to install bootstrap to your project as a dependency.
13+
Using the `--save` option the dependency will be saved in package.json
14+
```
15+
// version 3.x
16+
npm install bootstrap --save
17+
18+
// version 4.x
19+
npm install bootstrap@next --save
20+
```
21+
22+
Now that the project is set up it must be configured to include the bootstrap CSS.
23+
24+
Open the file `angular-cli.json` from the root of your project.
25+
Under the property `apps` the first item in that array is the default application.
26+
There is a property `styles` which allows external global styles to be applied to your application.
27+
Specify the path to `bootstrap.min.css`
28+
```
29+
// version 3.x and 4.x
30+
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
31+
```
32+
33+
With the application configured, run `ng serve` to run your application in develop mode.
34+
In your browser navigate to the application `localhost:4200`.
35+
Make a change to your application to ensure that the CSS library has been included.
36+
A quick test is to add the following markup to `app.component.html`
37+
```
38+
<button class="btn btn-primary">Test Button</button>
39+
```
40+
After saving this file, return to the browser to see the bootstrap styled button.
41+
42+
43+
**Note:** When you make changes to `angular-cli.json` you will need to re-start `ng serve` to pick up configuration changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Using corporate proxy
2+
3+
If you work behind a corporate proxy, the regular [backend proxy](http://github.com/angular/angular-cli#proxy-to-backend) configuration will not work if you try to proxy calls to any URL outside your local network.
4+
5+
In this case, you can configure the backend proxy to redirect calls through your corporate proxy using an agent:
6+
7+
```bash
8+
npm install --save-dev https-proxy-agent
9+
```
10+
11+
Then instead of using a `proxy.conf.json` file, we create a file called `proxy.conf.js` with the content
12+
13+
```js
14+
var HttpsProxyAgent = require('https-proxy-agent');
15+
var proxyConfig = [{
16+
context: '/api',
17+
target: 'http://your-remote-server.com:3000',
18+
secure: false
19+
}];
20+
21+
function setupForCorporateProxy(proxyConfig) {
22+
var proxyServer = process.env.http_proxy || process.env.HTTP_PROXY;
23+
if (proxyServer) {
24+
var agent = new HttpsProxyAgent(proxyServer);
25+
console.log('Using corporate proxy server: ' + proxyServer);
26+
proxyConfig.forEach(function(entry) {
27+
entry.agent = agent;
28+
});
29+
}
30+
return proxyConfig;
31+
}
32+
33+
module.exports = setupForCorporateProxy(proxyConfig);
34+
```
35+
36+
and edit the `package.json` file's start script accordingly
37+
38+
```json
39+
"start": "ng serve --proxy-config proxy.conf.js",
40+
```
41+
42+
This way if you have a `http_proxy` or `HTTP_PROXY` environment variable defined, an agent will automatically be added to pass calls through your corporate proxy when running `npm start`.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"postcss-loader": "^0.9.1",
9191
"quick-temp": "0.1.5",
9292
"raw-loader": "^0.5.1",
93-
"readline2": "0.1.1",
9493
"reflect-metadata": "^0.1.8",
9594
"remap-istanbul": "^0.6.4",
9695
"resolve": "^1.1.7",
@@ -114,7 +113,7 @@
114113
"typescript": "~2.0.3",
115114
"url-loader": "^0.5.7",
116115
"walk-sync": "^0.2.6",
117-
"webpack": "2.2.0-rc.4",
116+
"webpack": "2.2.0",
118117
"webpack-dev-server": "2.2.0-rc.0",
119118
"webpack-merge": "^0.14.0",
120119
"webpack-sources": "^0.1.3",

packages/@ngtools/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
"@angular/tsc-wrapped": "^0.5.0",
3838
"typescript": "^2.0.2",
3939
"reflect-metadata": "^0.1.8",
40-
"webpack": "2.2.0-rc.4"
40+
"webpack": "2.2.0"
4141
}
4242
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as ts from 'typescript';
2+
import {removeModuleIdOnlyForTesting} from './loader';
3+
import {WebpackCompilerHost} from './compiler_host';
4+
import {TypeScriptFileRefactor} from './refactor';
5+
6+
describe('@ngtools/webpack', () => {
7+
describe('loader', () => {
8+
describe('removeModuleId', () => {
9+
it('should work', () => {
10+
const host = new WebpackCompilerHost({}, '');
11+
host.writeFile('/file.ts', `
12+
export const obj = { moduleId: 123 };
13+
export const obj2 = { moduleId: 123, otherValue: 1 };
14+
export const obj2 = { otherValue: 1, moduleId: 123 };
15+
`, false);
16+
17+
const program = ts.createProgram(['/file.ts'], {}, host);
18+
19+
const refactor = new TypeScriptFileRefactor('/file.ts', host, program);
20+
removeModuleIdOnlyForTesting(refactor);
21+
22+
expect(refactor.sourceText).toMatch(/obj = \{\s+};/);
23+
expect(refactor.sourceText).toMatch(/obj2 = \{\s*otherValue: 1\s*};/);
24+
});
25+
});
26+
});
27+
});

packages/@ngtools/webpack/src/loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ function _removeModuleId(refactor: TypeScriptFileRefactor) {
9797
refactor.findAstNodes(sourceFile, ts.SyntaxKind.ObjectLiteralExpression, true)
9898
// Get all their property assignments.
9999
.filter((node: ts.ObjectLiteralExpression) =>
100-
node.properties.some(prop => prop.name.getText() == 'moduleId'))
100+
node.properties.some(prop => _getContentOfKeyLiteral(sourceFile, prop.name) == 'moduleId'))
101101
.forEach((node: ts.ObjectLiteralExpression) => {
102102
const moduleIdProp = node.properties.filter((prop: ts.ObjectLiteralElement, idx: number) => {
103-
return prop.name.getText() == 'moduleId';
103+
return _getContentOfKeyLiteral(sourceFile, prop.name) == 'moduleId';
104104
})[0];
105105
// get the trailing comma
106106
const moduleIdCommaProp = moduleIdProp.parent.getChildAt(1).getChildren()[1];

0 commit comments

Comments
 (0)