How to use the shelljs.config function in shelljs

To help you get started, we’ve selected a few shelljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github abeisgoat / firepit / firepit.js View on Github external
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const fs = require("fs");
const path = require("path");
const { fork, spawn } = require("child_process");
const homePath = require("user-home");
const chalk = require("chalk");
const shell = require("shelljs");
shell.config.silent = true;

const runtime = require("./runtime");
const version = require("./package.json").version;

let config;
try {
  config = require("./config");
} catch (err) {
  console.warn("Invalid Firepit configuration, this may be a broken build.");
  process.exit(2);
}

function SetWindowTitle(title) {
  if (process.platform === "win32") {
    process.title = title;
  } else {
github QDMarkMan / vue-base-template / build / build.js View on Github external
const rm = require('rimraf')
const path = require('path')
const shell = require('shelljs')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')

const spinner = ora('building for production...')
spinner.start()
// shell dll.js
const asasetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
console.log(chalk.yellow('\n shell dll begin'))
shell.rm('-rf', asasetsPath)
shell.mkdir('-p', asasetsPath)
shell.config.silent = true
shell.cp('-R', 'static/js/*', asasetsPath)
shell.cp('-R', 'static/tinymce/*', asasetsPath)
shell.config.silent = false
console.log(chalk.cyan('shell dll complete.\n'))


rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
  if (err) throw err
  webpack(webpackConfig, (err, stats) => {
    spinner.stop()
    if (err) throw err
    process.stdout.write(stats.toString({
      colors: true,
      modules: false,
      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
      chunks: false,
github wangdahoo / vonic-webpack-starter / build / build.js View on Github external
var webpackConfig = require('./webpack.prod.conf')

var spinner = ora('building for production...')
spinner.start()

var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
shell.rm('-rf', assetsPath)
shell.mkdir('-p', assetsPath)
shell.config.silent = true
shell.cp('-R', 'static/*', assetsPath)

// vonic assets
var vonicAssetsPath = path.join(config.build.assetsRoot, 'static', 'vonic')
shell.mkdir('-p', vonicAssetsPath)
shell.cp('-R', 'node_modules/vonic/dist/*', vonicAssetsPath)
shell.config.silent = false

webpack(webpackConfig, function (err, stats) {
  spinner.stop()
  if (err) throw err
  process.stdout.write(stats.toString({
    colors: true,
    modules: false,
    children: false,
    chunks: false,
    chunkModules: false
  }) + '\n\n')

  console.log(chalk.cyan('  Build complete.\n'))
  console.log(chalk.yellow(
    '  Tip: built files are meant to be served over an HTTP server.\n' +
    '  Opening index.html over file:// won\'t work.\n'
github katzer / cordova-plugin-badge / platforms / android / cordova / lib / check_reqs.js View on Github external
}
                    });
                } else {
                    // See if we can derive it from javac's location.
                    // fs.realpathSync is require on Ubuntu, which symplinks from /usr/bin -> JDK
                    var maybeJavaHome = path.dirname(path.dirname(javacPath));
                    if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
                        process.env['JAVA_HOME'] = maybeJavaHome;
                    } else {
                        throw new CordovaError(default_java_error_msg);
                    }
                }
            } else if (module.exports.isWindows()) {
                // Try to auto-detect java in the default install paths.
                var oldSilent = shelljs.config.silent;
                shelljs.config.silent = true;
                var firstJdkDir =
                    shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] ||
                    shelljs.ls('C:\\Program Files\\java\\jdk*')[0] ||
                    shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0];
                shelljs.config.silent = oldSilent;
                if (firstJdkDir) {
                    // shelljs always uses / in paths.
                    firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
                    if (!javacPath) {
                        process.env['PATH'] += path.delimiter + path.join(firstJdkDir, 'bin');
                    }
                    process.env['JAVA_HOME'] = firstJdkDir;
                }
            }
        }
    }).then(function () {
github fractal-code / meteor-azure / source / lib / cli.js View on Github external
// Configure CLI
program
  .description(pkg.description)
  .version(`v${pkg.version}`, '-v, --version')
  .option('-s, --settings ', 'path to settings file or comma-separated list of paths [settings.json]', 'settings.json')
  .option('-w, --web-config 
github mclear / NFC_Ring_Control / platforms / android / cordova / lib / check_reqs.js View on Github external
.then(function(stdout) {
                        process.env['JAVA_HOME'] = stdout.trim();
                    });
                } else {
                    // See if we can derive it from javac's location.
                    // fs.realpathSync is require on Ubuntu, which symplinks from /usr/bin -> JDK
                    var maybeJavaHome = path.dirname(path.dirname(javacPath));
                    if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
                        process.env['JAVA_HOME'] = maybeJavaHome;
                    } else {
                        throw new Error(msg);
                    }
                }
            } else if (isWindows) {
                // Try to auto-detect java in the default install paths.
                var oldSilent = shelljs.config.silent;
                shelljs.config.silent = true;
                var firstJdkDir =
                    shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] ||
                    shelljs.ls('C:\\Program Files\\java\\jdk*')[0] ||
                    shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0];
                shelljs.config.silent = oldSilent;
                if (firstJdkDir) {
                    // shelljs always uses / in paths.
                    firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
                    if (!javacPath) {
                        process.env['PATH'] += path.delimiter + path.join(firstJdkDir, 'bin');
                    }
                    process.env['JAVA_HOME'] = firstJdkDir;
                }
            }
        }
github mccxiv / tc / gulpfile.js View on Github external
const shell = require('shelljs')
const path = require('path')
const gulp = require('gulp')

shell.config.throw = true // Throw on error

gulp.task('dev-watch-files', function (done) {
  shell.rm('-rf', '_build')
  shell.mkdir('_build')
  shell.cp('src/tc-renderer/index.html', '_build/index.html')
  shell.cp('src/package.json', '_build/package.json')
  shell.exec(path.normalize(
    './node_modules/.bin/webpack --mode development --watch'
  ))
  done()
})

gulp.task('dev-launch-electron', function (done) {
  shell.exec(path.normalize(
    './node_modules/.bin/electron --enable-logging ./_build --dev-tools'
  ))
github alex-shpak / keemob / node_modules / cordova-android / bin / templates / cordova / lib / builders / ProjectBuilder.js View on Github external
function findOutputApksHelper (dir, build_type, arch) {
    var shellSilent = shell.config.silent;
    shell.config.silent = true;

    // list directory recursively
    var ret = shell.ls('-R', dir).map(function (file) {
        // ls does not include base directory
        return path.join(dir, file);
    }).filter(function (file) {
        // find all APKs
        return file.match(/\.apk?$/i);
    }).filter(function (candidate) {
        var apkName = path.basename(candidate);
        // Need to choose between release and debug .apk.
        if (build_type === 'debug') {
            return /-debug/.exec(apkName) && !/-unaligned|-unsigned/.exec(apkName);
        }
        if (build_type === 'release') {
            return /-release/.exec(apkName) && !/-unaligned/.exec(apkName);
github scottbedard / vuetober / build / build.js View on Github external
var path = require('path');
var chalk = require('chalk');
var shell = require('shelljs');
var webpack = require('webpack');
var config = require('../config');
var webpackConfig = require('./webpack.prod.conf');

var spinner = ora('building for production...');
spinner.start();

var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory);
shell.rm('-rf', assetsPath);
shell.mkdir('-p', assetsPath);
shell.config.silent = true;
shell.cp('-R', 'static/*', assetsPath);
shell.config.silent = false;

webpack(webpackConfig, function (err, stats) {
    spinner.stop();

    if (err) {
        throw err;
    }

    process.stdout.write(stats.toString({
        children: false,
        chunkModules: false,
        chunks: false,
        colors: true,
        modules: false,
    }) + '\n\n');
github ccorcos / doug / packages / doug-app / commands / build.js View on Github external
'use strict'

const shell = require('shelljs')
shell.config.fatal = true
const webpack = require('webpack')
const write = require('doug/utils/write')
const resolve = require('doug/resolve')

const runWebpack = (webpackConfig) => {
  return new Promise((resolve, reject) => {
    webpack(webpackConfig)
      .run((err, stats) => {
        if (err) {
          reject(err)
        } else {
          resolve(stats)
        }
      })
  })
}