How to use the mz/fs.mkdir function in mz

To help you get started, we’ve selected a few mz 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 Eugeny / terminus / app / src / plugins.ts View on Github external
global['module'].paths.map((x: string) => nodeModule.globalPaths.push(normalizePath(x)))

if (process.env.TERMINUS_DEV) {
    nodeModule.globalPaths.unshift(path.dirname(require('electron').remote.app.getAppPath()))
}

const builtinPluginsPath = process.env.TERMINUS_DEV ? path.dirname(require('electron').remote.app.getAppPath()) : path.join((process as any).resourcesPath, 'builtin-plugins')

const userPluginsPath = path.join(
    require('electron').remote.app.getPath('appData'),
    'terminus',
    'plugins',
)

if (!fs.existsSync(userPluginsPath)) {
    fs.mkdir(userPluginsPath)
}

Object.assign(window, { builtinPluginsPath, userPluginsPath })
nodeModule.globalPaths.unshift(builtinPluginsPath)
nodeModule.globalPaths.unshift(path.join(userPluginsPath, 'node_modules'))
// nodeModule.globalPaths.unshift(path.join((process as any).resourcesPath, 'app.asar', 'node_modules'))
if (process.env.TERMINUS_PLUGINS) {
    process.env.TERMINUS_PLUGINS.split(':').map(x => nodeModule.globalPaths.push(normalizePath(x)))
}

export type ProgressCallback = (current: number, total: number) => void // eslint-disable-line @typescript-eslint/no-type-alias

export interface PluginInfo {
    name: string
    description: string
    packageName: string
github macacajs / macaca-datahub / app / service / database.js View on Github external
async ensureNewDir(dir) {
    if (fs.existsSync(dir)) rimraf.sync(dir);

    // support Docker volume data
    if (!fs.existsSync(dir)) {
      await fs.mkdir(dir);
    }
  }
github node-inspector / node-inspector / test / helpers / fs-tree.js View on Github external
return co(function * () {
      yield fs.mkdir(name);
      yield Object.keys(node).map(key => {
        if (node[key] === true) return fs.writeFile(`${name}/${key}`, '', 'utf-8');
        if (typeof node[key] === 'object') folders.push([`${name}/${key}`, node[key]]);
      });
    });
  }
github dawg / vusic / src / cache.ts View on Github external
public async write() {
    const c = CacheType.encode(this.o);
    const dir = path.dirname(CACHE_PATH);
    if (!await fs.exists(dir)) {
      await fs.mkdir(dir);
    }

    return fs.writeFile(CACHE_PATH, JSON.stringify(c));
  }
}
github alangpierce / sucrase / src / cli.ts View on Github external
async function buildDirectory(
  srcDirPath: string,
  outDirPath: string,
  options: CLIOptions,
): Promise {
  const extensions = options.sucraseOptions.transforms.includes("typescript")
    ? [".ts", ".tsx"]
    : [".js", ".jsx"];
  if (!(await exists(outDirPath))) {
    await mkdir(outDirPath);
  }
  for (const child of await readdir(srcDirPath)) {
    if (["node_modules", ".git"].includes(child) || options.excludeDirs.includes(child)) {
      continue;
    }
    const srcChildPath = join(srcDirPath, child);
    const outChildPath = join(outDirPath, child);
    if ((await stat(srcChildPath)).isDirectory()) {
      await buildDirectory(srcChildPath, outChildPath, options);
    } else if (extensions.some((ext) => srcChildPath.endsWith(ext))) {
      const outPath = outChildPath.replace(/\.\w+$/, `.${options.outExtension}`);
      await buildFile(srcChildPath, outPath, options);
    }
  }
}
github GoogleChromeLabs / ProgressiveWordPress / build.js View on Github external
await elems.reduce(async (p, newPath) => {
    const oldPath = await p;
    const newDir = path.join(oldPath, newPath);
    await fs.mkdir(newDir).catch(_ => {});
    return newDir;
  }, Promise.resolve(''));
}
github pedromsilvapt / unicast / src / Storage.ts View on Github external
async ensureDir ( folder : string ) : Promise {
        if ( !( await fs.exists( folder ) ) ) {
            await this.ensureDir( path.dirname( folder ) );

            await fs.mkdir( folder );
        }
    }