Use Angular CLI instead of ngm for building

Some commands:

npm run build      - to build the library.  Output is in dist/ng2-file-upload/.
npm run test       - to run tests.  Coverage report is in coverage/ as before.
npm run demo.serve - to build demo application and serve it through browsersync
npm run start      - to run demo application using `ng serve`.  Requires the library to be built and linked first.
This commit is contained in:
Eugene Arshinov
2019-08-26 22:30:39 +03:00
committed by Evgeny Arshinov
parent 6cb3f87e57
commit 7a342268bb
18 changed files with 1471 additions and 1497 deletions

View File

@@ -4,6 +4,20 @@
"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",
@@ -44,38 +58,48 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ng2-file-upload:build"
"browserTarget": "ng2-file-upload-demo:build"
},
"configurations": {
"production": {
"browserTarget": "ng2-file-upload:build: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": "demo/src/../../scripts/test.ts",
"karmaConfig": "karma.conf.js",
"main": "test/test.ts",
"karmaConfig": "test/karma.conf.js",
"scripts": [],
"styles": [],
"tsConfig": "demo/src/tsconfig.json",
"assets": [
"demo/src/assets"
]
"tsConfig": "test/tsconfig.json"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [],
"exclude": []
"tsConfig": [
"src/tsconfig.json",
"demo/src/tsconfig.json",
"test/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ng2-file-upload",
"defaultProject": "ng2-file-upload-demo",
"schematics": {
"@schematics/angular:component": {
"prefix": "",

View File

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

View File

@@ -1,32 +1,25 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers": false,
"lib": ["es6", "dom"],
"types": [
"jasmine",
"webpack"
],
"mapRoot": "./",
"module": "esnext",
"moduleResolution": "node",
"outDir": "../temp/out-tsc",
"sourceMap": true,
"target": "es2015",
"typeRoots": [
"../node_modules/@types"
]
"target": "es2015"
},
"files": [
"../../scripts/typings.d.ts",
"main.ts",
"polyfills.ts"
"../../scripts/polyfills.ts"
],
"include": [
"*.d.ts",
"../../src/spec/*.spec.ts",
"../../scripts/test.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;
}
}

2785
package-lock.json generated

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",
"demo.serve": "run-s build link demo.build lite-server",
"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",
"link": "ngm link -p src --here",
"link": "cd dist/ng2-file-upload/ && npm link && cd ../../ && npm link ng2-file-upload",
"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/**\"",
"flow.changelog": "conventional-changelog -i CHANGELOG.md -s -p angular",
"flow.github-release": "conventional-github-releaser -p angular",
"build": "ngm build -p src --clean",
"build.watch": "ngm build -p src --watch --skip-bundles",
"start": "ng serve --aot",
"build": "ng build ng2-file-upload",
"build.watch": "ng build ng2-file-upload --watch",
"start": "ng serve ng2-file-upload-demo --aot",
"pretest": "run-s lint build link",
"test": "ng test",
"test-coverage": "ng test --code-coverage",
"test": "ng test ng2-file-upload-test",
"test-coverage": "ng test ng2-file-upload-test --code-coverage",
"version": "npm run flow.changelog && git add -A"
},
"main": "bundles/ng2-file-upload.umd.js",
"module": "index.js",
"typings": "index.d.ts",
"keywords": [
"angular2",
"bootstrap",
@@ -46,6 +43,7 @@
"peerDependencies": {},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.0",
"@angular-devkit/build-ng-packagr": "^0.803.0",
"@angular/cli": "^8.3.0",
"@angular/common": "^8.2.3",
"@angular/compiler": "^8.2.3",
@@ -74,7 +72,7 @@
"gh-pages": "0.12.0",
"gitignore-to-glob": "0.3.0",
"google-code-prettify": "1.0.5",
"html-loader": "0.4.4",
"html-loader": "^0.5.5",
"jasmine": "2.5.3",
"jasmine-core": "2.5.2",
"jasmine-data-provider": "2.2.0",
@@ -88,19 +86,21 @@
"karma-sauce-launcher": "1.1.0",
"lite-server": "2.2.2",
"lodash": "4.17.4",
"markdown-loader": "^0.1.7",
"markdown-loader": "^5.1.0",
"marked": "0.3.6",
"ngm-cli": "0.4.0",
"ng-packagr": "^5.5.0",
"ngx-bootstrap": "1.6.6",
"npm-run-all": "^4.0.1",
"pre-commit": "1.2.2",
"protractor": "5.0.0",
"raw-loader": "^3.1.0",
"reflect-metadata": "0.1.9",
"require-dir": "0.3.1",
"rxjs": "^6.5.2",
"systemjs-builder": "0.15.34",
"ts-helpers": "^1.1.1",
"ts-node": "2.0.0",
"tsickle": "^0.37.0",
"tslint": "^5.19.0",
"tslint-config-valorsoft": "^2.2.1",
"typedoc": "0.5.5",

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 {
/* 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": {
"baseUrl": ".",
"outDir": "../dist",
"target": "es5",
"module": "commonjs",
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
@@ -14,24 +15,12 @@
"stripInternal": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"lib": ["dom", "es6"],
"types": [
"jasmine",
"webpack"
],
"typeRoots": [
"../node_modules/@types"
]
"lib": ["dom", "es6"]
},
"include": [
"../scripts/typings.d.ts"
],
"exclude": [
"node_modules"
],
"files": [
"../scripts/typings.d.ts",
"./ng2-file-upload.ts",
"./index.ts"
],
"angularCompilerOptions": {
"genDir": "../temp/factories"
}
"**/*.spec.ts"
]
}

View File

@@ -1,7 +1,7 @@
// Karma configuration file, see link for more information
// 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) {
const configuration = {
@@ -14,7 +14,7 @@ module.exports = function (config) {
require('@angular-devkit/build-angular/plugins/karma')
],
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, '../coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: false
},

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/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"
]
}