UNPKG

basecamp-guide

Version:
75 lines (61 loc) 2.64 kB
// Dependecies var p = require('path'); var fs = require('fs'); var Colors = require('colors'); var Exec = require('child_process').execSync; var FileSys = require('../FileSystem.js'); var LaravelAppConfig = require('../LaravelAppConfig.js'); /** * Config & Settings for the basecamp-design package. * * Installs composer package. * * */ var ModulesComingInstallCommand = { fire : function(options) { var exportPaths = { root : this.config.exportPaths.root, stylus : p.join(this.config.exportPaths.root, this.config.exportPaths.stylus), vue : p.join(this.config.exportPaths.root, this.config.exportPaths.vue) }; // add laravel provider console.log('Add ComingServiceProvider...'.bold); LaravelAppConfig.addProvider('ComingServiceProvider'); console.log(''); // add ComingMiddleware console.log('Add ComingMiddleware...'.bold); LaravelAppConfig.addRouteMiddleware('ComingMiddleware', 'coming'); console.log(''); // update laravel auto-loader console.log('Update composer autoload...'.bold); var output = Exec('composer dump-autoload').toString(); console.log(Colors.grey(output)); // publish assets console.log('Publish ComingServiceProvider required files...'.bold); var forceFlag = ''; options.forEach(function(option) { if (option.name == 'force') forceFlag = '--force'; }); output = Exec('php artisan vendor:publish --provider="Basecamp\\Providers\\ComingServiceProvider" --tag="require" ' + forceFlag).toString(); console.log(Colors.grey(output)); // import style files in app.styl console.log('Add Styles to main stylus-file...'.bold); LaravelAppConfig.addStyleDependecy('coming-module/Coming', p.join(exportPaths.stylus, 'app.styl')); console.log(''); // import Vue-Views to app.js console.log('Add JS-Views (vue) to main JS-file...'.bold); LaravelAppConfig.addVueViewDependecy('./coming-module/views/ComingView.js', p.join(exportPaths.vue, 'app.js')); console.log(''); // Add COMING-Environmentvariable console.log('Adding COMING-Environmentvariables...'.bold); LaravelAppConfig.addENV('COMING', true); LaravelAppConfig.addENV('COMING_PASSWORD', 'basecamp'); }, /* * config-property will be injected from the * CommandLineTool while adding the command */ config : {}, }; module.exports = ModulesComingInstallCommand;