Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor with ng-packagr #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
39 changes: 37 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
node_modules/
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
package-lock.json
Thumbs.db
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Change Log

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="1.0.10"></a>
## [1.0.10](https://github.com/pqina/ngx-filepond/compare/1.0.3...1.0.10) (2018-05-04)
110 changes: 85 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Angular FilePond is a handy adapter component for [FilePond](https://github.com/

<img src="https://github.com/pqina/filepond-github-assets/blob/master/filepond-animation-01.gif?raw=true" width="370" alt=""/>

## Docs

[documentation](https://xmlking.github.io/ngx-filepond/)

## Installation

Install FilePond component from npm.
Expand All @@ -18,51 +22,46 @@ npm install angular-filepond --save

Add `FilePond` to an NgModule and if needed register any plugins. Please note that plugins need to be [installed from npm](https://pqina.nl/filepond/docs/patterns/plugins/introduction/#installing-plugins) separately.

```js
import { FilePond, registerPlugin } from 'angular-filepond';
```ts
import { FilePond, registerPlugin } from '@pqina/ngx-filepond';

// Registering plugins
import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.esm';
registerPlugin(FilePondPluginFileValidateType);
import * as FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type';
import * as FilepondPluginFileValidateSize from 'filepond-plugin-file-validate-size';
import * as FilepondPluginImagePreview from 'filepond-plugin-image-preview';

registerPlugin(FilePondPluginFileValidateType, FilepondPluginFileValidateSize, FilepondPluginImagePreview);

// Adding FilePond to imports
@NgModule({
imports: [
FilePond
FilePondModule
]
})

export class AppModule { }
```

Add the FilePond stylesheet to your `angular-cli.json` build script.

```json
"styles": [
"styles.css",
"../node_modules/filepond/dist/filepond.min.css"
]
```

Now FilePond can be used in your templates.

```js
```ts
import { Component, ViewChild } from '@angular/core';

@Component({
selector: 'app-root',
template: `
<div class="root">
<FilePond #myPond
name="my-name"
className="my-class"
labelIdle="Drop files here..."
allowMultiple="true"
acceptedFileTypes="image/jpeg, image/png"
server="/api"
[files]="myFiles"
(oninit)="handleFilePondInit()">
</FilePond>
<FilePond #myPond
name="myFilePond"
required="true"
allowMultiple="true"
maxFiles="3"
maxFileSize="1MB"
[acceptedFileTypes]="['image/*', 'application/pdf', 'application/*', 'text/plain', 'text/csv', '.vsd']"
server="/api"
[files]="myFiles"
(oninit)="handleFilePondInit()">
</FilePond>
</div>
`
})
Expand All @@ -85,3 +84,64 @@ export class AppComponent {
```

[Read the docs for more information](https://pqina.nl/filepond/docs/patterns/frameworks/angular/)


## Development

### Build Lib

Run `ng build @pqina/ngx-filepond` to build the lib. The build artifacts will be stored in the `dist/@pqina/ngx-filepond` directory.

### Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

### Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

### 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

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

### Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

### Release

To generate your changelog for your first release, simply do:
```bash
npm run release -- --first-release
```
This will tag a release without bumping the version in package.json (et al.).

When ready, push the git tag and npm publish your first release. \o/

Release as a pre-release
```bash
# you will get version 1.0.1-0.
npm run release -- --prerelease
f you want to name the pre-release, you specify the name via --prerelease <name>.
npm run release -- --prerelease alpha
# Release as a target type imperatively like npm version
npm run release -- --release-as 1.1.0
# running standard-version with the flag --dry-run allows you to see what commands would be run, without committing to git or updating files.
npm run release -- --dry-run
```
### Publishing

```bash
ng build @pqina/ngx-filepond --prod
cd dist/@pqina/ngx-filepond
npm publish
```
> The --prod flag should be used when building to publish because it will completely clean the build directory for the library beforehand, removing old code leftover code from previous versions.

### Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
166 changes: 166 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-filepond": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ngx-filepond",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngx-filepond:build"
},
"configurations": {
"production": {
"browserTarget": "ngx-filepond:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-filepond:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ngx-filepond-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ngx-filepond:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"@pqina/ngx-filepond": {
"root": "projects/@pqina/ngx-filepond",
"sourceRoot": "projects/@pqina/ngx-filepond/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/@pqina/ngx-filepond/tsconfig.lib.json",
"project": "projects/@pqina/ngx-filepond/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/@pqina/ngx-filepond/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/@pqina/ngx-filepond/src/test.ts",
"tsConfig": "projects/@pqina/ngx-filepond/tsconfig.spec.json",
"karmaConfig": "projects/@pqina/ngx-filepond/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/@pqina/ngx-filepond/tsconfig.lib.json",
"projects/@pqina/ngx-filepond/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ngx-filepond"
}
3 changes: 0 additions & 3 deletions dist/angular-filepond.module.d.ts

This file was deleted.

Loading