Skip to content

Commit

Permalink
feat(docs): updating the structure stackblitz examples (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimenovoleg authored Dec 24, 2019
1 parent 9f4c76a commit 44cd544
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 14 deletions.
8 changes: 7 additions & 1 deletion packages/docs/src/app/shared/stackblitz/stackblitz-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ const DOCS_CONTENT_PATH = 'docs-content/examples-source/';

const TEMPLATE_PATH = 'assets/stackblitz/';
const TEMPLATE_FILES = [
'.editorconfig',
'.gitignore',
'index.html',
'tsconfig.json',
'tsconfig.app.json',
'tsconfig.spec.json',
'styles.css',
'polyfills.ts',
'.angular-cli.json',
'angular.json',
'main.ts',
'mosaic-module.ts'
];
Expand All @@ -50,6 +55,7 @@ const dependencies = {
rxjs: '^6.4.0',
'web-animations-js': '^2.3.1',
messageformat: '^2.0.5',
'tslib': '^1.10.0',
'zone.js': '^0.8.14',
moment: '^2.24.0'
};
Expand Down
7 changes: 0 additions & 7 deletions packages/docs/src/assets/stackblitz/.angular-cli.json

This file was deleted.

15 changes: 15 additions & 0 deletions packages/docs/src/assets/stackblitz/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
31 changes: 31 additions & 0 deletions packages/docs/src/assets/stackblitz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# firebase artifacts
.firebase

package-lock.json

.env

# folders
node_modules/
coverage/
dist/
tmp/
temp/

# Example module file will be auto-generated.
/packages/mosaic-examples/example-module.ts

# IDEs
/.idea
/.vscode
/.awcache

# misc
.DS_Store
Thumbs.db
npm-debug.log
*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
64 changes: 64 additions & 0 deletions packages/docs/src/assets/stackblitz/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"mosaic-docs": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "dist",
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [],
"styles": [
"styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "mosaic-docs:build"
},
"configurations": {
"production": {
"browserTarget": "mosaic-docs:build:production"
}
}
}
}
}
},
"defaultProject": "mosaic-docs"
}
2 changes: 2 additions & 0 deletions packages/docs/src/assets/stackblitz/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Mono:300,400,500,700&display=swap"
rel="stylesheet">
<div class="mc-app-background basic-container">
<mosaic-docs-example>loading</mosaic-docs-example>
</div>
Expand Down
2 changes: 0 additions & 2 deletions packages/docs/src/assets/stackblitz/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'web-animations-js';
14 changes: 14 additions & 0 deletions packages/docs/src/assets/stackblitz/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"**/*.d.ts"
]
}
34 changes: 34 additions & 0 deletions packages/docs/src/assets/stackblitz/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"strictNullChecks": true
},
"exclude": [
"assets"
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
18 changes: 18 additions & 0 deletions packages/docs/src/assets/stackblitz/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
11 changes: 7 additions & 4 deletions packages/docs/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
// tslint:disable-next-line:no-import-side-effect
import './polyfills.ts';

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/';
import { environment } from './environments/environment';
// tslint:disable-next-line:no-import-side-effect
import './polyfills.ts';
import { unregisterServiceWorkers } from './unregister-service-workers';


// Unregister all installed service workers and force reload the page if there was
// an old service worker from a previous version of the docs.
unregisterServiceWorkers()
.then(hadServiceWorker => hadServiceWorker && location.reload(true));
.then((hadServiceWorker) => hadServiceWorker && location.reload());

// tslint:disable-next-line:blank-lines
if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
platformBrowserDynamic().bootstrapModule(AppModule)
// tslint:disable-next-line:no-console
.catch((err) => console.error(err));

0 comments on commit 44cd544

Please sign in to comment.