Skip to main content

@ensono-stacks/create-stacks-workspace

Create a new Ensono Stacks Nx workspace. Using the create-stacks-workspace script will quickly allow you to initialize a new NX workspace with the Ensono Stacks recommended plugins, packages and configuration to get started on a new project quickly.

The Ensono Stacks create-stacks-workspace script will

  • Run Nx create-nx-workspace command to setup a new NX workspace passing along any command line arguments provided
  • Install any recommended plugin/generators/executors from Ensono Stacks. If the next preset is selected the Ensono Next plugin will be installed. With all presets the Ensono Workspace Plugin will be installed. (see presets)
  • Configure the NX workspace. This will involve updating the NX.json file with any information provided from the command line arguments
  • Execute recommended generators from Ensono Stacks to initialize the workspace/projects depending on the options provided.
  • Create an e2e test project if this option was selected

Setting up @ensono-stacks/create-stacks-workspace

Execution

Run the @ensono-stacks/create-stacks-workspace with the following command including any options see command line arguments:

npx @ensono-stacks/create-stacks-workspace@latest

Presets

On running the script you will be asked for a monorepo preset with the following options

apps              [an empty monorepo with no plugins with a layout that works best for building apps]
next.js [a monorepo with a single Next.js application]

Each preset will install, configure and run any recommended plugins for that specific preset. For example the next.js preset will run the NX NextJS plugin application generator as well as the Ensonso Stacks NextJS init plugin generator.

We do not support react and currently only support nextjs, therefore if you want to create a nextjs workspace with a client side rendered application, you must use Nx and not Ensono Stacks.

You will then be asked which test runner to include for e2e testing:

  1. none: Creates your application without an e2e test project
  2. playwright: Installs the @ensono-stacks/playwright plugin and creates an e2e test project for your application using playwright.

Command line arguments

The following command line arguments are available:

OptionDescriptionTypeExample Accepted ValuesDefault
--nameWorkspace name (e.g. org name)stringnameOfWorkspace
--presetCustomizes the initial content of your workspacestringapps/ts/next/react-monorepo
--dirThe directory to install tostring/path/to/dir./
--appNameThe name of the application when a preset with pre-generated app is selectedstringnameOfApplication
--e2eTestRunnerTest runner to use in generating an e2e test projectstring["none", "playwright"]none
--nxVersionSet the version of Nx you want installedstringlatest
--packageManagerPackage manager to usestringpnpm/npm/yarnnpm
--interactiveEnable interactive modebooleantrue/falsetrue
--overwriteOverwrite the target directory on installbooleantrue/falsefalse
--cloud.platformName of the cloud providerstringazureazure
--cloud.regionRegion name where resources should be createdstringstringeuw
--pipelineName of the pipeline providerstringazdoazdo
--business.companyCompany Namestringstring
--business.domainCompany Scope or areastringstring
--business.componentCompany component being worked onstringstring
--domain.internalInternal domain for nonprod resourcesstringstring
--domain.externalExternal domain for prod resourcesstringstring
--terraform.groupTerraform state group namestringstring
--terraform.containerTerraform storage container namestringstring
--terraform.storageTerraform storage namestringstring
--vcs.typeVersion control providerstringazdo/github
--vcs.urlVersion control remote urlstringstring