• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript utils-fs.mkdirp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ionic/utils-fs.mkdirp函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirp函数的具体用法?TypeScript mkdirp怎么用?TypeScript mkdirp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mkdirp函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: preRunChecks

  protected async preRunChecks(runinfo: CommandInstanceInfo) {
    if (!this.project) {
      throw new FatalException('Cannot use Cordova outside a project directory.');
    }

    const { loadConfigXml } = await import('../../lib/integrations/cordova/config');

    await this.checkCordova(runinfo);

    // Check for www folder
    if (this.project.directory) {
      const wwwPath = path.join(this.integration.root, 'www');
      const wwwExists = await pathExists(wwwPath); // TODO: hard-coded

      if (!wwwExists) {
        const tasks = this.createTaskChain();

        tasks.next(`Creating ${strong(prettyPath(wwwPath))} directory for you`);
        await mkdirp(wwwPath);
        tasks.end();
      }
    }

    const conf = await loadConfigXml(this.integration);
    conf.resetContentSrc();
    await conf.save();
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:27,代码来源:base.ts


示例2: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions) {
    await remove(STAGING_DIRECTORY);
    await mkdirp(STAGING_DIRECTORY);

    const projectTypes: ProjectType[] = ['angular', 'ionic-angular', 'ionic1'];
    const baseCtx = await generateContext();

    for (const projectType of projectTypes) {
      // TODO: possible to do this without a physical directory?
      const ctx = { ...baseCtx, execPath: path.resolve(PROJECTS_DIRECTORY, projectType) };
      const executor = await loadExecutor(ctx, []);

      const location = await executor.namespace.locate([]);
      const formatter = new NamespaceSchemaHelpFormatter({ location, namespace: executor.namespace });
      const formatted = await formatter.serialize();
      const projectJson = { type: projectType, ...formatted };

      // TODO: `serialize()` from base formatter isn't typed properly
      projectJson.commands = await Promise.all(projectJson.commands.map(async cmd => this.extractCommand(cmd as CommandHelpSchema)));
      projectJson.commands.sort((a, b) => strcmp(a.name, b.name));

      await writeFile(path.resolve(STAGING_DIRECTORY, `${projectType}.json`), JSON.stringify(projectJson, undefined, 2) + '\n', { encoding: 'utf8' });
    }

    process.stdout.write(`${chalk.green('Done.')}\n`);
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:26,代码来源:index.ts


示例3: sendMessage

export async function sendMessage({ config, ctx }: SendMessageDeps, msg: IPCMessage) {
  const dir = path.dirname(config.p);
  await mkdirp(dir);
  const fd = await open(path.resolve(dir, 'helper.log'), 'a');
  const p = fork(ctx.binPath, ['_', '--no-interactive'], { stdio: ['ignore', fd, fd, 'ipc'] });

  p.send(msg);
  p.disconnect();
  p.unref();
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:10,代码来源:helper.ts


示例4: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const { getGeneratedPrivateKeyPath } = await import('../../lib/ssh');

    const { bits, annotation } = options;

    const keyPath = inputs[0] ? expandPath(String(inputs[0])) : await getGeneratedPrivateKeyPath(this.env.config.get('user.id'));
    const keyPathDir = path.dirname(keyPath);
    const pubkeyPath = `${keyPath}.pub`;

    if (!(await pathExists(keyPathDir))) {
      await mkdirp(keyPathDir, 0o700 as any); // tslint:disable-line
      this.env.log.msg(`Created ${strong(prettyPath(keyPathDir))} directory for you.`);
    }

    if (await pathExists(keyPath)) {
      const confirm = await this.env.prompt({
        type: 'confirm',
        name: 'confirm',
        message: `Key ${strong(prettyPath(keyPath))} exists. Overwrite?`,
      });

      if (confirm) {
        await unlink(keyPath);
      } else {
        this.env.log.msg(`Not overwriting ${strong(prettyPath(keyPath))}.`);
        return;
      }
    }

    this.env.log.info(
      'Enter a passphrase for your private key.\n' +
      `You will be prompted to provide a ${strong('passphrase')}, which is used to protect your private key should you lose it. (If someone has your private key, they can impersonate you!) Passphrases are recommended, but not required.\n`
    );

    const shellOptions = { stdio: 'inherit', showCommand: false, showError: false };
    await this.env.shell.run('ssh-keygen', ['-q', '-t', String(options['type']), '-b', String(bits), '-C', String(annotation), '-f', keyPath], shellOptions);

    this.env.log.nl();

    this.env.log.rawmsg(
      `Private Key (${strong(prettyPath(keyPath))}): Keep this safe!\n` +
      `Public Key (${strong(prettyPath(pubkeyPath))}): Give this to all your friends!\n\n`
    );

    this.env.log.ok('A new pair of SSH keys has been generated!');
    this.env.log.nl();

    this.env.log.msg(
      `${strong('Next steps:')}\n` +
      ` * Add your public key to Ionic: ${input('ionic ssh add ' + prettyPath(pubkeyPath))}\n` +
      ` * Use your private key for secure communication with Ionic: ${input('ionic ssh use ' + prettyPath(keyPath))}`
    );
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:53,代码来源:generate.ts


示例5: ensureDirectory

 private async ensureDirectory(p: string) {
   if (!(await pathExists(p))) {
     await mkdirp(p, 0o700 as any); // tslint:disable-line
     this.env.log.msg(`Created ${strong(prettyPath(p))} directory for you.`);
   }
 }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:6,代码来源:generate.ts


示例6: mkdirp

 .map(dir => mkdirp(dir));
开发者ID:driftyco,项目名称:ionic-cli,代码行数:1,代码来源:resources.ts



注:本文中的@ionic/utils-fs.mkdirp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript utils-fs.pathExists函数代码示例发布时间:2022-05-28
下一篇:
TypeScript utils-array.conform函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap