Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

Commit 42a61bf

Browse files
authored
refactor(app-shell): redo project layout, build system, test runner, package layout, and exports (#102)
Also moves shell-parser to an experimental directory until it can be updated.
1 parent d585cc9 commit 42a61bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+379
-601
lines changed

app-shell/angular-cli-build.js

-22
This file was deleted.

app-shell/angular-cli.json

-25
This file was deleted.

app-shell/config/karma-test-shim.js

-52
This file was deleted.

app-shell/config/karma.conf.js

-52
This file was deleted.

app-shell/gulpfile.ts

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
declare var require;
2+
3+
const childProcess = require('child_process');
4+
const commonjs = require('rollup-plugin-commonjs');
5+
const gulp = require('gulp');
6+
const jsmn = require('gulp-jasmine');
7+
const rimraf = require('rimraf');
8+
const rollup = require('rollup');
9+
const nodeResolve = require('rollup-plugin-node-resolve');
10+
const runSequence = require('run-sequence');
11+
12+
13+
gulp.task('clean', done => {
14+
rimraf('./tmp', () => {
15+
rimraf('./dist', done);
16+
});
17+
});
18+
19+
gulp.task('build', done => runSequence(
20+
'clean',
21+
'task:build',
22+
'task:deploy',
23+
done));
24+
25+
gulp.task('test', done => runSequence(
26+
'clean',
27+
'task:test',
28+
done));
29+
30+
gulp.task('task:build', done => runSequence(
31+
'task:app:compile_esm',
32+
'task:app:bundle',
33+
done));
34+
35+
gulp.task('task:test', done => runSequence(
36+
'task:app:compile_es5',
37+
'task:app:test',
38+
done))
39+
40+
gulp.task('task:deploy', done => runSequence(
41+
[
42+
'task:app:deploy',
43+
'task:bundles:deploy',
44+
'task:package:deploy',
45+
],
46+
done));
47+
48+
gulp.task('task:app:compile_es5', () => {
49+
childProcess.execSync('node_modules/.bin/tsc -p tsconfig.es5.json');
50+
});
51+
52+
gulp.task('task:app:compile_esm', () => {
53+
childProcess.execSync('node_modules/.bin/ngc -p tsconfig.esm.json');
54+
});
55+
56+
gulp.task('task:app:bundle', done => rollup
57+
.rollup({
58+
entry: 'tmp/esm/src/index.js',
59+
plugins: [
60+
nodeResolve({jsnext: true, main: true}),
61+
commonjs({
62+
include: 'node_modules/**',
63+
}),
64+
],
65+
external: [
66+
'@angular/core',
67+
]
68+
})
69+
.then(bundle => bundle.write({
70+
format: 'umd',
71+
moduleName: 'ng.appShell',
72+
dest: 'tmp/es5/bundles/app-shell.umd.js',
73+
globals: {
74+
'@angular/core': 'ng.core',
75+
},
76+
})));
77+
78+
gulp.task('task:app:deploy', () => gulp
79+
.src([
80+
'tmp/esm/src/index.d.ts',
81+
'tmp/esm/src/index.js',
82+
'tmp/esm/src/index.js.map',
83+
'tmp/esm/src/index.metadata.json',
84+
'tmp/esm/src/app/**/*.d.ts',
85+
'tmp/esm/src/app/**/*.js',
86+
'tmp/esm/src/app/**/*.js.map',
87+
'tmp/esm/src/app/**/*.metadata.json',
88+
], {base: 'tmp/esm/src'})
89+
.pipe(gulp.dest('dist')));
90+
91+
gulp.task('task:app:test', () => gulp
92+
.src([
93+
'tmp/es5/src/unit_tests.js',
94+
], {base: '.'})
95+
.pipe(jsmn({
96+
verbose: true,
97+
})));
98+
99+
gulp.task('task:bundles:deploy', () => gulp
100+
.src([
101+
'tmp/es5/bundles/**/*.js',
102+
'tmp/es5/bundles/**/*.js.map',
103+
], {base: 'tmp/es5'})
104+
.pipe(gulp.dest('dist')));
105+
106+
gulp.task('task:package:deploy', () => gulp
107+
.src([
108+
'package.json'
109+
])
110+
.pipe(gulp.dest('dist')));

app-shell/package.json

+45-44
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
{
2-
"name": "app-shell",
3-
"version": "0.0.0",
2+
"name": "@angular/app-shell",
3+
"description": "App Shell runtime library for Angular 2 Progressive Web Apps.",
4+
"version": "0.1.0",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/angular/mobile-toolkit.git"
8+
},
9+
"contributors": [
10+
"Jeff Cross <[email protected]>",
11+
"Minko Gechev <[email protected]>",
12+
"Alex Rickabaugh <[email protected]>"
13+
],
14+
"keywords": [
15+
"angular2",
16+
"pwa",
17+
"progressive web apps",
18+
"app shell"
19+
],
420
"license": "MIT",
521
"angular-cli": {},
6-
"scripts": {
7-
"start": "ng server",
8-
"postinstall": "typings install",
9-
"lint": "tslint \"src/**/*.ts\"",
10-
"format": "clang-format -i -style=file --glob=src/**/*.ts",
11-
"pree2e": "webdriver-manager update",
12-
"e2e": "protractor",
13-
"clean": "rm -rf dist",
14-
"build": "mkdir -p dist/app && ngc -p src/tsconfig.publish.json && cp src/package.json dist/app/package.json",
15-
"build_parser": "echo '' > dist/vendor/parse5/lib/tokenizer/named_entity_trie.js && browserify dist/app/shell-parser/index.js -s shellParserFactory > dist/app/shell-parser.js && rm -rf dist/app/shell-parser && rm -rf dist/app/vendor",
16-
"build_publish": "npm run clean && npm run build"
17-
},
22+
"scripts": {},
23+
"main": "bundles/app-shell.umd.js",
24+
"module": "index.js",
1825
"private": true,
19-
"dependencies": {
20-
"@angular/common": "^2.0.0-rc.6",
21-
"@angular/compiler": "^2.0.0-rc.6",
22-
"@angular/core": "^2.0.0-rc.6",
23-
"@angular/platform-browser": "^2.0.0-rc.6",
24-
"@angular/platform-browser-dynamic": "^2.0.0-rc.6",
25-
"es6-shim": "^0.35.0",
26-
"reflect-metadata": "0.1.3",
27-
"rxjs": "5.0.0-beta.11",
28-
"systemjs": "0.19.26",
29-
"zone.js": "^0.6.17"
30-
},
26+
"dependencies": {},
3127
"devDependencies": {
32-
"@angular/compiler-cli": "^0.6.0",
33-
"@angular/platform-server": "^2.0.0-rc.6",
34-
"angular-cli": "0.0.*",
35-
"browserify": "^13.0.1",
36-
"clang-format": "^1.0.35",
37-
"codelyzer": "0.0.14",
38-
"ember-cli-inject-live-reload": "^1.4.0",
39-
"jasmine-core": "^2.4.1",
40-
"jasmine-spec-reporter": "^2.4.0",
41-
"karma": "^0.13.15",
42-
"karma-chrome-launcher": "^0.2.3",
43-
"karma-jasmine": "^0.3.8",
44-
"parse5": "2.1.5",
45-
"protractor": "^3.3.0",
46-
"ts-node": "^0.5.5",
47-
"tslint": "^3.6.0",
48-
"typescript": "^2.0.2",
49-
"typings": "^1.0.4"
28+
"@angular/common": "^2.0.0",
29+
"@angular/compiler": "^2.0.0",
30+
"@angular/compiler-cli": "^0.6.2",
31+
"@angular/core": "^2.0.0",
32+
"@angular/platform-browser": "^2.0.0",
33+
"@angular/platform-browser-dynamic": "^2.0.0",
34+
"@angular/platform-server": "^2.0.0",
35+
"@types/jasmine": "^2.2.34",
36+
"gulp": "^3.9.1",
37+
"gulp-jasmine": "^2.4.1",
38+
"reflect-metadata": "^0.1.8",
39+
"rimraf": "^2.5.4",
40+
"rollup": "^0.36.0",
41+
"rollup-plugin-commonjs": "^5.0.4",
42+
"rollup-plugin-node-resolve": "^2.0.0",
43+
"run-sequence": "^1.2.2",
44+
"rxjs": "^5.0.0-beta.12",
45+
"ts-node": "^1.3.0",
46+
"typescript": "^2.0.3",
47+
"zone.js": "^0.6.25"
48+
},
49+
"peerDependencies": {
50+
"@angular/core": "^2.0.0"
5051
}
5152
}

app-shell/public/.gitignore

Whitespace-only changes.

app-shell/public/.npmignore

Whitespace-only changes.

app-shell/src/app/index.ts

+3-28
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
import { Type, NgModule, ModuleWithProviders } from '@angular/core';
2-
import { ShellRender } from './shell-render.directive';
3-
import { ShellNoRender } from './shell-no-render.directive';
4-
import { IS_PRERENDER } from './is-prerender.service';
5-
import { APP_SHELL_RUNTIME_PROVIDERS, APP_SHELL_BUILD_PROVIDERS } from './is-prerender.service';
6-
7-
export * from './is-prerender.service';
8-
export * from './shell-no-render.directive';
9-
export * from './shell-render.directive';
10-
11-
const APP_SHELL_DIRECTIVES: Type<any>[] = [
12-
ShellRender,
13-
ShellNoRender
14-
];
15-
16-
@NgModule({
17-
exports: APP_SHELL_DIRECTIVES,
18-
declarations: APP_SHELL_DIRECTIVES
19-
})
20-
export class AppShellModule {
21-
static forRoot(): ModuleWithProviders {
22-
return {
23-
ngModule: AppShellModule,
24-
providers: [APP_SHELL_RUNTIME_PROVIDERS, APP_SHELL_BUILD_PROVIDERS]
25-
};
26-
}
27-
}
28-
1+
export * from './module';
2+
export * from './prerender';
3+
export * from './shell';

0 commit comments

Comments
 (0)