Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
build: angular6
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Jun 3, 2018
1 parent fa3e179 commit 9c8c438
Show file tree
Hide file tree
Showing 56 changed files with 1,861 additions and 789 deletions.
55 changes: 0 additions & 55 deletions .angular-cli.json

This file was deleted.

8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ yarn.lock
.lib

# ignore build and dist for now
/demo/dist
/dist
/coverage
/tmp
/out-tsc
/__gen_lib
/publish-es5
/publish-es2015
/publish

# ignore inline compiling
/logs
Expand Down
Empty file added .prettierignore
Empty file.
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
}
}
25 changes: 18 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
sudo: false
sudo: required
language: node_js
node_js:
- "8.5.0"
- "8.11.0"

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

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

git:
depth: 1
Expand All @@ -14,8 +24,9 @@ before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

install:
- npm install

script:
- npm run test
- npm run $TASK
- |
if [ "$TASK" = "test" ]; then
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
fi
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ngx-umeditor
Angular2.x for Baidu UMeditor([UEditor](https://github.com/cipchk/ngx-ueditor)
Angular for Baidu UMeditor([UEditor](https://github.com/cipchk/ngx-ueditor)

[![NPM version](https://img.shields.io/npm/v/ngx-umeditor.svg)](https://www.npmjs.com/package/ngx-umeditor)
[![Build Status](https://travis-ci.org/cipchk/ngx-umeditor.svg?branch=master)](https://travis-ci.org/cipchk/ngx-umeditor)
Expand Down Expand Up @@ -30,7 +30,7 @@ npm install ngx-umeditor --save
import { UMeditorModule } from 'ngx-umeditor';

@NgModule({
imports: [BrowserModule, UMeditorModule ],
imports: [BrowserModule, UMeditorModule.forRoot() ],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
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-umeditor": {
"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": ["src/styles.css"],
"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-umeditor:build"
},
"configurations": {
"production": {
"browserTarget": "ngx-umeditor:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-umeditor: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": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
}
}
}
},
"ngx-umeditor-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "ngx-umeditor:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["e2e/tsconfig.e2e.json"],
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"defaultProject": "ngx-umeditor",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
54 changes: 54 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -u -e -o pipefail

readonly currentDir=$(cd $(dirname $0); pwd)
cd ${currentDir}

rm -rf publish
rm -rf __gen_lib
rm -rf publish-es2015
cp -r lib __gen_lib
node ./scripts/inline-template.js

echo 'Compiling to es2015 via Angular compiler'
$(npm bin)/ngc -p tsconfig-build.json -t es2015 --outDir publish-es2015/src

echo 'Bundling to es module of es2015'
export ROLLUP_TARGET=esm
$(npm bin)/rollup -c rollup.config.js -f es -i publish-es2015/src/index.js -o publish-es2015/esm2015/umeditor.js

echo 'Compiling to es5 via Angular compiler'
$(npm bin)/ngc -p tsconfig-build.json -t es5 --outDir publish-es5/src

echo 'Bundling to es module of es5'
export ROLLUP_TARGET=esm
$(npm bin)/rollup -c rollup.config.js -f es -i publish-es5/src/index.js -o publish-es5/esm5/umeditor.js

echo 'Bundling to umd module of es5'
export ROLLUP_TARGET=umd
$(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/umeditor.js -o publish-es5/bundles/umeditor.umd.js

echo 'Bundling to minified umd module of es5'
export ROLLUP_TARGET=mumd
$(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/umeditor.js -o publish-es5/bundles/umeditor.umd.min.js

echo 'Unifying publish folder'
mv publish-es5 publish
mv publish-es2015/esm2015 publish/esm2015
rm -rf publish-es2015

echo 'Cleaning up temporary files'
rm -rf __gen_lib
rm -rf publish/src/*.js
rm -rf publish/src/**/*.js

echo 'Normalizing entry files'
sed -e "s/from '.\//from '.\/src\//g" publish/src/index.d.ts > publish/umeditor.d.ts
sed -e "s/\":\".\//\":\".\/src\//g" publish/src/index.metadata.json > publish/umeditor.metadata.json
rm publish/src/index.d.ts publish/src/index.metadata.json

echo 'Copying package.json'
cp package.json publish/package.json
echo 'Copying README.md'
cp README.md publish/README.md
Loading

0 comments on commit 9c8c438

Please sign in to comment.