|  | @@ -1,51 +0,0 @@
 | 
	
		
			
			| 1 |  | -/* eslint-disable no-console */
 | 
	
		
			
			| 2 |  | -
 | 
	
		
			
			| 3 |  | -const ghpages = require('gh-pages');
 | 
	
		
			
			| 4 |  | -const pkg = require('./../package.json');
 | 
	
		
			
			| 5 |  | -const path = require('path');
 | 
	
		
			
			| 6 |  | -const chalk = require('chalk');
 | 
	
		
			
			| 7 |  | -const fs = require('fs');
 | 
	
		
			
			| 8 |  | -const distPath = path.join(__dirname, '../demo/dist');
 | 
	
		
			
			| 9 |  | -
 | 
	
		
			
			| 10 |  | -const deploy = (options = {}) => {
 | 
	
		
			
			| 11 |  | -    ghpages.publish(distPath, Object.assign({
 | 
	
		
			
			| 12 |  | -        message: pkg.version
 | 
	
		
			
			| 13 |  | -    }, options), (err) => {
 | 
	
		
			
			| 14 |  | -        if (err) {
 | 
	
		
			
			| 15 |  | -            error([err]);
 | 
	
		
			
			| 16 |  | -            return;
 | 
	
		
			
			| 17 |  | -        }
 | 
	
		
			
			| 18 |  | -        console.log(chalk.green('Demo has succesfully deployed.'));
 | 
	
		
			
			| 19 |  | -    });
 | 
	
		
			
			| 20 |  | -};
 | 
	
		
			
			| 21 |  | -
 | 
	
		
			
			| 22 |  | -const error = (errs = []) => {
 | 
	
		
			
			| 23 |  | -    errs.forEach((err) => {
 | 
	
		
			
			| 24 |  | -        console.log(chalk.red(err));
 | 
	
		
			
			| 25 |  | -    });
 | 
	
		
			
			| 26 |  | -    process.exit(1);
 | 
	
		
			
			| 27 |  | -};
 | 
	
		
			
			| 28 |  | -
 | 
	
		
			
			| 29 |  | -try {
 | 
	
		
			
			| 30 |  | -    fs.accessSync(distPath, fs.F_OK);
 | 
	
		
			
			| 31 |  | -    if (process.env.TRAVIS) {
 | 
	
		
			
			| 32 |  | -        if (process.env.GITHUB_TOKEN) {
 | 
	
		
			
			| 33 |  | -            deploy({
 | 
	
		
			
			| 34 |  | -                repo: `https://${process.env.GITHUB_TOKEN}@github.com/${process.env.TRAVIS_REPO_SLUG}.git`,
 | 
	
		
			
			| 35 |  | -                user: {
 | 
	
		
			
			| 36 |  | -                    name: 'Travis CI'
 | 
	
		
			
			| 37 |  | -                }
 | 
	
		
			
			| 38 |  | -            });
 | 
	
		
			
			| 39 |  | -        } else {
 | 
	
		
			
			| 40 |  | -            error(['process.env.GITHUB_TOKEN with "repo" access is required to deploy gh-pages.']);
 | 
	
		
			
			| 41 |  | -        }
 | 
	
		
			
			| 42 |  | -    } else {
 | 
	
		
			
			| 43 |  | -        // Deploys using git origin, username and email.
 | 
	
		
			
			| 44 |  | -        deploy();
 | 
	
		
			
			| 45 |  | -    }
 | 
	
		
			
			| 46 |  | -} catch (e) {
 | 
	
		
			
			| 47 |  | -    error([
 | 
	
		
			
			| 48 |  | -        `${distPath} does not exist.`,
 | 
	
		
			
			| 49 |  | -        'Please run "npm i && npm run i:demo && npm run build:demo" and try again.'
 | 
	
		
			
			| 50 |  | -    ]);
 | 
	
		
			
			| 51 |  | -}
 |