Merge pull request #1107 from earshinov/update-to-angular8

feta(build): update to Angular 8. Use Angular CLI instead of ngm for building. Ensure compatibility with Ivy on application side.
This commit was merged in pull request #1107.
This commit is contained in:
Vitaliy Makogon
2019-10-23 12:49:47 +03:00
committed by GitHub
21 changed files with 18788 additions and 183 deletions

View File

@@ -1,57 +0,0 @@
{
"project": {
"name": "ng2-file-upload"
},
"apps": [
{
"root": "demo/src",
"outDir": "demo/dist",
"assets": [
"assets"
],
"index": "index.html",
"main": "main.ts",
"test": "../../scripts/test.ts",
"tsconfig": "tsconfig.json",
"prefix": "",
"mobile": false,
"styles": [
],
"scripts": [
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "protractor.conf.js"
}
},
"test": {
"karma": {
"config": "karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}

View File

@@ -1,11 +1,13 @@
language: node_js language: node_js
node_js: node_js:
- "6" - "10"
services:
- xvfb
before_install: before_install:
- export CHROME_BIN=chromium-browser - export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: script:
- npm run pretest - npm run pretest

112
angular.json Normal file
View File

@@ -0,0 +1,112 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ng2-file-upload": {
"root": ".",
"sourceRoot": "src",
"projectType": "library",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "src/tsconfig.json",
"project": "src/ng-package.json"
}
}
}
},
"ng2-file-upload-demo": {
"root": "demo",
"sourceRoot": "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",
"assets": [
"demo/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": "demo/src/environments/environment.ts",
"with": "demo/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ng2-file-upload-demo:build"
},
"configurations": {
"production": {
"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",
"options": {
"tsConfig": [
"src/tsconfig.json",
"demo/src/tsconfig.json",
"test/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ng2-file-upload-demo",
"schematics": {
"@schematics/angular:component": {
"prefix": "",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": ""
}
}
}

12
demo/browserslist Normal file
View File

@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@@ -5,9 +5,9 @@ let doc = require('html-loader!markdown-loader!../../doc.md');
let tabDesc:Array<any> = [ let tabDesc:Array<any> = [
{ {
heading: 'Simple', heading: 'Simple',
ts: require('!!raw-loader?lang=typescript!./file-upload/simple-demo.ts'), ts: require('!!raw-loader!./file-upload/simple-demo.ts').default,
html: require('!!raw-loader?lang=markup!./file-upload/simple-demo.html'), html: require('!!raw-loader!./file-upload/simple-demo.html').default,
js: require('!!raw-loader?lang=javascript!./file-upload/file-catcher.js') js: require('!!raw-loader!./file-upload/file-catcher.js').default
} }
]; ];

View File

@@ -1,4 +1,4 @@
import './polyfills.ts'; import '../../scripts/polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';

View File

@@ -1,22 +1,25 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".",
"declaration": false, "declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"noEmitHelpers": false, "noEmitHelpers": false,
"lib": ["es6", "dom"], "lib": ["es6", "dom"],
"types": [
"jasmine",
"webpack"
],
"mapRoot": "./", "mapRoot": "./",
"module": "es6", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"outDir": "../temp/out-tsc", "outDir": "../temp/out-tsc",
"sourceMap": true, "sourceMap": true,
"target": "es5", "target": "es2015"
"typeRoots": [ },
"../node_modules/@types" "files": [
] "../../scripts/typings.d.ts",
} "main.ts",
"../../scripts/polyfills.ts"
],
"exclude": [
"**/*.spec.ts"
]
} }

16
demo/src/typings.d.ts vendored
View File

@@ -1,16 +0,0 @@
// Typings reference file, you can add your own global typings here
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
// tslint:disable
declare const System: any;
declare const ENV:string;
// google code-prettify
declare const PR:any;
// declare const require:any;
// declare const global:any;
declare module jasmine {
interface Matchers {
toHaveCssClass(expected: any): boolean;
}
}

18533
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -7,24 +7,21 @@
"lite-server": "lite-server -c demo/bs-config.json", "lite-server": "lite-server -c demo/bs-config.json",
"demo.serve": "run-s build link demo.build lite-server", "demo.serve": "run-s build link demo.build lite-server",
"demo.gh-pages": "run-s build demo.build demo.deploy", "demo.gh-pages": "run-s build demo.build demo.deploy",
"demo.build": "ng build -prod --aot", "demo.build": "ng build ng2-file-upload-demo --prod",
"demo.deploy": "gh-pages -d demo/dist", "demo.deploy": "gh-pages -d demo/dist",
"link": "ngm link -p src --here", "link": "cd dist/ng2-file-upload/ && npm link && cd ../../ && npm link ng2-file-upload",
"lint": "exit 0", "lint": "exit 0",
"disable-lint": "tslint \"**/*.ts\" -c tslint.json --fix --type-check -t prose -e \"node_modules/**\" -e \"dist/**\" -e \"temp/**\" -e \"scripts/docs/**\"", "disable-lint": "tslint \"**/*.ts\" -c tslint.json --fix --type-check -t prose -e \"node_modules/**\" -e \"dist/**\" -e \"temp/**\" -e \"scripts/docs/**\"",
"flow.changelog": "conventional-changelog -i CHANGELOG.md -s -p angular", "flow.changelog": "conventional-changelog -i CHANGELOG.md -s -p angular",
"flow.github-release": "conventional-github-releaser -p angular", "flow.github-release": "conventional-github-releaser -p angular",
"build": "ngm build -p src --clean", "build": "ng build ng2-file-upload",
"build.watch": "ngm build -p src --watch --skip-bundles", "build.watch": "ng build ng2-file-upload --watch",
"start": "ng serve --aot", "start": "ng serve ng2-file-upload-demo --aot",
"pretest": "run-s lint build link", "pretest": "run-s lint build link",
"test": "ng test -sr", "test": "ng test ng2-file-upload-test",
"test-coverage": "ng test -sr -cc", "test-coverage": "ng test ng2-file-upload-test --code-coverage",
"version": "npm run flow.changelog && git add -A" "version": "npm run flow.changelog && git add -A"
}, },
"main": "bundles/ng2-file-upload.umd.js",
"module": "index.js",
"typings": "index.d.ts",
"keywords": [ "keywords": [
"angular2", "angular2",
"bootstrap", "bootstrap",
@@ -43,33 +40,29 @@
"url": "https://github.com/valor-software/ng2-file-upload/issues" "url": "https://github.com/valor-software/ng2-file-upload/issues"
}, },
"homepage": "https://github.com/valor-software/ng2-file-upload#readme", "homepage": "https://github.com/valor-software/ng2-file-upload#readme",
"dependencies": {}, "peerDependencies": {},
"peerDependencies": {
"@angular/common": "^2.3.1 || >=4.0.0",
"@angular/core": "^2.3.1 || >=4.0.0"
},
"devDependencies": { "devDependencies": {
"@angular/cli": "1.0.0", "@angular-devkit/build-angular": "~0.803.0",
"@angular/common": "2.4.3", "@angular-devkit/build-ng-packagr": "^0.803.0",
"@angular/compiler": "2.4.3", "@angular/cli": "^8.3.0",
"@angular/compiler-cli": "2.4.3", "@angular/common": "^8.2.3",
"@angular/core": "2.4.3", "@angular/compiler": "^8.2.3",
"@angular/forms": "2.4.3", "@angular/compiler-cli": "^8.2.3",
"@angular/http": "2.4.3", "@angular/core": "^8.2.3",
"@angular/language-service": "2.4.3", "@angular/forms": "^8.2.3",
"@angular/platform-browser": "2.4.3", "@angular/language-service": "8.2.3",
"@angular/platform-browser-dynamic": "2.4.3", "@angular/platform-browser": "^8.2.3",
"@angular/router": "3.4.3", "@angular/platform-browser-dynamic": "^8.2.3",
"@angular/tsc-wrapped": "0.5.1", "@angular/router": "^8.2.3",
"@types/jasmine": "2.5.40", "@types/jasmine": "2.5.40",
"@types/marked": "0.0.28", "@types/marked": "0.0.28",
"@types/node": "7.0.0", "@types/node": "7.0.0",
"@types/webpack": "^2.2.1", "@types/webpack": "^3.8.18",
"bootstrap": "3.3.7", "bootstrap": "3.3.7",
"chokidar-cli": "1.2.0", "chokidar-cli": "1.2.0",
"classlist-polyfill": "1.0.3", "classlist-polyfill": "1.0.3",
"codecov": "1.0.1", "codecov": "1.0.1",
"codelyzer": "~2.0.0-beta.4", "codelyzer": "^5.0.1",
"conventional-changelog-cli": "1.2.0", "conventional-changelog-cli": "1.2.0",
"conventional-github-releaser": "1.1.3", "conventional-github-releaser": "1.1.3",
"core-js": "^2.4.1", "core-js": "^2.4.1",
@@ -79,41 +72,41 @@
"gh-pages": "0.12.0", "gh-pages": "0.12.0",
"gitignore-to-glob": "0.3.0", "gitignore-to-glob": "0.3.0",
"google-code-prettify": "1.0.5", "google-code-prettify": "1.0.5",
"html-loader": "0.4.4", "html-loader": "^0.5.5",
"jasmine": "2.5.3", "jasmine-core": "3.1.0",
"jasmine-core": "2.5.2",
"jasmine-data-provider": "2.2.0", "jasmine-data-provider": "2.2.0",
"jasmine-spec-reporter": "3.2.0", "jasmine-spec-reporter": "4.2.1",
"karma": "1.4.0", "karma": "4.1.0",
"karma-chrome-launcher": "^2.0.0", "karma-chrome-launcher": "2.2.0",
"karma-cli": "^1.0.1", "karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0", "karma-coverage-istanbul-reporter": "1.4.3",
"karma-jasmine": "^1.0.2", "karma-jasmine": "1.1.2",
"karma-remap-istanbul": "0.4.0", "karma-remap-istanbul": "0.6.0",
"karma-sauce-launcher": "1.1.0", "karma-sauce-launcher": "1.2.0",
"lite-server": "2.2.2", "lite-server": "2.2.2",
"lodash": "4.17.4", "lodash": "4.17.4",
"markdown-loader": "^0.1.7", "markdown-loader": "^5.1.0",
"marked": "0.3.6", "marked": "0.3.6",
"ng2-page-scroll": "4.0.0-beta.2", "ng-packagr": "^5.5.0",
"ngm-cli": "0.4.0",
"ngx-bootstrap": "1.6.6", "ngx-bootstrap": "1.6.6",
"npm-run-all": "^4.0.1", "npm-run-all": "^4.0.1",
"pre-commit": "1.2.2", "pre-commit": "1.2.2",
"protractor": "5.0.0", "protractor": "5.0.0",
"raw-loader": "^3.1.0",
"reflect-metadata": "0.1.9", "reflect-metadata": "0.1.9",
"require-dir": "0.3.1", "require-dir": "0.3.1",
"rxjs": "5.0.3", "rxjs": "^6.5.2",
"systemjs-builder": "0.15.34", "systemjs-builder": "0.15.34",
"ts-helpers": "^1.1.1", "ts-helpers": "^1.1.1",
"ts-node": "2.0.0", "ts-node": "2.0.0",
"tslint": "4.3.1", "tsickle": "^0.37.0",
"tslint-config-valorsoft": "1.2.0", "tslint": "^5.19.0",
"tslint-config-valorsoft": "^2.2.1",
"typedoc": "0.5.5", "typedoc": "0.5.5",
"typescript": "2.1.5", "typescript": "3.5.3",
"wallaby-webpack": "0.0.30", "wallaby-webpack": "0.0.30",
"webdriver-manager": "11.1.1", "webdriver-manager": "11.1.1",
"zone.js": "0.7.5" "zone.js": "~0.9.1"
}, },
"contributors": [ "contributors": [
{ {
@@ -136,5 +129,8 @@
"email": "otelnov@gmail.com", "email": "otelnov@gmail.com",
"url": "https://github.com/otelnov" "url": "https://github.com/otelnov"
} }
] ],
"dependencies": {
"tslib": "^1.10.0"
}
} }

1
scripts/.gitignore vendored
View File

@@ -1 +0,0 @@
!**/*.js

View File

@@ -1,4 +1,4 @@
import { FileLikeObject } from "../ng2-file-upload"; import { FileLikeObject } from "../index";
export class FileType { export class FileType {
/* MS office */ /* MS office */

7
src/ng-package.json Normal file
View File

@@ -0,0 +1,7 @@
{
"$schema": "../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../dist/ng2-file-upload",
"lib": {
"entryFile": "index.ts"
}
}

View File

@@ -1 +0,0 @@
export * from './index';

View File

@@ -1,8 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".",
"outDir": "../dist", "outDir": "../dist",
"target": "es5", "target": "es5",
"module": "commonjs", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
@@ -14,24 +15,19 @@
"stripInternal": true, "stripInternal": true,
"noUnusedLocals": false, "noUnusedLocals": false,
"noUnusedParameters": false, "noUnusedParameters": false,
"lib": ["dom", "es6"], "lib": ["dom", "es6"]
"types": [
"jasmine",
"webpack"
],
"typeRoots": [
"../node_modules/@types"
]
}, },
"exclude": [
"node_modules"
],
"files": [
"../scripts/typings.d.ts",
"./ng2-file-upload.ts",
"./index.ts"
],
"angularCompilerOptions": { "angularCompilerOptions": {
"genDir": "../temp/factories" "annotateForClosureCompiler": true,
} "strictMetadataEmit": true,
"skipTemplateCodegen": true,
"flatModuleOutFile": "ng2-file-upload.js",
"flatModuleId": "ng2-file-upload"
},
"include": [
"../scripts/typings.d.ts"
],
"exclude": [
"**/*.spec.ts"
]
} }

View File

@@ -1,45 +1,42 @@
// Karma configuration file, see link for more information // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html // https://karma-runner.github.io/0.13/config/configuration-file.html
const customLaunchers = require('./scripts/sauce-browsers').customLaunchers; const customLaunchers = require('./sauce-browsers').customLaunchers;
module.exports = function (config) { module.exports = function (config) {
const configuration = { const configuration = {
basePath: '', basePath: '',
frameworks: ['jasmine', '@angular/cli'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [ plugins: [
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-coverage-istanbul-reporter'), require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma') require('@angular-devkit/build-angular/plugins/karma')
], ],
files: [
{pattern: './scripts/test.ts', watched: false}
],
preprocessors: {
'./scripts/test.ts': ['@angular/cli']
},
coverageIstanbulReporter: { coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ], dir: require('path').join(__dirname, '../coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: false fixWebpackSourcePaths: false
}, },
angularCli: {
config: './angular-cli.json', reporters: ['dots', 'coverage-istanbul'],
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['dots', 'coverage-istanbul']
: ['dots'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true, autoWatch: true,
browsers: ['Chrome'], browsers: ['ChromeHeadless'],
singleRun: false, browserNoActivityTimeout: 20000,
browserDisconnectTolerance: 2,
browserDisconnectTimeout: 5000,
singleRun: true,
customLaunchers: { customLaunchers: {
Chrome_travis_ci: { Chrome_travis_ci: {
base: 'Chrome', base: 'ChromeHeadless',
flags: ['--no-sandbox'] flags: [
'--headless',
'--disable-gpu',
'--no-sandbox',
'--remote-debugging-port=9222'
]
} }
}, },
mime: { 'text/x-typescript': ['ts','tsx'] }, mime: { 'text/x-typescript': ['ts','tsx'] },
@@ -70,10 +67,10 @@ module.exports = function (config) {
}, },
public: 'public' public: 'public'
}; };
configuration.captureTimeout = 0; configuration.captureTimeout = 60000;
configuration.customLaunchers = customLaunchers(); configuration.customLaunchers = customLaunchers();
configuration.browsers = Object.keys(configuration.customLaunchers); configuration.browsers = Object.keys(configuration.customLaunchers);
configuration.concurrency = 3; configuration.concurrency = 4;
configuration.browserDisconnectTolerance = 2; configuration.browserDisconnectTolerance = 2;
configuration.browserNoActivityTimeout = 20000; configuration.browserNoActivityTimeout = 20000;
configuration.browserDisconnectTimeout = 5000; configuration.browserDisconnectTimeout = 5000;

View File

@@ -1,4 +1,4 @@
import '../demo/src/polyfills.ts'; import '../scripts/polyfills.ts';
import 'zone.js/dist/long-stack-trace-zone'; import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js'; import 'zone.js/dist/proxy.js';

22
test/tsconfig.json Normal file
View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"target": "es2015",
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"../scripts/typings.d.ts",
"test.ts",
"../scripts/polyfills.ts",
],
"include": [
"../src/**/*.spec.ts",
"../demo/src/**/*.spec.ts"
]
}