本文整理汇总了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 () {
示例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) {
//.........这里部分代码省略.........
示例3: cleanup
async function cleanup(modulePath) {
debug('Cleaning up temporary files...')
rimraf.sync(path.join(modulePath, 'node_production_modules'))
}
示例4:
outdatedDirs.forEach(outdatedDir => rimraf.sync(path.join(directory, outdatedDir)));
示例5: afterAll
afterAll(() => {
rimraf.sync(out_dir);
});
示例6: after
after(() => {
rimraf.sync(outputDirName);
});
示例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));
//.........这里部分代码省略.........
示例8: afterEach
afterEach(function () {
rimraf.sync(dir.name);
});
示例9: afterAll
afterAll(() => {
rimraf.sync(baseDir);
});
示例10:
return source.forEach(p => rimraf.sync(p));