Skip to content

Commit

Permalink
📝 Updated docs with current state of affairs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitzero committed Jun 18, 2023
1 parent fbaf9c3 commit 0cc4d6c
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 44 deletions.
62 changes: 21 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
# NgAutoAnimate
# ng-auto-animate

<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>

**This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)**

## Start the app
Mono-repo for the library and demo app.

To start the development server run `nx serve demo`. Open your browser and navigate to http://localhost:4200/. Happy coding!

## Generate code
- Library:
- ⭐️ [Source & README](https://github.com/ajitzero/ng-auto-animate/tree/main/libs/ng-auto-animate) (Visit here first)
- [NPM](https://www.npmjs.com/package/ng-auto-animate).
- Demo app, deployed via Netlify:
- [Source](https://github.com/ajitzero/ng-auto-animate/tree/main/apps/demo)
- [Live Demo](https://ng-auto-animate.netlify.app/)
- Original library docs:
- ⭐️ [Source & README](https://github.com/formkit/auto-animate) (For everything else)
- [Live Demo](https://auto-animate.formkit.com)

If you happen to use Nx plugins, you can leverage code generators that might come with it.
### Missing support for something?

Run `nx list` to get a list of available plugins and whether they have generators. Then run `nx list <plugin-name>` to see what generators are available.
Go through existing issues if your problem is already being tracked, otherwise [raise an issue!](https://github.com/ajitzero/ng-auto-animate/issues/new)

Learn more about [Nx generators on the docs](https://nx.dev/plugin-features/use-code-generators).
### License

## Running tasks
[MIT](https://github.com/ajitzero/ng-auto-animate/blob/main/LICENSE).

To execute tasks with Nx use the following syntax:
Built by [Ajit Panigrahi](https://github.com/ajitzero). Original library by [Justin Schroeder](https://github.com/justin-schroeder) and many contributors.

```
nx <target> <project> <...options>
```

You can also run multiple targets:
---
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>

```
nx run-many -t <target1> <target2>
```
**This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)**

..or add `-p` to filter specific projects

```
nx run-many -t <target1> <target2> -p <proj1> <proj2>
```
## Start the demo app

Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/core-features/run-tasks).
To start the development server run `nx serve demo`. Open your browser and navigate to http://localhost:4200/. Happy coding!

## Want better Editor Integration?

Expand All @@ -45,17 +39,3 @@ Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provid
## Ready to deploy?

Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed.

## Set up CI!

Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.

- [Set up remote caching](https://nx.dev/core-features/share-your-cache)
- [Set up task distribution across multiple machines](https://nx.dev/core-features/distribute-task-execution)
- [Learn more how to setup CI](https://nx.dev/recipes/ci)

## Connect with us!

- [Join the community](https://nx.dev/community)
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools)
- [Follow us on Twitter](https://twitter.com/nxdevtools)
82 changes: 79 additions & 3 deletions libs/ng-auto-animate/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,83 @@
# ng-auto-animate

This library was generated with [Nx](https://nx.dev).
An Angular Directive to use FormKit's [auto-animate](https://auto-animate.formkit.com) library, within Angular projects.

### Highlights:
- ✅ Standalone Directive, for Angular v14 and above. Tested on Node 18.x, but should work on previous versions.
- ✅ Custom `InjectionToken` for configuring global settings.
- 🚫 Currently, does not support [plugins](https://auto-animate.formkit.com/#plugins). WIP: See [#5](https://github.com/ajitzero/ng-auto-animate/issues/5).

### Why a new wrapper library?
A publishable library for Angular needs `ng-packr` and Angular CLI for proper scaffolding and finalized formatting. Migrating the repository structure for `auto-animate` is a non-trivial ask, and would need an unbiased build system like [Nx](https://nx.dev) (which I am using here) or some other similar tool.

[Justin Schroeder](https://github.com/justin-schroeder), the creator of `auto-animate`, has been supportive towards [contributions](https://github.com/formkit/auto-animate/pull/38) for Angular intergation, but he himself [does not work with Angular](https://github.com/formkit/auto-animate/issues/72#issuecomment-1222732238) and is unable to actively work towards this. I too would not be able to do much in his shoes, especially when it requires replacing all build actions, scripts and the project structure, all just to support one framework.

If there is a simpler solution, I would be willing to submit a PR with my changes here into the original project.

### Usage
1. Default usage:
```html
<article auto-animate>
<p *ngFor="let paragraph of paragraphs">
{{ paragraph }}
</p>
</article>
```
1. Pass one-off options:
```html
<article [auto-animate]="{ duration: 750 }">
<p *ngFor="let paragraph of paragraphs">
{{ paragraph }}
</p>
</article>
```
1. Configure global default options:
```ts
// src/app/app.config.ts
import { ApplicationConfig } from '@angular/core';
import { GLOBAL_AUTO_ANIMATE_OPTIONS } from 'ng-auto-animate';

export const appConfig: ApplicationConfig = {
providers: [
{
provide: GLOBAL_AUTO_ANIMATE_OPTIONS,
useValue: {
duration: 750,
easing: 'ease-out',
// etc.
},
},
// other providers
],
};

// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

## Running unit tests
bootstrapApplication(AppComponent, appConfig).catch((err) =>
console.error(err)
);
```
```html
<article auto-animate> <!-- Default usage -->
<p *ngFor="let paragraph of paragraphs">
{{ paragraph }}
</p>
</article>
```

Run `nx test ng-auto-animate` to execute the unit tests.
### Missing support for something?

Go through existing issues if your problem is already being tracked, otherwise [raise an issue!](https://github.com/ajitzero/ng-auto-animate/issues/new)

### License

[MIT](https://github.com/ajitzero/ng-auto-animate/blob/main/LICENSE).

Built by [Ajit Panigrahi](https://github.com/ajitzero). Original library by [Justin Schroeder](https://github.com/justin-schroeder) and many contributors.

---

This library was generated with [Nx](https://nx.dev).

0 comments on commit 0cc4d6c

Please sign in to comment.