feat(misc): replace tutorials with social links in create-nx-workspace (#29085)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Currently, `create-nx-workspace` links to tutorials which in most cases,
users are in the middle of doing or have already done in the past.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Rather than tutorials, `create-nx-workspace` will welcome users to the
Nx community and give them ways to show their appreciation, stay up to
date, and chat about Nx.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jason Jean 2024-11-26 17:49:32 -05:00 committed by GitHub
parent 4030494cd5
commit 0d0d6c7c11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 120 deletions

View File

@ -7,7 +7,6 @@ import { createWorkspace } from '../src/create-workspace';
import { isKnownPreset, Preset } from '../src/utils/preset/preset';
import { CLIErrorMessageConfig, output } from '../src/utils/output';
import { nxVersion } from '../src/utils/nx/nx-version';
import { pointToTutorialAndCourse } from '../src/utils/preset/point-to-tutorial-and-course';
import { yargsDecorator } from './decorator';
import { getPackageNameFromThirdPartyPreset } from '../src/utils/preset/get-third-party-preset';
@ -29,6 +28,7 @@ import { messages, recordStat } from '../src/utils/nx/ab-testing';
import { mapErrorToBodyLines } from '../src/utils/error-utils';
import { existsSync } from 'fs';
import { isCI } from '../src/utils/ci/is-ci';
import { printSocialInformation } from '../src/utils/social-information';
interface BaseArguments extends CreateWorkspaceOptions {
preset: Preset;
@ -234,11 +234,11 @@ async function main(parsedArgs: yargs.Arguments<Arguments>) {
});
if (parsedArgs.nxCloud && workspaceInfo.nxCloudInfo) {
console.log(workspaceInfo.nxCloudInfo);
process.stdout.write(workspaceInfo.nxCloudInfo);
}
if (isKnownPreset(parsedArgs.preset)) {
pointToTutorialAndCourse(parsedArgs.preset as Preset);
printSocialInformation();
} else {
output.log({
title: `Successfully applied preset: ${parsedArgs.preset}`,

View File

@ -167,8 +167,6 @@ export class CLIOutput {
});
this.writeOptionalOutputBody(bodyLines);
this.addNewline();
}
logSingleLine(message: string) {

View File

@ -1,72 +0,0 @@
import { output } from '../output';
import { Preset } from './preset';
export function pointToTutorialAndCourse(preset: Preset) {
const title = `First time using Nx? Check out this interactive Nx tutorial.`;
switch (preset) {
case Preset.NPM:
case Preset.Apps:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [
`https://nx.dev/getting-started/tutorials/npm-workspaces-tutorial`,
],
});
break;
case Preset.TS:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [
`https://nx.dev/getting-started/tutorials/integrated-repo-tutorial`,
],
});
break;
case Preset.ReactStandalone:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [
`https://nx.dev/getting-started/tutorials/react-standalone-tutorial`,
],
});
break;
case Preset.ReactMonorepo:
case Preset.NextJs:
case Preset.NextJsStandalone:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [`https://nx.dev/react-tutorial/1-code-generation`],
});
break;
case Preset.AngularStandalone:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [
`https://nx.dev/getting-started/tutorials/angular-standalone-tutorial`,
],
});
break;
case Preset.AngularMonorepo:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [`https://nx.dev/angular-tutorial/1-code-generation`],
});
break;
case Preset.Express:
case Preset.NodeStandalone:
output.addVerticalSeparator();
output.note({
title,
bodyLines: [
`https://nx.dev/getting-started/tutorials/node-server-tutorial`,
],
});
break;
}
}

View File

@ -1,43 +0,0 @@
import { Preset } from './preset';
export const presetOptions: { name: Preset; message: string }[] = [
{
name: Preset.Apps,
message:
'apps [an empty monorepo with no plugins with a layout that works best for building apps]',
},
{
name: Preset.TS,
message:
'ts [an empty monorepo with the JS/TS plugin preinstalled]',
},
{
name: Preset.ReactMonorepo,
message: 'react [a monorepo with a single React application]',
},
{
name: Preset.AngularMonorepo,
message: 'angular [a monorepo with a single Angular application]',
},
{
name: Preset.VueMonorepo,
message: 'vue [a monorepo with a single Vue application]',
},
{
name: Preset.Nuxt,
message: 'nuxt [a monorepo with a single Nuxt application]',
},
{
name: Preset.NextJs,
message: 'next.js [a monorepo with a single Next.js application]',
},
{
name: Preset.Nest,
message: 'nest [a monorepo with a single Nest application]',
},
{
name: Preset.ReactNative,
message:
'react-native [a monorepo with a single React Native application]',
},
];

View File

@ -0,0 +1,12 @@
import { output } from './output';
export function printSocialInformation() {
output.success({
title: 'Welcome to the Nx community! 👋',
bodyLines: [
'🌟 Star Nx on GitHub: https://github.com/nrwl/nx',
'📢 Stay up to date on X: https://x.com/nxdevtools',
'💬 Discuss Nx on Discord: https://go.nx.dev/community',
],
});
}