How to use the process.cwd 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 finos / perspective / packages / perspective / src / js / perspective.node.js View on Github external
const perspective = require("./perspective.js").default;

const fs = require("fs");
const http = require("http");
const WebSocket = require("ws");
const process = require("process");

const path = require("path");

const load_perspective = require("./psp.async.js").default;

// eslint-disable-next-line no-undef
const RESOLVER = typeof __non_webpack_require__ !== "undefined" ? __non_webpack_require__.resolve : module.require.resolve;

const LOCAL_PATH = path.join(process.cwd(), "node_modules");

const wasm = require("./psp.async.wasm.js");

const buffer = fs.readFileSync(path.join(__dirname, wasm)).buffer;

const SYNC_SERVER = new (class extends Server {
    init(msg) {
        load_perspective({
            wasmBinary: buffer,
            wasmJSMethod: "native-wasm"
        }).then(core => {
            this.perspective = perspective(core);
            super.init(msg);
        });
    }
github hemanth / interview-time / problems / set-difference / index.js View on Github external
var rootRequire = require('root-require'),
	check = rootRequire('./utils').check,
	cwd = require('process').cwd();

// Will use ES6 teamplate strings later on.
exports.problem = 'Write a program that takes two arrays: \n\n' +

	'a1 = [1,1,2,4,6,8,0] and a2 = [1,3,5,7,7] result must be their set difference.\n\n' +

	'* Create a file `set-diff.js` which takes in two arrays and returns the difference\n\n' +

	'* Don\'t forget to export you function. module.exports = function() {}`);\n\n' +

	'Finally to verify do a `interview-time verify set-diff.js`\n\n';

exports.verify = function (args, cb) {
	var proposed = require(cwd + '/' + args[0]),
		expected = [2, 4, 6, 8, 0];
github feathers-plus / generator-feathers-plus / generators / all / index.js View on Github external
async prompting () {
    await Generator.asyncInit(this);
    initSpecs('all');
    const { _specs: specs } = this;

    this.log();
    this.log([
      chalk.green.bold('Regenerate the entire app in dir '),
      chalk.yellow.bold(parse(cwd()).base),
      chalk.green.bold(` in ${specs.options.ts ? 'TypeScript' : 'JavaScript'}`),
    ].join(''));
    this.log();

    const prompts = [{
      name: 'confirmation',
      message: 'Regenerate the entire application?',
      type: 'confirm'
    }];

    return this.prompt(prompts)
      .then(answers => {
        if (!answers.confirmation) process.exit(0);
      });
  }
github cts / cts-cli / src / commands / setup.js View on Github external
CTSCLI.Setup.prototype.editConfig = function() {
  var currentDirectory = process.cwd();
  var configYml = path.join(currentDirectory, "_config.yml");
  fs.readFile(configYml, 'utf8', function (err,data) {
    if(err) { 
      console.log(err);
    } else {
      fs.renameSync(configYml, path.join(currentDirectory, "_config-old.yml"));
      var endOfLine = require('os').EOL;
      fs.writeFileSync(configYml, "theme: mog" + endOfLine + data);
    }
  });
};
CTSCLI.Setup.prototype.makeConfig = function() {
github Samsung / WATT / libs / brackets-server / embedded-ext / project / node / CompileDomain.js View on Github external
function installWGT(projectId, callback) {
        const sourcePath = process.cwd() + "projects" + projectId;
        var command = sourcePath + "/install.sh";
        let child = exec(command, {cwd: sourcePath});

        child.on("error", (err) => {
            console.error("Error");
            callback(err);
        });
    }
github christopherdumas / atomicdatabase / main.js View on Github external
})
                }

                console.log("pin database loaded");
                res.send({
                    data: null,
                    success: true
                });
            } else {
                console.log("Creating new pin for user");
                var val = -1;
                var pad = "0000"
                var ans = pad.substring(0, pad.length - val.length) + val;

                var found = false;
                var items = fs.readdirSync(process.cwd());
                do {
                    val++;
                    pad = "0000"
                    ans = pad.substring(0, pad.length - val.length) + val;

                    if (ans in items) {
                        console.log("Pin " + ans + " already used, progressing.");
                        found = true;
                    }
                } while (found);

                console.log("Pin "+ ans +" unused, creating file!");
                fs.closeSync(fs.openSync(ans, 'w'));

                console.log("Saving current table to database.");
                engine.saveDatabase(ans);
github peteroupc / html3dutil / build / compile.js View on Github external
async function chdirAsync(x, cb) {
  const wd = process.cwd();
  try {
    process.chdir(x);
    return await cb();
  } finally {
    process.chdir(wd);
  }
}
github w3f / polkadot-secure-validator / src / index.js View on Github external
#!/usr/bin/env node

const path = require('path');
const process = require('process');
const program = require('commander');
require('dotenv').config({path: path.resolve(process.cwd(), '.env')});
require('dotenv').config({path: path.resolve(process.cwd(), 'config/.env')});

const clean = require('./lib/actions/clean');
const sync = require('./lib/actions/sync');
const version = require('./lib/version');


program
  .version(version.show());

program
  .command('sync')
  .description('Synchronizes the infrastructure.')
  .option('-c, --config [path]', 'Path to config file.', './config/main.json')
  .action(sync.do);

program
github adamborowski / explorejs / packages / explorejs-server / main.js View on Github external
#!/usr/local/bin/node --max-old-space-size=200000
"use strict";
var process = require('process');
var argv = require('./argv');
var path = require('path');
var WebServer = require('./app/WebServer');


var sourcePath = path.isAbsolute(argv.path) ? argv.path : path.resolve(process.cwd(), argv.path);

var files = [];
var webserver = new WebServer({
    port: argv.port,
    files,
    sourcePath: sourcePath,
    devServer: argv['webpack-dev-server'],
    devServerPort: argv['webpack-dev-port'],
    clientAppPath: argv['client-app-path'],
});
webserver.start();
github chrisguttandin / angular-audio-context / gruntfile.js View on Github external
module.exports = (grunt) => loadGruntConfig(grunt, { configPath: join(cwd(), 'config/grunt') });