Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 3742238

Browse files
committed
chore: clean up BUILD guide
Relates to #11844
1 parent ab9129a commit 3742238

File tree

7 files changed

+73
-106
lines changed

7 files changed

+73
-106
lines changed

docs/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
Documentation
1+
AngularJS Material Docs
22
-------------
33

4-
The AngularJS Material **Live Docs** are generated from the source code. In fact, the AngularJS Material documentation itself uses the AngularJS Material layout, components and themes.
5-
6-
> Our build process uses **[dgeni](https://github.com/angular/dgeni)**, the wonderful documentation
7-
generator built by [Pete Bacon Darwin](https://github.com/petebacondarwin).
8-
9-
To view the Live Docs (locally):
10-
11-
1. Install the dependencies using `npm install`
12-
1. Build the docs and serve with 'live reload' using `npm run docs:watch`
13-
1. Open Browser for [http://localhost:8080](http://localhost:8080)
4+
- [How to build the documentation](guides/BUILD.md#livedocs)

docs/guides/BUILD.md

Lines changed: 48 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,121 +4,98 @@
44
* [Build Commands](#commands)
55
* [Building the Documentation](#livedocs)
66
* [Building the Library](#builds)
7-
* [Using the Library with Bower](#bower)<br/><br/>
8-
* [Introducing Components](#comp)
7+
<br/><br/>
8+
* [Component Modules](#comp)
99
* [Building Individual Components](#comp_builds)
10-
* [Component Debugging](#comp_debug)<br/><br/>
11-
* [Theming](#themes)
12-
10+
* [Component Debugging](#comp_debug)
1311

1412
## <a name="intro"></a> Introduction
1513

16-
AngularJS Material has a sophisticated collection of build process and commands available... to deploy
17-
distribution files, test components, and more.
14+
AngularJS Material has a collection of build processes and commands available to deploy distribution
15+
files, test components, and more.
1816

19-
These commands are defined within two (2) **gulp** files:
17+
These commands are defined within the `package.json` and two (2) **gulp** files:
2018

19+
* [package.json](../../package.json)
2120
* [Project Gulp](../../gulpfile.js)
2221
* [Documentation Gulp](../gulpfile.js)
2322

23+
From the project root, install the NPM packages by running
24+
- `npm install` or `npm i`
2425

2526
### <a name="commands"></a> Build Commands
2627

27-
For each milestone release, always run:
28-
29-
- `npm update` to update your local gulp dependencies
30-
- `bower update` to update AngularJS dependencies
31-
3228
The following command line tasks are available:
3329

34-
- `gulp build` (alias `gulp`) to build, add `--release` flag to uglify & strip `console.log`
35-
- `gulp docs` to build the Live Docs into dist/docs
36-
- `gulp watch` to build & rebuild on changes
30+
- `npm run build` to build
31+
- `npm run build:prod` to uglify, strip `console.log`, and autoprefix CSS
32+
- `npm run docs:build` to build the docs into `dist/docs`
33+
- `npm run docs:watch` to build the library and docs, and rebuild on file changes
3734

3835
<a separator></a>
3936

40-
- `gulp karma` to test once
41-
- `gulp karma-watch` to test & watch for changes
37+
- `npm run lint` to run ESLint
38+
- `npm run test:fast` to run smoke tests
39+
- `npm run test:full` to run all of the unit tests
4240

4341
### <a name="livedocs"></a> Building the Documentation
4442

45-
The AngularJS Material **Live Docs** are generated from the source code and demos and actually use the
46-
AngularJS Material components and themes.
43+
The AngularJS Material Docs are generated from the source code. The documentation itself uses the
44+
AngularJS Material layout, components, and themes.
4745

4846
> Our build process uses **[dgeni](https://github.com/angular/dgeni)**, the wonderful documentation
49-
generator built by [Pete Bacon Darwin](https://github.com/petebacondarwin).
47+
generator built by [Pete Bacon Darwin](https://github.com/petebacondarwin).
48+
49+
To view the Docs (locally):
5050

51-
See the [Building the Live Documentation](../README.md#docs) document for details.
51+
1. Build the docs and serve with 'live reload' using `npm run docs:watch`
52+
1. Open Browser to [http://localhost:8080](http://localhost:8080)
5253

5354
### <a name="builds"></a> Building the Library
5455

5556
Developers can build the entire AngularJS Material library or individual component modules. The
5657
library comprises:
5758

58-
* `angular-material.js` - components
59-
* `angular-material.css` - styles and default theme stylesheet
60-
* `/themes/**.css` - default theme override stylesheets
59+
* `angular-material.js` - components, services, and theming
60+
* `angular-material.css|scss` - styles
61+
* `layouts/**.css|scss` - default layout stylesheets
6162

6263
To build from the source, simply use:
63-
6464
```bash
65-
# Build and deploy the library to
65+
# Build the library to
6666
#
6767
# - `dist/angular-material.js`
68-
# - `dist/angular-material.css`
69-
# - `dist/themes`
68+
# - `dist/angular-material.css|scss`
69+
# - `dist/layouts`
7070

71-
gulp build
71+
npm run build
7272

7373
# Build minified assets
7474
#
7575
# - `dist/angular-material.min.js`
76-
# - `dist/angular-material.min.css`
77-
# - `dist/themes`
76+
# - `dist/angular-material.min.css|scss`
77+
# - `dist/layouts`
7878

79-
gulp build --release
79+
npm run build:prod
8080
```
8181

82-
### <a name="bower"></a> Using the Library with Bower
83-
84-
For developers not interested in building the AngularJS Material library, use **bower** to install and
85-
use the AngularJS Material distribution files.
86-
87-
Change to your project's root directory.
88-
89-
```bash
90-
# To get the latest stable version, use Bower from the command line.
91-
bower install angular-material
92-
93-
# To get the most recent, latest committed-to-master version use:
94-
bower install angular-material#master
95-
```
96-
97-
Visit [Bower-Material](https://github.com/angular/bower-material/blob/master/README.md) for more
98-
details on how to install and use the AngularJS Material distribution files within your own local
99-
project.
100-
101-
<br/>
102-
##<a name="comp"></a> Introducing Components
82+
##<a name="comp"></a> Component Modules
10383

104-
AngularJS Material supports the construction and deployment of individual component builds. Within
105-
AngularJS Material, each component is contained within its own module and specifies its own
106-
dependencies.
84+
AngularJS Material supports the construction and deployment of individual component builds.
85+
Each component is contained within its own module and specifies its own dependencies.
10786

10887
> At a minimum, all components have a dependency upon the `core` module.
10988
110-
For example, the **slider** component is registered as a **material.components.slider** module.
89+
For example, the **slider** component is registered as the **material.components.slider** module.
11190

11291
### <a name="comp_builds"></a> Building Individual Components
11392

114-
To build and deploy assets for each component individually, run the command
115-
93+
To build and deploy assets for each component individually, run:
11694
```bash
117-
gulp build-all-modules
95+
npm run build:modules
11896
```
11997

12098
All component modules are compiled and distributed to:
121-
12299
```text
123100
-- dist
124101
-- modules
@@ -128,8 +105,6 @@ All component modules are compiled and distributed to:
128105
```
129106

130107
Let's consider the Slider component with its module definition:
131-
132-
133108
```js
134109
/**
135110
* @ngdoc module
@@ -144,8 +119,6 @@ First build all the component modules.
144119

145120
To use - for example - the Slider component within your own application, simply load the stylesheets
146121
and JS from both the **slider** and the **core** modules:
147-
148-
149122
```text
150123
-- dist
151124
-- modules
@@ -161,7 +134,7 @@ and JS from both the **slider** and the **core** modules:
161134

162135
### <a name="comp_debug"></a> Component Debugging
163136

164-
Debugging a demo in the Live Docs is complicated due the multiple demos loading and initializing. A
137+
Debugging a demo in the Docs is complicated due the multiple demos loading and initializing. A
165138
more practical approach is to open and debug a specific, standalone Component demo.
166139

167140
To open a Component demo outside of the Docs application, just build, deploy and debug that
@@ -170,19 +143,14 @@ component's demo(s).
170143
For example, to debug the **textfield** component:
171144

172145
```bash
173-
# Watch, build and deploy the 'textfield' demos
146+
# Watch and build the 'textfield' demos
174147
#
175148
# NOTE: watch-demo will rebuild your component source
176-
# and demos upon each `save`
149+
# and demos upon each `save`.
150+
# Note: server will livereload demos on port 8080 after updates are
151+
# built (by watch-demo) to the dist/demos/ dir.
177152
#
178-
gulp watch-demo -c textfield
179-
180-
# launch the liveReload server on port 8080
181-
#
182-
# Note: livereload will reload demos after updates are
183-
# deployed (by watch-demo) to the dist/demos/
184-
#
185-
gulp server
153+
gulp watch-demo -c textfield server
186154
```
187155

188156
The demo build process will deploy a *self-contained* AngularJS application that runs the specified
@@ -192,13 +160,8 @@ component's demo(s). E.g.:
192160
* `dist/demos/tabs/**/*.*`
193161
* etc.
194162

195-
After running `gulp server` to start a *LiveReload* server in your project root:
163+
After running the appropriate `watch-demo` and `server` tasks:
196164

197-
* Open browser to url `http://localhost:8080/`
198-
* Navigate to `dist/demos/<component>/<demo>/index.html`
165+
* Open browser to [http://localhost:8080/dist/demos](http://localhost:8080/dist/demos)
166+
* Navigate to `<component>/<demo>`
199167
* Open Dev Tools and debug...
200-
201-
202-
## <a name="themes"></a> Theming
203-
204-
[Go to the Theming Guide](https://material.angularjs.org/latest/Theming/01_introduction)

gulp/tasks/server.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const connect = require('gulp-connect');
2+
const LR_PORT = require('../const').LR_PORT;
3+
4+
exports.task = function () {
5+
connect.server({
6+
root: './',
7+
livereload: true,
8+
port: LR_PORT
9+
});
10+
};

gulp/tasks/watch-demo.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ const util = require('../util');
44

55
exports.dependencies = ['build-demo'];
66

7-
exports.task = function() {
7+
exports.task = function () {
88
const module = util.readModuleArg();
99
const name = module.split('.').pop();
10-
const dir = "/dist/demos/"+name.trim();
10+
const dir = "/dist/demos/" + name.trim();
1111
gutil.log('\n',
12-
'-- Rebuilding', dir, 'when source files change...\n',
13-
'--', gutil.colors.green('Hint:'), 'Run',
14-
gutil.colors.cyan('`gulp server`'),
15-
'to start a livereload server in root, then navigate to\n',
16-
'--', gutil.colors.green('"dist/demos/' + name + '/"'), 'in your browser to develop.'
12+
'-- Rebuilding', dir, 'when source files change...\n',
13+
'-- Navigate to', gutil.colors.green('"dist/demos/' + name + '/"'),
14+
'in your browser to develop.'
1715
);
1816

1917
return gulp.watch('src/**/!(*.spec)', ['build-demo']);

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,16 @@
9797
},
9898
"scripts": {
9999
"build": "gulp build",
100+
"build:prod": "gulp build --release",
101+
"build:modules": "gulp build-all-modules --release --mode=default",
102+
"build:closure": "gulp build-all-modules --release --mode=closure",
103+
"build:docs:prod": "gulp docs --release",
100104
"contributors:release": "githubcontrib --owner angular --repo material --cols 6 --format md --showlogin true --sha master --sortOrder desc --fromDate ",
101105
"ddescribe-iit": "gulp ddescribe-iit",
102106
"docs:build": "gulp docs",
103107
"docs:watch": "gulp watch site --dev",
104108
"gulp": "gulp",
109+
"test:ci": "npm run test:full --config=config/karma-circleci.conf.js --reporters='dots,junit'",
105110
"test:fast": "gulp karma-fast",
106111
"test:full": "gulp karma",
107112
"lint": "eslint .",
@@ -120,4 +125,4 @@
120125
"node": ">=8.17 <12",
121126
"npm": ">=5"
122127
}
123-
}
128+
}

scripts/circleci/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ fi
1414
# Run our check to make sure all tests will actually run
1515
npm run ddescribe-iit
1616

17-
npm run test:full -- --config=config/karma-circleci.conf.js --reporters='dots,junit'
17+
npm run test:ci

scripts/snapshot-docs-site.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function run {
99

1010
echo "-- Building docs site release..."
1111
rm -rf dist/
12-
gulp docs --release
12+
npm run build:docs:prod
1313

1414
echo "-- Cloning code.material.angularjs.org..."
1515
rm -rf code.material.angularjs.org

0 commit comments

Comments
 (0)