本文整理汇总了TypeScript中polymer-workspaces.run函数的典型用法代码示例。如果您正苦于以下问题:TypeScript run函数的具体用法?TypeScript run怎么用?TypeScript run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: testWorkspaceInstallOnly
export async function testWorkspaceInstallOnly(
localConversionMap: Map<string, string>, options: WorkspaceTestSettings) {
const allRepos = options.reposToConvert;
logStep(1, 4, '🔧', `Preparing Repos...`);
const setupRepoResults =
await setupRepos(allRepos, localConversionMap, options);
setupRepoResults.failures.forEach(logRepoError);
logStep(2, 4, '🔧', `Installing Dependencies...`);
const runResults =
await run([...setupRepoResults.successes.keys()], async (repo) => {
try {
return await installNpmDependencies(repo);
} catch (err) {
logRepoError(err, repo);
throw err;
}
}, {concurrency: 1});
logStep(3, 4, '🔧', `Restoring Repos...`);
const restoreResults = await restoreRepos(allRepos);
restoreResults.failures.forEach(logRepoError);
logStep(4, 4, '🔧', `Tests Complete!`);
return [...runResults.successes.keys()];
}
开发者ID:,项目名称:,代码行数:27,代码来源:
示例2: setupRepos
/**
* Setup the workspace repos for testing. Be sure to call restoreRepos() after
* testing is complete.
*/
async function setupRepos(
reposUnderTest: WorkspaceRepo[],
localConversionMap: ConversionResultsMap,
options: WorkspaceTestSettings) {
return run(reposUnderTest, async (repo) => {
await exec(repo.dir, 'git', ['checkout', '-B', localDependenciesBranch]);
await writeTestingPackageJson(repo, localConversionMap, options);
await exec(
repo.dir, 'git', ['commit', '-am', 'testing commit', '--allow-empty']);
}, {concurrency: 10});
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例3: testWorkspace
export async function testWorkspace(
localConversionMap: Map<string, string>, options: WorkspaceTestSettings) {
const {wctFlagsRaw} = await inquirer.prompt([
{
type: 'input',
name: 'wctFlagsRaw',
message: 'wct flags:',
default: (options.importStyle === 'path') ?
'--npm' :
'--npm --module-resolution=node',
},
]);
const allRepos = options.reposToConvert;
const wctFlags: string[] = wctFlagsRaw.split(/\s+/);
logStep(1, 4, '🔧', `Preparing Repos...`);
const setupRepoResults =
await setupRepos(allRepos, localConversionMap, options);
setupRepoResults.failures.forEach(logRepoError);
logStep(2, 4, '🔧', `Running Tests...`);
const runResults =
await run([...setupRepoResults.successes.keys()], async (repo) => {
try {
await installNpmDependencies(repo);
return await testRepo(repo, wctFlags);
} catch (err) {
logRepoError(err, repo);
throw err;
}
}, {concurrency: 1});
logStep(3, 4, '🔧', `Restoring Repos...`);
const restoreResults = await restoreRepos(allRepos);
restoreResults.failures.forEach(logRepoError);
logStep(4, 4, '🔧', `Tests Complete!`);
return [...runResults.successes.keys()];
}
开发者ID:,项目名称:,代码行数:40,代码来源:
示例4: convert
/**
* Convert a set of workspace repos to npm packages and JavaScript modules.
* Returns a map of all packages converted, keyed by npm package name.
*/
export default async function convert(options: WorkspaceConversionSettings):
Promise<ConversionResultsMap> {
const analyzer = configureAnalyzer(options);
const analysis = await analyzer.analyzePackage();
const conversionSettings = createDefaultConversionSettings(analysis, options);
const urlHandler = new WorkspaceUrlHandler(analyzer, options.workspaceDir);
const converter =
new ProjectConverter(analysis, urlHandler, conversionSettings);
const scannedPackageResults: ConversionResultsMap = new Map();
// For each repo, convert the full package:
for (const repo of options.reposToConvert) {
const repoDirName = path.basename(repo.dir);
const bowerConfigPath = path.join(repo.dir, 'bower.json');
const npmPackageName = lookupNpmPackageName(bowerConfigPath);
if (!npmPackageName) {
continue;
}
scannedPackageResults.set(npmPackageName, repo.dir);
await converter.convertPackage(repoDirName);
}
// Process & write each conversion result:
const results = converter.getResults();
await writeFileResults(options.workspaceDir, results);
// update .travis.yml files for repos
for (const repo of options.reposToConvert) {
await transformTravisConfig(repo.dir, repo.dir);
}
// add `node_modules` to gitignore
for (const repo of options.reposToConvert) {
const gitIgnoreFile = path.join(repo.dir, '.gitignore');
await ignoreNodeModules(gitIgnoreFile);
}
// Generate a new package.json for each repo:
const packageJsonResults = await run(
options.reposToConvert, async (repo) => await writePackageJson(repo, {
version: options.packageVersion,
flat: options.flat,
private: options.private,
}));
packageJsonResults.failures.forEach(logRepoError);
const manifestResults = await run(options.reposToConvert, async (repo) => {
return writeConversionManifest(repo, converter);
});
manifestResults.failures.forEach(logRepoError);
// Delete files that were explicitly requested to be deleted. Note we apply
// the glob with each repo as the root directory (e.g. a glob of "types"
// will delete "types" from each individual repo).
if (options.deleteFiles !== undefined) {
for (const repo of options.reposToConvert) {
await deleteGlobsSafe(options.deleteFiles, repo.dir);
}
}
// Commit all changes to a staging branch for easy state resetting.
// Useful when performing actions that modify the repo, like installing deps.
const commitResults = await run(options.reposToConvert, async (repo) => {
await repo.git.createBranch(GIT_STAGING_BRANCH_NAME);
await exec(repo.dir, 'git', ['add', '-A']);
// TODO(fks): Add node_modules to .gitignore, if not found
// https://github.com/Polymer/polymer-modulizer/issues/250
await exec(repo.dir, 'git', ['reset', '--', 'node_modules/']);
await repo.git.commit('auto-converted by polymer-modulizer');
});
commitResults.failures.forEach(logRepoError);
// Return a map of all packages converted, keyed by npm package name.
return scannedPackageResults;
}
开发者ID:,项目名称:,代码行数:79,代码来源:
示例5: restoreRepos
/**
* Restore the repos to their proper state.
*/
async function restoreRepos(reposUnderTest: WorkspaceRepo[]) {
return run(reposUnderTest, async (repo) => {
await repo.git.destroyAllUncommittedChangesAndFiles();
await repo.git.checkout(GIT_STAGING_BRANCH_NAME);
}, {concurrency: 10});
}
开发者ID:,项目名称:,代码行数:9,代码来源:
注:本文中的polymer-workspaces.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论