diff --git a/packages/docs/src/app/shared/stackblitz/stackblitz-writer.ts b/packages/docs/src/app/shared/stackblitz/stackblitz-writer.ts index 5f5e8b444..541e05fde 100644 --- a/packages/docs/src/app/shared/stackblitz/stackblitz-writer.ts +++ b/packages/docs/src/app/shared/stackblitz/stackblitz-writer.ts @@ -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' ]; @@ -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' }; diff --git a/packages/docs/src/assets/stackblitz/.angular-cli.json b/packages/docs/src/assets/stackblitz/.angular-cli.json deleted file mode 100644 index 60fce6cd7..000000000 --- a/packages/docs/src/assets/stackblitz/.angular-cli.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "apps": [{ - "styles": [ - "styles.css" - ] - }] -} diff --git a/packages/docs/src/assets/stackblitz/.editorconfig b/packages/docs/src/assets/stackblitz/.editorconfig new file mode 100644 index 000000000..90a33c0ed --- /dev/null +++ b/packages/docs/src/assets/stackblitz/.editorconfig @@ -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 diff --git a/packages/docs/src/assets/stackblitz/.gitignore b/packages/docs/src/assets/stackblitz/.gitignore new file mode 100644 index 000000000..8a280da5e --- /dev/null +++ b/packages/docs/src/assets/stackblitz/.gitignore @@ -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.* diff --git a/packages/docs/src/assets/stackblitz/angular.json b/packages/docs/src/assets/stackblitz/angular.json new file mode 100644 index 000000000..642e3f6cd --- /dev/null +++ b/packages/docs/src/assets/stackblitz/angular.json @@ -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" +} diff --git a/packages/docs/src/assets/stackblitz/index.html b/packages/docs/src/assets/stackblitz/index.html index 0f260a982..8188f35d6 100644 --- a/packages/docs/src/assets/stackblitz/index.html +++ b/packages/docs/src/assets/stackblitz/index.html @@ -1,3 +1,5 @@ +
loading
diff --git a/packages/docs/src/assets/stackblitz/polyfills.ts b/packages/docs/src/assets/stackblitz/polyfills.ts index a7e48b8d7..bd3fca796 100644 --- a/packages/docs/src/assets/stackblitz/polyfills.ts +++ b/packages/docs/src/assets/stackblitz/polyfills.ts @@ -1,4 +1,2 @@ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; import 'zone.js/dist/zone'; import 'web-animations-js'; diff --git a/packages/docs/src/assets/stackblitz/tsconfig.app.json b/packages/docs/src/assets/stackblitz/tsconfig.app.json new file mode 100644 index 000000000..638d82b4a --- /dev/null +++ b/packages/docs/src/assets/stackblitz/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "main.ts", + "polyfills.ts" + ], + "include": [ + "**/*.d.ts" + ] +} diff --git a/packages/docs/src/assets/stackblitz/tsconfig.json b/packages/docs/src/assets/stackblitz/tsconfig.json new file mode 100644 index 000000000..6c94255c6 --- /dev/null +++ b/packages/docs/src/assets/stackblitz/tsconfig.json @@ -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 + } +} diff --git a/packages/docs/src/assets/stackblitz/tsconfig.spec.json b/packages/docs/src/assets/stackblitz/tsconfig.spec.json new file mode 100644 index 000000000..cd435828e --- /dev/null +++ b/packages/docs/src/assets/stackblitz/tsconfig.spec.json @@ -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" + ] +} diff --git a/packages/docs/src/main.ts b/packages/docs/src/main.ts index 0763ba2aa..04d8d2f69 100644 --- a/packages/docs/src/main.ts +++ b/packages/docs/src/main.ts @@ -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));