cleanup(misc): use shorthand

This commit is contained in:
Vivek More 2021-03-06 19:57:11 -05:00 committed by Victor Savkin
parent 7f21d5e85e
commit 49ba90b81a
19 changed files with 37 additions and 40 deletions

View File

@ -97,7 +97,7 @@ describe('Nx Plugin', () => {
expect(migrationsJson).toMatchObject({
generators: expect.objectContaining({
[`update-${version}`]: {
version: version,
version,
description: `update-${version}`,
cli: `nx`,
implementation: `./src/migrations/update-${version}/update-${version}`,

View File

@ -79,17 +79,14 @@ function createWorkspace(
}
function createNxPlugin(workspaceName, pluginName, packageManager) {
console.log(
`nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`
);
const command = `nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`;
console.log(command);
const pmc = getPackageManagerCommand(packageManager);
execSync(
`${pmc.exec} nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`,
{
cwd: workspaceName,
stdio: [0, 1, 2],
}
);
execSync(`${pmc.exec} ${command}`, {
cwd: workspaceName,
stdio: [0, 1, 2],
});
}
function updateWorkspace(workspaceName: string) {

View File

@ -513,7 +513,7 @@ function pointToTutorialAndCourse(preset: Preset) {
// case Preset.Gatsby:
output.addVerticalSeparator();
output.note({
title: title,
title,
bodyLines: [
`https://nx.dev/react/tutorial/01-create-application`,
...pointToFreeCourseOnEgghead(),
@ -524,7 +524,7 @@ function pointToTutorialAndCourse(preset: Preset) {
case Preset.AngularWithNest:
output.addVerticalSeparator();
output.note({
title: title,
title,
bodyLines: [
`https://nx.dev/angular/tutorial/01-create-application`,
...pointToFreeCourseOnYoutube(),

View File

@ -144,7 +144,7 @@ async function runCypress(baseUrl: string, opts: CypressExecutorOptions) {
// If not, will use the `baseUrl` normally from `cypress.json`
if (baseUrl) {
options.config = { baseUrl: baseUrl };
options.config = { baseUrl };
}
if (opts.browser) {

View File

@ -113,7 +113,7 @@ export function addOrUpdateProperty(
{
type: ChangeType.Insert,
index: arrayLiteral.elements.end,
text: text,
text,
},
]);
tree.write(path, updatedContents);
@ -145,7 +145,7 @@ export function addOrUpdateProperty(
{
type: ChangeType.Insert,
index: object.properties.end,
text: text,
text,
},
]);
tree.write(path, updatedContents);

View File

@ -120,7 +120,7 @@ function addProject(options: NormalizedSchema): Rule {
}
return updateWorkspaceInTree((json, context, host) => {
const architect = json.projects[options.name].architect;
const { architect } = json.projects[options.name];
if (architect) {
architect.build = {
builder: '@nrwl/node:package',

View File

@ -17,13 +17,13 @@ import { Schema } from './schema';
export default function (schema: Schema): Rule {
return (host: Tree) => {
const options = normalizeOptions(host, schema);
const { unitTestRunner } = options;
return chain([
externalSchematic('@nrwl/node', 'lib', {
...schema,
publishable: true,
importPath: schema.importPath,
unitTestRunner: options.unitTestRunner,
unitTestRunner,
}),
addDepsToPackageJson(
{},

View File

@ -53,8 +53,8 @@ describe('Build storybook', () => {
const result = await storybookBuilder(
{
uiFramework: uiFramework,
outputPath: outputPath,
uiFramework,
outputPath,
config,
},
context

View File

@ -642,10 +642,10 @@ function convertEventTypeToHandleMultipleConfigNames(
content: Buffer.from(JSON.stringify(formatted, null, 2)),
};
} else {
return { eventPath: actualConfigName, content: content };
return { eventPath: actualConfigName, content };
}
} else {
return { eventPath: actualConfigName, content: content };
return { eventPath: actualConfigName, content };
}
} else {
return { eventPath, content };

View File

@ -206,14 +206,14 @@ async function runExecutorInternal<T extends { success: boolean }>(
if (ws.isNxExecutor(nodeModule, executor)) {
const implementation = implementationFactory();
const r = implementation(combinedOptions, {
root: root,
root,
target: targetConfig,
workspace: workspace,
workspace,
projectName: project,
targetName: target,
configurationName: configuration,
cwd: cwd,
isVerbose: isVerbose,
cwd,
isVerbose,
}) as Promise<T> | AsyncIterableIterator<T>;
if (isPromise<T>(r)) {
return promiseToIterator<T>(r);

View File

@ -57,7 +57,7 @@ function getDevServerPartial(
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
},
noInfo: true,
onListening: function (server: any) {
onListening(server: any) {
// Depend on the info in the server for this function because the user might adjust the webpack config
const serverUrl = url.format({
protocol: server.options.https ? 'https' : 'http',

View File

@ -81,7 +81,7 @@ function getBrowserPartial(
output: basename(index),
baseHref,
entrypoints: generateEntryPoints({ scripts, styles }),
deployUrl: deployUrl,
deployUrl,
sri: subresourceIntegrity,
noModuleEntrypoints: ['polyfills-es5'],
})

View File

@ -52,7 +52,7 @@ async function createTasks(
project: affectedProject,
target: nxArgs.target,
configuration: nxArgs.configuration,
overrides: overrides,
overrides,
errorIfCannotFindConfiguration: false,
})
);
@ -62,7 +62,7 @@ async function createTasks(
const isYarn = pm === 'yarn';
return tasks.map((task, index) => ({
id: task.id,
overrides: overrides,
overrides,
target: task.target,
command: `${isYarn ? 'yarn' : `${pm} run`} ${getCommandAsString(
'nx',

View File

@ -124,7 +124,7 @@ function constructCollection() {
return {
name: 'workspace-generators',
version: '1.0',
generators: generators,
generators,
schematics: generators,
};
}
@ -353,8 +353,8 @@ async function executeAngularDevkitSchematic(
.execute({
collection: path.join(outDir, 'workspace-generators.json'),
schematic: schematicName,
options: options,
logger: logger,
options,
logger,
})
.toPromise();

View File

@ -115,7 +115,7 @@ function defaultReadFileAtRevision(
function getFileData(filePath: string): FileData {
const file = path.relative(appRootPath, filePath).split(path.sep).join('/');
return {
file: file,
file,
hash: defaultFileHasher.hashFile(filePath),
ext: path.extname(filePath),
};

View File

@ -131,7 +131,7 @@ export function differentFromCache(
};
return {
filesDifferentFromCache: filesDifferentFromCache,
filesDifferentFromCache,
partiallyConstructedProjectGraph,
noDifference: Object.keys(filesDifferentFromCache).length === 0,
};

View File

@ -70,7 +70,7 @@ export function createProjectGraph(
const ctx = {
workspaceJson,
nxJson: normalizedNxJson,
fileMap: fileMap,
fileMap,
};
const projectGraph = buildProjectGraph(ctx, fileRead, null);
if (shouldCache) {

View File

@ -42,7 +42,7 @@ export async function runCommand<T extends RunArgs>(
project,
target: nxArgs.target,
configuration: nxArgs.configuration,
overrides: overrides,
overrides,
errorIfCannotFindConfiguration: project.name === initiatingProject,
});
});
@ -55,7 +55,7 @@ export async function runCommand<T extends RunArgs>(
}
const cached = [];
tasksRunner(tasks, runnerOptions, {
initiatingProject: initiatingProject,
initiatingProject,
target: nxArgs.target,
projectGraph,
nxJson,

View File

@ -16,7 +16,7 @@ export function createProjectGraphFromTree(tree: Tree) {
visitNotIgnoredFiles(tree, '', (file) => {
files.push({
file: file,
file,
ext: extname(file),
hash: '',
});