commit dc046ae33c18b0072348375b0077d2c81229f08c
parent 17a2dc0dfc6bc60c0a702565a0dc2e430fea7229
Author: Konstantin Tarkus <hello@tarkus.me>
Date: Sat, 29 Aug 2015 18:04:32 +0300
Add a sample deployment script
Diffstat:
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
@@ -53,11 +53,11 @@ Join [#react-starter-kit](https://gitter.im/kriasoft/react-starter-kit) chatroom
│ ├── /build.js # Builds the project from source to output (build) folder
│ ├── /bundle.js # Bundles the web resources into package(s) through Webpack
│ ├── /clean.js # Cleans up the output (build) folder
-│ ├── /config.js # Webpack configuration for both client and server side bundles
+│ ├── /config.js # Webpack configuration for application bundles
│ ├── /copy.js # Copies static files to output (build) folder
-│ ├── /serve.js # Launches the Node.js/Express web server in a seperate process
-│ ├── /start.js # Launches the development web server with "live reload" functionality
-│ └── /(deploy.js) # Deploys your web application (Planned)
+│ ├── /deploy.js # Deploys your web application
+│ ├── /serve.js # Launches the Node.js/Express web server
+│ └── /start.js # Launches the development web server with "live reload"
│── package.json # The list of 3rd party libraries and utilities
└── preprocessor.js # ES6 transpiler settings for Jest
```
diff --git a/tools/deploy.js b/tools/deploy.js
@@ -0,0 +1,40 @@
+/**
+ * React Starter Kit (http://www.reactstarterkit.com/)
+ *
+ * Copyright © 2014-2015 Kriasoft, LLC. All rights reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.txt file in the root directory of this source tree.
+ */
+
+import push from 'git-push';
+
+/**
+ * Deploy the contents of the `/build` folder to a remote
+ * server via Git. Example: `npm run deploy -- staging`
+ */
+export default () => new Promise((resolve, reject) => {
+ let remote;
+
+ if (process.argv.includes('production')) {
+ remote = {
+ name: 'production',
+ url: 'https://example.scm.azurewebsites.net/example.git',
+ branch: 'master'
+ };
+ } else if (process.argv.includes('staging')) {
+ remote = {
+ name: 'staging',
+ url: 'https://example-staging.scm.azurewebsites.net/example.git',
+ branch: 'master'
+ };
+ } else {
+ remote = {
+ name: 'test',
+ url: 'https://example-test.scm.azurewebsites.net/example.git',
+ branch: 'master'
+ };
+ }
+
+ push('./build', remote, err => err ? reject(err) : resolve());
+});