简体   繁体   中英

CLI arguments of create-nx-workspace

Is there some documentation regarding the arguments that create-nx-workspace takes? I'd like to build a copy and paste -able oneliner to set up a new workspace without any interactive questions asked. So far I have

npx create-nx-workspace@latest myworkspace --name myworkspace --preset web-components --appName myapp --cli angular

Next it's asking me which default stylesheet format I want to use. And I can't figure out how to specify that as a command line parameter.

Currently there is not option to define style within create-nx-workspace command. As you can see there is only prompt to inquire style after determination of appName promise:

determineWorkspaceName(parsedArgs).then(name => {
    determinePreset(parsedArgs).then(preset => {
        return determineAppName(preset, parsedArgs).then(appName => {
            return determineStyle(preset).then(style => {
                return determineCli(preset, parsedArgs).then(cli => {
                    const tmpDir = createSandbox(packageManager, cli);
                    createApp(tmpDir, cli, parsedArgs, name, preset, appName, style);
                    showCliWarning(preset, parsedArgs);
                    showNxWarning(name);
                    pointToTutorial(preset);
                });
            });
        });
    });
});

Code of the determineStyle is here .

I have already prepared PR to add this feature into create-nx-workspace command here .

You may select the tools used for styling the application

npx create-nx-workspace@latest myworkspace ... --style=css

You may use on of the following options

  • css , scss , less for Angular projects
  • styl for all non-Angular, and
  • styled-components , @emotion/styled , styled-jsx for React, Next.js and Gatsby.

Command line options for NX

You can check the command line options that you can use to create the NX workspace by running

npx create-nx-workspace@latest --help

The following are the command line options for the v13.4.5 version:

Option Description
preset Tools to be used in the workspace (options: "apps", "empty", "core", "npm", "ts", "web-components", "angular", "angular-nest", "react", "react-express", "react-native", "next", "gatsby", "nest", "express")
appName Name of the application
cli CLI to be used (options: "nx", "angular")
style style option (options: "css", "scss", "less" for Angular, "styl" for all non-Angular and "styled-components", "@emotion/styled", "styled-jsx" for React, Next.js and Gatsby)
interactive enable interactive mode when using presets (boolean)
packageManager package manager to use (npm, yarn, pnpm)
nx-cloud yse Nx Cloud (boolean)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM