Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manekinekko/angular-library-starter
🎩 A Minimalist Starter for Angular (v2+) libraries (w/ AOT support)
https://github.com/manekinekko/angular-library-starter
angular library starter typescript
Last synced: about 9 hours ago
JSON representation
🎩 A Minimalist Starter for Angular (v2+) libraries (w/ AOT support)
- Host: GitHub
- URL: https://github.com/manekinekko/angular-library-starter
- Owner: manekinekko
- Created: 2016-12-28T16:29:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-02T16:47:39.000Z (almost 7 years ago)
- Last Synced: 2024-11-01T11:42:25.253Z (7 days ago)
- Topics: angular, library, starter, typescript
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 71
- Watchers: 7
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-angular-components - @manekinekko/angular-library-starter - A Minimalist Starter for Angular (v2+) libraries (w/ AOT support). (Uncategorized / Uncategorized)
- awesome-angular-components - @manekinekko/angular-library-starter - A Minimalist Starter for Angular (v2+) libraries (w/ AOT support). (Uncategorized / Uncategorized)
README
[![Build status](https://ci.appveyor.com/api/projects/status/hhk7cc6vtlf2j6dl/branch/master?svg=true)](https://ci.appveyor.com/project/manekinekko/angular-library-starter/branch/master)
[![CircleCI](https://circleci.com/gh/manekinekko/angular-library-starter.svg?style=svg)](https://circleci.com/gh/manekinekko/angular-library-starter)### Due to the limited time on our planet Earth (24 hours a day is too short!), I'm sadly not supporting this project anymore. Please use [Jurgen's Yeoman generator](https://github.com/jvandemo/generator-angular2-library).
![](https://cloud.githubusercontent.com/assets/1859381/24447242/901c8a1a-1470-11e7-8b55-2484b7825722.jpg)
## 🎩 Minimalist Angular Library Starter
This is a minimalist starter if you need to (quickly) create and ship a library for your Angular (v2+) applications.
## Most Important Files
#### package.json
```
{
"name": "@manekinekko/angular-library-starter",
"version": "1.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"private": false,
"scripts": {
"build:aot": "ngc -p tsconfig.json",
},
//...
}
```#### tsconfig.json
```
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"noImplicitAny": false,
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"typeRoots": ["./node_modules/@types"],
"types": ["node"],
"lib": ["dom", "es2015"]
},
// this is for the AOT compiler
"angularCompilerOptions": {
"genDir": "tmp",
"entryModule": "src/lib/app.module#AppModule"
},
//...
}
```## Using you library in another project
### yarn or npm it in your `package.json`
```json
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
//...
"@manekinekko/angular-library-starter": "^1.0.0",
},
//...
```### import the `AppModule` from the library
```typescript
import { NgModule } from '@angular/core';
import { AppModule } from '@manekinekko/angular-library-starter';@NgModule({
imports: [
AppModule.forRoot()
],
//...
})
export class AppModule { }
```### use it anywhere in your NgModules
```typescript
import { Component } from '@angular/core';
import { AppService } from '@manekinekko/angular-library-starter';// AppService and AppPipe are imported by the AppModule
@Component({
selector: 'app-root',
template: `
{{ text | truncate }}
`
})
export class AppComponent {
text = 'Lorem ipsum dolor sit amet';
constructor(as: AppService) {
this.date = as.getDate().toString();
}
}
```### Custom types
If you have custom typings you want to include in your project, use the [custom-typings.d.ts](https://github.com/manekinekko/angular-library-starter/blob/master/src/custom-typings.d.ts) for that purpose.
## Disclaimers
1. This starter contains the minimum configuration for your library so it can be shared and used across other projects.
2. Tests are not included in this starter!
3. This starter is not compatible with the angular-cli **YET**.## Have a PR?
All contributions are welcome ;)
## License
The MIT License (MIT)
Copyright (c) 2017 - Wassim CHEGHAMPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.