cleanup(misc): use shorthand
This commit is contained in:
parent
7f21d5e85e
commit
49ba90b81a
@ -97,7 +97,7 @@ describe('Nx Plugin', () => {
|
|||||||
expect(migrationsJson).toMatchObject({
|
expect(migrationsJson).toMatchObject({
|
||||||
generators: expect.objectContaining({
|
generators: expect.objectContaining({
|
||||||
[`update-${version}`]: {
|
[`update-${version}`]: {
|
||||||
version: version,
|
version,
|
||||||
description: `update-${version}`,
|
description: `update-${version}`,
|
||||||
cli: `nx`,
|
cli: `nx`,
|
||||||
implementation: `./src/migrations/update-${version}/update-${version}`,
|
implementation: `./src/migrations/update-${version}/update-${version}`,
|
||||||
|
|||||||
@ -79,17 +79,14 @@ function createWorkspace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createNxPlugin(workspaceName, pluginName, packageManager) {
|
function createNxPlugin(workspaceName, pluginName, packageManager) {
|
||||||
console.log(
|
const command = `nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`;
|
||||||
`nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`
|
console.log(command);
|
||||||
);
|
|
||||||
const pmc = getPackageManagerCommand(packageManager);
|
const pmc = getPackageManagerCommand(packageManager);
|
||||||
execSync(
|
execSync(`${pmc.exec} ${command}`, {
|
||||||
`${pmc.exec} nx generate @nrwl/nx-plugin:plugin ${pluginName} --importPath=${workspaceName}/${pluginName}`,
|
|
||||||
{
|
|
||||||
cwd: workspaceName,
|
cwd: workspaceName,
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateWorkspace(workspaceName: string) {
|
function updateWorkspace(workspaceName: string) {
|
||||||
|
|||||||
@ -513,7 +513,7 @@ function pointToTutorialAndCourse(preset: Preset) {
|
|||||||
// case Preset.Gatsby:
|
// case Preset.Gatsby:
|
||||||
output.addVerticalSeparator();
|
output.addVerticalSeparator();
|
||||||
output.note({
|
output.note({
|
||||||
title: title,
|
title,
|
||||||
bodyLines: [
|
bodyLines: [
|
||||||
`https://nx.dev/react/tutorial/01-create-application`,
|
`https://nx.dev/react/tutorial/01-create-application`,
|
||||||
...pointToFreeCourseOnEgghead(),
|
...pointToFreeCourseOnEgghead(),
|
||||||
@ -524,7 +524,7 @@ function pointToTutorialAndCourse(preset: Preset) {
|
|||||||
case Preset.AngularWithNest:
|
case Preset.AngularWithNest:
|
||||||
output.addVerticalSeparator();
|
output.addVerticalSeparator();
|
||||||
output.note({
|
output.note({
|
||||||
title: title,
|
title,
|
||||||
bodyLines: [
|
bodyLines: [
|
||||||
`https://nx.dev/angular/tutorial/01-create-application`,
|
`https://nx.dev/angular/tutorial/01-create-application`,
|
||||||
...pointToFreeCourseOnYoutube(),
|
...pointToFreeCourseOnYoutube(),
|
||||||
|
|||||||
@ -144,7 +144,7 @@ async function runCypress(baseUrl: string, opts: CypressExecutorOptions) {
|
|||||||
|
|
||||||
// If not, will use the `baseUrl` normally from `cypress.json`
|
// If not, will use the `baseUrl` normally from `cypress.json`
|
||||||
if (baseUrl) {
|
if (baseUrl) {
|
||||||
options.config = { baseUrl: baseUrl };
|
options.config = { baseUrl };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.browser) {
|
if (opts.browser) {
|
||||||
|
|||||||
@ -113,7 +113,7 @@ export function addOrUpdateProperty(
|
|||||||
{
|
{
|
||||||
type: ChangeType.Insert,
|
type: ChangeType.Insert,
|
||||||
index: arrayLiteral.elements.end,
|
index: arrayLiteral.elements.end,
|
||||||
text: text,
|
text,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
tree.write(path, updatedContents);
|
tree.write(path, updatedContents);
|
||||||
@ -145,7 +145,7 @@ export function addOrUpdateProperty(
|
|||||||
{
|
{
|
||||||
type: ChangeType.Insert,
|
type: ChangeType.Insert,
|
||||||
index: object.properties.end,
|
index: object.properties.end,
|
||||||
text: text,
|
text,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
tree.write(path, updatedContents);
|
tree.write(path, updatedContents);
|
||||||
|
|||||||
@ -120,7 +120,7 @@ function addProject(options: NormalizedSchema): Rule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return updateWorkspaceInTree((json, context, host) => {
|
return updateWorkspaceInTree((json, context, host) => {
|
||||||
const architect = json.projects[options.name].architect;
|
const { architect } = json.projects[options.name];
|
||||||
if (architect) {
|
if (architect) {
|
||||||
architect.build = {
|
architect.build = {
|
||||||
builder: '@nrwl/node:package',
|
builder: '@nrwl/node:package',
|
||||||
|
|||||||
@ -17,13 +17,13 @@ import { Schema } from './schema';
|
|||||||
export default function (schema: Schema): Rule {
|
export default function (schema: Schema): Rule {
|
||||||
return (host: Tree) => {
|
return (host: Tree) => {
|
||||||
const options = normalizeOptions(host, schema);
|
const options = normalizeOptions(host, schema);
|
||||||
|
const { unitTestRunner } = options;
|
||||||
return chain([
|
return chain([
|
||||||
externalSchematic('@nrwl/node', 'lib', {
|
externalSchematic('@nrwl/node', 'lib', {
|
||||||
...schema,
|
...schema,
|
||||||
publishable: true,
|
publishable: true,
|
||||||
importPath: schema.importPath,
|
importPath: schema.importPath,
|
||||||
unitTestRunner: options.unitTestRunner,
|
unitTestRunner,
|
||||||
}),
|
}),
|
||||||
addDepsToPackageJson(
|
addDepsToPackageJson(
|
||||||
{},
|
{},
|
||||||
|
|||||||
@ -53,8 +53,8 @@ describe('Build storybook', () => {
|
|||||||
|
|
||||||
const result = await storybookBuilder(
|
const result = await storybookBuilder(
|
||||||
{
|
{
|
||||||
uiFramework: uiFramework,
|
uiFramework,
|
||||||
outputPath: outputPath,
|
outputPath,
|
||||||
config,
|
config,
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
|
|||||||
@ -642,10 +642,10 @@ function convertEventTypeToHandleMultipleConfigNames(
|
|||||||
content: Buffer.from(JSON.stringify(formatted, null, 2)),
|
content: Buffer.from(JSON.stringify(formatted, null, 2)),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return { eventPath: actualConfigName, content: content };
|
return { eventPath: actualConfigName, content };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return { eventPath: actualConfigName, content: content };
|
return { eventPath: actualConfigName, content };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return { eventPath, content };
|
return { eventPath, content };
|
||||||
|
|||||||
@ -206,14 +206,14 @@ async function runExecutorInternal<T extends { success: boolean }>(
|
|||||||
if (ws.isNxExecutor(nodeModule, executor)) {
|
if (ws.isNxExecutor(nodeModule, executor)) {
|
||||||
const implementation = implementationFactory();
|
const implementation = implementationFactory();
|
||||||
const r = implementation(combinedOptions, {
|
const r = implementation(combinedOptions, {
|
||||||
root: root,
|
root,
|
||||||
target: targetConfig,
|
target: targetConfig,
|
||||||
workspace: workspace,
|
workspace,
|
||||||
projectName: project,
|
projectName: project,
|
||||||
targetName: target,
|
targetName: target,
|
||||||
configurationName: configuration,
|
configurationName: configuration,
|
||||||
cwd: cwd,
|
cwd,
|
||||||
isVerbose: isVerbose,
|
isVerbose,
|
||||||
}) as Promise<T> | AsyncIterableIterator<T>;
|
}) as Promise<T> | AsyncIterableIterator<T>;
|
||||||
if (isPromise<T>(r)) {
|
if (isPromise<T>(r)) {
|
||||||
return promiseToIterator<T>(r);
|
return promiseToIterator<T>(r);
|
||||||
|
|||||||
@ -57,7 +57,7 @@ function getDevServerPartial(
|
|||||||
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
||||||
},
|
},
|
||||||
noInfo: true,
|
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
|
// Depend on the info in the server for this function because the user might adjust the webpack config
|
||||||
const serverUrl = url.format({
|
const serverUrl = url.format({
|
||||||
protocol: server.options.https ? 'https' : 'http',
|
protocol: server.options.https ? 'https' : 'http',
|
||||||
|
|||||||
@ -81,7 +81,7 @@ function getBrowserPartial(
|
|||||||
output: basename(index),
|
output: basename(index),
|
||||||
baseHref,
|
baseHref,
|
||||||
entrypoints: generateEntryPoints({ scripts, styles }),
|
entrypoints: generateEntryPoints({ scripts, styles }),
|
||||||
deployUrl: deployUrl,
|
deployUrl,
|
||||||
sri: subresourceIntegrity,
|
sri: subresourceIntegrity,
|
||||||
noModuleEntrypoints: ['polyfills-es5'],
|
noModuleEntrypoints: ['polyfills-es5'],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -52,7 +52,7 @@ async function createTasks(
|
|||||||
project: affectedProject,
|
project: affectedProject,
|
||||||
target: nxArgs.target,
|
target: nxArgs.target,
|
||||||
configuration: nxArgs.configuration,
|
configuration: nxArgs.configuration,
|
||||||
overrides: overrides,
|
overrides,
|
||||||
errorIfCannotFindConfiguration: false,
|
errorIfCannotFindConfiguration: false,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -62,7 +62,7 @@ async function createTasks(
|
|||||||
const isYarn = pm === 'yarn';
|
const isYarn = pm === 'yarn';
|
||||||
return tasks.map((task, index) => ({
|
return tasks.map((task, index) => ({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
overrides: overrides,
|
overrides,
|
||||||
target: task.target,
|
target: task.target,
|
||||||
command: `${isYarn ? 'yarn' : `${pm} run`} ${getCommandAsString(
|
command: `${isYarn ? 'yarn' : `${pm} run`} ${getCommandAsString(
|
||||||
'nx',
|
'nx',
|
||||||
|
|||||||
@ -124,7 +124,7 @@ function constructCollection() {
|
|||||||
return {
|
return {
|
||||||
name: 'workspace-generators',
|
name: 'workspace-generators',
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
generators: generators,
|
generators,
|
||||||
schematics: generators,
|
schematics: generators,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -353,8 +353,8 @@ async function executeAngularDevkitSchematic(
|
|||||||
.execute({
|
.execute({
|
||||||
collection: path.join(outDir, 'workspace-generators.json'),
|
collection: path.join(outDir, 'workspace-generators.json'),
|
||||||
schematic: schematicName,
|
schematic: schematicName,
|
||||||
options: options,
|
options,
|
||||||
logger: logger,
|
logger,
|
||||||
})
|
})
|
||||||
.toPromise();
|
.toPromise();
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ function defaultReadFileAtRevision(
|
|||||||
function getFileData(filePath: string): FileData {
|
function getFileData(filePath: string): FileData {
|
||||||
const file = path.relative(appRootPath, filePath).split(path.sep).join('/');
|
const file = path.relative(appRootPath, filePath).split(path.sep).join('/');
|
||||||
return {
|
return {
|
||||||
file: file,
|
file,
|
||||||
hash: defaultFileHasher.hashFile(filePath),
|
hash: defaultFileHasher.hashFile(filePath),
|
||||||
ext: path.extname(filePath),
|
ext: path.extname(filePath),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -131,7 +131,7 @@ export function differentFromCache(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filesDifferentFromCache: filesDifferentFromCache,
|
filesDifferentFromCache,
|
||||||
partiallyConstructedProjectGraph,
|
partiallyConstructedProjectGraph,
|
||||||
noDifference: Object.keys(filesDifferentFromCache).length === 0,
|
noDifference: Object.keys(filesDifferentFromCache).length === 0,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -70,7 +70,7 @@ export function createProjectGraph(
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
workspaceJson,
|
workspaceJson,
|
||||||
nxJson: normalizedNxJson,
|
nxJson: normalizedNxJson,
|
||||||
fileMap: fileMap,
|
fileMap,
|
||||||
};
|
};
|
||||||
const projectGraph = buildProjectGraph(ctx, fileRead, null);
|
const projectGraph = buildProjectGraph(ctx, fileRead, null);
|
||||||
if (shouldCache) {
|
if (shouldCache) {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export async function runCommand<T extends RunArgs>(
|
|||||||
project,
|
project,
|
||||||
target: nxArgs.target,
|
target: nxArgs.target,
|
||||||
configuration: nxArgs.configuration,
|
configuration: nxArgs.configuration,
|
||||||
overrides: overrides,
|
overrides,
|
||||||
errorIfCannotFindConfiguration: project.name === initiatingProject,
|
errorIfCannotFindConfiguration: project.name === initiatingProject,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ export async function runCommand<T extends RunArgs>(
|
|||||||
}
|
}
|
||||||
const cached = [];
|
const cached = [];
|
||||||
tasksRunner(tasks, runnerOptions, {
|
tasksRunner(tasks, runnerOptions, {
|
||||||
initiatingProject: initiatingProject,
|
initiatingProject,
|
||||||
target: nxArgs.target,
|
target: nxArgs.target,
|
||||||
projectGraph,
|
projectGraph,
|
||||||
nxJson,
|
nxJson,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export function createProjectGraphFromTree(tree: Tree) {
|
|||||||
|
|
||||||
visitNotIgnoredFiles(tree, '', (file) => {
|
visitNotIgnoredFiles(tree, '', (file) => {
|
||||||
files.push({
|
files.push({
|
||||||
file: file,
|
file,
|
||||||
ext: extname(file),
|
ext: extname(file),
|
||||||
hash: '',
|
hash: '',
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user