Skip to content

Commit

Permalink
feat: support angular6, releases: 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed May 7, 2018
1 parent 47d0b49 commit eee32bb
Show file tree
Hide file tree
Showing 61 changed files with 7,319 additions and 12,394 deletions.
45 changes: 0 additions & 45 deletions .angular-cli.json

This file was deleted.

53 changes: 38 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
/__gen_lib
/publish-es5
/publish-es2015
/publish

# dependencies
/node_modules
npm-debug.log
.tmp

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

# ignore build and dist for now
/demo/dist
/dist
/coverage
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# ignore inline compiling
/logs
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# AoT generated files
factories
# System Files
.DS_Store
Thumbs.db
File renamed without changes.
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all"
}
34 changes: 34 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"extends": {
"stylelint-config-standard",
"./node_modules/prettier-stylelint/config.js"
},
"rules": {
"comment-empty-line-before": null,
"declaration-empty-line-before": null,
"function-comma-newline-after": null,
"function-name-case": null,
"function-parentheses-newline-inside": null,
"function-max-empty-lines": null,
"function-whitespace-after": null,
"indentation": null,
"number-leading-zero": null,
"number-no-trailing-zeros": null,
"rule-empty-line-before": null,
"selector-combinator-space-after": null,
"selector-list-comma-newline-after": null,
"selector-pseudo-element-colon-notation": null,
"unit-no-unknown": null,
"value-list-max-empty-lines": null,
"selector-type-no-unknown": null,
"selector-pseudo-element-no-unknown": [
true,
{
"ignorePseudoElements": [
"ng-deep"
]
}
],
"no-descending-specificity": null
}
}
27 changes: 24 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
sudo: required
language: node_js
node_js:
- "8"
- "8.11.0"

env:
- TASK=test
- TASK=lint
- TASK=build
- TASK=site:build

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
- google-chrome-beta

git:
depth: 1

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run pretest
- npm run test
- npm run $TASK
- |
if [ "$TASK" = "test" ]; then
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
fi
3 changes: 0 additions & 3 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-present 卡色
Copyright (c) 2018-present 卡色<[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Simple file save with FileSaver.js

## 示例

[demo](https://cipchk.github.io/ngx-filesaver/)
- [demo](https://cipchk.github.io/ngx-filesaver/)
- [Stackblitz](https://stackblitz.com/edit/ngx-filesaver)

## 安装

Expand Down Expand Up @@ -50,31 +51,35 @@ onSave() {
#### 配置型

```html
<button type="button"
fileSaver
<button type="button"
fileSaver
[method]="'GET'"
[fileName]="'中文pdf.pdf'"
[url]="'assets/files/demo.pdf'"
[header]="{ token: 'demo' }"
[query]="{ pi: 1, name: 'demo' }">Download PDF</button>
[query]="{ pi: 1, name: 'demo' }"
(success)="onSuc($event)"
(error)="onErr($event)">Download PDF</button>
```

**fileSaver**:属性指令名称。

**url**:下路路径。

**fileName**:文件名。【选填】

**header**:请求的 `headers` 属性值,一般用来指定 _token_ 之类。【选填】

**query**:额外的查询参数。【选填】


**参数说明**

参数 | 说明 | 类型 | 默认值
----|------|-----|------
method | 请求方法类型 | `string` | `GET`
url | 下路路径 | `string` | -
fileName | 文件名 | `string` | -
query | 额外的查询参数,等同 `params` 值 | `string` | -
header | 请求的 `headers` 属性值,一般用来指定 _token_ 之类 | `any` | -
success | 下载成功回调 | `EventEmitter<any>` | -
error | 下载错误回调 | `EventEmitter<any>` | -

#### 自定义Http型

```html
<button type="button"
fileSaver
<button type="button"
fileSaver
[http]="onRemote('pdf', true)">Download PDF</button>
```

Expand Down
113 changes: 113 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-filesaver": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.json",
"polyfills": "src/polyfills.ts",
"assets": ["src/assets"],
"styles": [],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngx-filesaver:build"
},
"configurations": {
"prod": {
"browserTarget": "ngx-filesaver:build:prod"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-filesaver:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "lib/test.ts",
"tsConfig": "lib/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": "src/polyfills.ts",
"scripts": [],
"styles": [],
"assets": ["src/assets"]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [],
"exclude": []
}
}
}
},
"ngx-filesaver-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "ngx-filesaver:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [],
"exclude": []
}
}
}
}
},
"defaultProject": "ngx-filesaver",
"schematics": {
"@schematics/angular:component": {
"prefix": "",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": ""
}
}
}
Loading

0 comments on commit eee32bb

Please sign in to comment.