From 48627ea8ae5ce85a5697a3dbdf138670f46cd1cc Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Wed, 3 Aug 2016 13:46:02 -0700 Subject: [PATCH] build: move from angular-cli to gulp --- .travis.yml | 1 - angular-cli-build.js | 111 -------- angular-cli.json | 25 -- gulpfile.js | 245 ++++++++++++++++++ package.json | 24 +- scripts/ci/build-and-test.sh | 3 +- scripts/release/inline-resources.js | 49 ++-- scripts/serve-dist.js | 22 ++ src/demo-app/environment.ts | 7 - src/demo-app/index.html | 18 +- src/demo-app/system-config.ts | 6 - src/demo-app/tsconfig.json | 25 +- src/demo-app/typings.d.ts | 2 - src/e2e-app/index.html | 15 +- src/e2e-app/system-config.ts | 31 ++- src/e2e-app/tsconfig.json | 28 +- src/e2e-app/typings.d.ts | 3 - .../button-toggle/README.md | 0 .../button-toggle/button-toggle.html | 0 .../button-toggle/button-toggle.scss | 0 .../button-toggle/button-toggle.spec.ts | 0 .../button-toggle/button-toggle.ts | 9 +- .../button-toggle/package.json | 0 src/{components => lib}/button/README.md | 0 .../button/_button-base.scss | 0 .../button/_button-theme.scss | 0 src/{components => lib}/button/button.html | 0 src/{components => lib}/button/button.scss | 0 src/{components => lib}/button/button.spec.ts | 0 src/{components => lib}/button/button.ts | 2 - src/lib/button/index.ts | 1 + src/{components => lib}/button/package.json | 0 src/{components => lib}/card/README.md | 0 src/{components => lib}/card/card-header.html | 0 .../card/card-title-group.html | 0 src/{components => lib}/card/card.html | 0 src/{components => lib}/card/card.scss | 0 src/{components => lib}/card/card.ts | 3 - src/{components => lib}/card/package.json | 0 src/{components => lib}/checkbox/README.md | 0 .../checkbox/checkbox.html | 0 .../checkbox/checkbox.scss | 0 .../checkbox/checkbox.spec.ts | 0 src/{components => lib}/checkbox/checkbox.ts | 1 - src/{components => lib}/checkbox/package.json | 0 src/{ => lib}/core/README.md | 0 src/{ => lib}/core/a11y/README.md | 0 src/{ => lib}/core/a11y/live-announcer.scss | 0 .../core/a11y/live-announcer.spec.ts | 0 src/{ => lib}/core/a11y/live-announcer.ts | 0 .../core/annotations/field-value.spec.ts | 0 src/{ => lib}/core/annotations/field-value.ts | 0 src/{ => lib}/core/async/promise-completer.ts | 0 .../unique-selection-dispatcher.ts | 0 src/{ => lib}/core/core.ts | 0 src/{ => lib}/core/errors/error.ts | 0 .../core/gestures/MdGestureConfig.ts | 0 src/{ => lib}/core/line/line.ts | 0 .../core/overlay/generic-component-type.ts | 0 .../core/overlay/overlay-container.ts | 0 .../core/overlay/overlay-directives.spec.ts | 0 .../core/overlay/overlay-directives.ts | 0 src/{ => lib}/core/overlay/overlay-ref.ts | 0 src/{ => lib}/core/overlay/overlay-state.ts | 0 src/{ => lib}/core/overlay/overlay.scss | 0 src/{ => lib}/core/overlay/overlay.spec.ts | 0 src/{ => lib}/core/overlay/overlay.ts | 0 .../connected-position-strategy.spec.ts | 0 .../position/connected-position-strategy.ts | 0 .../overlay/position/connected-position.ts | 0 .../position/global-position-strategy.spec.ts | 0 .../position/global-position-strategy.ts | 0 .../position/overlay-position-builder.ts | 0 .../overlay/position/position-strategy.ts | 0 .../position/relative-position-strategy.ts | 0 .../overlay/position/viewport-ruler.spec.ts | 0 .../core/overlay/position/viewport-ruler.ts | 0 src/{ => lib}/core/package.json | 0 src/{ => lib}/core/portal/README.md | 0 src/{ => lib}/core/portal/dom-portal-host.ts | 0 .../core/portal/portal-directives.ts | 0 src/{ => lib}/core/portal/portal-errors.ts | 0 src/{ => lib}/core/portal/portal.spec.ts | 0 src/{ => lib}/core/portal/portal.ts | 0 src/{ => lib}/core/ripple/README.md | 0 src/{ => lib}/core/ripple/ripple-renderer.ts | 0 src/{ => lib}/core/ripple/ripple.spec.ts | 0 src/{ => lib}/core/ripple/ripple.ts | 0 src/{ => lib}/core/rtl/dir.ts | 0 src/{ => lib}/core/style/_button-mixins.scss | 0 src/{ => lib}/core/style/_default-theme.scss | 0 src/{ => lib}/core/style/_elevation.scss | 0 src/{ => lib}/core/style/_list-shared.scss | 0 src/{ => lib}/core/style/_mixins.scss | 0 src/{ => lib}/core/style/_palette.scss | 0 src/{ => lib}/core/style/_ripple.scss | 0 src/{ => lib}/core/style/_sidenav-mixins.scss | 0 .../core/style/_theme-functions.scss | 0 src/{ => lib}/core/style/_variables.scss | 0 src/{ => lib}/core/style/apply-transform.ts | 0 src/{ => lib}/core/style/core.scss | 0 .../dialog/dialog-config.ts | 0 .../dialog/dialog-container.html | 0 .../dialog/dialog-container.scss | 0 .../dialog/dialog-container.ts | 1 - .../dialog/dialog-errors.ts | 0 .../dialog/dialog-injector.ts | 0 src/{components => lib}/dialog/dialog-ref.ts | 0 src/{components => lib}/dialog/dialog.spec.ts | 0 src/{components => lib}/dialog/dialog.ts | 0 src/{components => lib}/grid-list/README.md | 0 .../grid-list/grid-list-errors.ts | 0 .../grid-list/grid-list-measure.ts | 0 .../grid-list/grid-list.html | 0 .../grid-list/grid-list.scss | 0 .../grid-list/grid-list.spec.ts | 0 .../grid-list/grid-list.ts | 1 - .../grid-list/grid-tile-text.html | 0 .../grid-list/grid-tile.html | 0 .../grid-list/grid-tile.ts | 2 - .../grid-list/package.json | 0 .../grid-list/tile-coordinator.ts | 0 .../grid-list/tile-styler.ts | 0 src/{components => lib}/icon/README.md | 0 src/{components => lib}/icon/fake-svgs.ts | 0 src/{components => lib}/icon/icon-registry.ts | 0 src/{components => lib}/icon/icon.scss | 0 src/{components => lib}/icon/icon.spec.ts | 0 src/{components => lib}/icon/icon.ts | 1 - src/{components => lib}/icon/package.json | 0 src/{components => lib}/input/README.md | 0 src/{components => lib}/input/input.html | 0 src/{components => lib}/input/input.scss | 0 src/{components => lib}/input/input.spec.ts | 0 src/{components => lib}/input/input.ts | 1 - src/{components => lib}/input/package.json | 0 src/{components => lib}/list/README.md | 0 src/{components => lib}/list/list-item.html | 0 src/{components => lib}/list/list.scss | 0 src/{components => lib}/list/list.spec.ts | 0 src/{components => lib}/list/list.ts | 2 - src/{components => lib}/list/package.json | 0 src/{components => lib}/menu/README.md | 0 .../menu/menu-directive.ts | 1 - src/{components => lib}/menu/menu-errors.ts | 0 src/{components => lib}/menu/menu-item.ts | 0 .../menu/menu-positions.ts | 0 src/{components => lib}/menu/menu-trigger.ts | 0 src/{components => lib}/menu/menu.html | 0 src/{components => lib}/menu/menu.scss | 0 src/{components => lib}/menu/menu.spec.ts | 0 src/{components => lib}/menu/menu.ts | 0 src/{components => lib}/menu/package.json | 0 .../progress-bar/README.md | 0 .../progress-bar/package.json | 0 .../progress-bar/progress-bar.html | 0 .../progress-bar/progress-bar.scss | 0 .../progress-bar/progress-bar.spec.ts | 0 .../progress-bar/progress-bar.ts | 1 - .../progress-circle/README.md | 0 .../progress-circle/package.json | 0 .../progress-circle/progress-circle.html | 0 .../progress-circle/progress-circle.scss | 0 .../progress-circle/progress-circle.spec.ts | 0 .../progress-circle/progress-circle.ts | 2 - src/{components => lib}/radio/README.md | 0 src/{components => lib}/radio/package.json | 0 src/{components => lib}/radio/radio.html | 0 src/{components => lib}/radio/radio.scss | 0 src/{components => lib}/radio/radio.spec.ts | 0 src/{components => lib}/radio/radio.ts | 9 +- src/{components => lib}/sidenav/README.md | 0 src/{components => lib}/sidenav/package.json | 0 .../sidenav/sidenav-transitions.scss | 0 src/{components => lib}/sidenav/sidenav.html | 0 src/{components => lib}/sidenav/sidenav.scss | 0 .../sidenav/sidenav.spec.ts | 0 src/{components => lib}/sidenav/sidenav.ts | 1 - .../slide-toggle/README.md | 0 .../slide-toggle/package.json | 0 .../slide-toggle/slide-toggle.html | 0 .../slide-toggle/slide-toggle.scss | 0 .../slide-toggle/slide-toggle.spec.ts | 0 .../slide-toggle/slide-toggle.ts | 11 +- src/{components => lib}/slider/slider.html | 0 src/{components => lib}/slider/slider.scss | 0 src/{components => lib}/slider/slider.spec.ts | 0 src/{components => lib}/slider/slider.ts | 3 +- .../slider/test-gesture-config.ts | 0 src/{components => lib}/tabs/README.md | 0 src/{components => lib}/tabs/ink-bar.ts | 0 src/{components => lib}/tabs/package.json | 0 src/{components => lib}/tabs/tab-content.ts | 0 src/{components => lib}/tabs/tab-group.html | 0 src/{components => lib}/tabs/tab-group.scss | 0 .../tabs/tab-group.spec.ts | 0 .../tabs/tab-label-wrapper.ts | 0 src/{components => lib}/tabs/tab-label.ts | 0 src/{components => lib}/tabs/tabs.ts | 1 - src/{components => lib}/toolbar/README.md | 0 src/{components => lib}/toolbar/package.json | 0 src/{components => lib}/toolbar/toolbar.html | 0 src/{components => lib}/toolbar/toolbar.scss | 0 .../toolbar/toolbar.spec.ts | 0 src/{components => lib}/toolbar/toolbar.ts | 1 - src/{components => lib}/tooltip/README.md | 0 src/{components => lib}/tooltip/tooltip.html | 0 src/{components => lib}/tooltip/tooltip.scss | 0 .../tooltip/tooltip.spec.ts | 3 +- src/{components => lib}/tooltip/tooltip.ts | 1 - src/lib/tsconfig.json | 36 +++ typings.json | 12 - 212 files changed, 423 insertions(+), 298 deletions(-) delete mode 100644 angular-cli-build.js delete mode 100644 angular-cli.json create mode 100644 gulpfile.js create mode 100644 scripts/serve-dist.js delete mode 100644 src/demo-app/environment.ts rename src/{components => lib}/button-toggle/README.md (100%) rename src/{components => lib}/button-toggle/button-toggle.html (100%) rename src/{components => lib}/button-toggle/button-toggle.scss (100%) rename src/{components => lib}/button-toggle/button-toggle.spec.ts (100%) rename src/{components => lib}/button-toggle/button-toggle.ts (98%) rename src/{components => lib}/button-toggle/package.json (100%) rename src/{components => lib}/button/README.md (100%) rename src/{components => lib}/button/_button-base.scss (100%) rename src/{components => lib}/button/_button-theme.scss (100%) rename src/{components => lib}/button/button.html (100%) rename src/{components => lib}/button/button.scss (100%) rename src/{components => lib}/button/button.spec.ts (100%) rename src/{components => lib}/button/button.ts (98%) create mode 100644 src/lib/button/index.ts rename src/{components => lib}/button/package.json (100%) rename src/{components => lib}/card/README.md (100%) rename src/{components => lib}/card/card-header.html (100%) rename src/{components => lib}/card/card-title-group.html (100%) rename src/{components => lib}/card/card.html (100%) rename src/{components => lib}/card/card.scss (100%) rename src/{components => lib}/card/card.ts (96%) rename src/{components => lib}/card/package.json (100%) rename src/{components => lib}/checkbox/README.md (100%) rename src/{components => lib}/checkbox/checkbox.html (100%) rename src/{components => lib}/checkbox/checkbox.scss (100%) rename src/{components => lib}/checkbox/checkbox.spec.ts (100%) rename src/{components => lib}/checkbox/checkbox.ts (99%) rename src/{components => lib}/checkbox/package.json (100%) rename src/{ => lib}/core/README.md (100%) rename src/{ => lib}/core/a11y/README.md (100%) rename src/{ => lib}/core/a11y/live-announcer.scss (100%) rename src/{ => lib}/core/a11y/live-announcer.spec.ts (100%) rename src/{ => lib}/core/a11y/live-announcer.ts (100%) rename src/{ => lib}/core/annotations/field-value.spec.ts (100%) rename src/{ => lib}/core/annotations/field-value.ts (100%) rename src/{ => lib}/core/async/promise-completer.ts (100%) rename src/{ => lib}/core/coordination/unique-selection-dispatcher.ts (100%) rename src/{ => lib}/core/core.ts (100%) rename src/{ => lib}/core/errors/error.ts (100%) rename src/{ => lib}/core/gestures/MdGestureConfig.ts (100%) rename src/{ => lib}/core/line/line.ts (100%) rename src/{ => lib}/core/overlay/generic-component-type.ts (100%) rename src/{ => lib}/core/overlay/overlay-container.ts (100%) rename src/{ => lib}/core/overlay/overlay-directives.spec.ts (100%) rename src/{ => lib}/core/overlay/overlay-directives.ts (100%) rename src/{ => lib}/core/overlay/overlay-ref.ts (100%) rename src/{ => lib}/core/overlay/overlay-state.ts (100%) rename src/{ => lib}/core/overlay/overlay.scss (100%) rename src/{ => lib}/core/overlay/overlay.spec.ts (100%) rename src/{ => lib}/core/overlay/overlay.ts (100%) rename src/{ => lib}/core/overlay/position/connected-position-strategy.spec.ts (100%) rename src/{ => lib}/core/overlay/position/connected-position-strategy.ts (100%) rename src/{ => lib}/core/overlay/position/connected-position.ts (100%) rename src/{ => lib}/core/overlay/position/global-position-strategy.spec.ts (100%) rename src/{ => lib}/core/overlay/position/global-position-strategy.ts (100%) rename src/{ => lib}/core/overlay/position/overlay-position-builder.ts (100%) rename src/{ => lib}/core/overlay/position/position-strategy.ts (100%) rename src/{ => lib}/core/overlay/position/relative-position-strategy.ts (100%) rename src/{ => lib}/core/overlay/position/viewport-ruler.spec.ts (100%) rename src/{ => lib}/core/overlay/position/viewport-ruler.ts (100%) rename src/{ => lib}/core/package.json (100%) rename src/{ => lib}/core/portal/README.md (100%) rename src/{ => lib}/core/portal/dom-portal-host.ts (100%) rename src/{ => lib}/core/portal/portal-directives.ts (100%) rename src/{ => lib}/core/portal/portal-errors.ts (100%) rename src/{ => lib}/core/portal/portal.spec.ts (100%) rename src/{ => lib}/core/portal/portal.ts (100%) rename src/{ => lib}/core/ripple/README.md (100%) rename src/{ => lib}/core/ripple/ripple-renderer.ts (100%) rename src/{ => lib}/core/ripple/ripple.spec.ts (100%) rename src/{ => lib}/core/ripple/ripple.ts (100%) rename src/{ => lib}/core/rtl/dir.ts (100%) rename src/{ => lib}/core/style/_button-mixins.scss (100%) rename src/{ => lib}/core/style/_default-theme.scss (100%) rename src/{ => lib}/core/style/_elevation.scss (100%) rename src/{ => lib}/core/style/_list-shared.scss (100%) rename src/{ => lib}/core/style/_mixins.scss (100%) rename src/{ => lib}/core/style/_palette.scss (100%) rename src/{ => lib}/core/style/_ripple.scss (100%) rename src/{ => lib}/core/style/_sidenav-mixins.scss (100%) rename src/{ => lib}/core/style/_theme-functions.scss (100%) rename src/{ => lib}/core/style/_variables.scss (100%) rename src/{ => lib}/core/style/apply-transform.ts (100%) rename src/{ => lib}/core/style/core.scss (100%) rename src/{components => lib}/dialog/dialog-config.ts (100%) rename src/{components => lib}/dialog/dialog-container.html (100%) rename src/{components => lib}/dialog/dialog-container.scss (100%) rename src/{components => lib}/dialog/dialog-container.ts (99%) rename src/{components => lib}/dialog/dialog-errors.ts (100%) rename src/{components => lib}/dialog/dialog-injector.ts (100%) rename src/{components => lib}/dialog/dialog-ref.ts (100%) rename src/{components => lib}/dialog/dialog.spec.ts (100%) rename src/{components => lib}/dialog/dialog.ts (100%) rename src/{components => lib}/grid-list/README.md (100%) rename src/{components => lib}/grid-list/grid-list-errors.ts (100%) rename src/{components => lib}/grid-list/grid-list-measure.ts (100%) rename src/{components => lib}/grid-list/grid-list.html (100%) rename src/{components => lib}/grid-list/grid-list.scss (100%) rename src/{components => lib}/grid-list/grid-list.spec.ts (100%) rename src/{components => lib}/grid-list/grid-list.ts (99%) rename src/{components => lib}/grid-list/grid-tile-text.html (100%) rename src/{components => lib}/grid-list/grid-tile.html (100%) rename src/{components => lib}/grid-list/grid-tile.ts (97%) rename src/{components => lib}/grid-list/package.json (100%) rename src/{components => lib}/grid-list/tile-coordinator.ts (100%) rename src/{components => lib}/grid-list/tile-styler.ts (100%) rename src/{components => lib}/icon/README.md (100%) rename src/{components => lib}/icon/fake-svgs.ts (100%) rename src/{components => lib}/icon/icon-registry.ts (100%) rename src/{components => lib}/icon/icon.scss (100%) rename src/{components => lib}/icon/icon.spec.ts (100%) rename src/{components => lib}/icon/icon.ts (99%) rename src/{components => lib}/icon/package.json (100%) rename src/{components => lib}/input/README.md (100%) rename src/{components => lib}/input/input.html (100%) rename src/{components => lib}/input/input.scss (100%) rename src/{components => lib}/input/input.spec.ts (100%) rename src/{components => lib}/input/input.ts (99%) rename src/{components => lib}/input/package.json (100%) rename src/{components => lib}/list/README.md (100%) rename src/{components => lib}/list/list-item.html (100%) rename src/{components => lib}/list/list.scss (100%) rename src/{components => lib}/list/list.spec.ts (100%) rename src/{components => lib}/list/list.ts (97%) rename src/{components => lib}/list/package.json (100%) rename src/{components => lib}/menu/README.md (100%) rename src/{components => lib}/menu/menu-directive.ts (99%) rename src/{components => lib}/menu/menu-errors.ts (100%) rename src/{components => lib}/menu/menu-item.ts (100%) rename src/{components => lib}/menu/menu-positions.ts (100%) rename src/{components => lib}/menu/menu-trigger.ts (100%) rename src/{components => lib}/menu/menu.html (100%) rename src/{components => lib}/menu/menu.scss (100%) rename src/{components => lib}/menu/menu.spec.ts (100%) rename src/{components => lib}/menu/menu.ts (100%) rename src/{components => lib}/menu/package.json (100%) rename src/{components => lib}/progress-bar/README.md (100%) rename src/{components => lib}/progress-bar/package.json (100%) rename src/{components => lib}/progress-bar/progress-bar.html (100%) rename src/{components => lib}/progress-bar/progress-bar.scss (100%) rename src/{components => lib}/progress-bar/progress-bar.spec.ts (100%) rename src/{components => lib}/progress-bar/progress-bar.ts (98%) rename src/{components => lib}/progress-circle/README.md (100%) rename src/{components => lib}/progress-circle/package.json (100%) rename src/{components => lib}/progress-circle/progress-circle.html (100%) rename src/{components => lib}/progress-circle/progress-circle.scss (100%) rename src/{components => lib}/progress-circle/progress-circle.spec.ts (100%) rename src/{components => lib}/progress-circle/progress-circle.ts (99%) rename src/{components => lib}/radio/README.md (100%) rename src/{components => lib}/radio/package.json (100%) rename src/{components => lib}/radio/radio.html (100%) rename src/{components => lib}/radio/radio.scss (100%) rename src/{components => lib}/radio/radio.spec.ts (100%) rename src/{components => lib}/radio/radio.ts (99%) rename src/{components => lib}/sidenav/README.md (100%) rename src/{components => lib}/sidenav/package.json (100%) rename src/{components => lib}/sidenav/sidenav-transitions.scss (100%) rename src/{components => lib}/sidenav/sidenav.html (100%) rename src/{components => lib}/sidenav/sidenav.scss (100%) rename src/{components => lib}/sidenav/sidenav.spec.ts (100%) rename src/{components => lib}/sidenav/sidenav.ts (99%) rename src/{components => lib}/slide-toggle/README.md (100%) rename src/{components => lib}/slide-toggle/package.json (100%) rename src/{components => lib}/slide-toggle/slide-toggle.html (100%) rename src/{components => lib}/slide-toggle/slide-toggle.scss (100%) rename src/{components => lib}/slide-toggle/slide-toggle.spec.ts (100%) rename src/{components => lib}/slide-toggle/slide-toggle.ts (96%) rename src/{components => lib}/slider/slider.html (100%) rename src/{components => lib}/slider/slider.scss (100%) rename src/{components => lib}/slider/slider.spec.ts (100%) rename src/{components => lib}/slider/slider.ts (99%) rename src/{components => lib}/slider/test-gesture-config.ts (100%) rename src/{components => lib}/tabs/README.md (100%) rename src/{components => lib}/tabs/ink-bar.ts (100%) rename src/{components => lib}/tabs/package.json (100%) rename src/{components => lib}/tabs/tab-content.ts (100%) rename src/{components => lib}/tabs/tab-group.html (100%) rename src/{components => lib}/tabs/tab-group.scss (100%) rename src/{components => lib}/tabs/tab-group.spec.ts (100%) rename src/{components => lib}/tabs/tab-label-wrapper.ts (100%) rename src/{components => lib}/tabs/tab-label.ts (100%) rename src/{components => lib}/tabs/tabs.ts (99%) rename src/{components => lib}/toolbar/README.md (100%) rename src/{components => lib}/toolbar/package.json (100%) rename src/{components => lib}/toolbar/toolbar.html (100%) rename src/{components => lib}/toolbar/toolbar.scss (100%) rename src/{components => lib}/toolbar/toolbar.spec.ts (100%) rename src/{components => lib}/toolbar/toolbar.ts (97%) rename src/{components => lib}/tooltip/README.md (100%) rename src/{components => lib}/tooltip/tooltip.html (100%) rename src/{components => lib}/tooltip/tooltip.scss (100%) rename src/{components => lib}/tooltip/tooltip.spec.ts (96%) rename src/{components => lib}/tooltip/tooltip.ts (99%) create mode 100644 src/lib/tsconfig.json delete mode 100644 typings.json diff --git a/.travis.yml b/.travis.yml index dc3f4e01dfe6..3dfb1d1c9941 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,6 @@ matrix: install: - npm install - - npm run typings before_script: - mkdir -p $LOGS_DIR diff --git a/angular-cli-build.js b/angular-cli-build.js deleted file mode 100644 index f7225769f49c..000000000000 --- a/angular-cli-build.js +++ /dev/null @@ -1,111 +0,0 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); - -// Import the require hook. Enables us to require TS files natively. -require('ts-node/register'); - -const Angular2App = require('angular-cli/lib/broccoli/angular2-app'); -const Funnel = require('broccoli-funnel'); -const MergeTree = require('broccoli-merge-trees'); -const autoPrefixerTree = require('broccoli-autoprefixer'); - - -module.exports = function(defaults) { - // The Angular Application tree. - const appTree = _buildAppTree(defaults); - - // The CSS tree that is auto prefixed with browser support. - const cssAutoprefixed = autoPrefixerTree(new Funnel(appTree, { - include: [ '**/*.css' ] - })); - - // Include the scss sources in the output for when we publish. - const scssSources = new Funnel('src', {include: ['**/*.scss']}); - - return new MergeTree([appTree, cssAutoprefixed, scssSources], { overwrite: true }); -}; - - -/** - * Build the Broccoli Tree containing all the files used as the input to the Demo Angular2App. - */ -function _buildDemoAppInputTree() { - return new MergeTree([ - new Funnel('typings', { - destDir: 'typings' - }), - new Funnel('src', { - include: ['components/**/*', 'core/**/*'], - destDir: 'src/demo-app' - }), - new Funnel('src/demo-app', { - destDir: 'src/demo-app' - }) - ]); -} - - -/** - * Build the Broccoli Tree containing all the files used as the input to the e2e Angular2App. - */ -function _buildE2EAppInputTree() { - return new MergeTree([ - new Funnel('typings', { - destDir: 'typings' - }), - new Funnel('src', { - include: ['components/**/*', 'core/**/*'], - destDir: 'src/e2e-app' - }), - new Funnel('src/e2e-app', { - destDir: 'src/e2e-app' - }) - ]); -} - - -/** - * Build the Broccoli Tree that contains the Angular2 App. This picks between E2E, Example or Demo - * app. - * @param defaults The default objects from AngularCLI (deprecated). - * @returns {Angular2App} - */ -function _buildAppTree(defaults) { - let inputNode; - let sourceDir; - switch(process.env['MD_APP']) { - case 'e2e': - inputNode = _buildE2EAppInputTree(); - sourceDir = 'src/e2e-app'; - break; - default: - inputNode = _buildDemoAppInputTree(); - sourceDir = 'src/demo-app'; - } - - return new Angular2App(defaults, inputNode, { - sourceDir: sourceDir, - polyfills: [ - 'vendor/core-js/client/core.js', - 'vendor/systemjs/dist/system.src.js', - 'vendor/zone.js/dist/zone.js', - 'vendor/hammerjs/hammer.min.js' - ], - tsCompiler: {}, - sassCompiler: { - includePaths: [ - 'src/core/style' - ] - }, - vendorNpmFiles: [ - 'systemjs/dist/system-polyfills.js', - 'systemjs/dist/system.src.js', - 'zone.js/dist/*.+(js|js.map)', - 'core-js/client/core.js', - 'rxjs/**/*.+(js|js.map)', - '@angular/**/*.+(js|js.map)', - 'hammerjs/*.min.+(js|js.map)' - ] - }); -} diff --git a/angular-cli.json b/angular-cli.json deleted file mode 100644 index b416b34f14ee..000000000000 --- a/angular-cli.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "project": { - "version": "0.0.37", - "name": "material2" - }, - "apps": [ - {"main": "src/main.ts", "tsconfig": "src/tsconfig.json"} - ], - "addons": [], - "packages": [], - "e2e": { - "protractor": { - "config": "test/protractor.conf.js" - } - }, - "test": { - "karma": { - "config": "test/karma.conf.js" - } - }, - "defaults": { - "prefix": "", - "sourceDir": "src" - } -} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 000000000000..ebd584d730fa --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,245 @@ +'use strict'; +/** + * This file needs to be JavaScript and is read by gulp. + */ +// Global imports. +const fs = require('fs'); +const gulp = require('gulp'); +const path = require('path'); + +// Other imports. +const inlineResources = require('./scripts/release/inline-resources'); + +// Gulp plugins. +const gulpClean = require('gulp-clean'); +const gulpTs = require('gulp-typescript'); +const gulpMerge = require('merge2'); +const gulpSass = require('gulp-sass'); +const gulpSourcemaps = require('gulp-sourcemaps'); +const gulpLiveServer = require('gulp-live-server'); + + +// Directories. +const srcDir = path.join(__dirname, 'src'); +const componentsDir = path.join(srcDir, 'lib'); +const devAppDir = path.join(srcDir, 'demo-app'); +const e2eAppDir = path.join(srcDir, 'e2e-app'); + +const outDir = 'dist'; +const outLibDir = path.join(outDir, '@angular2-material'); + + +/** + * Create a TS Build Task, based on the options. + */ +function makeTsBuildTask(options) { + const tsConfigDir = options.tsConfigPath; + const tsConfigPath = path.join(tsConfigDir, 'tsconfig.json'); + const tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf-8')); + const dest = path.join(tsConfigDir, tsConfig.compilerOptions.outDir); + + return function() { + const tsProject = gulpTs.createProject(tsConfigPath, { + typescript: require('typescript') + }); + + let pipe = tsProject.src() + .pipe(gulpSourcemaps.init()) + .pipe(gulpTs(tsProject)); + let dts = pipe.dts.pipe(gulp.dest(dest)); + + if (tsConfig.compilerOptions.sourceMap) { + if (!tsConfig.compilerOptions.inlineSources) { + pipe = pipe.pipe(gulpSourcemaps.write(dest)); + } else { + pipe = pipe.pipe(gulpSourcemaps.write()); + } + } + + return gulpMerge([dts, pipe.pipe(gulp.dest(dest))]); + }; +} + +/** + * Create a SASS Build Task. + */ +function makeSassBuildTask(options) { + const dest = options.dest; + const glob = path.join(options.root, '**/*.scss'); + const sassOptions = { + includePaths: options.includePaths + }; + + return function() { + return gulp.src(glob) + .pipe(gulpSourcemaps.init()) + .pipe(gulpSass(sassOptions).on('error', gulpSass.logError)) + .pipe(gulpSourcemaps.write(dest)) + .pipe(gulp.dest(dest)); + }; +} + + +/*************************************************************************************************** + * Components Build Tasks. + */ +gulp.task('build:components:ts', makeTsBuildTask({ tsConfigPath: componentsDir })); +gulp.task('build:components:assets', function() { + return gulp.src(path.join(componentsDir, '*/**/*.!(ts|spec.ts)')) + .pipe(gulp.dest(outLibDir)); +}); +gulp.task('build:components:scss', function() { + const cssTask = makeSassBuildTask({ + dest: outLibDir, + root: componentsDir, + includePaths: path.join(componentsDir, 'core/style') + }); + // Also copy over the SCSS for the components. + return gulpMerge([ + cssTask(), + gulp.src(path.join(componentsDir, '**/*.scss')) + .pipe(gulp.dest(outLibDir)) + ]); +}); +gulp.task('build:components', [ + 'build:components:ts', + 'build:components:assets', + 'build:components:scss' +], function() { + inlineResources([outLibDir]); +}); + +/*************************************************************************************************** + * DevApp Build Tasks. + */ +gulp.task('build:devapp:ts', ['build:components:ts'], makeTsBuildTask({ tsConfigPath: devAppDir })); +gulp.task('build:devapp:scss', ['build:components:scss'], makeSassBuildTask({ + dest: outDir, + root: devAppDir, + // Change this once we have a better strategy for releasing SCSS files. + includePaths: [ + path.join(componentsDir, 'core/style'), + componentsDir + ] +})); +gulp.task('build:devapp:assets', function() { + return gulp.src(path.join(devAppDir, '**/*')) + .pipe(gulp.dest(outDir)); +}); +gulp.task('build:devapp:vendor', function() { + const npmVendorFiles = [ + 'core-js/client', 'zone.js/dist', 'hammerjs', 'systemjs/dist', 'rxjs', '@angular', 'hammerjs' + ]; + + return gulpMerge( + npmVendorFiles.map(function(root) { + const glob = path.join(root, '**/*.+(js|js.map)'); + return gulp.src(path.join('node_modules', glob)) + .pipe(gulp.dest(path.join('dist/vendor', root))); + })); +}); + +gulp.task('build:devapp', [ + 'build:components', + 'build:devapp:vendor', + 'build:devapp:ts', + 'build:devapp:scss', + 'build:devapp:assets' +]); + +/*************************************************************************************************** + * DevApp Build Tasks. + */ +gulp.task('build:e2eapp:ts', ['build:components:ts'], makeTsBuildTask({ tsConfigPath: e2eAppDir })); +gulp.task('build:e2eapp:scss', ['build:components:scss'], makeSassBuildTask({ + dest: outDir, + root: e2eAppDir, + // Change this once we have a better strategy for releasing SCSS files. + includePaths: [ + path.join(componentsDir, 'core/style'), + componentsDir + ] +})); +gulp.task('build:e2eapp:assets', function() { + return gulp.src(path.join(e2eAppDir, '**/*')) + .pipe(gulp.dest(outDir)); +}); +gulp.task('build:e2eapp:vendor', function() { + const npmVendorFiles = [ + 'core-js/client', 'zone.js/dist', 'hammerjs', 'systemjs/dist', 'rxjs', '@angular', 'hammerjs' + ]; + + return gulpMerge( + npmVendorFiles.map(function(root) { + const glob = path.join(root, '**/*.+(js|js.map)'); + return gulp.src(path.join('node_modules', glob)) + .pipe(gulp.dest(path.join('dist/vendor', root))); + })); +}); + +gulp.task('build:e2eapp', [ + 'build:components', + 'build:e2eapp:vendor', + 'build:e2eapp:ts', + 'build:e2eapp:scss', + 'build:e2eapp:assets' +]); + + +/*************************************************************************************************** + * Global tasks. + */ +gulp.task('build', ['build:devapp']); + +gulp.task('clean', function () { + return gulp.src('dist', { read: false }) + .pipe(gulpClean()); +}); + + +/*************************************************************************************************** + * Watch Tasks. + */ +gulp.task('watch:components', ['build:components'], function() { + gulp.watch(path.join(componentsDir, '**/*'), ['build:components']); +}); + +gulp.task('watch:devapp', ['watch:components', 'build:devapp'], function() { + gulp.watch(path.join(devAppDir, '**/*'), ['build:devapp']); +}); + + +/*************************************************************************************************** + * Serve Tasks. + */ +gulp.task('serve:devapp', ['build:devapp'], function() { + const server = gulpLiveServer('scripts/serve-dist.js'); + + server.start(); + function reload(file) { + server.notify(file); + } + + gulp.watch(path.join(componentsDir, '**/*.ts'), ['build:components:ts'], reload); + gulp.watch(path.join(componentsDir, '**/*.scss'), ['build:components:scss'], reload); + gulp.watch(path.join(componentsDir, '**/*.html'), ['build:components:assets'], reload); + gulp.watch(path.join(devAppDir, '**/*.ts'), ['build:devapp:ts'], reload); + gulp.watch(path.join(devAppDir, '**/*.scss'), ['build:devapp:scss'], reload); + gulp.watch(path.join(devAppDir, '**/*.html'), ['build:devapp:assets'], reload); +}); + +gulp.task('serve:e2eapp', ['build:e2eapp'], function() { + const server = gulpLiveServer('scripts/serve-dist.js'); + + server.start(); + function reload(file) { + server.notify.apply(server, [file]); + } + + gulp.watch(path.join(componentsDir, '**/*.ts'), ['build:components:ts'], reload); + gulp.watch(path.join(componentsDir, '**/*.scss'), ['build:components:scss'], reload); + gulp.watch(path.join(componentsDir, '**/*.html'), ['build:components:assets'], reload); + gulp.watch(path.join(e2eAppDir, '**/*.ts'), ['build:e2eapp:ts'], reload); + gulp.watch(path.join(e2eAppDir, '**/*.scss'), ['build:e2eapp:scss'], reload); + gulp.watch(path.join(e2eAppDir, '**/*.html'), ['build:e2eapp:assets'], reload); +}); diff --git a/package.json b/package.json index 1d50ce46ca9f..5089c5358511 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,14 @@ }, "scripts": { "ci:forbidden-identifiers": "node ./scripts/ci/forbidden-identifiers.js", - "build": "ng build", - "demo-app": "ng serve", + "build": "gulp build", + "demo-app": "gulp serve:devapp", "test": "karma start test/karma.conf.js", "tslint": "tslint -c tslint.json 'src/**/*.ts'", "stylelint": "stylelint 'src/**/*.scss' --config stylelint-config.json --syntax scss", "check-circular-deps": "madge --circular ./dist", - "typings": "typings install --global", - "postinstall": "npm run typings", "e2e": "protractor", - "inline-resources": "node ./scripts/release/inline-resources.js ./dist/components", + "inline-resources": "", "deploy": "firebase deploy", "webdriver-manager": "webdriver-manager" }, @@ -31,11 +29,11 @@ "@angular/common": "2.0.0-rc.4", "@angular/compiler": "2.0.0-rc.4", "@angular/core": "2.0.0-rc.4", + "@angular/forms": "^0.2.0", "@angular/http": "2.0.0-rc.4", "@angular/platform-browser": "2.0.0-rc.4", "@angular/platform-browser-dynamic": "2.0.0-rc.4", "@angular/router": "v3.0.0-alpha.8", - "@angular/forms": "^0.2.0", "core-js": "^2.4.0", "hammerjs": "^2.0.8", "rxjs": "5.0.0-beta.6", @@ -44,17 +42,22 @@ }, "devDependencies": { "@angular/compiler-cli": "^0.4.1", + "@types/hammerjs": "^2.0.30", + "@types/jasmine": "^2.2.31", "add-stream": "^1.0.0", - "angular-cli": "^1.0.0-beta.9", - "broccoli-autoprefixer": "^4.1.0", - "broccoli-funnel": "^1.0.1", - "broccoli-merge-trees": "^1.1.1", "browserstacktunnel-wrapper": "^1.4.2", "conventional-changelog": "^1.1.0", "ember-cli-inject-live-reload": "^1.4.0", "firebase-tools": "^2.2.1", "fs-extra": "^0.26.5", "glob": "^6.0.4", + "gulp": "^3.9.1", + "gulp-clean": "^0.3.2", + "gulp-live-server": "0.0.30", + "gulp-sass": "^2.3.2", + "gulp-shell": "^0.5.2", + "gulp-sourcemaps": "^1.6.0", + "gulp-typescript": "^2.13.6", "jasmine-core": "^2.4.1", "js-yaml": "^3.5.2", "karma": "^1.1.1", @@ -64,6 +67,7 @@ "karma-jasmine": "^1.0.2", "karma-sauce-launcher": "^1.0.0", "madge": "^0.6.0", + "merge2": "^1.0.2", "node-sass": "^3.4.2", "protractor": "^3.3.0", "protractor-accessibility-plugin": "0.1.1", diff --git a/scripts/ci/build-and-test.sh b/scripts/ci/build-and-test.sh index 969cba5a68ed..f006f27055fd 100755 --- a/scripts/ci/build-and-test.sh +++ b/scripts/ci/build-and-test.sh @@ -14,7 +14,7 @@ start_tunnel wait_for_tunnel if is_lint; then - npm run tslint + npm run tslint npm run ci:forbidden-identifiers npm run stylelint elif is_circular_deps_check; then @@ -43,6 +43,7 @@ elif is_e2e; then ng e2e elif is_extract_metadata; then # Run `tsc` first so that the directory structure in dist/ matches what ngc expects. + ./node_modules/.bin/tsc -p ./src/lib/ ./node_modules/.bin/tsc -p ./src/demo-app/ ./node_modules/.bin/ngc -p ./src/demo-app/ else diff --git a/scripts/release/inline-resources.js b/scripts/release/inline-resources.js index 697612ffb47a..fb4bc16171ec 100644 --- a/scripts/release/inline-resources.js +++ b/scripts/release/inline-resources.js @@ -29,28 +29,34 @@ const readFile = promiseify(fs.readFile); const writeFile = promiseify(fs.writeFile); -/** - * For every argument, inline the templates and styles under it and write the new file. - */ -for (let arg of process.argv.slice(2)) { - if (arg.indexOf('*') < 0) { - // Argument is a directory target, add glob patterns to include every files. - arg = path.join(arg, '**', '*'); - } +function inlineResources(globs) { + /** + * For every argument, inline the templates and styles under it and write the new file. + */ + for (let pattern of globs) { + if (pattern.indexOf('*') < 0) { + // Argument is a directory target, add glob patterns to include every files. + pattern = path.join(pattern, '**', '*'); + } - const files = glob.sync(arg, {}) - .filter(name => /\.js$/.test(name)); // Matches only JavaScript files. + const files = glob.sync(pattern, {}) + .filter(name => /\.js$/.test(name)); // Matches only JavaScript files. - // Generate all files content with inlined templates. - files.forEach(filePath => { - readFile(filePath, 'utf-8') - .then(content => inlineTemplate(filePath, content)) - .then(content => inlineStyle(filePath, content)) - .then(content => writeFile(filePath, content)) - .catch(err => { - console.error('An error occured: ', err); - }); - }); + // Generate all files content with inlined templates. + files.forEach(filePath => { + readFile(filePath, 'utf-8') + .then(content => inlineTemplate(filePath, content)) + .then(content => inlineStyle(filePath, content)) + .then(content => writeFile(filePath, content)) + .catch(err => { + console.error('An error occured: ', err); + }); + }); + } +} + +if (require.main === module) { + inlineResources(process.argv.slice(2)); } @@ -96,3 +102,6 @@ function inlineStyle(filePath, content) { + ']'; }); } + + +module.exports = inlineResources; diff --git a/scripts/serve-dist.js b/scripts/serve-dist.js new file mode 100644 index 000000000000..3327ff39ec04 --- /dev/null +++ b/scripts/serve-dist.js @@ -0,0 +1,22 @@ +var app = require('connect')(); +var express = require('express'); +var path = require('path'); +var connect_livereload = require('connect-livereload'); +var serve_static = require('serve-static'); + +var root = 'dist/'; +var port = 4200; + +app.use(connect_livereload()); +app.use(serve_static(path.join(process.cwd(), root))); + +// Add a fallback that serves index.html +const defaultRoute = express(); +defaultRoute.all("/*", function(req, res) { res.sendFile("index.html", { root: root }); }); +app.use(defaultRoute); + +app.listen(port, function () { + var host = 'localhost'; + + console.log('folder "%s" serving at http://%s:%s', root, host, port); +}); diff --git a/src/demo-app/environment.ts b/src/demo-app/environment.ts deleted file mode 100644 index 79ee96fdfdbd..000000000000 --- a/src/demo-app/environment.ts +++ /dev/null @@ -1,7 +0,0 @@ -// The file for the current environment will overwrite this one during build -// Different environments can be found in config/environment.{dev|prod}.ts -// The build system defaults to the dev environment - -export const environment = { - production: false -}; diff --git a/src/demo-app/index.html b/src/demo-app/index.html index d2ee30b106b5..b285fa35fada 100644 --- a/src/demo-app/index.html +++ b/src/demo-app/index.html @@ -1,20 +1,14 @@ -{{!-- This file is an handlebar file that gets filled at build time. --}} Material2 - - - {{!-- Add live-reload support, only in development. --}} - {{#unless environment.production}} - - {{/unless}} + - + @@ -23,10 +17,10 @@ Loading... - {{!-- Add all polyfill scripts. --}} - {{#each scripts.polyfills}} - - {{/each}} + + + + - {{/unless}} + + @@ -21,9 +17,10 @@ Loading... - {{#each scripts.polyfills}} - - {{/each}} + + + +