diff --git a/.gitignore b/.gitignore index dafb76b6..dd87e2d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -bower_components/ -node_modules/ -build/ -*.pyc +node_modules +build diff --git a/README.md b/README.md index 19e96b6c..fa2d8b76 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,28 @@ # NEWS -## Prerequisites - -### Polymer CLI - -Install [polymer-cli](https://github.com/Polymer/polymer-cli): - - npm install -g polymer-cli - -### Setup - - git clone https://github.com/polymer/news.git - cd news - bower install - -## Start the development server - - polymer serve +## Setup +```bash +$ git clone https://github.com/polymer/news.git +$ cd news +$ npm i +$ npm start +``` ## Build - - polymer build +```bash +$ npm run build +``` ## Test the build - -Use `polymer serve` to serve a specific build preset of the app. For example: - - polymer serve build/es5-bundled +To test prpl-server build: +```bash +$ npm run serve:prpl-server +``` +To test static build: +```bash +$ npm run serve:static +``` + +## Deploying + +Our [production deployment of NEWS](https://news.polymer-project.org/) is hosted on App Engine with Node.js. It can be deployed with [the same steps as PWA Starter Kit](https://polymer.github.io/pwa-starter-kit/building-and-deploying/#deploying-prpl-server). diff --git a/bower.json b/bower.json deleted file mode 100644 index bb9f1a5d..00000000 --- a/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "news", - "version": "2.0.0", - "authors": [ - "The Polymer Authors" - ], - "private": true, - "dependencies": { - "polymer": "polymer/polymer#^2.0.0", - "app-layout": "polymerelements/app-layout#^2.0.0", - "app-route": "polymerelements/app-route#^2.0.0", - "iron-flex-layout": "polymerelements/iron-flex-layout#^2.0.0", - "iron-icon": "polymerelements/iron-icon#^2.0.0", - "iron-iconset-svg": "polymerelements/iron-iconset-svg#^2.0.0", - "iron-pages": "polymerelements/iron-pages#^2.0.0", - "iron-selector": "polymerelements/iron-selector#^2.0.0", - "paper-icon-button": "polymerelements/paper-icon-button#^2.0.0" - }, - "devDependencies": { - "web-component-tester": "^6.0.0" - } -} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..6bc27fb5 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,43 @@ +/** +@license +Copyright (c) 2018 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +const gulp = require('gulp'); +const rename = require('gulp-rename'); +const replace = require('gulp-replace'); +const del = require('del'); + +/** + * Cleans the prpl-server build in the server directory. + */ +gulp.task('prpl-server:clean', () => { + return del('server/build'); +}); + +/** + * Copies the prpl-server build to the server directory while renaming the + * node_modules directory so services like App Engine will upload it. + */ +gulp.task('prpl-server:build', () => { + const pattern = 'node_modules'; + const replacement = 'node_assets'; + + return gulp.src('build/**') + .pipe(rename(((path) => { + path.basename = path.basename.replace(pattern, replacement); + path.dirname = path.dirname.replace(pattern, replacement); + }))) + .pipe(replace(pattern, replacement)) + .pipe(gulp.dest('server/build')); +}); + +gulp.task('prpl-server', gulp.series( + 'prpl-server:clean', + 'prpl-server:build' +)); diff --git a/index.html b/index.html index 49db3932..806c7d0c 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,7 @@