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

TypeScript rimraf.sync函数代码示例

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

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



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

示例1: resolve

                resolve(memo);
                return;
            }
            Promise.cast(iter(arr.shift())).then((res: W) => {
                memo.push(res);
                next();
            }, reject);
        };
        next();
    });
}

// As soon as this module is loaded we clear the tscache
// This ensures that we compile all the typescript whenever we are restarted
try {
    rimraf.sync(cacheUtils.cacheDir);
    gruntGlobal.log.writeln('Cleared fast compile cache'.cyan);
}
catch (ex) {
    gruntGlobal.log.writeln('No existing fast compile cache'.cyan);
}

function pluginFn(grunt: IGrunt) {

    /////////////////////////////////////////////////////////////////////
    // The grunt task
    ////////////////////////////////////////////////////////////////////

    // Note: this function is called once for each target
    // so task + target options are a bit blurred inside this function
    grunt.registerMultiTask('ts', 'Compile TypeScript files', function () {
开发者ID:donaldpipowitch,项目名称:grunt-ts,代码行数:31,代码来源:ts.ts


示例2: function

  run: function (serveTaskOptions: ServeTaskOptions, rebuildDoneCb: any) {
    const ui = this.ui;

    let webpackCompiler: any;
    const projectConfig = CliConfig.fromProject().config;
    const appConfig = projectConfig.apps[0];

    const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
    if (this.project.root === outputPath) {
      throw new SilentError('Output path MUST not be project root directory!');
    }
    rimraf.sync(path.resolve(this.project.root, outputPath));

    const serveDefaults = {
      // default deployUrl to '' on serve to prevent the default from angular-cli.json
      deployUrl: ''
    };

    serveTaskOptions = Object.assign({}, serveDefaults, serveTaskOptions);

    let webpackConfig = new NgCliWebpackConfig(serveTaskOptions).config;

    // This allows for live reload of page when changes are made to repo.
    // https://webpack.github.io/docs/webpack-dev-server.html#inline-mode
    let entryPoints = [
      `webpack-dev-server/client?http://${serveTaskOptions.host}:${serveTaskOptions.port}/`
    ];
    if (serveTaskOptions.hmr) {
      const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
      ui.writeLine(oneLine`
        ${chalk.yellow('NOTICE')} Hot Module Replacement (HMR) is enabled for the dev server.
      `);
      ui.writeLine('  The project will still live reload when HMR is enabled,');
      ui.writeLine('  but to take advantage of HMR additional application code is required');
      ui.writeLine('  (not included in an Angular CLI project by default).');
      ui.writeLine(`  See ${chalk.blue(webpackHmrLink)}`);
      ui.writeLine('  for information on working with HMR for Webpack.');
      entryPoints.push('webpack/hot/dev-server');
      webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
      webpackConfig.plugins.push(new webpack.NamedModulesPlugin());
      if (serveTaskOptions.extractCss) {
        ui.writeLine(oneLine`
          ${chalk.yellow('NOTICE')} (HMR) does not allow for CSS hot reload when used
          together with '--extract-css'.
        `);
      }
    }
    if (!webpackConfig.entry.main) { webpackConfig.entry.main = []; }
    webpackConfig.entry.main.unshift(...entryPoints);
    webpackCompiler = webpack(webpackConfig);

    if (rebuildDoneCb) {
      webpackCompiler.plugin('done', rebuildDoneCb);
    }

    const statsConfig = getWebpackStatsConfig(serveTaskOptions.verbose);

    let proxyConfig = {};
    if (serveTaskOptions.proxyConfig) {
      const proxyPath = path.resolve(this.project.root, serveTaskOptions.proxyConfig);
      if (fs.existsSync(proxyPath)) {
        proxyConfig = require(proxyPath);
      } else {
        const message = 'Proxy config file ' + proxyPath + ' does not exist.';
        return Promise.reject(new SilentError(message));
      }
    }

    let sslKey: string = null;
    let sslCert: string = null;
    if (serveTaskOptions.ssl) {
      const keyPath = path.resolve(this.project.root, serveTaskOptions.sslKey);
      if (fs.existsSync(keyPath)) {
        sslKey = fs.readFileSync(keyPath, 'utf-8');
      }
      const certPath = path.resolve(this.project.root, serveTaskOptions.sslCert);
      if (fs.existsSync(certPath)) {
        sslCert = fs.readFileSync(certPath, 'utf-8');
      }
    }

    const webpackDevServerConfiguration: IWebpackDevServerConfigurationOptions = {
      contentBase: path.join(this.project.root, `./${appConfig.root}`),
      headers: { 'Access-Control-Allow-Origin': '*' },
      historyApiFallback: {
        index: `/${appConfig.index}`,
        disableDotRule: true,
        htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']
      },
      stats: statsConfig,
      inline: true,
      proxy: proxyConfig,
      compress: serveTaskOptions.target === 'production',
      watchOptions: {
        poll: projectConfig.defaults && projectConfig.defaults.poll
      },
      https: serveTaskOptions.ssl
    };

    if (sslKey != null && sslCert != null) {
//.........这里部分代码省略.........
开发者ID:Percyman,项目名称:angular-cli,代码行数:101,代码来源:serve.ts


示例3: cleanup

async function cleanup(modulePath) {
  debug('Cleaning up temporary files...')
  rimraf.sync(path.join(modulePath, 'node_production_modules'))
}
开发者ID:seffalabdelaziz,项目名称:botpress,代码行数:4,代码来源:package.ts


示例4:

 outdatedDirs.forEach(outdatedDir => rimraf.sync(path.join(directory, outdatedDir)));
开发者ID:JoshuaKGoldberg,项目名称:tslint,代码行数:1,代码来源:buildDocs.ts


示例5: afterAll

 afterAll(() => {
   rimraf.sync(out_dir);
 });
开发者ID:elgohr,项目名称:webdriver-manager,代码行数:3,代码来源:chrome_driver_spec.ts


示例6: after

 after(() => {
     rimraf.sync(outputDirName);
 });
开发者ID:dssoft32,项目名称:javascript-obfuscator,代码行数:3,代码来源:JavaScriptObfuscatorCLI.spec.ts


示例7: function

  run: function (serveTaskOptions: ServeTaskOptions, rebuildDoneCb: any) {
    const ui = this.ui;

    let webpackCompiler: any;
    const projectConfig = CliConfig.fromProject().config;
    const appConfig = getAppFromConfig(projectConfig.apps, serveTaskOptions.app);

    const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
    if (this.project.root === outputPath) {
      throw new SilentError('Output path MUST not be project root directory!');
    }
    if (projectConfig.project && projectConfig.project.ejected) {
      throw new SilentError('An ejected project cannot use the build command anymore.');
    }
    rimraf.sync(path.resolve(this.project.root, outputPath));

    const serveDefaults = {
      // default deployUrl to '' on serve to prevent the default from .angular-cli.json
      deployUrl: ''
    };

    serveTaskOptions = Object.assign({}, serveDefaults, serveTaskOptions);

    let webpackConfig = new NgCliWebpackConfig(serveTaskOptions, appConfig).buildConfig();

    const serverAddress = url.format({
      protocol: serveTaskOptions.ssl ? 'https' : 'http',
      hostname: serveTaskOptions.host,
      port: serveTaskOptions.port.toString()
    });
    let clientAddress = serverAddress;
    if (serveTaskOptions.liveReloadClient) {
      const clientUrl = url.parse(serveTaskOptions.liveReloadClient);
      // very basic sanity check
      if (!clientUrl.host) {
        return Promise.reject(new SilentError(`'live-reload-client' must be a full URL.`));
      }
      clientAddress = clientUrl.href;
    }

    if (serveTaskOptions.liveReload) {
      // This allows for live reload of page when changes are made to repo.
      // https://webpack.github.io/docs/webpack-dev-server.html#inline-mode
      let entryPoints = [
        `webpack-dev-server/client?${clientAddress}`
      ];
      if (serveTaskOptions.hmr) {
        const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
        ui.writeLine(oneLine`
          ${chalk.yellow('NOTICE')} Hot Module Replacement (HMR) is enabled for the dev server.
        `);
        ui.writeLine('  The project will still live reload when HMR is enabled,');
        ui.writeLine('  but to take advantage of HMR additional application code is required');
        ui.writeLine('  (not included in an Angular CLI project by default).');
        ui.writeLine(`  See ${chalk.blue(webpackHmrLink)}`);
        ui.writeLine('  for information on working with HMR for Webpack.');
        entryPoints.push('webpack/hot/dev-server');
        webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
        webpackConfig.plugins.push(new webpack.NamedModulesPlugin());
        if (serveTaskOptions.extractCss) {
          ui.writeLine(oneLine`
            ${chalk.yellow('NOTICE')} (HMR) does not allow for CSS hot reload when used
            together with '--extract-css'.
          `);
        }
      }
      if (!webpackConfig.entry.main) { webpackConfig.entry.main = []; }
      webpackConfig.entry.main.unshift(...entryPoints);
    } else if (serveTaskOptions.hmr) {
      ui.writeLine(chalk.yellow('Live reload is disabled. HMR option ignored.'));
    }

    if (!serveTaskOptions.watch) {
      // There's no option to turn off file watching in webpack-dev-server, but
      // we can override the file watcher instead.
      webpackConfig.plugins.unshift({
        apply: (compiler: any) => {
          compiler.plugin('after-environment', () => {
            compiler.watchFileSystem = { watch: () => {} };
          });
        }
      });
    }

    webpackCompiler = webpack(webpackConfig);

    if (rebuildDoneCb) {
      webpackCompiler.plugin('done', rebuildDoneCb);
    }

    const statsConfig = getWebpackStatsConfig(serveTaskOptions.verbose);

    let proxyConfig = {};
    if (serveTaskOptions.proxyConfig) {
      const proxyPath = path.resolve(this.project.root, serveTaskOptions.proxyConfig);
      if (fs.existsSync(proxyPath)) {
        proxyConfig = require(proxyPath);
      } else {
        const message = 'Proxy config file ' + proxyPath + ' does not exist.';
        return Promise.reject(new SilentError(message));
//.........这里部分代码省略.........
开发者ID:itslenny,项目名称:angular-cli,代码行数:101,代码来源:serve.ts


示例8: afterEach

 afterEach(function () {
     rimraf.sync(dir.name);
 });
开发者ID:hmenager,项目名称:composer,代码行数:3,代码来源:data-repository.spec.ts


示例9: afterAll

afterAll(() => {
  rimraf.sync(baseDir);
});
开发者ID:elastic,项目名称:kibana,代码行数:3,代码来源:controller.test.ts


示例10:

 return source.forEach(p => rimraf.sync(p));
开发者ID:13812453806,项目名称:angular2-seed,代码行数:1,代码来源:clear.files.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript ringcentral.platform函数代码示例发布时间:2022-05-25
下一篇:
TypeScript rimraf.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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