From f9988392df1926f4995061681d72c7eb5a53c5ba Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 12 Apr 2017 09:54:10 -0700 Subject: [PATCH 1/2] build: create example package * Initial refactoring that allows Material to build multiple packages using a shared logic. --- .../closure-compiler/build-devapp-bundle.sh | 4 +- scripts/release/publish-build-artifacts.sh | 2 +- src/{lib => }/README.md | 0 .../autocomplete-overview-example.ts | 2 + src/examples/package.json | 29 ++++ src/examples/public_api.ts | 2 + src/examples/tsconfig-build.json | 34 +++++ src/tsconfig.json | 7 +- tools/gulp/constants.ts | 7 +- tools/gulp/gulpfile.ts | 1 + tools/gulp/tasks/aot.ts | 6 +- tools/gulp/tasks/docs.ts | 1 - tools/gulp/tasks/examples.ts | 52 +++++++ tools/gulp/tasks/library.ts | 39 +----- tools/gulp/tasks/release.ts | 128 ++---------------- tools/gulp/util/inline-resources.ts | 34 +++++ tools/gulp/util/package-build.ts | 111 +++++++++++++++ tools/gulp/util/rollup-helper.ts | 2 + 18 files changed, 299 insertions(+), 162 deletions(-) rename src/{lib => }/README.md (100%) create mode 100644 src/examples/package.json create mode 100644 src/examples/public_api.ts create mode 100644 src/examples/tsconfig-build.json create mode 100644 tools/gulp/tasks/examples.ts create mode 100644 tools/gulp/util/inline-resources.ts create mode 100644 tools/gulp/util/package-build.ts diff --git a/scripts/closure-compiler/build-devapp-bundle.sh b/scripts/closure-compiler/build-devapp-bundle.sh index a292742d526f..2670df103d39 100755 --- a/scripts/closure-compiler/build-devapp-bundle.sh +++ b/scripts/closure-compiler/build-devapp-bundle.sh @@ -39,7 +39,7 @@ OPTS=( # List of path prefixes to be removed from ES6 & CommonJS modules. "--js_module_root=dist/packages" - "--js_module_root=dist/release" + "--js_module_root=dist/releases/material" "--js_module_root=node_modules/@angular/core" "--js_module_root=node_modules/@angular/common" "--js_module_root=node_modules/@angular/compiler" @@ -57,7 +57,7 @@ OPTS=( "--debug" # Include the Material FESM bundle - dist/release/@angular/material.js + dist/releases/material/@angular/material.js # Include all Angular FESM bundles. node_modules/@angular/core/@angular/core.js diff --git a/scripts/release/publish-build-artifacts.sh b/scripts/release/publish-build-artifacts.sh index 5b508ad2cedd..3c6c96b44fe1 100755 --- a/scripts/release/publish-build-artifacts.sh +++ b/scripts/release/publish-build-artifacts.sh @@ -8,7 +8,7 @@ set -e -o pipefail # Go to the project root directory cd $(dirname $0)/../.. -buildDir="dist/release" +buildDir="dist/releases/material" buildVersion=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json) commitSha=$(git rev-parse --short HEAD) diff --git a/src/lib/README.md b/src/README.md similarity index 100% rename from src/lib/README.md rename to src/README.md diff --git a/src/examples/autocomplete-overview/autocomplete-overview-example.ts b/src/examples/autocomplete-overview/autocomplete-overview-example.ts index 7b28b28b998b..fc2ca560b463 100644 --- a/src/examples/autocomplete-overview/autocomplete-overview-example.ts +++ b/src/examples/autocomplete-overview/autocomplete-overview-example.ts @@ -1,6 +1,8 @@ import {Component} from '@angular/core'; import {FormControl} from '@angular/forms'; + import 'rxjs/add/operator/startWith'; +import 'rxjs/add/operator/map'; @Component({ selector: 'autocomplete-overview-example', diff --git a/src/examples/package.json b/src/examples/package.json new file mode 100644 index 000000000000..32ba85000ccc --- /dev/null +++ b/src/examples/package.json @@ -0,0 +1,29 @@ +{ + "name": "@angular/material-examples", + "version": "2.0.0-beta.3", + "description": "Angular Material", + "main": "./bundles/examples.umd.js", + "module": "./@angular/examples.es5.js", + "es2015": "./@angular/examples.js", + "typings": "./examples.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/angular/material2.git" + }, + "keywords": [ + "angular", + "material", + "material design", + "components" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/angular/material2/issues" + }, + "homepage": "https://github.com/angular/material2#readme", + "peerDependencies": { + "@angular/core": "^4.0.0", + "@angular/common": "^4.0.0", + "@angular/http": "^4.0.0" + } +} diff --git a/src/examples/public_api.ts b/src/examples/public_api.ts new file mode 100644 index 000000000000..fb5467a485a3 --- /dev/null +++ b/src/examples/public_api.ts @@ -0,0 +1,2 @@ +export * from './example-data'; +export * from './example-module'; diff --git a/src/examples/tsconfig-build.json b/src/examples/tsconfig-build.json new file mode 100644 index 000000000000..00be20c52159 --- /dev/null +++ b/src/examples/tsconfig-build.json @@ -0,0 +1,34 @@ +// TypeScript config file that is used to compile the examples. Target environment needs to be +// ES2015 since the build process will create FESM bundles using rollup. +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "stripInternal": false, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "outDir": "../../dist/packages/examples", + "paths": { + "@angular/material": [ + "../../dist/packages/material" + ] + }, + "rootDir": ".", + "sourceMap": true, + "inlineSources": true, + "target": "es2015", + "lib": ["es2015", "dom"], + "skipLibCheck": true, + "types": [] + }, + "files": [ + "public_api.ts" + ], + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "strictMetadataEmit": true, + "flatModuleOutFile": "index.js", + "skipTemplateCodegen": true + } +} diff --git a/src/tsconfig.json b/src/tsconfig.json index 9f199f2cf4a7..56ba5a12a6db 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -10,6 +10,11 @@ "inlineSources": true, "target": "es2015", "lib": ["es2015", "dom"], - "types": ["jasmine"] + "types": ["jasmine"], + "paths": { + "@angular/material": [ + "../../dist/packages/material" + ] + } } } diff --git a/tools/gulp/constants.ts b/tools/gulp/constants.ts index 199a6690dbb0..36ca0857eb92 100644 --- a/tools/gulp/constants.ts +++ b/tools/gulp/constants.ts @@ -13,12 +13,11 @@ export const DIST_BUNDLES = join(DIST_ROOT, 'bundles'); /** Output subdirectory where all library artifacts will be written (compiled JS, CSS, etc.) */ export const DIST_MATERIAL = join(DIST_ROOT, 'packages', 'material'); - -/** Output subdirectory where the npm package will be staged for publish */ -export const DIST_RELEASE = join(DIST_ROOT, 'release'); - export const DIST_DEMOAPP = join(DIST_ROOT, 'packages', 'demo-app'); export const DIST_E2EAPP = join(DIST_ROOT, 'packages', 'e2e-app'); +export const DIST_EXAMPLES = join(DIST_ROOT, 'packages', 'examples'); + +export const DIST_RELEASES = join(DIST_ROOT, 'releases'); export const COVERAGE_RESULT_FILE = join(DIST_ROOT, 'coverage', 'coverage-summary.json'); diff --git a/tools/gulp/gulpfile.ts b/tools/gulp/gulpfile.ts index 3268612e0052..0acef67e2f87 100644 --- a/tools/gulp/gulpfile.ts +++ b/tools/gulp/gulpfile.ts @@ -12,3 +12,4 @@ import './tasks/aot'; import './tasks/payload'; import './tasks/coverage'; import './tasks/library'; +import './tasks/examples'; diff --git a/tools/gulp/tasks/aot.ts b/tools/gulp/tasks/aot.ts index d75683101cfd..3676dfc5d356 100644 --- a/tools/gulp/tasks/aot.ts +++ b/tools/gulp/tasks/aot.ts @@ -1,6 +1,6 @@ import {task} from 'gulp'; import {copySync} from 'fs-extra'; -import {DIST_DEMOAPP, DIST_RELEASE} from '../constants'; +import {DIST_DEMOAPP, DIST_RELEASES} from '../constants'; import {sequenceTask, execNodeTask} from '../util/task_helpers'; import {join} from 'path'; @@ -11,7 +11,9 @@ task('aot:deps', sequenceTask('build:devapp', ':package:release', 'aot:copy-rele // As a workaround for https://github.com/angular/angular/issues/12249, we need to // copy the Material ESM output inside of the demo-app output. -task('aot:copy-release', () => copySync(DIST_RELEASE, join(DIST_DEMOAPP, 'material'))); +task('aot:copy-release', () => { + return copySync(join(DIST_RELEASES, 'material'), join(DIST_DEMOAPP, 'material')); +}); /** Build the demo-app and a release to confirm that the library is AOT-compatible. */ task('aot:build', sequenceTask('aot:deps', 'aot:compiler-cli')); diff --git a/tools/gulp/tasks/docs.ts b/tools/gulp/tasks/docs.ts index 793d07162cc9..499bf5baab55 100644 --- a/tools/gulp/tasks/docs.ts +++ b/tools/gulp/tasks/docs.ts @@ -48,7 +48,6 @@ const MARKDOWN_TAGS_TO_CLASS_ALIAS = [ 'code', ]; - /** Generate all docs content. */ task('docs', [ 'markdown-docs', diff --git a/tools/gulp/tasks/examples.ts b/tools/gulp/tasks/examples.ts new file mode 100644 index 000000000000..2b73a984cf65 --- /dev/null +++ b/tools/gulp/tasks/examples.ts @@ -0,0 +1,52 @@ +import {task, watch} from 'gulp'; +import {join} from 'path'; +import {main as tsc} from '@angular/tsc-wrapped'; +import {SOURCE_ROOT, DIST_BUNDLES, DIST_EXAMPLES} from '../constants'; +import {sequenceTask, sassBuildTask, copyTask, triggerLivereload} from '../util/task_helpers'; +import {createRollupBundle} from '../util/rollup-helper'; +import {transpileFile} from '../util/ts-compiler'; +import {buildModuleEntry, composeRelease} from '../util/package-build'; +import {ScriptTarget, ModuleKind} from 'typescript'; +import {writeFileSync} from 'fs'; + +// There are no type definitions available for these imports. +const inlineResources = require('../../../scripts/release/inline-resources'); +const uglify = require('uglify-js'); + +const examplesRoot = join(SOURCE_ROOT, 'examples'); +const tsconfigPath = join(examplesRoot, 'tsconfig-build.json'); + +// Paths to the different output directories. +const examplesOut = DIST_EXAMPLES; +const bundlesDir = DIST_BUNDLES; + +const examplesMain = join(examplesOut, 'public_api.js'); + +task('examples:clean-build', sequenceTask('clean', 'examples:build')); + +task('examples:build', sequenceTask( + // The examples depend on the library. Build the library first. + 'library:build', + // Build ESM and copy HTML assets to the dist. + ['examples:build:esm', 'examples:assets:html'], + // Inline assets into ESM output. + 'examples:assets:inline', + // Build bundles on top of inlined ESM output. + 'examples:build:bundles', +)); + +task('examples:release', ['examples:clean-build'], () => composeRelease('examples')); + +/** + * TypeScript compilation tasks. Tasks are creating ESM, FESM, UMD bundles for releases. + **/ + +task('examples:build:esm', () => tsc(tsconfigPath, {basePath: examplesRoot})); +task('examples:build:bundles', () => buildModuleEntry(examplesMain, 'examples')); + +/** + * Asset tasks. Copying and inlining CSS, HTML files into the ESM output. + **/ + +task('examples:assets:html', copyTask(join(examplesRoot, '**/*.+(html|css)'), examplesOut)); +task('examples:assets:inline', () => inlineResources(examplesOut)); diff --git a/tools/gulp/tasks/library.ts b/tools/gulp/tasks/library.ts index d55d3d354792..aacf1a4be046 100644 --- a/tools/gulp/tasks/library.ts +++ b/tools/gulp/tasks/library.ts @@ -5,6 +5,7 @@ import {SOURCE_ROOT, DIST_BUNDLES, DIST_MATERIAL} from '../constants'; import {sequenceTask, sassBuildTask, copyTask, triggerLivereload} from '../util/task_helpers'; import {createRollupBundle} from '../util/rollup-helper'; import {transpileFile} from '../util/ts-compiler'; +import {buildModuleEntry} from '../util/package-build'; import {ScriptTarget, ModuleKind} from 'typescript'; import {writeFileSync} from 'fs'; @@ -45,44 +46,6 @@ task('library:watch', () => { task('library:build:esm', () => tsc(tsconfigPath, {basePath: libraryRoot})); task('library:build:bundles', () => buildModuleEntry(esmMainFile)); -/** Builds a module entry-point. If no entry name is specified it builds the whole library. */ -async function buildModuleEntry(entryFile: string, entryName = '') { - let baseFileName = entryName ? `material-${entryName}` : 'material'; - let moduleName = entryName ? `ng.material.${entryName}` : 'ng.material'; - - // List of paths for the specified entrypoint. - let fesm2015File = join(bundlesDir, `${baseFileName}.js`); - let fesm2014File = join(bundlesDir, `${baseFileName}.es5.js`); - let umdFile = join(bundlesDir, `${baseFileName}.umd.js`); - let umdMinFile = join(bundlesDir, `${baseFileName}.umd.min.js`); - - // Build FESM-2015 bundle file. - await createRollupBundle({ - moduleName: moduleName, - entry: entryFile, - dest: fesm2015File, - format: 'es', - }); - - // Downlevel FESM-2015 file to ES5. - transpileFile(fesm2015File, fesm2014File, { - target: ScriptTarget.ES5, - module: ModuleKind.ES2015, - allowJs: true - }); - - // Create UMD bundle of FESM-2014 output. - await createRollupBundle({ - moduleName: moduleName, - entry: fesm2014File, - dest: umdFile, - format: 'umd' - }); - - // Output a minified version of the UMD bundle - writeFileSync(umdMinFile, uglify.minify(umdFile, { preserveComments: 'license' }).code); -} - /** * Asset tasks. Building SaSS files and inlining CSS, HTML files into the ESM output. **/ diff --git a/tools/gulp/tasks/release.ts b/tools/gulp/tasks/release.ts index f02b12a99fe8..4674fbd65190 100644 --- a/tools/gulp/tasks/release.ts +++ b/tools/gulp/tasks/release.ts @@ -2,12 +2,14 @@ import {spawn} from 'child_process'; import {existsSync, readFileSync, statSync, writeFileSync} from 'fs-extra'; import {basename, join} from 'path'; import {dest, src, task} from 'gulp'; +import {inlineMetadataResources} from '../util/inline-resources'; import {execNodeTask, execTask, sequenceTask} from '../util/task_helpers'; +import {composeRelease} from '../util/package-build'; import { COMPONENTS_DIR, DIST_BUNDLES, DIST_MATERIAL, - DIST_RELEASE, + DIST_RELEASES, DIST_ROOT, LICENSE_BANNER, PROJECT_ROOT, @@ -21,20 +23,14 @@ const gulpRename = require('gulp-rename'); /** Parse command-line arguments for release task. */ const argv = minimist(process.argv.slice(3)); -// Matches all Typescript definition files for Material. -const typingsGlob = join(DIST_MATERIAL, '**/*.+(d.ts|metadata.json)'); -// Matches the "package.json" and "README.md" file that needs to be shipped. -const assetsGlob = join(COMPONENTS_DIR, '+(package.json|README.md)'); -// Matches all UMD bundles inside of the bundles distribution. -const umdGlob = join(DIST_BUNDLES, '*.umd.*'); -// Matches all flat ESM bundles (e.g material.js and material.es5.js) -const fesmGlob = [join(DIST_BUNDLES, '*.js'), `!${umdGlob}`]; +// Path to the release output of material. +const releasePath = join(DIST_RELEASES, 'material'); // The entry-point for the scss theming bundle. const themingEntryPointPath = join(COMPONENTS_DIR, 'core', 'theming', '_all-theme.scss'); // Output path for the scss theming bundle. -const themingBundlePath = join(DIST_RELEASE, '_theming.scss'); +const themingBundlePath = join(releasePath, '_theming.scss'); // Matches all pre-built theme css files const prebuiltThemeGlob = join(DIST_MATERIAL, '**/theming/prebuilt/*.css'); @@ -44,76 +40,15 @@ task('build:release', sequenceTask( ':package:release', )); -/** Task that combines intermediate build artifacts into the release package structure. */ -task(':package:release', sequenceTask( - // Run in parallel - [ - ':package:typings', - ':package:umd', - ':package:fesm', - ':package:assets', - ':package:theming', - ':package:license' - ], - // Run in sequence - ':inline-metadata-resources', - ':package:metadata', -)); - -/** Writes a re-export metadata */ -task(':package:metadata', () => { - const metadataReExport = - `{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./typings/index"}]}`; - writeFileSync(join(DIST_RELEASE, 'material.metadata.json'), metadataReExport, 'utf-8'); -}); - -/** Inlines the html and css resources into all metadata.json files in dist/ */ -task(':inline-metadata-resources', () => { - // Create a map of fileName -> fullFilePath. This is needed because the templateUrl and - // styleUrls for each component use just the filename because, in the source, the component - // and the resources live in the same directory. - const componentResources = new Map(); - glob(join(DIST_ROOT, '**/*.+(html|css)'), (err: any, resourceFilePaths: any) => { - for (const path of resourceFilePaths) { - componentResources.set(basename(path), path); - } - }); - - // Find all metadata files. For each one, parse the JSON content, inline the resources, and - // reserialize and rewrite back to the original location. - glob(join(DIST_ROOT, '**/*.metadata.json'), (err: any, metadataFilePaths: any) => { - for (const path of metadataFilePaths) { - let metadata = JSON.parse(readFileSync(path, 'utf-8')); - inlineMetadataResources(metadata, componentResources); - writeFileSync(path , JSON.stringify(metadata), 'utf-8'); - } - }); -}); - -/** Copy static assets (package.json, README.md) to the release package. */ -task(':package:assets', () => src(assetsGlob).pipe(dest(DIST_RELEASE))); - -/** Copy the license to the release package. */ -task(':package:license', () => src(join(PROJECT_ROOT, 'LICENSE')).pipe(dest(DIST_RELEASE))); - -/** Copy all d.ts except the special flat typings from ngc to typings/ in the release package. */ -task(':package:typings', () => { - return src(typingsGlob) - .pipe(dest(join(DIST_RELEASE, 'typings'))) - .on('end', () => createTypingFile()); -}); - -/** Copy umd bundles to the root of the release package. */ -task(':package:umd', () => src(umdGlob).pipe((dest(join(DIST_RELEASE, 'bundles'))))); - -/** Copy primary entry-point FESM bundles to the @angular/ directory. */ -task(':package:fesm', () => src(fesmGlob).pipe(dest(join(DIST_RELEASE, '@angular')))); +/** Task that composes the different build files into the release structure. */ +task(':package:release', [':package:theming'], () => composeRelease('material')); /** Copies all prebuilt themes into the release package under `prebuilt-themes/` */ -task(':package:theming', [':bundle:theming-scss'], - () => src(prebuiltThemeGlob) - .pipe(gulpRename({dirname: ''})) - .pipe(dest(join(DIST_RELEASE, 'prebuilt-themes')))); +task(':package:theming', [':bundle:theming-scss'], () => { + src(prebuiltThemeGlob) + .pipe(gulpRename({dirname: ''})) + .pipe(dest(join(releasePath, 'prebuilt-themes'))); +}); /** Bundles all scss requires for theming into a single scss file in the root of the package. */ task(':bundle:theming-scss', execNodeTask( @@ -132,7 +67,7 @@ task(':publish:whoami', execTask('npm', ['whoami'], { /** Create a typing file that links to the bundled definitions of NGC. */ function createTypingFile() { - writeFileSync(join(DIST_RELEASE, 'material.d.ts'), + writeFileSync(join(releasePath, 'material.d.ts'), LICENSE_BANNER + '\nexport * from "./typings/index";' ); } @@ -141,7 +76,7 @@ task(':publish:logout', execTask('npm', ['logout'])); function _execNpmPublish(label: string): Promise<{}> { - const packageDir = DIST_RELEASE; + const packageDir = releasePath; if (!statSync(packageDir).isDirectory()) { return; } @@ -209,36 +144,3 @@ task('publish', sequenceTask( ':publish', ':publish:logout', )); - - -/** - * Recurse through a parsed metadata.json file and inline all html and css. - * Note: this assumes that all html and css files have a unique name. - */ -function inlineMetadataResources(metadata: any, componentResources: Map) { - // Convert `templateUrl` to `template` - if (metadata.templateUrl) { - const fullResourcePath = componentResources.get(metadata.templateUrl); - metadata.template = readFileSync(fullResourcePath, 'utf-8'); - delete metadata.templateUrl; - } - - // Convert `styleUrls` to `styles` - if (metadata.styleUrls && metadata.styleUrls.length) { - metadata.styles = []; - for (const styleUrl of metadata.styleUrls) { - const fullResourcePath = componentResources.get(styleUrl); - metadata.styles.push(readFileSync(fullResourcePath, 'utf-8')); - } - delete metadata.styleUrls; - } - - // We we did nothing at this node, go deeper. - if (!metadata.template && !metadata.styles) { - for (const property in metadata) { - if (typeof metadata[property] == 'object' && metadata[property]) { - inlineMetadataResources(metadata[property], componentResources); - } - } - } -} diff --git a/tools/gulp/util/inline-resources.ts b/tools/gulp/util/inline-resources.ts new file mode 100644 index 000000000000..eccb1205e92f --- /dev/null +++ b/tools/gulp/util/inline-resources.ts @@ -0,0 +1,34 @@ +import {readFileSync} from 'fs'; +import {basename} from 'path'; + +/** + * Recurse through a parsed metadata.json file and inline all html and css. + * Note: this assumes that all html and css files have a unique name. + */ +export function inlineMetadataResources(metadata: any, componentResources: Map) { + // Convert `templateUrl` to `template` + if (metadata.templateUrl) { + const fullResourcePath = componentResources.get(basename(metadata.templateUrl)); + metadata.template = readFileSync(fullResourcePath, 'utf-8'); + delete metadata.templateUrl; + } + + // Convert `styleUrls` to `styles` + if (metadata.styleUrls && metadata.styleUrls.length) { + metadata.styles = []; + for (const styleUrl of metadata.styleUrls) { + const fullResourcePath = componentResources.get(basename(styleUrl)); + metadata.styles.push(readFileSync(fullResourcePath, 'utf-8')); + } + delete metadata.styleUrls; + } + + // We we did nothing at this node, go deeper. + if (!metadata.template && !metadata.styles) { + for (const property in metadata) { + if (typeof metadata[property] == 'object' && metadata[property]) { + inlineMetadataResources(metadata[property], componentResources); + } + } + } +} diff --git a/tools/gulp/util/package-build.ts b/tools/gulp/util/package-build.ts new file mode 100644 index 000000000000..f88f7a22988e --- /dev/null +++ b/tools/gulp/util/package-build.ts @@ -0,0 +1,111 @@ +import {join, basename, dirname, relative} from 'path'; +import {main as tsc} from '@angular/tsc-wrapped'; +import {DIST_BUNDLES, DIST_ROOT, SOURCE_ROOT, PROJECT_ROOT, LICENSE_BANNER} from '../constants'; +import {createRollupBundle} from '../util/rollup-helper'; +import {inlineMetadataResources} from '../util/inline-resources'; +import {transpileFile} from '../util/ts-compiler'; +import {ScriptTarget, ModuleKind} from 'typescript'; +import {sync as glob} from 'glob'; +import { + writeFileSync, copySync, mkdirpSync, readFileSync +} from 'fs-extra'; + +// There are no type definitions available for these imports. +const uglify = require('uglify-js'); + +export function composeRelease(packageName: string) { + // To avoid refactoring of the project the package material will map to the source path `lib/`. + let sourcePath = join(SOURCE_ROOT, packageName === 'material' ? 'lib' : packageName); + let packagePath = join(DIST_ROOT, 'packages', packageName); + let releasePath = join(DIST_ROOT, 'releases', packageName); + + inlineMetadata(packagePath); + + copyFiles(packagePath, '**/*.+(d.ts|metadata.json)', join(releasePath, 'typings')); + copyFiles(DIST_BUNDLES, `${packageName}.umd?(.min).js`, join(releasePath, 'bundles')); + copyFiles(DIST_BUNDLES, `${packageName}?(.es5).js`, join(releasePath, '@angular')); + copyFiles(PROJECT_ROOT, 'LICENSE', releasePath); + copyFiles(SOURCE_ROOT, 'README', releasePath); + copyFiles(sourcePath, 'package.json', releasePath); + + createTypingFile(releasePath, packageName); + createMetadataFile(releasePath, packageName); +} + +/** Builds a module entry-point. If no entry name is specified it builds the whole library. */ +export async function buildModuleEntry(entryFile: string, entryName = 'material') { + let moduleName = entryName ? `ng.material.${entryName}` : 'ng.material'; + + // List of paths for the specified entrypoint. + let fesm2015File = join(DIST_BUNDLES, `${entryName}.js`); + let fesm2014File = join(DIST_BUNDLES, `${entryName}.es5.js`); + let umdFile = join(DIST_BUNDLES, `${entryName}.umd.js`); + let umdMinFile = join(DIST_BUNDLES, `${entryName}.umd.min.js`); + + // Build FESM-2015 bundle file. + await createRollupBundle({ + moduleName: moduleName, + entry: entryFile, + dest: fesm2015File, + format: 'es', + }); + + // Downlevel FESM-2015 file to ES5. + transpileFile(fesm2015File, fesm2014File, { + target: ScriptTarget.ES5, + module: ModuleKind.ES2015, + allowJs: true + }); + + // Create UMD bundle of FESM-2014 output. + await createRollupBundle({ + moduleName: moduleName, + entry: fesm2014File, + dest: umdFile, + format: 'umd' + }); + + // Output a minified version of the UMD bundle + writeFileSync(umdMinFile, uglify.minify(umdFile, { preserveComments: 'license' }).code); +} + +function copyFiles(fromPath: string, fileGlob: string, outDir: string) { + glob(fileGlob, {cwd: fromPath}).forEach(filePath => { + let fileDestPath = join(outDir, filePath); + mkdirpSync(dirname(fileDestPath)); + copySync(join(fromPath, filePath), fileDestPath); + }); +} + +/** Create a typing file that links to the bundled definitions of NGC. */ +function createTypingFile(outputDir: string, entryName: string) { + writeFileSync(join(outputDir, `${entryName}.d.ts`), + LICENSE_BANNER + '\nexport * from "./typings/index";' + ); +} + +/** Creates a metadata file that re-exports the metadata bundle inside of the typings. */ +function createMetadataFile(packageDir: string, packageName: string) { + const metadataReExport = + `{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./typings/index"}]}`; + writeFileSync(join(packageDir, `${packageName}.metadata.json`), metadataReExport, 'utf-8'); +} + +function inlineMetadata(packagePath: string) { + // Create a map of fileName -> fullFilePath. This is needed because the templateUrl and + // styleUrls for each component use just the filename because, in the source, the component + // and the resources live in the same directory. + const componentResources = new Map(); + + glob(join(packagePath, '**/*.+(html|css)')).forEach(resourcePath => { + componentResources.set(basename(resourcePath), resourcePath); + }); + + // Find all metadata files. For each one, parse the JSON content, inline the resources, and + // reserialize and rewrite back to the original location. + glob(join(packagePath, '**/*.metadata.json')).forEach(path => { + let metadata = JSON.parse(readFileSync(path, 'utf-8')); + inlineMetadataResources(metadata, componentResources); + writeFileSync(path , JSON.stringify(metadata), 'utf-8'); + }); +} diff --git a/tools/gulp/util/rollup-helper.ts b/tools/gulp/util/rollup-helper.ts index dbf746b1fce5..296782fb23f0 100644 --- a/tools/gulp/util/rollup-helper.ts +++ b/tools/gulp/util/rollup-helper.ts @@ -13,6 +13,8 @@ const ROLLUP_GLOBALS = { '@angular/platform-browser': 'ng.platformBrowser', '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic', '@angular/platform-browser/animations': 'ng.platformBrowser.animations', + // NGC always adds the `index` suffix. As a temporary workaround just define that as a global. + '@angular/material/index': 'ng.material', // Rxjs dependencies 'rxjs/Subject': 'Rx', From dddfce56717cbf7049065d80673e71462fa6ad49 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 12 Apr 2017 14:15:24 -0700 Subject: [PATCH 2/2] Address feedback --- src/lib/core/overlay/overlay-ref.ts | 2 +- src/lib/core/overlay/overlay-state.ts | 10 ++++---- .../autocomplete-overview-example.css | 0 .../autocomplete-overview-example.html | 0 .../autocomplete-overview-example.ts | 0 .../button-overview-example.css | 0 .../button-overview-example.html | 0 .../button-overview-example.ts | 0 .../button-toggle-exclusive-example.css | 0 .../button-toggle-exclusive-example.html | 0 .../button-toggle-exclusive-example.ts | 0 .../button-toggle-overview-example.css | 0 .../button-toggle-overview-example.html | 0 .../button-toggle-overview-example.ts | 0 .../button-types/button-types-example.css | 0 .../button-types/button-types-example.html | 0 .../button-types/button-types-example.ts | 0 .../card-fancy/card-fancy-example.css | 0 .../card-fancy/card-fancy-example.html | 0 .../card-fancy/card-fancy-example.ts | 0 .../card-overview/card-overview-example.css | 0 .../card-overview/card-overview-example.html | 0 .../card-overview/card-overview-example.ts | 0 .../checkbox-configurable-example.css | 0 .../checkbox-configurable-example.html | 0 .../checkbox-configurable-example.ts | 0 .../checkbox-overview-example.css | 0 .../checkbox-overview-example.html | 0 .../checkbox-overview-example.ts | 0 .../chips-overview/chips-overview-example.css | 0 .../chips-overview-example.html | 0 .../chips-overview/chips-overview-example.ts | 0 .../chips-stacked/chips-stacked-example.css | 0 .../chips-stacked/chips-stacked-example.html | 0 .../chips-stacked/chips-stacked-example.ts | 0 .../dialog-elements-example-dialog.html | 0 .../dialog-elements-example.css | 0 .../dialog-elements-example.html | 0 .../dialog-elements-example.ts | 0 .../dialog-overview-example-dialog.html | 0 .../dialog-overview-example.css | 0 .../dialog-overview-example.html | 0 .../dialog-overview-example.ts | 0 .../dialog-result-example-dialog.html | 0 .../dialog-result/dialog-result-example.css | 0 .../dialog-result/dialog-result-example.html | 0 .../dialog-result/dialog-result-example.ts | 0 .../example-data.ts | 0 .../example-module.ts | 0 .../grid-list-dynamic-example.css | 0 .../grid-list-dynamic-example.html | 0 .../grid-list-dynamic-example.ts | 0 .../grid-list-overview-example.css | 0 .../grid-list-overview-example.html | 0 .../grid-list-overview-example.ts | 0 .../icon-overview/icon-overview-example.css | 0 .../icon-overview/icon-overview-example.html | 0 .../icon-overview/icon-overview-example.ts | 0 .../icon-svg-example/icon-svg-example.css | 0 .../icon-svg-example/icon-svg-example.html | 0 .../icon-svg-example/icon-svg-example.ts | 0 .../input-form/input-form-example.css | 0 .../input-form/input-form-example.html | 0 .../input-form/input-form-example.ts | 0 .../input-overview/input-overview-example.css | 0 .../input-overview-example.html | 0 .../input-overview/input-overview-example.ts | 0 .../list-overview/list-overview-example.css | 0 .../list-overview/list-overview-example.html | 0 .../list-overview/list-overview-example.ts | 0 .../list-sections/list-sections-example.css | 0 .../list-sections/list-sections-example.html | 0 .../list-sections/list-sections-example.ts | 0 .../menu-icons/menu-icons-example.css | 0 .../menu-icons/menu-icons-example.html | 0 .../menu-icons/menu-icons-example.ts | 0 .../menu-overview/menu-overview-example.css | 0 .../menu-overview/menu-overview-example.html | 0 .../menu-overview/menu-overview-example.ts | 0 .../package.json | 11 ++++---- .../progress-bar-configurable-example.css | 0 .../progress-bar-configurable-example.html | 0 .../progress-bar-configurable-example.ts | 0 .../progress-bar-overview-example.css | 0 .../progress-bar-overview-example.html | 0 .../progress-bar-overview-example.ts | 0 .../progress-spinner-configurable-example.css | 0 ...progress-spinner-configurable-example.html | 0 .../progress-spinner-configurable-example.ts | 0 .../progress-spinner-overview-example.css | 0 .../progress-spinner-overview-example.html | 0 .../progress-spinner-overview-example.ts | 0 .../public_api.ts | 0 .../radio-ng-model/radio-ng-model-example.css | 0 .../radio-ng-model-example.html | 0 .../radio-ng-model/radio-ng-model-example.ts | 0 .../radio-overview/radio-overview-example.css | 0 .../radio-overview-example.html | 0 .../radio-overview/radio-overview-example.ts | 0 .../select-form/select-form-example.css | 0 .../select-form/select-form-example.html | 0 .../select-form/select-form-example.ts | 0 .../select-overview-example.css | 0 .../select-overview-example.html | 0 .../select-overview-example.ts | 0 .../sidenav-fab/sidenav-fab-example.css | 0 .../sidenav-fab/sidenav-fab-example.html | 0 .../sidenav-fab/sidenav-fab-example.ts | 0 .../sidenav-overview-example.css | 0 .../sidenav-overview-example.html | 0 .../sidenav-overview-example.ts | 0 .../slide-toggle-configurable-example.css | 0 .../slide-toggle-configurable-example.html | 0 .../slide-toggle-configurable-example.ts | 0 .../slide-toggle-overview-example.css | 0 .../slide-toggle-overview-example.html | 0 .../slide-toggle-overview-example.ts | 0 .../slider-configurable-example.css | 0 .../slider-configurable-example.html | 0 .../slider-configurable-example.ts | 0 .../slider-overview-example.css | 0 .../slider-overview-example.html | 0 .../slider-overview-example.ts | 0 .../snack-bar-component-example-snack.css | 0 .../snack-bar-component-example-snack.html | 0 .../snack-bar-component-example.html | 0 .../snack-bar-component-example.ts | 0 .../snack-bar-overview-example.css | 0 .../snack-bar-overview-example.html | 0 .../snack-bar-overview-example.ts | 0 .../tabs-overview/tabs-overview-example.css | 0 .../tabs-overview/tabs-overview-example.html | 0 .../tabs-overview/tabs-overview-example.ts | 0 .../tabs-template-label-example.css | 0 .../tabs-template-label-example.html | 0 .../tabs-template-label-example.ts | 0 .../toolbar-multirow-example.css | 0 .../toolbar-multirow-example.html | 0 .../toolbar-multirow-example.ts | 0 .../toolbar-overview-example.css | 0 .../toolbar-overview-example.html | 0 .../toolbar-overview-example.ts | 0 .../tooltip-overview-example.css | 0 .../tooltip-overview-example.html | 0 .../tooltip-overview-example.ts | 0 .../tooltip-position-example.css | 0 .../tooltip-position-example.html | 0 .../tooltip-position-example.ts | 0 .../tsconfig-build.json | 0 tools/dgeni/processors/categorizer.js | 6 ++--- tools/gulp/tasks/examples.ts | 25 +++++++------------ tools/gulp/tasks/library.ts | 15 +++-------- tools/gulp/util/package-build.ts | 19 ++++++++------ 153 files changed, 40 insertions(+), 48 deletions(-) rename src/{examples => material-examples}/autocomplete-overview/autocomplete-overview-example.css (100%) rename src/{examples => material-examples}/autocomplete-overview/autocomplete-overview-example.html (100%) rename src/{examples => material-examples}/autocomplete-overview/autocomplete-overview-example.ts (100%) rename src/{examples => material-examples}/button-overview/button-overview-example.css (100%) rename src/{examples => material-examples}/button-overview/button-overview-example.html (100%) rename src/{examples => material-examples}/button-overview/button-overview-example.ts (100%) rename src/{examples => material-examples}/button-toggle-exclusive/button-toggle-exclusive-example.css (100%) rename src/{examples => material-examples}/button-toggle-exclusive/button-toggle-exclusive-example.html (100%) rename src/{examples => material-examples}/button-toggle-exclusive/button-toggle-exclusive-example.ts (100%) rename src/{examples => material-examples}/button-toggle-overview/button-toggle-overview-example.css (100%) rename src/{examples => material-examples}/button-toggle-overview/button-toggle-overview-example.html (100%) rename src/{examples => material-examples}/button-toggle-overview/button-toggle-overview-example.ts (100%) rename src/{examples => material-examples}/button-types/button-types-example.css (100%) rename src/{examples => material-examples}/button-types/button-types-example.html (100%) rename src/{examples => material-examples}/button-types/button-types-example.ts (100%) rename src/{examples => material-examples}/card-fancy/card-fancy-example.css (100%) rename src/{examples => material-examples}/card-fancy/card-fancy-example.html (100%) rename src/{examples => material-examples}/card-fancy/card-fancy-example.ts (100%) rename src/{examples => material-examples}/card-overview/card-overview-example.css (100%) rename src/{examples => material-examples}/card-overview/card-overview-example.html (100%) rename src/{examples => material-examples}/card-overview/card-overview-example.ts (100%) rename src/{examples => material-examples}/checkbox-configurable/checkbox-configurable-example.css (100%) rename src/{examples => material-examples}/checkbox-configurable/checkbox-configurable-example.html (100%) rename src/{examples => material-examples}/checkbox-configurable/checkbox-configurable-example.ts (100%) rename src/{examples => material-examples}/checkbox-overview/checkbox-overview-example.css (100%) rename src/{examples => material-examples}/checkbox-overview/checkbox-overview-example.html (100%) rename src/{examples => material-examples}/checkbox-overview/checkbox-overview-example.ts (100%) rename src/{examples => material-examples}/chips-overview/chips-overview-example.css (100%) rename src/{examples => material-examples}/chips-overview/chips-overview-example.html (100%) rename src/{examples => material-examples}/chips-overview/chips-overview-example.ts (100%) rename src/{examples => material-examples}/chips-stacked/chips-stacked-example.css (100%) rename src/{examples => material-examples}/chips-stacked/chips-stacked-example.html (100%) rename src/{examples => material-examples}/chips-stacked/chips-stacked-example.ts (100%) rename src/{examples => material-examples}/dialog-elements/dialog-elements-example-dialog.html (100%) rename src/{examples => material-examples}/dialog-elements/dialog-elements-example.css (100%) rename src/{examples => material-examples}/dialog-elements/dialog-elements-example.html (100%) rename src/{examples => material-examples}/dialog-elements/dialog-elements-example.ts (100%) rename src/{examples => material-examples}/dialog-overview/dialog-overview-example-dialog.html (100%) rename src/{examples => material-examples}/dialog-overview/dialog-overview-example.css (100%) rename src/{examples => material-examples}/dialog-overview/dialog-overview-example.html (100%) rename src/{examples => material-examples}/dialog-overview/dialog-overview-example.ts (100%) rename src/{examples => material-examples}/dialog-result/dialog-result-example-dialog.html (100%) rename src/{examples => material-examples}/dialog-result/dialog-result-example.css (100%) rename src/{examples => material-examples}/dialog-result/dialog-result-example.html (100%) rename src/{examples => material-examples}/dialog-result/dialog-result-example.ts (100%) rename src/{examples => material-examples}/example-data.ts (100%) rename src/{examples => material-examples}/example-module.ts (100%) rename src/{examples => material-examples}/grid-list-dynamic/grid-list-dynamic-example.css (100%) rename src/{examples => material-examples}/grid-list-dynamic/grid-list-dynamic-example.html (100%) rename src/{examples => material-examples}/grid-list-dynamic/grid-list-dynamic-example.ts (100%) rename src/{examples => material-examples}/grid-list-overview/grid-list-overview-example.css (100%) rename src/{examples => material-examples}/grid-list-overview/grid-list-overview-example.html (100%) rename src/{examples => material-examples}/grid-list-overview/grid-list-overview-example.ts (100%) rename src/{examples => material-examples}/icon-overview/icon-overview-example.css (100%) rename src/{examples => material-examples}/icon-overview/icon-overview-example.html (100%) rename src/{examples => material-examples}/icon-overview/icon-overview-example.ts (100%) rename src/{examples => material-examples}/icon-svg-example/icon-svg-example.css (100%) rename src/{examples => material-examples}/icon-svg-example/icon-svg-example.html (100%) rename src/{examples => material-examples}/icon-svg-example/icon-svg-example.ts (100%) rename src/{examples => material-examples}/input-form/input-form-example.css (100%) rename src/{examples => material-examples}/input-form/input-form-example.html (100%) rename src/{examples => material-examples}/input-form/input-form-example.ts (100%) rename src/{examples => material-examples}/input-overview/input-overview-example.css (100%) rename src/{examples => material-examples}/input-overview/input-overview-example.html (100%) rename src/{examples => material-examples}/input-overview/input-overview-example.ts (100%) rename src/{examples => material-examples}/list-overview/list-overview-example.css (100%) rename src/{examples => material-examples}/list-overview/list-overview-example.html (100%) rename src/{examples => material-examples}/list-overview/list-overview-example.ts (100%) rename src/{examples => material-examples}/list-sections/list-sections-example.css (100%) rename src/{examples => material-examples}/list-sections/list-sections-example.html (100%) rename src/{examples => material-examples}/list-sections/list-sections-example.ts (100%) rename src/{examples => material-examples}/menu-icons/menu-icons-example.css (100%) rename src/{examples => material-examples}/menu-icons/menu-icons-example.html (100%) rename src/{examples => material-examples}/menu-icons/menu-icons-example.ts (100%) rename src/{examples => material-examples}/menu-overview/menu-overview-example.css (100%) rename src/{examples => material-examples}/menu-overview/menu-overview-example.html (100%) rename src/{examples => material-examples}/menu-overview/menu-overview-example.ts (100%) rename src/{examples => material-examples}/package.json (68%) rename src/{examples => material-examples}/progress-bar-configurable/progress-bar-configurable-example.css (100%) rename src/{examples => material-examples}/progress-bar-configurable/progress-bar-configurable-example.html (100%) rename src/{examples => material-examples}/progress-bar-configurable/progress-bar-configurable-example.ts (100%) rename src/{examples => material-examples}/progress-bar-overview/progress-bar-overview-example.css (100%) rename src/{examples => material-examples}/progress-bar-overview/progress-bar-overview-example.html (100%) rename src/{examples => material-examples}/progress-bar-overview/progress-bar-overview-example.ts (100%) rename src/{examples => material-examples}/progress-spinner-configurable/progress-spinner-configurable-example.css (100%) rename src/{examples => material-examples}/progress-spinner-configurable/progress-spinner-configurable-example.html (100%) rename src/{examples => material-examples}/progress-spinner-configurable/progress-spinner-configurable-example.ts (100%) rename src/{examples => material-examples}/progress-spinner-overview/progress-spinner-overview-example.css (100%) rename src/{examples => material-examples}/progress-spinner-overview/progress-spinner-overview-example.html (100%) rename src/{examples => material-examples}/progress-spinner-overview/progress-spinner-overview-example.ts (100%) rename src/{examples => material-examples}/public_api.ts (100%) rename src/{examples => material-examples}/radio-ng-model/radio-ng-model-example.css (100%) rename src/{examples => material-examples}/radio-ng-model/radio-ng-model-example.html (100%) rename src/{examples => material-examples}/radio-ng-model/radio-ng-model-example.ts (100%) rename src/{examples => material-examples}/radio-overview/radio-overview-example.css (100%) rename src/{examples => material-examples}/radio-overview/radio-overview-example.html (100%) rename src/{examples => material-examples}/radio-overview/radio-overview-example.ts (100%) rename src/{examples => material-examples}/select-form/select-form-example.css (100%) rename src/{examples => material-examples}/select-form/select-form-example.html (100%) rename src/{examples => material-examples}/select-form/select-form-example.ts (100%) rename src/{examples => material-examples}/select-overview/select-overview-example.css (100%) rename src/{examples => material-examples}/select-overview/select-overview-example.html (100%) rename src/{examples => material-examples}/select-overview/select-overview-example.ts (100%) rename src/{examples => material-examples}/sidenav-fab/sidenav-fab-example.css (100%) rename src/{examples => material-examples}/sidenav-fab/sidenav-fab-example.html (100%) rename src/{examples => material-examples}/sidenav-fab/sidenav-fab-example.ts (100%) rename src/{examples => material-examples}/sidenav-overview/sidenav-overview-example.css (100%) rename src/{examples => material-examples}/sidenav-overview/sidenav-overview-example.html (100%) rename src/{examples => material-examples}/sidenav-overview/sidenav-overview-example.ts (100%) rename src/{examples => material-examples}/slide-toggle-configurable/slide-toggle-configurable-example.css (100%) rename src/{examples => material-examples}/slide-toggle-configurable/slide-toggle-configurable-example.html (100%) rename src/{examples => material-examples}/slide-toggle-configurable/slide-toggle-configurable-example.ts (100%) rename src/{examples => material-examples}/slide-toggle-overview/slide-toggle-overview-example.css (100%) rename src/{examples => material-examples}/slide-toggle-overview/slide-toggle-overview-example.html (100%) rename src/{examples => material-examples}/slide-toggle-overview/slide-toggle-overview-example.ts (100%) rename src/{examples => material-examples}/slider-configurable/slider-configurable-example.css (100%) rename src/{examples => material-examples}/slider-configurable/slider-configurable-example.html (100%) rename src/{examples => material-examples}/slider-configurable/slider-configurable-example.ts (100%) rename src/{examples => material-examples}/slider-overview/slider-overview-example.css (100%) rename src/{examples => material-examples}/slider-overview/slider-overview-example.html (100%) rename src/{examples => material-examples}/slider-overview/slider-overview-example.ts (100%) rename src/{examples => material-examples}/snack-bar-component/snack-bar-component-example-snack.css (100%) rename src/{examples => material-examples}/snack-bar-component/snack-bar-component-example-snack.html (100%) rename src/{examples => material-examples}/snack-bar-component/snack-bar-component-example.html (100%) rename src/{examples => material-examples}/snack-bar-component/snack-bar-component-example.ts (100%) rename src/{examples => material-examples}/snack-bar-overview/snack-bar-overview-example.css (100%) rename src/{examples => material-examples}/snack-bar-overview/snack-bar-overview-example.html (100%) rename src/{examples => material-examples}/snack-bar-overview/snack-bar-overview-example.ts (100%) rename src/{examples => material-examples}/tabs-overview/tabs-overview-example.css (100%) rename src/{examples => material-examples}/tabs-overview/tabs-overview-example.html (100%) rename src/{examples => material-examples}/tabs-overview/tabs-overview-example.ts (100%) rename src/{examples => material-examples}/tabs-template-label/tabs-template-label-example.css (100%) rename src/{examples => material-examples}/tabs-template-label/tabs-template-label-example.html (100%) rename src/{examples => material-examples}/tabs-template-label/tabs-template-label-example.ts (100%) rename src/{examples => material-examples}/toolbar-multirow/toolbar-multirow-example.css (100%) rename src/{examples => material-examples}/toolbar-multirow/toolbar-multirow-example.html (100%) rename src/{examples => material-examples}/toolbar-multirow/toolbar-multirow-example.ts (100%) rename src/{examples => material-examples}/toolbar-overview/toolbar-overview-example.css (100%) rename src/{examples => material-examples}/toolbar-overview/toolbar-overview-example.html (100%) rename src/{examples => material-examples}/toolbar-overview/toolbar-overview-example.ts (100%) rename src/{examples => material-examples}/tooltip-overview/tooltip-overview-example.css (100%) rename src/{examples => material-examples}/tooltip-overview/tooltip-overview-example.html (100%) rename src/{examples => material-examples}/tooltip-overview/tooltip-overview-example.ts (100%) rename src/{examples => material-examples}/tooltip-position/tooltip-position-example.css (100%) rename src/{examples => material-examples}/tooltip-position/tooltip-position-example.html (100%) rename src/{examples => material-examples}/tooltip-position/tooltip-position-example.ts (100%) rename src/{examples => material-examples}/tsconfig-build.json (100%) diff --git a/src/lib/core/overlay/overlay-ref.ts b/src/lib/core/overlay/overlay-ref.ts index 8da9d5c5dc97..454ece6dbb3d 100644 --- a/src/lib/core/overlay/overlay-ref.ts +++ b/src/lib/core/overlay/overlay-ref.ts @@ -103,7 +103,7 @@ export class OverlayRef implements PortalHost { } } - /** Updates the text direction of the overlay panel. **/ + /** Updates the text direction of the overlay panel. */ private updateDirection() { this._pane.setAttribute('dir', this._state.direction); } diff --git a/src/lib/core/overlay/overlay-state.ts b/src/lib/core/overlay/overlay-state.ts index 551b25754fb0..09676cce9ede 100644 --- a/src/lib/core/overlay/overlay-state.ts +++ b/src/lib/core/overlay/overlay-state.ts @@ -13,19 +13,19 @@ export class OverlayState { /** Whether the overlay has a backdrop. */ hasBackdrop: boolean = false; - /** Custom class to add to the backdrop **/ + /** Custom class to add to the backdrop */ backdropClass: string = 'cdk-overlay-dark-backdrop'; - /** The width of the overlay panel. If a number is provided, pixel units are assumed. **/ + /** The width of the overlay panel. If a number is provided, pixel units are assumed. */ width: number | string; - /** The height of the overlay panel. If a number is provided, pixel units are assumed. **/ + /** The height of the overlay panel. If a number is provided, pixel units are assumed. */ height: number | string; - /** The min-width of the overlay panel. If a number is provided, pixel units are assumed. **/ + /** The min-width of the overlay panel. If a number is provided, pixel units are assumed. */ minWidth: number | string; - /** The min-height of the overlay panel. If a number is provided, pixel units are assumed. **/ + /** The min-height of the overlay panel. If a number is provided, pixel units are assumed. */ minHeight: number | string; /** The direction of the text in the overlay panel. */ diff --git a/src/examples/autocomplete-overview/autocomplete-overview-example.css b/src/material-examples/autocomplete-overview/autocomplete-overview-example.css similarity index 100% rename from src/examples/autocomplete-overview/autocomplete-overview-example.css rename to src/material-examples/autocomplete-overview/autocomplete-overview-example.css diff --git a/src/examples/autocomplete-overview/autocomplete-overview-example.html b/src/material-examples/autocomplete-overview/autocomplete-overview-example.html similarity index 100% rename from src/examples/autocomplete-overview/autocomplete-overview-example.html rename to src/material-examples/autocomplete-overview/autocomplete-overview-example.html diff --git a/src/examples/autocomplete-overview/autocomplete-overview-example.ts b/src/material-examples/autocomplete-overview/autocomplete-overview-example.ts similarity index 100% rename from src/examples/autocomplete-overview/autocomplete-overview-example.ts rename to src/material-examples/autocomplete-overview/autocomplete-overview-example.ts diff --git a/src/examples/button-overview/button-overview-example.css b/src/material-examples/button-overview/button-overview-example.css similarity index 100% rename from src/examples/button-overview/button-overview-example.css rename to src/material-examples/button-overview/button-overview-example.css diff --git a/src/examples/button-overview/button-overview-example.html b/src/material-examples/button-overview/button-overview-example.html similarity index 100% rename from src/examples/button-overview/button-overview-example.html rename to src/material-examples/button-overview/button-overview-example.html diff --git a/src/examples/button-overview/button-overview-example.ts b/src/material-examples/button-overview/button-overview-example.ts similarity index 100% rename from src/examples/button-overview/button-overview-example.ts rename to src/material-examples/button-overview/button-overview-example.ts diff --git a/src/examples/button-toggle-exclusive/button-toggle-exclusive-example.css b/src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.css similarity index 100% rename from src/examples/button-toggle-exclusive/button-toggle-exclusive-example.css rename to src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.css diff --git a/src/examples/button-toggle-exclusive/button-toggle-exclusive-example.html b/src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.html similarity index 100% rename from src/examples/button-toggle-exclusive/button-toggle-exclusive-example.html rename to src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.html diff --git a/src/examples/button-toggle-exclusive/button-toggle-exclusive-example.ts b/src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.ts similarity index 100% rename from src/examples/button-toggle-exclusive/button-toggle-exclusive-example.ts rename to src/material-examples/button-toggle-exclusive/button-toggle-exclusive-example.ts diff --git a/src/examples/button-toggle-overview/button-toggle-overview-example.css b/src/material-examples/button-toggle-overview/button-toggle-overview-example.css similarity index 100% rename from src/examples/button-toggle-overview/button-toggle-overview-example.css rename to src/material-examples/button-toggle-overview/button-toggle-overview-example.css diff --git a/src/examples/button-toggle-overview/button-toggle-overview-example.html b/src/material-examples/button-toggle-overview/button-toggle-overview-example.html similarity index 100% rename from src/examples/button-toggle-overview/button-toggle-overview-example.html rename to src/material-examples/button-toggle-overview/button-toggle-overview-example.html diff --git a/src/examples/button-toggle-overview/button-toggle-overview-example.ts b/src/material-examples/button-toggle-overview/button-toggle-overview-example.ts similarity index 100% rename from src/examples/button-toggle-overview/button-toggle-overview-example.ts rename to src/material-examples/button-toggle-overview/button-toggle-overview-example.ts diff --git a/src/examples/button-types/button-types-example.css b/src/material-examples/button-types/button-types-example.css similarity index 100% rename from src/examples/button-types/button-types-example.css rename to src/material-examples/button-types/button-types-example.css diff --git a/src/examples/button-types/button-types-example.html b/src/material-examples/button-types/button-types-example.html similarity index 100% rename from src/examples/button-types/button-types-example.html rename to src/material-examples/button-types/button-types-example.html diff --git a/src/examples/button-types/button-types-example.ts b/src/material-examples/button-types/button-types-example.ts similarity index 100% rename from src/examples/button-types/button-types-example.ts rename to src/material-examples/button-types/button-types-example.ts diff --git a/src/examples/card-fancy/card-fancy-example.css b/src/material-examples/card-fancy/card-fancy-example.css similarity index 100% rename from src/examples/card-fancy/card-fancy-example.css rename to src/material-examples/card-fancy/card-fancy-example.css diff --git a/src/examples/card-fancy/card-fancy-example.html b/src/material-examples/card-fancy/card-fancy-example.html similarity index 100% rename from src/examples/card-fancy/card-fancy-example.html rename to src/material-examples/card-fancy/card-fancy-example.html diff --git a/src/examples/card-fancy/card-fancy-example.ts b/src/material-examples/card-fancy/card-fancy-example.ts similarity index 100% rename from src/examples/card-fancy/card-fancy-example.ts rename to src/material-examples/card-fancy/card-fancy-example.ts diff --git a/src/examples/card-overview/card-overview-example.css b/src/material-examples/card-overview/card-overview-example.css similarity index 100% rename from src/examples/card-overview/card-overview-example.css rename to src/material-examples/card-overview/card-overview-example.css diff --git a/src/examples/card-overview/card-overview-example.html b/src/material-examples/card-overview/card-overview-example.html similarity index 100% rename from src/examples/card-overview/card-overview-example.html rename to src/material-examples/card-overview/card-overview-example.html diff --git a/src/examples/card-overview/card-overview-example.ts b/src/material-examples/card-overview/card-overview-example.ts similarity index 100% rename from src/examples/card-overview/card-overview-example.ts rename to src/material-examples/card-overview/card-overview-example.ts diff --git a/src/examples/checkbox-configurable/checkbox-configurable-example.css b/src/material-examples/checkbox-configurable/checkbox-configurable-example.css similarity index 100% rename from src/examples/checkbox-configurable/checkbox-configurable-example.css rename to src/material-examples/checkbox-configurable/checkbox-configurable-example.css diff --git a/src/examples/checkbox-configurable/checkbox-configurable-example.html b/src/material-examples/checkbox-configurable/checkbox-configurable-example.html similarity index 100% rename from src/examples/checkbox-configurable/checkbox-configurable-example.html rename to src/material-examples/checkbox-configurable/checkbox-configurable-example.html diff --git a/src/examples/checkbox-configurable/checkbox-configurable-example.ts b/src/material-examples/checkbox-configurable/checkbox-configurable-example.ts similarity index 100% rename from src/examples/checkbox-configurable/checkbox-configurable-example.ts rename to src/material-examples/checkbox-configurable/checkbox-configurable-example.ts diff --git a/src/examples/checkbox-overview/checkbox-overview-example.css b/src/material-examples/checkbox-overview/checkbox-overview-example.css similarity index 100% rename from src/examples/checkbox-overview/checkbox-overview-example.css rename to src/material-examples/checkbox-overview/checkbox-overview-example.css diff --git a/src/examples/checkbox-overview/checkbox-overview-example.html b/src/material-examples/checkbox-overview/checkbox-overview-example.html similarity index 100% rename from src/examples/checkbox-overview/checkbox-overview-example.html rename to src/material-examples/checkbox-overview/checkbox-overview-example.html diff --git a/src/examples/checkbox-overview/checkbox-overview-example.ts b/src/material-examples/checkbox-overview/checkbox-overview-example.ts similarity index 100% rename from src/examples/checkbox-overview/checkbox-overview-example.ts rename to src/material-examples/checkbox-overview/checkbox-overview-example.ts diff --git a/src/examples/chips-overview/chips-overview-example.css b/src/material-examples/chips-overview/chips-overview-example.css similarity index 100% rename from src/examples/chips-overview/chips-overview-example.css rename to src/material-examples/chips-overview/chips-overview-example.css diff --git a/src/examples/chips-overview/chips-overview-example.html b/src/material-examples/chips-overview/chips-overview-example.html similarity index 100% rename from src/examples/chips-overview/chips-overview-example.html rename to src/material-examples/chips-overview/chips-overview-example.html diff --git a/src/examples/chips-overview/chips-overview-example.ts b/src/material-examples/chips-overview/chips-overview-example.ts similarity index 100% rename from src/examples/chips-overview/chips-overview-example.ts rename to src/material-examples/chips-overview/chips-overview-example.ts diff --git a/src/examples/chips-stacked/chips-stacked-example.css b/src/material-examples/chips-stacked/chips-stacked-example.css similarity index 100% rename from src/examples/chips-stacked/chips-stacked-example.css rename to src/material-examples/chips-stacked/chips-stacked-example.css diff --git a/src/examples/chips-stacked/chips-stacked-example.html b/src/material-examples/chips-stacked/chips-stacked-example.html similarity index 100% rename from src/examples/chips-stacked/chips-stacked-example.html rename to src/material-examples/chips-stacked/chips-stacked-example.html diff --git a/src/examples/chips-stacked/chips-stacked-example.ts b/src/material-examples/chips-stacked/chips-stacked-example.ts similarity index 100% rename from src/examples/chips-stacked/chips-stacked-example.ts rename to src/material-examples/chips-stacked/chips-stacked-example.ts diff --git a/src/examples/dialog-elements/dialog-elements-example-dialog.html b/src/material-examples/dialog-elements/dialog-elements-example-dialog.html similarity index 100% rename from src/examples/dialog-elements/dialog-elements-example-dialog.html rename to src/material-examples/dialog-elements/dialog-elements-example-dialog.html diff --git a/src/examples/dialog-elements/dialog-elements-example.css b/src/material-examples/dialog-elements/dialog-elements-example.css similarity index 100% rename from src/examples/dialog-elements/dialog-elements-example.css rename to src/material-examples/dialog-elements/dialog-elements-example.css diff --git a/src/examples/dialog-elements/dialog-elements-example.html b/src/material-examples/dialog-elements/dialog-elements-example.html similarity index 100% rename from src/examples/dialog-elements/dialog-elements-example.html rename to src/material-examples/dialog-elements/dialog-elements-example.html diff --git a/src/examples/dialog-elements/dialog-elements-example.ts b/src/material-examples/dialog-elements/dialog-elements-example.ts similarity index 100% rename from src/examples/dialog-elements/dialog-elements-example.ts rename to src/material-examples/dialog-elements/dialog-elements-example.ts diff --git a/src/examples/dialog-overview/dialog-overview-example-dialog.html b/src/material-examples/dialog-overview/dialog-overview-example-dialog.html similarity index 100% rename from src/examples/dialog-overview/dialog-overview-example-dialog.html rename to src/material-examples/dialog-overview/dialog-overview-example-dialog.html diff --git a/src/examples/dialog-overview/dialog-overview-example.css b/src/material-examples/dialog-overview/dialog-overview-example.css similarity index 100% rename from src/examples/dialog-overview/dialog-overview-example.css rename to src/material-examples/dialog-overview/dialog-overview-example.css diff --git a/src/examples/dialog-overview/dialog-overview-example.html b/src/material-examples/dialog-overview/dialog-overview-example.html similarity index 100% rename from src/examples/dialog-overview/dialog-overview-example.html rename to src/material-examples/dialog-overview/dialog-overview-example.html diff --git a/src/examples/dialog-overview/dialog-overview-example.ts b/src/material-examples/dialog-overview/dialog-overview-example.ts similarity index 100% rename from src/examples/dialog-overview/dialog-overview-example.ts rename to src/material-examples/dialog-overview/dialog-overview-example.ts diff --git a/src/examples/dialog-result/dialog-result-example-dialog.html b/src/material-examples/dialog-result/dialog-result-example-dialog.html similarity index 100% rename from src/examples/dialog-result/dialog-result-example-dialog.html rename to src/material-examples/dialog-result/dialog-result-example-dialog.html diff --git a/src/examples/dialog-result/dialog-result-example.css b/src/material-examples/dialog-result/dialog-result-example.css similarity index 100% rename from src/examples/dialog-result/dialog-result-example.css rename to src/material-examples/dialog-result/dialog-result-example.css diff --git a/src/examples/dialog-result/dialog-result-example.html b/src/material-examples/dialog-result/dialog-result-example.html similarity index 100% rename from src/examples/dialog-result/dialog-result-example.html rename to src/material-examples/dialog-result/dialog-result-example.html diff --git a/src/examples/dialog-result/dialog-result-example.ts b/src/material-examples/dialog-result/dialog-result-example.ts similarity index 100% rename from src/examples/dialog-result/dialog-result-example.ts rename to src/material-examples/dialog-result/dialog-result-example.ts diff --git a/src/examples/example-data.ts b/src/material-examples/example-data.ts similarity index 100% rename from src/examples/example-data.ts rename to src/material-examples/example-data.ts diff --git a/src/examples/example-module.ts b/src/material-examples/example-module.ts similarity index 100% rename from src/examples/example-module.ts rename to src/material-examples/example-module.ts diff --git a/src/examples/grid-list-dynamic/grid-list-dynamic-example.css b/src/material-examples/grid-list-dynamic/grid-list-dynamic-example.css similarity index 100% rename from src/examples/grid-list-dynamic/grid-list-dynamic-example.css rename to src/material-examples/grid-list-dynamic/grid-list-dynamic-example.css diff --git a/src/examples/grid-list-dynamic/grid-list-dynamic-example.html b/src/material-examples/grid-list-dynamic/grid-list-dynamic-example.html similarity index 100% rename from src/examples/grid-list-dynamic/grid-list-dynamic-example.html rename to src/material-examples/grid-list-dynamic/grid-list-dynamic-example.html diff --git a/src/examples/grid-list-dynamic/grid-list-dynamic-example.ts b/src/material-examples/grid-list-dynamic/grid-list-dynamic-example.ts similarity index 100% rename from src/examples/grid-list-dynamic/grid-list-dynamic-example.ts rename to src/material-examples/grid-list-dynamic/grid-list-dynamic-example.ts diff --git a/src/examples/grid-list-overview/grid-list-overview-example.css b/src/material-examples/grid-list-overview/grid-list-overview-example.css similarity index 100% rename from src/examples/grid-list-overview/grid-list-overview-example.css rename to src/material-examples/grid-list-overview/grid-list-overview-example.css diff --git a/src/examples/grid-list-overview/grid-list-overview-example.html b/src/material-examples/grid-list-overview/grid-list-overview-example.html similarity index 100% rename from src/examples/grid-list-overview/grid-list-overview-example.html rename to src/material-examples/grid-list-overview/grid-list-overview-example.html diff --git a/src/examples/grid-list-overview/grid-list-overview-example.ts b/src/material-examples/grid-list-overview/grid-list-overview-example.ts similarity index 100% rename from src/examples/grid-list-overview/grid-list-overview-example.ts rename to src/material-examples/grid-list-overview/grid-list-overview-example.ts diff --git a/src/examples/icon-overview/icon-overview-example.css b/src/material-examples/icon-overview/icon-overview-example.css similarity index 100% rename from src/examples/icon-overview/icon-overview-example.css rename to src/material-examples/icon-overview/icon-overview-example.css diff --git a/src/examples/icon-overview/icon-overview-example.html b/src/material-examples/icon-overview/icon-overview-example.html similarity index 100% rename from src/examples/icon-overview/icon-overview-example.html rename to src/material-examples/icon-overview/icon-overview-example.html diff --git a/src/examples/icon-overview/icon-overview-example.ts b/src/material-examples/icon-overview/icon-overview-example.ts similarity index 100% rename from src/examples/icon-overview/icon-overview-example.ts rename to src/material-examples/icon-overview/icon-overview-example.ts diff --git a/src/examples/icon-svg-example/icon-svg-example.css b/src/material-examples/icon-svg-example/icon-svg-example.css similarity index 100% rename from src/examples/icon-svg-example/icon-svg-example.css rename to src/material-examples/icon-svg-example/icon-svg-example.css diff --git a/src/examples/icon-svg-example/icon-svg-example.html b/src/material-examples/icon-svg-example/icon-svg-example.html similarity index 100% rename from src/examples/icon-svg-example/icon-svg-example.html rename to src/material-examples/icon-svg-example/icon-svg-example.html diff --git a/src/examples/icon-svg-example/icon-svg-example.ts b/src/material-examples/icon-svg-example/icon-svg-example.ts similarity index 100% rename from src/examples/icon-svg-example/icon-svg-example.ts rename to src/material-examples/icon-svg-example/icon-svg-example.ts diff --git a/src/examples/input-form/input-form-example.css b/src/material-examples/input-form/input-form-example.css similarity index 100% rename from src/examples/input-form/input-form-example.css rename to src/material-examples/input-form/input-form-example.css diff --git a/src/examples/input-form/input-form-example.html b/src/material-examples/input-form/input-form-example.html similarity index 100% rename from src/examples/input-form/input-form-example.html rename to src/material-examples/input-form/input-form-example.html diff --git a/src/examples/input-form/input-form-example.ts b/src/material-examples/input-form/input-form-example.ts similarity index 100% rename from src/examples/input-form/input-form-example.ts rename to src/material-examples/input-form/input-form-example.ts diff --git a/src/examples/input-overview/input-overview-example.css b/src/material-examples/input-overview/input-overview-example.css similarity index 100% rename from src/examples/input-overview/input-overview-example.css rename to src/material-examples/input-overview/input-overview-example.css diff --git a/src/examples/input-overview/input-overview-example.html b/src/material-examples/input-overview/input-overview-example.html similarity index 100% rename from src/examples/input-overview/input-overview-example.html rename to src/material-examples/input-overview/input-overview-example.html diff --git a/src/examples/input-overview/input-overview-example.ts b/src/material-examples/input-overview/input-overview-example.ts similarity index 100% rename from src/examples/input-overview/input-overview-example.ts rename to src/material-examples/input-overview/input-overview-example.ts diff --git a/src/examples/list-overview/list-overview-example.css b/src/material-examples/list-overview/list-overview-example.css similarity index 100% rename from src/examples/list-overview/list-overview-example.css rename to src/material-examples/list-overview/list-overview-example.css diff --git a/src/examples/list-overview/list-overview-example.html b/src/material-examples/list-overview/list-overview-example.html similarity index 100% rename from src/examples/list-overview/list-overview-example.html rename to src/material-examples/list-overview/list-overview-example.html diff --git a/src/examples/list-overview/list-overview-example.ts b/src/material-examples/list-overview/list-overview-example.ts similarity index 100% rename from src/examples/list-overview/list-overview-example.ts rename to src/material-examples/list-overview/list-overview-example.ts diff --git a/src/examples/list-sections/list-sections-example.css b/src/material-examples/list-sections/list-sections-example.css similarity index 100% rename from src/examples/list-sections/list-sections-example.css rename to src/material-examples/list-sections/list-sections-example.css diff --git a/src/examples/list-sections/list-sections-example.html b/src/material-examples/list-sections/list-sections-example.html similarity index 100% rename from src/examples/list-sections/list-sections-example.html rename to src/material-examples/list-sections/list-sections-example.html diff --git a/src/examples/list-sections/list-sections-example.ts b/src/material-examples/list-sections/list-sections-example.ts similarity index 100% rename from src/examples/list-sections/list-sections-example.ts rename to src/material-examples/list-sections/list-sections-example.ts diff --git a/src/examples/menu-icons/menu-icons-example.css b/src/material-examples/menu-icons/menu-icons-example.css similarity index 100% rename from src/examples/menu-icons/menu-icons-example.css rename to src/material-examples/menu-icons/menu-icons-example.css diff --git a/src/examples/menu-icons/menu-icons-example.html b/src/material-examples/menu-icons/menu-icons-example.html similarity index 100% rename from src/examples/menu-icons/menu-icons-example.html rename to src/material-examples/menu-icons/menu-icons-example.html diff --git a/src/examples/menu-icons/menu-icons-example.ts b/src/material-examples/menu-icons/menu-icons-example.ts similarity index 100% rename from src/examples/menu-icons/menu-icons-example.ts rename to src/material-examples/menu-icons/menu-icons-example.ts diff --git a/src/examples/menu-overview/menu-overview-example.css b/src/material-examples/menu-overview/menu-overview-example.css similarity index 100% rename from src/examples/menu-overview/menu-overview-example.css rename to src/material-examples/menu-overview/menu-overview-example.css diff --git a/src/examples/menu-overview/menu-overview-example.html b/src/material-examples/menu-overview/menu-overview-example.html similarity index 100% rename from src/examples/menu-overview/menu-overview-example.html rename to src/material-examples/menu-overview/menu-overview-example.html diff --git a/src/examples/menu-overview/menu-overview-example.ts b/src/material-examples/menu-overview/menu-overview-example.ts similarity index 100% rename from src/examples/menu-overview/menu-overview-example.ts rename to src/material-examples/menu-overview/menu-overview-example.ts diff --git a/src/examples/package.json b/src/material-examples/package.json similarity index 68% rename from src/examples/package.json rename to src/material-examples/package.json index 32ba85000ccc..a3f8bf2af809 100644 --- a/src/examples/package.json +++ b/src/material-examples/package.json @@ -1,11 +1,12 @@ { "name": "@angular/material-examples", "version": "2.0.0-beta.3", - "description": "Angular Material", - "main": "./bundles/examples.umd.js", - "module": "./@angular/examples.es5.js", - "es2015": "./@angular/examples.js", - "typings": "./examples.d.ts", + "description": "Angular Material Examples", + "main": "./bundles/material-examples.umd.js", + "module": "./@angular/material-examples.es5.js", + "es2015": "./@angular/material-examples.js", + "typings": "./material-examples.d.ts", + "private": true, "repository": { "type": "git", "url": "https://github.com/angular/material2.git" diff --git a/src/examples/progress-bar-configurable/progress-bar-configurable-example.css b/src/material-examples/progress-bar-configurable/progress-bar-configurable-example.css similarity index 100% rename from src/examples/progress-bar-configurable/progress-bar-configurable-example.css rename to src/material-examples/progress-bar-configurable/progress-bar-configurable-example.css diff --git a/src/examples/progress-bar-configurable/progress-bar-configurable-example.html b/src/material-examples/progress-bar-configurable/progress-bar-configurable-example.html similarity index 100% rename from src/examples/progress-bar-configurable/progress-bar-configurable-example.html rename to src/material-examples/progress-bar-configurable/progress-bar-configurable-example.html diff --git a/src/examples/progress-bar-configurable/progress-bar-configurable-example.ts b/src/material-examples/progress-bar-configurable/progress-bar-configurable-example.ts similarity index 100% rename from src/examples/progress-bar-configurable/progress-bar-configurable-example.ts rename to src/material-examples/progress-bar-configurable/progress-bar-configurable-example.ts diff --git a/src/examples/progress-bar-overview/progress-bar-overview-example.css b/src/material-examples/progress-bar-overview/progress-bar-overview-example.css similarity index 100% rename from src/examples/progress-bar-overview/progress-bar-overview-example.css rename to src/material-examples/progress-bar-overview/progress-bar-overview-example.css diff --git a/src/examples/progress-bar-overview/progress-bar-overview-example.html b/src/material-examples/progress-bar-overview/progress-bar-overview-example.html similarity index 100% rename from src/examples/progress-bar-overview/progress-bar-overview-example.html rename to src/material-examples/progress-bar-overview/progress-bar-overview-example.html diff --git a/src/examples/progress-bar-overview/progress-bar-overview-example.ts b/src/material-examples/progress-bar-overview/progress-bar-overview-example.ts similarity index 100% rename from src/examples/progress-bar-overview/progress-bar-overview-example.ts rename to src/material-examples/progress-bar-overview/progress-bar-overview-example.ts diff --git a/src/examples/progress-spinner-configurable/progress-spinner-configurable-example.css b/src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.css similarity index 100% rename from src/examples/progress-spinner-configurable/progress-spinner-configurable-example.css rename to src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.css diff --git a/src/examples/progress-spinner-configurable/progress-spinner-configurable-example.html b/src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.html similarity index 100% rename from src/examples/progress-spinner-configurable/progress-spinner-configurable-example.html rename to src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.html diff --git a/src/examples/progress-spinner-configurable/progress-spinner-configurable-example.ts b/src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.ts similarity index 100% rename from src/examples/progress-spinner-configurable/progress-spinner-configurable-example.ts rename to src/material-examples/progress-spinner-configurable/progress-spinner-configurable-example.ts diff --git a/src/examples/progress-spinner-overview/progress-spinner-overview-example.css b/src/material-examples/progress-spinner-overview/progress-spinner-overview-example.css similarity index 100% rename from src/examples/progress-spinner-overview/progress-spinner-overview-example.css rename to src/material-examples/progress-spinner-overview/progress-spinner-overview-example.css diff --git a/src/examples/progress-spinner-overview/progress-spinner-overview-example.html b/src/material-examples/progress-spinner-overview/progress-spinner-overview-example.html similarity index 100% rename from src/examples/progress-spinner-overview/progress-spinner-overview-example.html rename to src/material-examples/progress-spinner-overview/progress-spinner-overview-example.html diff --git a/src/examples/progress-spinner-overview/progress-spinner-overview-example.ts b/src/material-examples/progress-spinner-overview/progress-spinner-overview-example.ts similarity index 100% rename from src/examples/progress-spinner-overview/progress-spinner-overview-example.ts rename to src/material-examples/progress-spinner-overview/progress-spinner-overview-example.ts diff --git a/src/examples/public_api.ts b/src/material-examples/public_api.ts similarity index 100% rename from src/examples/public_api.ts rename to src/material-examples/public_api.ts diff --git a/src/examples/radio-ng-model/radio-ng-model-example.css b/src/material-examples/radio-ng-model/radio-ng-model-example.css similarity index 100% rename from src/examples/radio-ng-model/radio-ng-model-example.css rename to src/material-examples/radio-ng-model/radio-ng-model-example.css diff --git a/src/examples/radio-ng-model/radio-ng-model-example.html b/src/material-examples/radio-ng-model/radio-ng-model-example.html similarity index 100% rename from src/examples/radio-ng-model/radio-ng-model-example.html rename to src/material-examples/radio-ng-model/radio-ng-model-example.html diff --git a/src/examples/radio-ng-model/radio-ng-model-example.ts b/src/material-examples/radio-ng-model/radio-ng-model-example.ts similarity index 100% rename from src/examples/radio-ng-model/radio-ng-model-example.ts rename to src/material-examples/radio-ng-model/radio-ng-model-example.ts diff --git a/src/examples/radio-overview/radio-overview-example.css b/src/material-examples/radio-overview/radio-overview-example.css similarity index 100% rename from src/examples/radio-overview/radio-overview-example.css rename to src/material-examples/radio-overview/radio-overview-example.css diff --git a/src/examples/radio-overview/radio-overview-example.html b/src/material-examples/radio-overview/radio-overview-example.html similarity index 100% rename from src/examples/radio-overview/radio-overview-example.html rename to src/material-examples/radio-overview/radio-overview-example.html diff --git a/src/examples/radio-overview/radio-overview-example.ts b/src/material-examples/radio-overview/radio-overview-example.ts similarity index 100% rename from src/examples/radio-overview/radio-overview-example.ts rename to src/material-examples/radio-overview/radio-overview-example.ts diff --git a/src/examples/select-form/select-form-example.css b/src/material-examples/select-form/select-form-example.css similarity index 100% rename from src/examples/select-form/select-form-example.css rename to src/material-examples/select-form/select-form-example.css diff --git a/src/examples/select-form/select-form-example.html b/src/material-examples/select-form/select-form-example.html similarity index 100% rename from src/examples/select-form/select-form-example.html rename to src/material-examples/select-form/select-form-example.html diff --git a/src/examples/select-form/select-form-example.ts b/src/material-examples/select-form/select-form-example.ts similarity index 100% rename from src/examples/select-form/select-form-example.ts rename to src/material-examples/select-form/select-form-example.ts diff --git a/src/examples/select-overview/select-overview-example.css b/src/material-examples/select-overview/select-overview-example.css similarity index 100% rename from src/examples/select-overview/select-overview-example.css rename to src/material-examples/select-overview/select-overview-example.css diff --git a/src/examples/select-overview/select-overview-example.html b/src/material-examples/select-overview/select-overview-example.html similarity index 100% rename from src/examples/select-overview/select-overview-example.html rename to src/material-examples/select-overview/select-overview-example.html diff --git a/src/examples/select-overview/select-overview-example.ts b/src/material-examples/select-overview/select-overview-example.ts similarity index 100% rename from src/examples/select-overview/select-overview-example.ts rename to src/material-examples/select-overview/select-overview-example.ts diff --git a/src/examples/sidenav-fab/sidenav-fab-example.css b/src/material-examples/sidenav-fab/sidenav-fab-example.css similarity index 100% rename from src/examples/sidenav-fab/sidenav-fab-example.css rename to src/material-examples/sidenav-fab/sidenav-fab-example.css diff --git a/src/examples/sidenav-fab/sidenav-fab-example.html b/src/material-examples/sidenav-fab/sidenav-fab-example.html similarity index 100% rename from src/examples/sidenav-fab/sidenav-fab-example.html rename to src/material-examples/sidenav-fab/sidenav-fab-example.html diff --git a/src/examples/sidenav-fab/sidenav-fab-example.ts b/src/material-examples/sidenav-fab/sidenav-fab-example.ts similarity index 100% rename from src/examples/sidenav-fab/sidenav-fab-example.ts rename to src/material-examples/sidenav-fab/sidenav-fab-example.ts diff --git a/src/examples/sidenav-overview/sidenav-overview-example.css b/src/material-examples/sidenav-overview/sidenav-overview-example.css similarity index 100% rename from src/examples/sidenav-overview/sidenav-overview-example.css rename to src/material-examples/sidenav-overview/sidenav-overview-example.css diff --git a/src/examples/sidenav-overview/sidenav-overview-example.html b/src/material-examples/sidenav-overview/sidenav-overview-example.html similarity index 100% rename from src/examples/sidenav-overview/sidenav-overview-example.html rename to src/material-examples/sidenav-overview/sidenav-overview-example.html diff --git a/src/examples/sidenav-overview/sidenav-overview-example.ts b/src/material-examples/sidenav-overview/sidenav-overview-example.ts similarity index 100% rename from src/examples/sidenav-overview/sidenav-overview-example.ts rename to src/material-examples/sidenav-overview/sidenav-overview-example.ts diff --git a/src/examples/slide-toggle-configurable/slide-toggle-configurable-example.css b/src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.css similarity index 100% rename from src/examples/slide-toggle-configurable/slide-toggle-configurable-example.css rename to src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.css diff --git a/src/examples/slide-toggle-configurable/slide-toggle-configurable-example.html b/src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.html similarity index 100% rename from src/examples/slide-toggle-configurable/slide-toggle-configurable-example.html rename to src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.html diff --git a/src/examples/slide-toggle-configurable/slide-toggle-configurable-example.ts b/src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.ts similarity index 100% rename from src/examples/slide-toggle-configurable/slide-toggle-configurable-example.ts rename to src/material-examples/slide-toggle-configurable/slide-toggle-configurable-example.ts diff --git a/src/examples/slide-toggle-overview/slide-toggle-overview-example.css b/src/material-examples/slide-toggle-overview/slide-toggle-overview-example.css similarity index 100% rename from src/examples/slide-toggle-overview/slide-toggle-overview-example.css rename to src/material-examples/slide-toggle-overview/slide-toggle-overview-example.css diff --git a/src/examples/slide-toggle-overview/slide-toggle-overview-example.html b/src/material-examples/slide-toggle-overview/slide-toggle-overview-example.html similarity index 100% rename from src/examples/slide-toggle-overview/slide-toggle-overview-example.html rename to src/material-examples/slide-toggle-overview/slide-toggle-overview-example.html diff --git a/src/examples/slide-toggle-overview/slide-toggle-overview-example.ts b/src/material-examples/slide-toggle-overview/slide-toggle-overview-example.ts similarity index 100% rename from src/examples/slide-toggle-overview/slide-toggle-overview-example.ts rename to src/material-examples/slide-toggle-overview/slide-toggle-overview-example.ts diff --git a/src/examples/slider-configurable/slider-configurable-example.css b/src/material-examples/slider-configurable/slider-configurable-example.css similarity index 100% rename from src/examples/slider-configurable/slider-configurable-example.css rename to src/material-examples/slider-configurable/slider-configurable-example.css diff --git a/src/examples/slider-configurable/slider-configurable-example.html b/src/material-examples/slider-configurable/slider-configurable-example.html similarity index 100% rename from src/examples/slider-configurable/slider-configurable-example.html rename to src/material-examples/slider-configurable/slider-configurable-example.html diff --git a/src/examples/slider-configurable/slider-configurable-example.ts b/src/material-examples/slider-configurable/slider-configurable-example.ts similarity index 100% rename from src/examples/slider-configurable/slider-configurable-example.ts rename to src/material-examples/slider-configurable/slider-configurable-example.ts diff --git a/src/examples/slider-overview/slider-overview-example.css b/src/material-examples/slider-overview/slider-overview-example.css similarity index 100% rename from src/examples/slider-overview/slider-overview-example.css rename to src/material-examples/slider-overview/slider-overview-example.css diff --git a/src/examples/slider-overview/slider-overview-example.html b/src/material-examples/slider-overview/slider-overview-example.html similarity index 100% rename from src/examples/slider-overview/slider-overview-example.html rename to src/material-examples/slider-overview/slider-overview-example.html diff --git a/src/examples/slider-overview/slider-overview-example.ts b/src/material-examples/slider-overview/slider-overview-example.ts similarity index 100% rename from src/examples/slider-overview/slider-overview-example.ts rename to src/material-examples/slider-overview/slider-overview-example.ts diff --git a/src/examples/snack-bar-component/snack-bar-component-example-snack.css b/src/material-examples/snack-bar-component/snack-bar-component-example-snack.css similarity index 100% rename from src/examples/snack-bar-component/snack-bar-component-example-snack.css rename to src/material-examples/snack-bar-component/snack-bar-component-example-snack.css diff --git a/src/examples/snack-bar-component/snack-bar-component-example-snack.html b/src/material-examples/snack-bar-component/snack-bar-component-example-snack.html similarity index 100% rename from src/examples/snack-bar-component/snack-bar-component-example-snack.html rename to src/material-examples/snack-bar-component/snack-bar-component-example-snack.html diff --git a/src/examples/snack-bar-component/snack-bar-component-example.html b/src/material-examples/snack-bar-component/snack-bar-component-example.html similarity index 100% rename from src/examples/snack-bar-component/snack-bar-component-example.html rename to src/material-examples/snack-bar-component/snack-bar-component-example.html diff --git a/src/examples/snack-bar-component/snack-bar-component-example.ts b/src/material-examples/snack-bar-component/snack-bar-component-example.ts similarity index 100% rename from src/examples/snack-bar-component/snack-bar-component-example.ts rename to src/material-examples/snack-bar-component/snack-bar-component-example.ts diff --git a/src/examples/snack-bar-overview/snack-bar-overview-example.css b/src/material-examples/snack-bar-overview/snack-bar-overview-example.css similarity index 100% rename from src/examples/snack-bar-overview/snack-bar-overview-example.css rename to src/material-examples/snack-bar-overview/snack-bar-overview-example.css diff --git a/src/examples/snack-bar-overview/snack-bar-overview-example.html b/src/material-examples/snack-bar-overview/snack-bar-overview-example.html similarity index 100% rename from src/examples/snack-bar-overview/snack-bar-overview-example.html rename to src/material-examples/snack-bar-overview/snack-bar-overview-example.html diff --git a/src/examples/snack-bar-overview/snack-bar-overview-example.ts b/src/material-examples/snack-bar-overview/snack-bar-overview-example.ts similarity index 100% rename from src/examples/snack-bar-overview/snack-bar-overview-example.ts rename to src/material-examples/snack-bar-overview/snack-bar-overview-example.ts diff --git a/src/examples/tabs-overview/tabs-overview-example.css b/src/material-examples/tabs-overview/tabs-overview-example.css similarity index 100% rename from src/examples/tabs-overview/tabs-overview-example.css rename to src/material-examples/tabs-overview/tabs-overview-example.css diff --git a/src/examples/tabs-overview/tabs-overview-example.html b/src/material-examples/tabs-overview/tabs-overview-example.html similarity index 100% rename from src/examples/tabs-overview/tabs-overview-example.html rename to src/material-examples/tabs-overview/tabs-overview-example.html diff --git a/src/examples/tabs-overview/tabs-overview-example.ts b/src/material-examples/tabs-overview/tabs-overview-example.ts similarity index 100% rename from src/examples/tabs-overview/tabs-overview-example.ts rename to src/material-examples/tabs-overview/tabs-overview-example.ts diff --git a/src/examples/tabs-template-label/tabs-template-label-example.css b/src/material-examples/tabs-template-label/tabs-template-label-example.css similarity index 100% rename from src/examples/tabs-template-label/tabs-template-label-example.css rename to src/material-examples/tabs-template-label/tabs-template-label-example.css diff --git a/src/examples/tabs-template-label/tabs-template-label-example.html b/src/material-examples/tabs-template-label/tabs-template-label-example.html similarity index 100% rename from src/examples/tabs-template-label/tabs-template-label-example.html rename to src/material-examples/tabs-template-label/tabs-template-label-example.html diff --git a/src/examples/tabs-template-label/tabs-template-label-example.ts b/src/material-examples/tabs-template-label/tabs-template-label-example.ts similarity index 100% rename from src/examples/tabs-template-label/tabs-template-label-example.ts rename to src/material-examples/tabs-template-label/tabs-template-label-example.ts diff --git a/src/examples/toolbar-multirow/toolbar-multirow-example.css b/src/material-examples/toolbar-multirow/toolbar-multirow-example.css similarity index 100% rename from src/examples/toolbar-multirow/toolbar-multirow-example.css rename to src/material-examples/toolbar-multirow/toolbar-multirow-example.css diff --git a/src/examples/toolbar-multirow/toolbar-multirow-example.html b/src/material-examples/toolbar-multirow/toolbar-multirow-example.html similarity index 100% rename from src/examples/toolbar-multirow/toolbar-multirow-example.html rename to src/material-examples/toolbar-multirow/toolbar-multirow-example.html diff --git a/src/examples/toolbar-multirow/toolbar-multirow-example.ts b/src/material-examples/toolbar-multirow/toolbar-multirow-example.ts similarity index 100% rename from src/examples/toolbar-multirow/toolbar-multirow-example.ts rename to src/material-examples/toolbar-multirow/toolbar-multirow-example.ts diff --git a/src/examples/toolbar-overview/toolbar-overview-example.css b/src/material-examples/toolbar-overview/toolbar-overview-example.css similarity index 100% rename from src/examples/toolbar-overview/toolbar-overview-example.css rename to src/material-examples/toolbar-overview/toolbar-overview-example.css diff --git a/src/examples/toolbar-overview/toolbar-overview-example.html b/src/material-examples/toolbar-overview/toolbar-overview-example.html similarity index 100% rename from src/examples/toolbar-overview/toolbar-overview-example.html rename to src/material-examples/toolbar-overview/toolbar-overview-example.html diff --git a/src/examples/toolbar-overview/toolbar-overview-example.ts b/src/material-examples/toolbar-overview/toolbar-overview-example.ts similarity index 100% rename from src/examples/toolbar-overview/toolbar-overview-example.ts rename to src/material-examples/toolbar-overview/toolbar-overview-example.ts diff --git a/src/examples/tooltip-overview/tooltip-overview-example.css b/src/material-examples/tooltip-overview/tooltip-overview-example.css similarity index 100% rename from src/examples/tooltip-overview/tooltip-overview-example.css rename to src/material-examples/tooltip-overview/tooltip-overview-example.css diff --git a/src/examples/tooltip-overview/tooltip-overview-example.html b/src/material-examples/tooltip-overview/tooltip-overview-example.html similarity index 100% rename from src/examples/tooltip-overview/tooltip-overview-example.html rename to src/material-examples/tooltip-overview/tooltip-overview-example.html diff --git a/src/examples/tooltip-overview/tooltip-overview-example.ts b/src/material-examples/tooltip-overview/tooltip-overview-example.ts similarity index 100% rename from src/examples/tooltip-overview/tooltip-overview-example.ts rename to src/material-examples/tooltip-overview/tooltip-overview-example.ts diff --git a/src/examples/tooltip-position/tooltip-position-example.css b/src/material-examples/tooltip-position/tooltip-position-example.css similarity index 100% rename from src/examples/tooltip-position/tooltip-position-example.css rename to src/material-examples/tooltip-position/tooltip-position-example.css diff --git a/src/examples/tooltip-position/tooltip-position-example.html b/src/material-examples/tooltip-position/tooltip-position-example.html similarity index 100% rename from src/examples/tooltip-position/tooltip-position-example.html rename to src/material-examples/tooltip-position/tooltip-position-example.html diff --git a/src/examples/tooltip-position/tooltip-position-example.ts b/src/material-examples/tooltip-position/tooltip-position-example.ts similarity index 100% rename from src/examples/tooltip-position/tooltip-position-example.ts rename to src/material-examples/tooltip-position/tooltip-position-example.ts diff --git a/src/examples/tsconfig-build.json b/src/material-examples/tsconfig-build.json similarity index 100% rename from src/examples/tsconfig-build.json rename to src/material-examples/tsconfig-build.json diff --git a/tools/dgeni/processors/categorizer.js b/tools/dgeni/processors/categorizer.js index 758d14b7d611..1644f29158f4 100644 --- a/tools/dgeni/processors/categorizer.js +++ b/tools/dgeni/processors/categorizer.js @@ -18,7 +18,7 @@ module.exports = function categorizer() { * Decorates all class docs inside of the dgeni pipeline. * - Methods and properties of a class-doc will be extracted into separate variables. * - Identifies directives, services or NgModules and marks them them in class-doc. - **/ + */ function decorateClassDoc(classDoc) { // Resolve all methods and properties from the classDoc. Includes inherited docs. classDoc.methods = resolveMethods(classDoc); @@ -42,7 +42,7 @@ module.exports = function categorizer() { /** * Method that will be called for each method doc. The parameters for the method-docs * will be normalized, so that they can be easily used inside of dgeni templates. - **/ + */ function decorateMethodDoc(methodDoc) { normalizeMethodParameters(methodDoc); @@ -53,7 +53,7 @@ module.exports = function categorizer() { /** * Method that will be called for each property doc. Properties that are Angular inputs or * outputs will be marked. Aliases for the inputs or outputs will be stored as well. - **/ + */ function decoratePropertyDoc(propertyDoc) { propertyDoc.isDirectiveInput = isDirectiveInput(propertyDoc); propertyDoc.directiveInputAlias = getDirectiveInputAlias(propertyDoc); diff --git a/tools/gulp/tasks/examples.ts b/tools/gulp/tasks/examples.ts index 2b73a984cf65..c66a015f6169 100644 --- a/tools/gulp/tasks/examples.ts +++ b/tools/gulp/tasks/examples.ts @@ -1,25 +1,18 @@ -import {task, watch} from 'gulp'; +import {task} from 'gulp'; import {join} from 'path'; import {main as tsc} from '@angular/tsc-wrapped'; -import {SOURCE_ROOT, DIST_BUNDLES, DIST_EXAMPLES} from '../constants'; -import {sequenceTask, sassBuildTask, copyTask, triggerLivereload} from '../util/task_helpers'; -import {createRollupBundle} from '../util/rollup-helper'; -import {transpileFile} from '../util/ts-compiler'; +import {SOURCE_ROOT, DIST_EXAMPLES} from '../constants'; +import {sequenceTask, copyTask} from '../util/task_helpers'; import {buildModuleEntry, composeRelease} from '../util/package-build'; -import {ScriptTarget, ModuleKind} from 'typescript'; -import {writeFileSync} from 'fs'; // There are no type definitions available for these imports. const inlineResources = require('../../../scripts/release/inline-resources'); -const uglify = require('uglify-js'); -const examplesRoot = join(SOURCE_ROOT, 'examples'); +const examplesRoot = join(SOURCE_ROOT, 'material-examples'); const tsconfigPath = join(examplesRoot, 'tsconfig-build.json'); -// Paths to the different output directories. +// Paths to the different output files and directories. const examplesOut = DIST_EXAMPLES; -const bundlesDir = DIST_BUNDLES; - const examplesMain = join(examplesOut, 'public_api.js'); task('examples:clean-build', sequenceTask('clean', 'examples:build')); @@ -35,18 +28,18 @@ task('examples:build', sequenceTask( 'examples:build:bundles', )); -task('examples:release', ['examples:clean-build'], () => composeRelease('examples')); +task('examples:release', ['examples:clean-build'], () => composeRelease('material-examples')); /** * TypeScript compilation tasks. Tasks are creating ESM, FESM, UMD bundles for releases. - **/ + */ task('examples:build:esm', () => tsc(tsconfigPath, {basePath: examplesRoot})); -task('examples:build:bundles', () => buildModuleEntry(examplesMain, 'examples')); +task('examples:build:bundles', () => buildModuleEntry(examplesMain, 'material-examples')); /** * Asset tasks. Copying and inlining CSS, HTML files into the ESM output. - **/ + */ task('examples:assets:html', copyTask(join(examplesRoot, '**/*.+(html|css)'), examplesOut)); task('examples:assets:inline', () => inlineResources(examplesOut)); diff --git a/tools/gulp/tasks/library.ts b/tools/gulp/tasks/library.ts index aacf1a4be046..66e1fb47edca 100644 --- a/tools/gulp/tasks/library.ts +++ b/tools/gulp/tasks/library.ts @@ -1,25 +1,18 @@ import {task, watch} from 'gulp'; import {join} from 'path'; import {main as tsc} from '@angular/tsc-wrapped'; -import {SOURCE_ROOT, DIST_BUNDLES, DIST_MATERIAL} from '../constants'; +import {SOURCE_ROOT, DIST_MATERIAL} from '../constants'; import {sequenceTask, sassBuildTask, copyTask, triggerLivereload} from '../util/task_helpers'; -import {createRollupBundle} from '../util/rollup-helper'; -import {transpileFile} from '../util/ts-compiler'; import {buildModuleEntry} from '../util/package-build'; -import {ScriptTarget, ModuleKind} from 'typescript'; -import {writeFileSync} from 'fs'; // There are no type definitions available for these imports. const inlineResources = require('../../../scripts/release/inline-resources'); -const uglify = require('uglify-js'); const libraryRoot = join(SOURCE_ROOT, 'lib'); const tsconfigPath = join(libraryRoot, 'tsconfig-build.json'); -// Paths to the different output directories. +// Paths to the different output files and directories. const materialDir = DIST_MATERIAL; -const bundlesDir = DIST_BUNDLES; - const esmMainFile = join(materialDir, 'index.js'); task('library:clean-build', sequenceTask('clean', 'library:build')); @@ -41,14 +34,14 @@ task('library:watch', () => { /** * TypeScript compilation tasks. Tasks are creating ESM, FESM, UMD bundles for releases. - **/ + */ task('library:build:esm', () => tsc(tsconfigPath, {basePath: libraryRoot})); task('library:build:bundles', () => buildModuleEntry(esmMainFile)); /** * Asset tasks. Building SaSS files and inlining CSS, HTML files into the ESM output. - **/ + */ task('library:assets', ['library:assets:scss', 'library:assets:html']); diff --git a/tools/gulp/util/package-build.ts b/tools/gulp/util/package-build.ts index f88f7a22988e..0a6e516f20b7 100644 --- a/tools/gulp/util/package-build.ts +++ b/tools/gulp/util/package-build.ts @@ -1,9 +1,8 @@ -import {join, basename, dirname, relative} from 'path'; -import {main as tsc} from '@angular/tsc-wrapped'; +import {join, basename, dirname} from 'path'; import {DIST_BUNDLES, DIST_ROOT, SOURCE_ROOT, PROJECT_ROOT, LICENSE_BANNER} from '../constants'; -import {createRollupBundle} from '../util/rollup-helper'; -import {inlineMetadataResources} from '../util/inline-resources'; -import {transpileFile} from '../util/ts-compiler'; +import {createRollupBundle} from './rollup-helper'; +import {inlineMetadataResources} from './inline-resources'; +import {transpileFile} from './ts-compiler'; import {ScriptTarget, ModuleKind} from 'typescript'; import {sync as glob} from 'glob'; import { @@ -13,13 +12,18 @@ import { // There are no type definitions available for these imports. const uglify = require('uglify-js'); +/** + * Copies different output files into a folder structure that follows the `angular/angular` + * release folder structure. The output will also contain a README and the according package.json + * file. Additionally the package will be Closure Compiler and AOT compatible. + */ export function composeRelease(packageName: string) { // To avoid refactoring of the project the package material will map to the source path `lib/`. let sourcePath = join(SOURCE_ROOT, packageName === 'material' ? 'lib' : packageName); let packagePath = join(DIST_ROOT, 'packages', packageName); let releasePath = join(DIST_ROOT, 'releases', packageName); - inlineMetadata(packagePath); + inlinePackageMetadataFiles(packagePath); copyFiles(packagePath, '**/*.+(d.ts|metadata.json)', join(releasePath, 'typings')); copyFiles(DIST_BUNDLES, `${packageName}.umd?(.min).js`, join(releasePath, 'bundles')); @@ -91,7 +95,8 @@ function createMetadataFile(packageDir: string, packageName: string) { writeFileSync(join(packageDir, `${packageName}.metadata.json`), metadataReExport, 'utf-8'); } -function inlineMetadata(packagePath: string) { +/** Inlines HTML and CSS resources into `metadata.json` files. */ +function inlinePackageMetadataFiles(packagePath: string) { // Create a map of fileName -> fullFilePath. This is needed because the templateUrl and // styleUrls for each component use just the filename because, in the source, the component // and the resources live in the same directory.