Skip to content

Commit ce9e6d9

Browse files
committed
chore(package): added a setup gulp task
1 parent ee754e3 commit ce9e6d9

File tree

3 files changed

+31
-41
lines changed

3 files changed

+31
-41
lines changed

README.md

+13-31
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ View all the directives and components in action at [https://angular-material-ex
6767
<a name="peerDependencies"/>
6868

6969
## Requirements (peer dependencies):
70-
- [angular animations v7.0.2](https://www.npmjs.com/package/@angular/animations)
71-
- [angular http v7.0.2](https://www.npmjs.com/package/@angular/http)
72-
- [angular cdk v7.0.2](https://www.npmjs.com/package/@angular/cdk)
73-
- [angular material v7.0.2](https://www.npmjs.com/package/@angular/material)
70+
- [angular animations v7.x](https://www.npmjs.com/package/@angular/animations)
71+
- [angular http v7.x](https://www.npmjs.com/package/@angular/http)
72+
- [angular cdk v7.x](https://www.npmjs.com/package/@angular/cdk)
73+
- [angular material v7.x](https://www.npmjs.com/package/@angular/material)
7474

7575
- [angular material theme](https://material.angular.io/guide/getting-started#step-4-include-a-theme)
7676

@@ -208,30 +208,22 @@ Please checkout the full documentation [here](https://angular-material-extension
208208
$ git clone https://github.com/angular-material-extensions/link-preview.git
209209
```
210210

211-
- link the **@angular-material-extensions/link-preview** package
211+
- setup the **@angular-material-extensions/link-preview** package
212212

213213
```bash
214-
$ gulp link
214+
$ gulp setup
215215
```
216216

217217
- navigate to the demo app directory
218218
```bash
219219
$ cd demo
220220
```
221221

222-
- install the dependencies
222+
- install the dependencies and run the app
223223
```bash
224-
$ npm i
224+
$ npm i && npm start
225225
```
226226

227-
- run/start/serve the app
228-
```bash
229-
$ npm run start
230-
```
231-
or
232-
```bash
233-
$ ng serve --open
234-
```
235227
- the app is now hosted by `http://localhost:4200/`
236228

237229

@@ -241,22 +233,12 @@ $ ng serve --open
241233

242234
1. clone this [repo](https://github.com/angular-material-extensions/link-preview.git)
243235
2. Install the dependencies by running `npm i`
244-
3. build the library `npm run build` or `gulp build`
245-
To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
246-
247-
```bash
248-
$ npm run build
249-
```
250-
251-
4. Link the library
252-
- on windows `gulp link` or locally `npx gulp link`
253-
- on mac/linux `sudo gulp link` or locally `sudo npx gulp link`
254-
255-
5. Navigate to the demo app's directory
236+
3. setup the library `gulp setup`
237+
4. Navigate to the demo app's directory
256238
- `cd demo`
257-
_ `npm i`
258-
_ `npm start`
259-
239+
_ `npm i && npm start`
240+
241+
---
260242

261243

262244
<a name="other-angular-libraries"/>

gulpfile.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ gulp.task('serve:doc', ['clean:doc'], (cb) => {
501501
const execDemoCmd = (args, opts) => {
502502
if (fs.existsSync(`${config.demoDir}/node_modules`)) {
503503
return execCmd('ng', args, opts, `/${config.demoDir}`);
504-
}
505-
else {
504+
} else {
506505
fancyLog(acolors.yellow(`No 'node_modules' found in '${config.demoDir}'. Installing dependencies for you...`));
507506
return helpers.installDependencies({cwd: `${config.demoDir}`})
508507
.then(exitCode => exitCode === 0 ? execCmd('ng', args, opts, `/${config.demoDir}`) : Promise.reject())
@@ -671,8 +670,7 @@ gulp.task('release', (cb) => {
671670
if (!readyToRelease()) {
672671
fancyLog(acolors.red('# Pre-Release Checks have failed. Please fix them and try again. Aborting...'));
673672
cb();
674-
}
675-
else {
673+
} else {
676674
fancyLog(acolors.green('# Pre-Release Checks have succeeded. Continuing...'));
677675
runSequence(
678676
'bump-version',
@@ -699,6 +697,16 @@ gulp.task('release', (cb) => {
699697
// Utility Tasks
700698
/////////////////////////////////////////////////////////////////////////////
701699

700+
// setup the project by installing first the dependencies,
701+
// building the library and finally linking it
702+
gulp.task('setup', (cb) => {
703+
return runSequence('install', 'build', 'link', cb);
704+
});
705+
706+
gulp.task('install', () => {
707+
return execExternalCmd('npm', 'i');
708+
});
709+
702710
// Link 'dist' folder (create a local 'ng-scrollreveal' package that symlinks to it)
703711
// This way, we can have the demo project declare a dependency on 'ng-scrollreveal' (as it should)
704712
// and, thanks to 'npm link ng-scrollreveal' on demo project, be sure to always use the latest built

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)