From be27edbe134a5fa86fda3e7fb36a7a2b56ba00c5 Mon Sep 17 00:00:00 2001 From: SvetlanaMuravlova <83700465+SvetlanaMuravlova@users.noreply.github.com> Date: Fri, 3 Sep 2021 13:44:45 +0300 Subject: [PATCH] chore(bump): updated versions (#1177) * feat(upgrade): updated up to angular 11 tests are failed * chore(bump): updated versions * chore(bump): updated package * fix(style): delete extra rule * disabled ivy build, added prod config, changed demo serve script * feat(bump): added strict mode, doesn't build in dist, should be resolved * feat(core): added nx * feat(core): updated dependencies list * feat(github actions): check gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(github actions): delete codecov * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(strict): added strict mode * feat(github actions): updated yml file * fix(lint): fixed linting errors * fix(lint): fixed linting errors * fix(lint): fixed lint errors * Delete hosting.ZGlzdC9hcHBzL2RlbW8.cache * feat(github actions): added publish action * fix(firebase): test extra folder https Co-authored-by: Mishchenko Dmitriy Co-authored-by: Dmitriy Shekhovtsov --- .eslintrc.json | 60 + .firebaserc | 5 + .github/workflows/on-publish.yml | 121 + .github/workflows/on-push-or-pull.yml | 113 + CHANGELOG.md | 37 + angular.json | 106 +- apps/demo/.eslintrc.json | 21 + {demo => apps/demo}/.gitignore | 0 {demo => apps/demo}/browserslist | 0 apps/demo/bs-config.json | 4 + {demo => apps/demo}/server/file-catcher.js | 0 {demo => apps/demo}/src/app/app.component.ts | 4 +- {demo => apps/demo}/src/app/app.module.ts | 0 .../app/components/file-upload-section.html | 0 .../src/app/components/file-upload-section.ts | 19 +- .../components/file-upload/file-catcher.js | 0 .../components/file-upload/simple-demo.html | 0 .../app/components/file-upload/simple-demo.ts | 20 +- {demo => apps/demo}/src/app/index.ts | 0 .../demo}/src/assets/css/glyphicons.css | 0 .../src/assets/css/prettify-angulario.css | 0 {demo => apps/demo}/src/assets/css/style.css | 8 + .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../fonts/glyphicons-halflings-regular.woff2 | Bin .../demo}/src/assets/js/prettify.min.js | 0 {demo => apps/demo}/src/doc.md | 0 .../src/environments/environment.prod.ts | 0 .../demo}/src/environments/environment.ts | 0 {demo => apps/demo}/src/favicon.ico | Bin {demo => apps/demo}/src/getting-started.md | 0 {demo => apps/demo}/src/index.html | 2 +- {demo => apps/demo}/src/main.ts | 2 +- {scripts => apps/demo/src}/typings.d.ts | 4 +- apps/demo/tsconfig.app.json | 17 + apps/demo/tsconfig.editor.json | 7 + apps/demo/tsconfig.json | 20 + decorate-angular-cli.js | 69 + demo/bs-config.json | 4 - demo/src/tsconfig.json | 25 - firebase.json | 16 + jest.config.js | 5 + jest.preset.js | 7 + libs/ng2-file-upload/.eslintrc.json | 21 + libs/ng2-file-upload/README.md | 10 + .../file-upload/file-drop.directive.ts | 39 +- .../file-upload/file-item.class.ts | 80 +- .../file-upload/file-like-object.class.ts | 28 + .../file-upload/file-select.directive.ts | 41 + .../file-upload/file-type.class.ts | 157 +- .../file-upload/file-upload.module.ts | 0 .../file-upload/file-uploader.class.ts | 245 +- {src => libs/ng2-file-upload}/index.ts | 4 +- libs/ng2-file-upload/jest.config.js | 26 + libs/ng2-file-upload/ng-package.json | 7 + {src => libs/ng2-file-upload}/package.json | 0 .../testing}/spec/file-drop.directive.spec.ts | 25 +- .../spec/file-select.directive.spec.ts | 28 +- libs/ng2-file-upload/testing/test-setup.ts | 1 + libs/ng2-file-upload/tsconfig.json | 28 + libs/ng2-file-upload/tsconfig.lib.json | 23 + libs/ng2-file-upload/tsconfig.lib.prod.json | 10 + libs/ng2-file-upload/tsconfig.spec.json | 12 + nx.json | 38 + package-lock.json | 33954 ++++++++++------ package.json | 154 +- scripts/polyfills.ts | 16 - scripts/set-version.ts | 13 + src/file-upload/file-like-object.class.ts | 33 - src/file-upload/file-select.directive.ts | 41 - src/ng-package.json | 7 - src/tsconfig.json | 33 - test/karma.conf.js | 80 - test/matchers.ts | 21 - test/sauce-browsers.js | 18 - test/test.ts | 37 - test/tsconfig.json | 22 - tsconfig.base.json | 27 + 80 files changed, 23348 insertions(+), 12627 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .firebaserc create mode 100644 .github/workflows/on-publish.yml create mode 100644 .github/workflows/on-push-or-pull.yml create mode 100644 apps/demo/.eslintrc.json rename {demo => apps/demo}/.gitignore (100%) rename {demo => apps/demo}/browserslist (100%) create mode 100644 apps/demo/bs-config.json rename {demo => apps/demo}/server/file-catcher.js (100%) rename {demo => apps/demo}/src/app/app.component.ts (91%) rename {demo => apps/demo}/src/app/app.module.ts (100%) rename {demo => apps/demo}/src/app/components/file-upload-section.html (100%) rename {demo => apps/demo}/src/app/components/file-upload-section.ts (51%) rename {demo => apps/demo}/src/app/components/file-upload/file-catcher.js (100%) rename {demo => apps/demo}/src/app/components/file-upload/simple-demo.html (100%) rename {demo => apps/demo}/src/app/components/file-upload/simple-demo.ts (71%) rename {demo => apps/demo}/src/app/index.ts (100%) rename {demo => apps/demo}/src/assets/css/glyphicons.css (100%) rename {demo => apps/demo}/src/assets/css/prettify-angulario.css (100%) rename {demo => apps/demo}/src/assets/css/style.css (98%) rename {demo => apps/demo}/src/assets/fonts/glyphicons-halflings-regular.eot (100%) rename {demo => apps/demo}/src/assets/fonts/glyphicons-halflings-regular.svg (100%) rename {demo => apps/demo}/src/assets/fonts/glyphicons-halflings-regular.ttf (100%) rename {demo => apps/demo}/src/assets/fonts/glyphicons-halflings-regular.woff (100%) rename {demo => apps/demo}/src/assets/fonts/glyphicons-halflings-regular.woff2 (100%) rename {demo => apps/demo}/src/assets/js/prettify.min.js (100%) rename {demo => apps/demo}/src/doc.md (100%) rename {demo => apps/demo}/src/environments/environment.prod.ts (100%) rename {demo => apps/demo}/src/environments/environment.ts (100%) rename {demo => apps/demo}/src/favicon.ico (100%) rename {demo => apps/demo}/src/getting-started.md (100%) rename {demo => apps/demo}/src/index.html (89%) rename {demo => apps/demo}/src/main.ts (89%) rename {scripts => apps/demo/src}/typings.d.ts (79%) create mode 100644 apps/demo/tsconfig.app.json create mode 100644 apps/demo/tsconfig.editor.json create mode 100644 apps/demo/tsconfig.json create mode 100644 decorate-angular-cli.js delete mode 100644 demo/bs-config.json delete mode 100644 demo/src/tsconfig.json create mode 100644 firebase.json create mode 100644 jest.config.js create mode 100644 jest.preset.js create mode 100644 libs/ng2-file-upload/.eslintrc.json create mode 100644 libs/ng2-file-upload/README.md rename {src => libs/ng2-file-upload}/file-upload/file-drop.directive.ts (61%) rename {src => libs/ng2-file-upload}/file-upload/file-item.class.ts (56%) create mode 100644 libs/ng2-file-upload/file-upload/file-like-object.class.ts create mode 100644 libs/ng2-file-upload/file-upload/file-select.directive.ts rename {src => libs/ng2-file-upload}/file-upload/file-type.class.ts (52%) rename {src => libs/ng2-file-upload}/file-upload/file-upload.module.ts (100%) rename {src => libs/ng2-file-upload}/file-upload/file-uploader.class.ts (60%) rename {src => libs/ng2-file-upload}/index.ts (67%) create mode 100644 libs/ng2-file-upload/jest.config.js create mode 100644 libs/ng2-file-upload/ng-package.json rename {src => libs/ng2-file-upload}/package.json (100%) rename {src => libs/ng2-file-upload/testing}/spec/file-drop.directive.spec.ts (86%) rename {src => libs/ng2-file-upload/testing}/spec/file-select.directive.spec.ts (77%) create mode 100644 libs/ng2-file-upload/testing/test-setup.ts create mode 100644 libs/ng2-file-upload/tsconfig.json create mode 100644 libs/ng2-file-upload/tsconfig.lib.json create mode 100644 libs/ng2-file-upload/tsconfig.lib.prod.json create mode 100644 libs/ng2-file-upload/tsconfig.spec.json create mode 100644 nx.json create mode 100644 scripts/set-version.ts delete mode 100644 src/file-upload/file-like-object.class.ts delete mode 100644 src/file-upload/file-select.directive.ts delete mode 100644 src/ng-package.json delete mode 100644 src/tsconfig.json delete mode 100644 test/karma.conf.js delete mode 100644 test/matchers.ts delete mode 100644 test/sauce-browsers.js delete mode 100644 test/test.ts delete mode 100644 test/tsconfig.json create mode 100644 tsconfig.base.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..23d3c6d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,60 @@ +{ + "root": true, + "ignorePatterns": [ + "**/*" + ], + "plugins": [ + "@nrwl/nx" + ], + "overrides": [ + { + "files": [ + "*.ts", + "*.tsx", + "*.js", + "*.jsx" + ], + "rules": { + "@nrwl/nx/enforce-module-boundaries": [ + "error", + { + "enforceBuildableLibDependency": true, + "allow": [], + "depConstraints": [ + { + "sourceTag": "*", + "onlyDependOnLibsWithTags": [ + "*" + ] + } + ] + } + ] + } + }, + { + "files": [ + "*.ts", + "*.tsx" + ], + "extends": [ + "plugin:@nrwl/nx/typescript" + ], + "parserOptions": { "project": "./tsconfig.*?.json" }, + "rules": { + "semi": "off", + "@typescript-eslint/semi": ["error"] + } + }, + { + "files": [ + "*.js", + "*.jsx" + ], + "extends": [ + "plugin:@nrwl/nx/javascript" + ], + "rules": {} + } + ] +} diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..90289ef --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "ngx-file-upload" + } +} diff --git a/.github/workflows/on-publish.yml b/.github/workflows/on-publish.yml new file mode 100644 index 0000000..3f8db30 --- /dev/null +++ b/.github/workflows/on-publish.yml @@ -0,0 +1,121 @@ +name: on-release +on: + push: + tags: + - v* + +env: + NX_BRANCH: ${{ github.event.number }} + NX_RUN_GROUP: ${{ github.run_id }} + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} + MOZ_HEADLESS: 1 + CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + # one run + one_run: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + + # install dependencies + install: + runs-on: ubuntu-latest + needs: one_run + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + id: cache + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' + + # build ng2-file-upload + build: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - uses: actions/cache@v2.1.4 + with: + path: | + dist + key: dist-${{ github.run_id }} + - run: npx ng build --prod + + # update release notes in github + update_release_draft: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - run: npx conventional-github-releaser -p angular + + # update gh_pages + gh_pages_deploy: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.3.4 + with: + ref: 'gh-pages' + path: 'gh-pages' + + - uses: actions/cache@v2.1.4 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - uses: actions/cache@v2.1.4 + with: + path: | + dist + key: dist-${{ github.run_id }} + - run: | + cd gh-pages + git config user.email gh-actions-${GITHUB_ACTOR}@github.com + git config user.name $GITHUB_ACTOR + git add -A + git commit -am "ci: gh-pages update" + continue-on-error: true + - name: push to gh-pages + uses: ad-m/github-push-action@v0.6.0 + continue-on-error: true + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: 'gh-pages' + directory: 'gh-pages' + + # publish to npm + npm_publish: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - uses: actions/cache@v2.1.4 + with: + path: | + dist + key: dist-${{ github.run_id }} + - uses: JS-DevTools/npm-publish@v1 + with: + package: "dist/libs/ng2-file-upload/package.json" + token: ${{ secrets.NPM_TOKEN }} + diff --git a/.github/workflows/on-push-or-pull.yml b/.github/workflows/on-push-or-pull.yml new file mode 100644 index 0000000..75799b3 --- /dev/null +++ b/.github/workflows/on-push-or-pull.yml @@ -0,0 +1,113 @@ +name: on-pull-request-or-push + +on: + pull_request: + push: + branches: + - development + +env: + NX_BRANCH: ${{ github.event.number }} + NX_RUN_GROUP: ${{ github.run_id }} + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} + MOZ_HEALESS: 1 + SAUCE_USERNAME_PR: valorkinpr + FIREBASE_CHANNEL: ${{ fromJSON('["", "live"]')[!github.base_ref] }} + + CACHE_NODE_MODULES_PATH: | + ~/.npm + node_modules + + CACHE_DIST_PATH: | + dist + +jobs: + # one run + one_run: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + + # install dependencies + install: + runs-on: ubuntu-latest + needs: one_run + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + id: cache + with: + path: ${{ env.CACHE_NODE_MODULES_PATH }} + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' + + # build ng2-file-upload + build: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/cache@v2.1.4 + with: + path: ${{ env.CACHE_NODE_MODULES_PATH }} + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - uses: actions/cache@v2.1.4 + with: + path: ${{ env.CACHE_DIST_PATH }} + key: dist-${{ github.run_id }} + - run: npx ng build --prod + + # run unit tests + unit_tests_with_coverage: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ${{ env.CACHE_NODE_MODULES_PATH }} + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - uses: actions/cache@v2 + with: + path: ${{ env.CACHE_DIST_PATH }} + key: dist-${{ github.run_id }} + - run: npm run test-coverage + continue-on-error: true + + # run linting + linting: + runs-on: ubuntu-latest + needs: install + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ${{ env.CACHE_NODE_MODULES_PATH }} + key: node_modules-${{ hashFiles('**/package-lock.json') }} + - run: npm run lint + + # firebase preview + build_and_preview: + runs-on: ubuntu-latest + needs: build + outputs: + output_url: ${{ steps.firebase_hosting_preview.outputs.details_url }} + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ${{ env.CACHE_DIST_PATH }} + key: dist-${{ github.run_id }} + - uses: FirebaseExtended/action-hosting-deploy@v0 + continue-on-error: true + id: firebase_hosting_preview + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NGX_FILE_UPLOAD }}' + projectId: ngx-file-upload + channelId: ${{ env.FIREBASE_CHANNEL }} + expires: 7d diff --git a/CHANGELOG.md b/CHANGELOG.md index a0820da..d1dc354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +# [1.3.0](https://github.com/valor-software/ng2-file-upload/compare/v1.2.0...v1.3.0) (2021-08-31) + + +### Bug Fixes + +* **ci:** fix xvfb service issue ([33ac156](https://github.com/valor-software/ng2-file-upload/commit/33ac156208bfcf57851210f037719107e1ca9eb9)) +* **style:** delete extra rule ([b5917b9](https://github.com/valor-software/ng2-file-upload/commit/b5917b9fa77e63c4c1b06598abc817b8033730c3)) +* **typo:** fix grammatical mistake in readme ([#1119](https://github.com/valor-software/ng2-file-upload/issues/1119)) ([8171bc8](https://github.com/valor-software/ng2-file-upload/commit/8171bc831b69692d04b650be19ff82f04ff56662)) + + +### Features + +* **bump:** added strict mode, doesn't build in dist, should be resolved ([69cd64d](https://github.com/valor-software/ng2-file-upload/commit/69cd64dc287c9bdd1c35af1062e27ce32a47e977)) +* **core:** added nx ([de738f7](https://github.com/valor-software/ng2-file-upload/commit/de738f7c63d7f37e07019bc596c02e9f4320f563)) +* **package:** relaxed peer dependencies to allow ng v4 ([#713](https://github.com/valor-software/ng2-file-upload/issues/713)) ([7704e0e](https://github.com/valor-software/ng2-file-upload/commit/7704e0e970276ebcd8bfefe34bf153f82108a11e)) +* **upgrade:** updated up to angular 11 tests are failed ([ce9dc20](https://github.com/valor-software/ng2-file-upload/commit/ce9dc20056cc6c7cd58e502af05d7d97043c8f3a)) + + + +# [1.3.0](https://github.com/valor-software/ng2-file-upload/compare/v1.2.0...v1.3.0) (2021-08-31) + + +### Bug Fixes + +* **ci:** fix xvfb service issue ([33ac156](https://github.com/valor-software/ng2-file-upload/commit/33ac156208bfcf57851210f037719107e1ca9eb9)) +* **style:** delete extra rule ([b5917b9](https://github.com/valor-software/ng2-file-upload/commit/b5917b9fa77e63c4c1b06598abc817b8033730c3)) +* **typo:** fix grammatical mistake in readme ([#1119](https://github.com/valor-software/ng2-file-upload/issues/1119)) ([8171bc8](https://github.com/valor-software/ng2-file-upload/commit/8171bc831b69692d04b650be19ff82f04ff56662)) + + +### Features + +* **bump:** added strict mode, doesn't build in dist, should be resolved ([69cd64d](https://github.com/valor-software/ng2-file-upload/commit/69cd64dc287c9bdd1c35af1062e27ce32a47e977)) +* **package:** relaxed peer dependencies to allow ng v4 ([#713](https://github.com/valor-software/ng2-file-upload/issues/713)) ([7704e0e](https://github.com/valor-software/ng2-file-upload/commit/7704e0e970276ebcd8bfefe34bf153f82108a11e)) +* **upgrade:** updated up to angular 11 tests are failed ([ce9dc20](https://github.com/valor-software/ng2-file-upload/commit/ce9dc20056cc6c7cd58e502af05d7d97043c8f3a)) + + + # [1.3.0](https://github.com/valor-software/ng2-file-upload/compare/v1.2.0...v1.3.0) (2017-11-25) diff --git a/angular.json b/angular.json index 59dcf50..24d753d 100644 --- a/angular.json +++ b/angular.json @@ -2,39 +2,89 @@ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", + "defaultProject": "ng2-file-upload-demo", "projects": { "ng2-file-upload": { - "root": ".", - "sourceRoot": "src", + "root": "libs/ng2-file-upload", + "sourceRoot": "libs/ng2-file-upload/src", "projectType": "library", "architect": { "build": { - "builder": "@angular-devkit/build-ng-packagr:build", + "builder": "@nrwl/angular:package", + "outputs": [ + "dist/libs/ng2-file-upload" + ], "options": { - "tsConfig": "src/tsconfig.json", - "project": "src/ng-package.json" + "tsConfig": "libs/ng2-file-upload/tsconfig.lib.json", + "project": "libs/ng2-file-upload/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "libs/ng2-file-upload/tsconfig.lib.prod.json" + } + } + }, + "lint": { + "builder": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "libs/ng2-file-upload/**/*.ts" + ] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "outputs": [ + "coverage/libs/ng2-file-upload" + ], + "options": { + "jestConfig": "libs/ng2-file-upload/jest.config.js", + "passWithNoTests": true + } + }, + "version": { + "builder": "@nrwl/workspace:run-commands", + "outputs": [ + ], + "options": { + "commands": [ + "ts-node ./scripts/set-version.ts", + "conventional-changelog -i CHANGELOG.md -s -p angular", + "git add -A", + "git commit -am \"chore(changelog): update [skip ci] \"" + ], + "parallel": false + }, + "configurations": { + "production": {} } } } }, "ng2-file-upload-demo": { - "root": "demo", - "sourceRoot": "demo/src", + "root": "apps/demo", + "sourceRoot": "apps/demo/src", "projectType": "application", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "demo/dist", - "index": "demo/src/index.html", - "main": "demo/src/main.ts", - "tsConfig": "demo/src/tsconfig.json", + "outputPath": "dist/apps/demo", + "index": "apps/demo/src/index.html", + "main": "apps/demo/src/main.ts", + "tsConfig": "apps/demo/tsconfig.json", "assets": [ - "demo/src/assets" + "apps/demo/src/assets" ], "styles": [], "scripts": [] }, + "dependsOn": [ + { + "target": "build", + "projects": "dependencies" + } + ], "configurations": { "production": { "optimization": true, @@ -48,8 +98,8 @@ "buildOptimizer": true, "fileReplacements": [ { - "replace": "demo/src/environments/environment.ts", - "with": "demo/src/environments/environment.prod.ts" + "replace": "apps/demo/src/environments/environment.ts", + "with": "apps/demo/src/environments/environment.prod.ts" } ] } @@ -65,34 +115,12 @@ "browserTarget": "ng2-file-upload-demo:build:production" } } - } - } - }, - "ng2-file-upload-test": { - "root": ".", - "sourceRoot": "test", - "projectType": "library", - "architect": { - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "test/test.ts", - "karmaConfig": "test/karma.conf.js", - "scripts": [], - "styles": [], - "tsConfig": "test/tsconfig.json" - } }, "lint": { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": { - "tsConfig": [ - "src/tsconfig.json", - "demo/src/tsconfig.json", - "test/tsconfig.json" - ], - "exclude": [ - "**/node_modules/**" + "lintFilePatterns": [ + "apps/demo/**/*.ts" ] } } diff --git a/apps/demo/.eslintrc.json b/apps/demo/.eslintrc.json new file mode 100644 index 0000000..a0dbfb5 --- /dev/null +++ b/apps/demo/.eslintrc.json @@ -0,0 +1,21 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": [ + "plugin:@nrwl/nx/angular", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "parserOptions": { "project": ["src/accordion/tsconfig.*?.json"] }, + "rules": { + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nrwl/nx/angular-template"], + "rules": {} + } + ] +} diff --git a/demo/.gitignore b/apps/demo/.gitignore similarity index 100% rename from demo/.gitignore rename to apps/demo/.gitignore diff --git a/demo/browserslist b/apps/demo/browserslist similarity index 100% rename from demo/browserslist rename to apps/demo/browserslist diff --git a/apps/demo/bs-config.json b/apps/demo/bs-config.json new file mode 100644 index 0000000..f7378b7 --- /dev/null +++ b/apps/demo/bs-config.json @@ -0,0 +1,4 @@ +{ + "port": 4200, + "server": { "baseDir": "./dist/apps/demo" } +} diff --git a/demo/server/file-catcher.js b/apps/demo/server/file-catcher.js similarity index 100% rename from demo/server/file-catcher.js rename to apps/demo/server/file-catcher.js diff --git a/demo/src/app/app.component.ts b/apps/demo/src/app/app.component.ts similarity index 91% rename from demo/src/app/app.component.ts rename to apps/demo/src/app/app.component.ts index 8326fae..fce058d 100644 --- a/demo/src/app/app.component.ts +++ b/apps/demo/src/app/app.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; - -let gettingStarted = require('html-loader!markdown-loader!../getting-started.md'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const gettingStarted = require('html-loader!markdown-loader!../getting-started.md'); @Component({ selector: 'app', diff --git a/demo/src/app/app.module.ts b/apps/demo/src/app/app.module.ts similarity index 100% rename from demo/src/app/app.module.ts rename to apps/demo/src/app/app.module.ts diff --git a/demo/src/app/components/file-upload-section.html b/apps/demo/src/app/components/file-upload-section.html similarity index 100% rename from demo/src/app/components/file-upload-section.html rename to apps/demo/src/app/components/file-upload-section.html diff --git a/demo/src/app/components/file-upload-section.ts b/apps/demo/src/app/components/file-upload-section.ts similarity index 51% rename from demo/src/app/components/file-upload-section.ts rename to apps/demo/src/app/components/file-upload-section.ts index 2c9af6b..d9c9dbc 100644 --- a/demo/src/app/components/file-upload-section.ts +++ b/apps/demo/src/app/components/file-upload-section.ts @@ -1,12 +1,15 @@ import { Component } from '@angular/core'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const doc = require('html-loader!markdown-loader!../../doc.md'); -let doc = require('html-loader!markdown-loader!../../doc.md'); - -let tabDesc:Array = [ +const tabDesc: Array = [ { heading: 'Simple', + // eslint-disable-next-line @typescript-eslint/no-var-requires ts: require('!!raw-loader!./file-upload/simple-demo.ts').default, + // eslint-disable-next-line @typescript-eslint/no-var-requires html: require('!!raw-loader!./file-upload/simple-demo.html').default, + // eslint-disable-next-line @typescript-eslint/no-var-requires js: require('!!raw-loader!./file-upload/file-catcher.js').default } ]; @@ -16,12 +19,12 @@ let tabDesc:Array = [ templateUrl: './file-upload-section.html' }) export class FileUploadSectionComponent { - public name:string = 'File Upload'; - public currentHeading:string = 'Simple'; - public doc:string = doc; - public tabs:any = tabDesc; + name = 'File Upload'; + currentHeading = 'Simple'; + doc = doc; + tabs: any = tabDesc; - public select(e:any):void { + select(e: any): void { if (e.heading) { this.currentHeading = e.heading; } diff --git a/demo/src/app/components/file-upload/file-catcher.js b/apps/demo/src/app/components/file-upload/file-catcher.js similarity index 100% rename from demo/src/app/components/file-upload/file-catcher.js rename to apps/demo/src/app/components/file-upload/file-catcher.js diff --git a/demo/src/app/components/file-upload/simple-demo.html b/apps/demo/src/app/components/file-upload/simple-demo.html similarity index 100% rename from demo/src/app/components/file-upload/simple-demo.html rename to apps/demo/src/app/components/file-upload/simple-demo.html diff --git a/demo/src/app/components/file-upload/simple-demo.ts b/apps/demo/src/app/components/file-upload/simple-demo.ts similarity index 71% rename from demo/src/app/components/file-upload/simple-demo.ts rename to apps/demo/src/app/components/file-upload/simple-demo.ts index 4a26a21..0a30c1a 100644 --- a/demo/src/app/components/file-upload/simple-demo.ts +++ b/apps/demo/src/app/components/file-upload/simple-demo.ts @@ -10,18 +10,18 @@ const URL = 'https://evening-anchorage-3159.herokuapp.com/api/'; }) export class SimpleDemoComponent { - uploader:FileUploader; - hasBaseDropZoneOver:boolean; - hasAnotherDropZoneOver:boolean; - response:string; + uploader: FileUploader; + hasBaseDropZoneOver: boolean; + hasAnotherDropZoneOver: boolean; + response: string; - constructor (){ + constructor() { this.uploader = new FileUploader({ url: URL, disableMultipart: true, // 'DisableMultipart' must be 'true' for formatDataFunction to be called. formatDataFunctionIsAsync: true, - formatDataFunction: async (item) => { - return new Promise( (resolve, reject) => { + formatDataFunction: async item => { + return new Promise((resolve, reject) => { resolve({ name: item._file.name, length: item._file.size, @@ -37,14 +37,14 @@ export class SimpleDemoComponent { this.response = ''; - this.uploader.response.subscribe( res => this.response = res ); + this.uploader.response.subscribe(res => this.response = res ); } - public fileOverBase(e:any):void { + fileOverBase(e: any): void { this.hasBaseDropZoneOver = e; } - public fileOverAnother(e:any):void { + fileOverAnother(e: any): void { this.hasAnotherDropZoneOver = e; } } diff --git a/demo/src/app/index.ts b/apps/demo/src/app/index.ts similarity index 100% rename from demo/src/app/index.ts rename to apps/demo/src/app/index.ts diff --git a/demo/src/assets/css/glyphicons.css b/apps/demo/src/assets/css/glyphicons.css similarity index 100% rename from demo/src/assets/css/glyphicons.css rename to apps/demo/src/assets/css/glyphicons.css diff --git a/demo/src/assets/css/prettify-angulario.css b/apps/demo/src/assets/css/prettify-angulario.css similarity index 100% rename from demo/src/assets/css/prettify-angulario.css rename to apps/demo/src/assets/css/prettify-angulario.css diff --git a/demo/src/assets/css/style.css b/apps/demo/src/assets/css/style.css similarity index 98% rename from demo/src/assets/css/style.css rename to apps/demo/src/assets/css/style.css index 5549277..ed872f8 100644 --- a/demo/src/assets/css/style.css +++ b/apps/demo/src/assets/css/style.css @@ -123,6 +123,14 @@ section { background-color: #eee; } +simple-demo { + max-width: 100%; +} + +simple-demo >.container { + max-width: 100%; +} + @media (min-width: 992px) { .bd-pageheader h1, .bd-pageheader p { margin-right: 380px; diff --git a/demo/src/assets/fonts/glyphicons-halflings-regular.eot b/apps/demo/src/assets/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from demo/src/assets/fonts/glyphicons-halflings-regular.eot rename to apps/demo/src/assets/fonts/glyphicons-halflings-regular.eot diff --git a/demo/src/assets/fonts/glyphicons-halflings-regular.svg b/apps/demo/src/assets/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from demo/src/assets/fonts/glyphicons-halflings-regular.svg rename to apps/demo/src/assets/fonts/glyphicons-halflings-regular.svg diff --git a/demo/src/assets/fonts/glyphicons-halflings-regular.ttf b/apps/demo/src/assets/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from demo/src/assets/fonts/glyphicons-halflings-regular.ttf rename to apps/demo/src/assets/fonts/glyphicons-halflings-regular.ttf diff --git a/demo/src/assets/fonts/glyphicons-halflings-regular.woff b/apps/demo/src/assets/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from demo/src/assets/fonts/glyphicons-halflings-regular.woff rename to apps/demo/src/assets/fonts/glyphicons-halflings-regular.woff diff --git a/demo/src/assets/fonts/glyphicons-halflings-regular.woff2 b/apps/demo/src/assets/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from demo/src/assets/fonts/glyphicons-halflings-regular.woff2 rename to apps/demo/src/assets/fonts/glyphicons-halflings-regular.woff2 diff --git a/demo/src/assets/js/prettify.min.js b/apps/demo/src/assets/js/prettify.min.js similarity index 100% rename from demo/src/assets/js/prettify.min.js rename to apps/demo/src/assets/js/prettify.min.js diff --git a/demo/src/doc.md b/apps/demo/src/doc.md similarity index 100% rename from demo/src/doc.md rename to apps/demo/src/doc.md diff --git a/demo/src/environments/environment.prod.ts b/apps/demo/src/environments/environment.prod.ts similarity index 100% rename from demo/src/environments/environment.prod.ts rename to apps/demo/src/environments/environment.prod.ts diff --git a/demo/src/environments/environment.ts b/apps/demo/src/environments/environment.ts similarity index 100% rename from demo/src/environments/environment.ts rename to apps/demo/src/environments/environment.ts diff --git a/demo/src/favicon.ico b/apps/demo/src/favicon.ico similarity index 100% rename from demo/src/favicon.ico rename to apps/demo/src/favicon.ico diff --git a/demo/src/getting-started.md b/apps/demo/src/getting-started.md similarity index 100% rename from demo/src/getting-started.md rename to apps/demo/src/getting-started.md diff --git a/demo/src/index.html b/apps/demo/src/index.html similarity index 89% rename from demo/src/index.html rename to apps/demo/src/index.html index f733a32..967a7fc 100644 --- a/demo/src/index.html +++ b/apps/demo/src/index.html @@ -12,7 +12,7 @@ - +