How to use the process.chdir function in process

To help you get started, we’ve selected a few process 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 headwirecom / peregrine-cms / buildscripts / buildvue.js View on Github external
if(compiling.length === 0) {
        console.log('done compiling')

        if(process.argv[3] === 'upload') {
            console.log('upload')
            const slang = require('./slang.js')
            slang.setOptions({
                port: 8080,
                host: 'localhost'
            })

            const appName = felibName
            console.log('felib name is', appName)

            process.chdir('target/classes')
            slang.up('etc/felibs/' + appName + '/js.txt').then(function (status) {
//                console.log('success', status)
            }).catch(function (status, err) {
                console.error('error', status, err)
            });
            slang.up('etc/felibs/' + appName + '/css.txt').then(function (status) {
//                console.log('success', status)
            }).catch(function (status, err) {
                console.error('error', status, err)
            });

            jsFiles.slice(1).forEach( function(file) {
                slang.up('etc/felibs/' + appName + '/'+file).then(function (status) {
//                    console.log('success', status)
                }).catch(function (status, err) {
                    console.error('error', status, err)
github raomengyun / auto_assets / lib / auto_assets.js View on Github external
start() {
    /// 当前文件夹设置为 root 位置
    const process = require("process");
    process.chdir(this.root);
    /// 校验是否是 flutter 项目
    this._validateFlutterProject();
    /// 提取配置文件
    const configs = this._extraConfigFileContent();
    const FolderWatcher = require("./folder_watcher/folder_watcher.js");
    this.folderWatcher = new FolderWatcher(configs);
    this.folderWatcher.start();
  }
github one-more / sprute / tests-client / unit-tests / process-tests.js View on Github external
it('should change working directory', function(done) {
            process.chdir('../../../../../../');
            expect(process.cwd()).to.equal('/');
            process.chdir('./static');
            expect(process.cwd()).to.equal('/static');
            process.chdir('../common');
            expect(process.cwd()).to.equal('/common');
            process.chdir('./modules');
            expect(process.cwd()).to.equal('/common/modules');
            process.chdir('./meta');
            expect(process.cwd()).to.equal('/common/modules/meta');
            process.chdir('/build');
            expect(process.cwd()).to.equal('/build');
            process.chdir('configuration');
            expect(process.cwd()).to.equal('/configuration');
            expect(process.chdir.bind(null, 'undefined')).to.throw(Error);
            process.chdir('/');
            done()
        })
    });
github one-more / sprute / tests-client / index.js View on Github external
'use strict';
//
const process = require('process'),
    express = require('express'),
    path = require('path'),
    fs = require('fs'),
    _ = require('underscore'),
    commonPath = path.join(__dirname, 'common'),
    commonEvents = require('../common/events/common');

process.chdir('../');

require('../index');

commonEvents.on('init server', () => {
    app.get('server').use(express.static(__dirname));
    app.get('server').use((req, res, next) => {
        app.setVars();
        switch(req.path) {
            case '/rest/query':
                app.set('classPath', commonPath);
                break;
        }
        next()
    });
    const routes = {
            '/page:number': 'page',
github Cedware / electron-angular-toolkit / src / index.ts View on Github external
private static async installNativeDependenciesIntoBuild(packageJson: Package): Promise {
        if(packageJson.nativeModules){
            console.log(`installing native dependencies`);
            let packagesToInstall: string[] = [];
            try {
                await fs.mkdir(path.join(process.cwd(), 'bundle', 'node_modules'));
                for (let packageName of packageJson.nativeModules) {
                    packagesToInstall.push(`${packageName}@${packageJson.dependencies[packageName]}`);
                }
                process.chdir('bundle');
                await this.npmInstall(packagesToInstall, false);
                process.chdir('..');
                console.log(chalk.green('finished installing native dependencies'));
            }
            catch (error) {
                console.log(chalk.red('failed installing native dependencies'));
                console.log(chalk.red(error));
                console.log(chalk.red(`packages: ${packagesToInstall.join(', ')}`));
                process.exit(1);
            }
        }
    }
github caiusCitiriga / shell-profiler / src / services / system.service.ts View on Github external
public upsertAlias(alias: ProfilerItem) {
        let updated = false;

        if (!this.checkProfilerDataIntegrity()) {
            this.initializeCoreFiles();
        }

        proc.chdir(os.homedir() + path.sep + GENERAL.profilerDataDirectory);
        const profilerData: ProfilerData = JSON.parse(fs.readFileSync(GENERAL.profilerDataFile, { encoding: 'UTF-8' }));

        if (!!profilerData && !profilerData.aliases) {
            profilerData.aliases = [];
        }
        if (!!profilerData.aliases.find(a => a.name === alias.name.trim().toLowerCase())) {
            profilerData.aliases.forEach((a, i) => {
                if (a.name === alias.name.toLowerCase().trim()) {
                    profilerData.aliases[i].command = alias.command;
                    updated = true;
                }
            });
        } else {
            profilerData.aliases.push(alias);
        }
        this.updateDataFile(profilerData);
github rhdeck / react-native-swift-cli / bin / cli.js View on Github external
.action(function(projectname, projectpath) {
    validateModuleName(projectname);
    if (!projectpath) projectpath = "./" + projectname;
    makeNewProject(projectname, projectpath);
    chdir(projectpath);
    yarnif.addDevDependency("react-native-swift-bridge");
    yarnif.addDevDependency("react-native-pod");
    spawnSync("yarn", ["run", "react-native-swift-bridge"], opts);
    spawnSync("yarn", ["link"], opts);
  });
github lutzroeder / netron / src / app.js View on Github external
electron.app.on('second-instance', (event, commandLine, workingDirectory) => {
            const currentDirectory = process.cwd();
            process.chdir(workingDirectory);
            const open = this._parseCommandLine(commandLine);
            process.chdir(currentDirectory);
            if (!open) {
                if (this._views.count > 0) {
                    const view = this._views.item(0);
                    if (view) {
                        view.restore();
                    }
                }
            }
        });
github fibjs / fibjs / fibjs / include / ifs / idlc.js View on Github external
var dir = fs.readdir(path);
    dir.forEach(function(name) {
        var fname = path + '/' + name;
        var f = fs.stat(fname);
        if (f.isDirectory()) {
            clean_folder(fname);
            fs.rmdir(fname);
        } else
            fs.unlink(fname);
    });
}

clean_folder("../../../docs/html");
process.run('doxygen');

process.chdir("../../../docs/src");
process.run('doxygen');

function replace_dot(path) {
    var dir = fs.readdir(path);
    dir.forEach(function(name) {
        var fname = path + '/' + name;
        var f = fs.stat(fname);
        if (f.isDirectory()) {
            replace_dot(fname);

        } else if (name.substr(name.length - 5) == ".html") {
            var html = fs.readTextFile(fname);
            html = html.replace(/::/g, ".");
            html = html.replace(//g, "");
            html = html.replace(//g, "");
            html = html.replace(//g, "");
github DataFire / OneDB / apps / data-explorer / prerender.ts View on Github external
.forEach(function (dir) {
      if (!existsSync(dir)) {
        mkdirSync(dir);
      }
      chdir(dir);
    });