Skip to content

Commit

Permalink
feat(core): update to Angular v6.x.x and higher
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `forRoot()` on `NgwWowModule` has been removed as no longer necessary

Before:

```ts
import {NgwWowModule} from 'ngx-wow';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgwWowModule.forRoot()],
  bootstrap: [AppComponent]
})
export class AppModule {
}
```

After:

```ts
import {NgwWowModule} from 'ngx-wow';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgwWowModule],
  bootstrap: [AppComponent]
})
export class AppModule {
}
  • Loading branch information
tinesoft committed Oct 9, 2018
1 parent ec56d5e commit ccdab37
Show file tree
Hide file tree
Showing 49 changed files with 30,987 additions and 13,616 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ script: gulp test:ci
after_success: gulp coveralls

cache:
yarn: true
directories:
- node_modules

23 changes: 18 additions & 5 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generator-ngx-library": {
"version": "5.4.0",
"version": "6.2.1",
"authorName": "Tine Kondo",
"authorEmail": "kondotine@gmail.com",
"githubUsername": "tinesoft",
Expand All @@ -16,7 +16,7 @@
"reveal",
"animation"
],
"ngVersion": "2.0.0",
"ngVersion": "6.0.0",
"ngModules": [
"core",
"common"
Expand All @@ -34,12 +34,25 @@
"README.md",
"CHANGELOG.md",
"config/karma.conf",
"demo/src/app/**",
"demo/src/styles.scss",
"demo/src/app/home/**",
"demo/src/app/getting-started/**",
"demo/src/assets/logo.svg",
"demo/src/index.html",
"demo/src/favicon.ico",
"src/**/*.*"
"src/**/*.ts",
".git/HEAD"
],
"deleteExclusions": [
"README.md",
"CHANGELOG.md",
"config/karma.conf",
"demo/src/app/home/**",
"demo/src/app/getting-started/**",
"demo/src/assets/logo.svg",
"demo/src/index.html",
"demo/src/favicon.ico",
"src/**/*.ts",
".git/HEAD"
]
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Tine Kondo
Copyright (c) 2018 Tine Kondo

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@
View all the directives in action at https://tinesoft.github.io/ngx-wow

## Dependencies
* [Angular](https://angular.io) (*requires* Angular 2 or higher, tested with 2.0.0)

* [Angular](https://angular.io) (*requires* Angular 6+, [v1.0.2](https://github.com/tinesoft/ngx-wow/tree/v1.0.2) is the latest version for Angular < 6 )
* [WOW JS](http://mynameismatthieu.com/WOW/) (*requires* WOW JS 1.1 or higher, tested with 1.1.3)


## Installation

Install above dependencies via *npm*. In particular for `WOW JS`, run:
```shell
npm install --save wowjs
```

---
##### Angular-CLI

>**Note**: If you are using `angular-cli` to build your app, make sure that `wowjs` is properly listed as a [global library](https://github.com/angular/angular-cli#global-library-installation), by editing your `angular-cli.json` as such:
```
"scripts": [
Expand All @@ -51,14 +54,18 @@ Also make sure that [Animate.css](which is already installed and used internally
```

##### SystemJS

>**Note**:If you are using `SystemJS`, you should adjust your configuration to point to the UMD bundle.
In your systemjs config file, `map` needs to tell the System loader where to look for `ngx-wow`:

```js
map: {
'ngx-wow': 'node_modules/ngx-wow/bundles/ngx-wow.min.js',
}
```

In your systemjs config file, `meta` needs to tell the System loader how to load `wowjs`:

```js
meta: {
'./node_modules/wowjs/dist/wow.min.js': {
Expand Down Expand Up @@ -89,37 +96,25 @@ npm install --save ngx-wow
```

Once installed you need to import the main module:
```js
```ts
import { NgwWowModule } from 'ngx-wow';
```
The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice ` NgwWowModule.forRoot()`):
```js

```ts
import { NgwWowModule } from 'ngx-wow';

@NgModule({
declarations: [AppComponent, ...],
imports: [NgwWowModule.forRoot(), ...],
imports: [NgwWowModule, ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
```

Other modules in your application can simply import ` NgwWowModule `:

```js
import { NgwWowModule } from 'ngx-wow';

@NgModule({
declarations: [OtherComponent, ...],
imports: [NgwWowModule, ...],
})
export class OtherModule {
}
```

## Usage

Once the module is imported, you can use the `NgwWowService` in your component (i.e. `AppComponent`) to trigger reveal animation by calling `init()` or to be notified by WOW when an element is revealed.

Here is how it works:
Expand Down Expand Up @@ -176,5 +171,5 @@ See [WOW.js Documentation](https://github.com/matthieua/WOW#advanced-usage) to s

## License

Copyright (c) 2017 Tine Kondo. Licensed under the MIT License (MIT)
Copyright (c) 2018 Tine Kondo. Licensed under the MIT License (MIT)

9 changes: 4 additions & 5 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ module.exports = function (config) {
require('karma-mocha-reporter'),
require('karma-jasmine-html-reporter'),
],

customLaunchers: {
// chrome setup for travis CI
Chrome_travis_ci: {
base: 'Chrome',
// Chrome setup for CI (Travis, Docker, ...)
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
files: [
'./node_modules/wowjs/dist/wow.min.js',
'./node_modules/animate.css/animate.min.css',
{ pattern: './config/karma-test-shim.js', watched: false }
{pattern: './config/karma-test-shim.js', watched: false}
],

preprocessors: {
Expand Down
8 changes: 4 additions & 4 deletions config/webpack.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const helpers = require('./helpers');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
const webpack = require('webpack');
const { CheckerPlugin } = require('awesome-typescript-loader');

const getConfig = (hasCoverage, isTddMode) => {
Expand All @@ -27,6 +26,7 @@ const getConfig = (hasCoverage, isTddMode) => {
}

return {
mode: 'none',
devtool: 'inline-source-map',
resolve: {
extensions: ['.ts', '.js'],
Expand Down Expand Up @@ -75,14 +75,14 @@ const getConfig = (hasCoverage, isTddMode) => {

plugins: [

new LoaderOptionsPlugin({
new webpack.LoaderOptionsPlugin({
debug: false,
options: {
// legacy options go here
}
}),
// Fixes linker warnings (see https://github.com/angular/angular/issues/11580)
new ContextReplacementPlugin(
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?angular(\\|\/)core(.+)?/,
helpers.root('src'), // location of your src
Expand Down
91 changes: 0 additions & 91 deletions demo/.angular-cli.json

This file was deleted.

4 changes: 0 additions & 4 deletions demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ yarn-error.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
4 changes: 2 additions & 2 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ngx-wow-demo

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.0.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.

## Development server

Expand All @@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Expand Down
Loading

0 comments on commit ccdab37

Please sign in to comment.