Skip to content

Commit 5f2e8ab

Browse files
authored
refactor: build process (#117)
* Refactors the build process to use the TS compiler directly for proper source maps. * Uses NGC to output the necessary metadata files. * Fixes errors when compiling the module with AoT. * Reverts the build process to use ES6 instead of TS. * Cleans up the dependencies.
1 parent ef59213 commit 5f2e8ab

24 files changed

+198
-237
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ from the defaults.
7777

7878
```typescript
7979
import {NgModule} from '@angular/core';
80-
import {RoundProgressModule, RoundProgressConfig} from 'round-progress';
80+
import {RoundProgressModule, RoundProgressConfig} from 'angular-svg-round-progressbar';
8181

8282
@NgModule({
8383
imports: [RoundProgressModule]

demo/demo.css

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
box-sizing: border-box;
33
}
44

5-
body{
5+
body {
66
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
77
background: #fafafa;
88
}
99

10-
h2{
10+
h2 {
1111
margin: 0 0 40px;
1212
}
1313

@@ -21,13 +21,13 @@ h2{
2121
clear: both;
2222
}
2323

24-
.progress-wrapper{
24+
.progress-wrapper {
2525
position: relative;
2626
margin: 20px auto;
2727
font-size: 40px;
2828
}
2929

30-
.current{
30+
.current {
3131
position: absolute;
3232
color: #bbb;
3333
font-weight: 100;
@@ -38,7 +38,7 @@ round-progress {
3838
margin: auto;
3939
}
4040

41-
.container{
41+
.container {
4242
width: 100%;
4343
max-width: 650px;
4444
margin: 40px auto 80px;
@@ -49,7 +49,7 @@ round-progress {
4949
border-radius: 4px;
5050
}
5151

52-
button{
52+
button {
5353
display: inline-block;
5454
padding: 10px 20px;
5555
background: #45ccce;
@@ -62,40 +62,36 @@ button{
6262
margin: 0 5px 5px 0;
6363
}
6464

65-
form{
65+
form {
6666
text-align: left;
6767
max-width: 350px;
6868
margin: 30px auto;
6969
}
7070

71-
form > div{
71+
form > div {
7272
margin-bottom: 15px;
7373
}
7474

75-
input, select{
75+
input, select {
7676
float: right;
7777
padding: 5px;
7878
width: 150px;
7979
}
8080

81-
input[type='checkbox']{
81+
input[type='checkbox'] {
8282
width: auto;
8383
}
8484

85-
input[type='color']{
85+
input[type='color'] {
8686
height: 30px;
8787
}
8888

89-
.back{
89+
.back {
9090
position: fixed;
9191
top: 5px;
9292
right: 5px;
9393
}
9494

95-
.ng-cloak{
96-
display: none;
97-
}
98-
9995
.loading {
10096
position: fixed;
10197
top: 50%;
@@ -107,7 +103,7 @@ input[type='color']{
107103
color: #bbb;
108104
}
109105

110-
@media(max-width: 650px){
106+
@media (max-width: 650px) {
111107
body {
112108
padding: 12.5px;
113109
}

demo/src/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
22
import {DemoModule} from './demo.module';
33

4-
const platform = platformBrowserDynamic();
5-
platform.bootstrapModule(DemoModule);
4+
platformBrowserDynamic().bootstrapModule(DemoModule);

demo/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"target": "es5",
1212
"stripInternal": true,
1313
"baseUrl": ".",
14+
"outDir": "./dist",
1415
"paths": {
1516
"round-progress": [
1617
"./round-progress"

gulp/constants.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
SRC: './src',
3+
DIST: './dist',
4+
DEMO: './demo/',
5+
DEMO_DIST: './demo/round-progress'
6+
}

gulp/constants.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

gulp/demo.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const gulp = require('gulp');
2+
const path = require('path');
3+
const ghPages = require('gulp-gh-pages');
4+
const runSequence = require('run-sequence');
5+
6+
const DEMO = require('./constants').DEMO;
7+
const clean = require('./tasks/clean');
8+
const server = require('./tasks/server');
9+
const copy = require('./tasks/copy');
10+
const compile = require('./tasks/compile');
11+
12+
gulp.task('demo:clean', clean(path.join(DEMO, '{vendor,dist}')));
13+
gulp.task('demo:server', server(DEMO));
14+
gulp.task('demo:gh-pages', () => gulp.src(path.join(DEMO, '**/*')).pipe(ghPages()));
15+
gulp.task('demo:ts', compile.tsc(DEMO));
16+
17+
gulp.task('demo:assets', copy(
18+
'node_modules',
19+
path.join(DEMO, 'vendor'),
20+
[
21+
'@angular/**/*.umd.js',
22+
'core-js/client/*.min.+(js|js.map)',
23+
'rxjs/**/*.+(js|js.map)',
24+
'systemjs/dist/*.js',
25+
'zone.js/dist/*.js'
26+
]
27+
));
28+
29+
gulp.task('demo:build', done => {
30+
runSequence('demo:clean', 'demo:assets', 'demo:ts', done);
31+
});
32+
33+
gulp.task('demo:watch', () => {
34+
gulp.watch(path.join(DEMO, 'src/**/*.ts'), ['demo:ts']);
35+
});
36+
37+
gulp.task('demo:deploy', done => {
38+
runSequence('demo:build', 'demo:gh-pages', done);
39+
});

gulp/demo.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

gulp/gulpfile.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

gulp/module.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const gulp = require('gulp');
2+
const path = require('path');
3+
const runSequence = require('run-sequence');
4+
5+
const compile = require('./tasks/compile');
6+
const clean = require('./tasks/clean');
7+
const constants = require('./constants');
8+
9+
gulp.task('module:clean', clean(constants.DIST));
10+
gulp.task('module:ts:tsc', compile.tsc(constants.SRC));
11+
gulp.task('module:ts:ngc', compile.ngc(constants.SRC));
12+
gulp.task('module:ts', ['module:ts:tsc', 'module:ts:ngc']);
13+
14+
gulp.task('module:ts:demo', compile.tsc(constants.SRC, {
15+
'--outDir': constants.DEMO_DIST
16+
}));
17+
18+
gulp.task('module:ts:umd', compile.tsc(constants.SRC, {
19+
'--outFile': path.join(constants.DIST, 'round-progress.umd.js'),
20+
'--module': 'system'
21+
}));
22+
23+
gulp.task('module:watch', () => {
24+
gulp.watch(path.join(constants.SRC, '**/*.ts'), ['module:ts:demo']);
25+
});
26+
27+
gulp.task('module:build', done => {
28+
runSequence('module:clean', 'module:ts', 'module:ts:umd', done);
29+
});
30+
31+
gulp.task('deploy', done => {
32+
runSequence('module:build', 'demo:deploy', done);
33+
});

0 commit comments

Comments
 (0)