How to use path-extra - 10 common examples

To help you get started, we’ve selected a few path-extra 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 RyanZim / onessg / test / onessg.js View on Github external
.then(() => {
    // Assert that dist/ & expected/ are equal:
      assert.dirsEqual(distPath, path.join('test/fixtures/', fixture, 'expected'));
    });
};
github NatWeiss / RapidGame / rapidgame.js View on Github external
var copySrcFiles = function(callback) {
	var src = path.join(__dirname, "src"),
		dest = path.join(cmd.prefix, "src");

	// Synchronously copy src directory to dest
	if (src !== dest && !dirExists(dest)) {
		logBuild("Copying " + src + " to " + dest, true);
		copyRecursive(src, dest, true);
	}

	callback();
};
github RyanZim / onessg / index.js View on Github external
function render(data) {
  return globby(path.join(conf.layouts, data._layout) + '.*')
    .then(arr => {
      var layout = arr[0];
      // Globby doesn't throw an error if the layout path doesn't exist, so we do:
      if (!layout) throw new Error(`The layout: ${data._layout} cannot be found in ${conf.layouts}`);
      // Render with jstransformer:
      return transformer(layout, data);
    })
    .then(obj => obj.body);
}
github NatWeiss / RapidGame / rapidgame.js View on Github external
src = path.join(cmd.prefix, "src", "proj.android");
		dest = path.join(cmd.src, "build", configs[i] + "-Android");

		// Always copy latest Android build files.
		logBuild("Copying " + src + " to " + dest, false);
		wrench.mkdirSyncRecursive(dest);
		//copyGlobbed(src, dest, "build.sh");
		//copyGlobbed(src, dest, "makefile");
		copyGlobbed(path.join(src, "jni"), path.join(dest, "jni"), "*");

		// Set func.
		func = linkAndroid;

		for (j = 0; j < archs.length; j += 1) {
			// Run the ndk-build.
			command = path.join(process.env["NDK_ROOT"], "ndk-build" + (process.platform === "win32" ? ".cmd" : ""));
			args = [
				"-C", dest,
				"NDK_TOOLCHAIN_VERSION=" + ndkToolchainVersion,
				"NDK_MODULE_PATH=" + cmd.src,
				"APP_PLATFORM=" + "android-18",
				"APP_ABI=" + archs[j],
				"CONFIG=" + configs[i],
				"DO_JS=" + (doJSB ? "1" : "0")
			];
			funcArg = configs[i] + "-" + archs[j];
			builds.push([configs[i], command, dest, args, func, funcArg]);
		}
	}
	nextBuild("Android", callback);
};
github unfoldingWord / translationCore / tests / h.CheckDataGrabber.js View on Github external
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();
const CheckDataGrabber = require('../src/js/components/core/create_project/CheckDataGrabber.js');
const CheckStore = require('../src/js/stores/CheckStore.js');
const CoreStore = require('../src/js/stores/CoreStore.js');
const path = require('path-extra');
const api = window.ModuleApi;
const fs = require(window.__base + 'node_modules/fs-extra');

const PARENT = path.datadir('translationCore');
const PACKAGE_SAVE_LOCATION = path.join(PARENT, 'packages-compiled');
const testTool = path.join(PACKAGE_SAVE_LOCATION, 'ExampleChecker');
const testCheckArray = [
    {
        "name": "ExampleChecker",
        "location": path.join(PACKAGE_SAVE_LOCATION , "ExampleChecker")
    },
    {
        "name": "TPane",
        "location": path.join(PACKAGE_SAVE_LOCATION , "TPane")
    },
    {
        "name": "ExampleTool",
        "location": path.join(PACKAGE_SAVE_LOCATION , "ExampleTool")
    },
    {
        "name": "CommentBox",
github unfoldingWord / translationCore / tests / d.Upload.js View on Github external
* 8. saveManifest - Important (TESTED THROUGH SENDPATH)                ✓
 * 9. fixManifestVerThree - Somewhat Important (TESTED THROUGH SENDPATH)✓
 * 10. manifestError                                                    ✘
 * 11. isOldTestament - Somewhat Important (TESTED THROUGH SENDPATH)    ✓
 ******************************************************************************/
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();
const Upload = require('../src/js/components/core/UploadMethods.js');
const CheckStore = require('../src/js/stores/CheckStore.js')
const path = require('path-extra');
const api = window.ModuleApi;
var fs = require('fs');

const testProjectPath = path.join(path.homedir(), 'translationCore', 'id_-co_text_reg');
const testUSFMProjectPath = path.join(window.__base, '/tests/static/3john');
const noTCManifestProject = path.join(window.__base, '/tests/static/id_-co_text_reg');
const undefinedProject = path.join(window.__base, '/tests/static/JesusSaves');

describe('Upload.sendFilePath(undefined project)', function () {
    it('should fail', function (done) {
        Upload.sendFilePath(undefinedProject, null, function () {
            assert.isNotOk(api.getDataFromCommon('tcManifest'));
            assert.isNotOk(api.getDataFromCommon('saveLocation'));
            assert.isNotOk(api.getDataFromCommon('params'));
            assert.isNotOk(api.getDataFromCommon('targetLanguage'));
            api.inputJson(undefinedProject + '/tc-manifest.json', function (err, data) {
                if (!err) {
                    assert.equal(true, false);
                } else {
                    assert.isNotOk(data);
                }
github unfoldingWord / translationCore / src / js / components / core / package_manager / PackageManager.js View on Github external
/**
 *@author: Ian Hoegen
 *@description: This is the central manager of all packages for translationCore.
 ******************************************************************************/
const pathex = require('path-extra');
const fs = require(window.__base + 'node_modules/fs-extra');
const git = require('../GitApi.js');
const npm = pathex.join(window.__base, 'node_modules', '.bin', 'npm');
const babelCli = pathex.join(window.__base, 'node_modules', '.bin', 'babel');
const exec = require('child_process').exec;
const api = window.ModuleApi;

const PARENT = pathex.datadir('translationCore')
const PACKAGE_SAVE_LOCATION = pathex.join(PARENT, 'packages');
const PACKAGE_COMPILE_LOCATION = pathex.join(PARENT, 'packages-compiled')
const CENTRAL_REPO = "https://raw.githubusercontent.com/translationCoreApps/translationCore-apps/master/directory.json";

/**
 * @description - This downloads the specified package to the packages folder.
 * @param {String} packageName - The name of the package to be installed.
 * @param {function} callback - To be called upon completion
 ******************************************************************************/
function downloadPackage(packageName, callback) {
  getPackageList(function(obj){
    var packageLocation = obj[packageName].repo;
    fs.ensureDirSync(PACKAGE_SAVE_LOCATION);
    fs.ensureDirSync(PACKAGE_COMPILE_LOCATION);
    var source = pathex.join(PACKAGE_SAVE_LOCATION, packageName);
    fs.emptyDirSync(source);
    git(PACKAGE_SAVE_LOCATION).mirror(packageLocation, source, function() {
github unfoldingWord / translationCore / src / js / components / core / package_manager / PackageManager.js View on Github external
/**
 *@author: Ian Hoegen
 *@description: This is the central manager of all packages for translationCore.
 ******************************************************************************/
const pathex = require('path-extra');
const fs = require(window.__base + 'node_modules/fs-extra');
const git = require('../GitApi.js');
const npm = pathex.join(window.__base, 'node_modules', '.bin', 'npm');
const babelCli = pathex.join(window.__base, 'node_modules', '.bin', 'babel');
const exec = require('child_process').exec;
const api = window.ModuleApi;

const PARENT = pathex.datadir('translationCore')
const PACKAGE_SAVE_LOCATION = pathex.join(PARENT, 'packages');
const PACKAGE_COMPILE_LOCATION = pathex.join(PARENT, 'packages-compiled')
const CENTRAL_REPO = "https://raw.githubusercontent.com/translationCoreApps/translationCore-apps/master/directory.json";

/**
 * @description - This downloads the specified package to the packages folder.
 * @param {String} packageName - The name of the package to be installed.
 * @param {function} callback - To be called upon completion
 ******************************************************************************/
function downloadPackage(packageName, callback) {
  getPackageList(function(obj){
    var packageLocation = obj[packageName].repo;
    fs.ensureDirSync(PACKAGE_SAVE_LOCATION);
    fs.ensureDirSync(PACKAGE_COMPILE_LOCATION);
    var source = pathex.join(PACKAGE_SAVE_LOCATION, packageName);
    fs.emptyDirSync(source);
    git(PACKAGE_SAVE_LOCATION).mirror(packageLocation, source, function() {
      var destination = pathex.join(PACKAGE_COMPILE_LOCATION, packageName);
github NatWeiss / RapidGame / rapidgame.js View on Github external
var showPrefix = function(directory) {
	if (!resolveDirs()) {return 1;}
	
	console.log("Rapidgame lives here: " + cmd.prefix);
	console.log("Prebuilt headers and libs path: " + cmd.dest);
	console.log("Headers have been copied: " + (dirExists(path.join(cmd.dest, "cocos2d", "x", "include")) ? "YES" : "NO"));
	console.log("Libraries have been built: " + (dirExists(path.join(cmd.dest, "cocos2d", "x", "lib")) ? "YES" : "NO"));
	if (cmd.src != defaults.src) {
		console.log("src: " + cmd.src);
	}
};
github NatWeiss / RapidGame / rapidgame.js View on Github external
var showPrefix = function(directory) {
	if (!resolveDirs()) {return 1;}
	
	console.log("Rapidgame lives here: " + cmd.prefix);
	console.log("Prebuilt headers and libs path: " + cmd.dest);
	console.log("Headers have been copied: " + (dirExists(path.join(cmd.dest, "cocos2d", "x", "include")) ? "YES" : "NO"));
	console.log("Libraries have been built: " + (dirExists(path.join(cmd.dest, "cocos2d", "x", "lib")) ? "YES" : "NO"));
	if (cmd.src != defaults.src) {
		console.log("src: " + cmd.src);
	}
};

path-extra

path-extra contains methods that aren't included in the vanilla Node.js path package.

MIT
Latest version published 5 years ago

Package Health Score

54 / 100
Full package analysis

Popular path-extra functions