Giter Site home page Giter Site logo

cli's Introduction

Nuxt CLI (nuxi)

⚡️ Nuxt Generation CLI Experience.

Commands

All commands are listed on https://nuxt.com/docs/api/commands

Vision and Roadmap

We've rebuilt nuxi from the ground up using unjs/citty. We have grand plans for this - check out some of the features + roadmap discussions and please feel free to contribute!

Contributing

# Install dependencies
pnpm i

# Generate type stubs
pnpm dev:prepare

# Go the the playground directory
cd playground

# And run any commands
pnpm nuxi <command>

License

MIT

cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

support http proxy when using `nuxi init` with node >= 18

Environment


  • Operating System: Darwin
  • Node Version: v16.17.0
  • Nuxt Version: 0.0.0
  • Nitro Version: -
  • Package Manager: unknown
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Not exist

Describe the bug

 ERROR  Failed to download template from registry: request to https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json failed, reason: connect ECON3

  at /Users/xdclass/.npm/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13269:11
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async downloadTemplate (/Users/xdclass/.npm/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13268:20)
  at async Object.invoke (/Users/xdclass/.npm/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13336:15)
  at async _main (/Users/xdclass/.npm/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/cli.mjs:50:20)

Additional context

curl https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json

{
  "name": "v3",
  "defaultDir": "nuxt-app",
  "url": "https://v3.nuxtjs.org",
  "tar": "https://codeload.github.com/nuxt/starter/tar.gz/refs/heads/v3"
}

Everything works fine when I request the URL directly, I think this might be a bug in nuxt.

Logs

No response

Nuxt development server can't be opened in FF when using `--https` flag

Environment

------------------------------
- Operating System: `Darwin`
- Node Version:     `v16.17.0`
- Nuxt Version:     `3.0.0-rc.12-27729267.0640a6c`
- Nitro Version:    `0.5.4-27726613.640c2b7`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `runtimeConfig`, `telemetry`, `srcDir`, `ssr`, `typescript`, `modules`, `meta`, `css`
- Runtime Modules:  `~/modules/app-customisations.ts`, `@nuxtjs/[email protected]`
- Build Modules:    `-`
------------------------------

Reproduction

https://github.com/nandi95/nuxt-starter
npm ci && npm run dev

Describe the bug

When using the --https flag the generated certificate is not acceptable for FF. (works no problem in chrome, including wss)
Using manually generated certificates work just fine.
using the --domain flag makes no difference
FF presents the following error:
Screenshot 2022-09-21 at 20 17 09

Additional context

Linked to nuxt/nuxt#12748

Logs

No response

`nuxi upgrade` for Nuxt monorepo packages

Describe the feature

As @pi0 mentioned in https://github.com/nuxt/framework/issues/7027#issuecomment-1230143224, if user didn't lock @nuxt/kit or @nuxt/bridge (and even @nuxt/template?) versions in package.json, It's would be more expected if nuxi upgrade command upgrades modules from @nuxt/framework monorepo too.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

migrate to citty

Citty is still WIP. I will probably slim it down to make initial migration on CLI definition and progressively adding features back to it, making Nuxt CLI code as simple as possible.

Better handling initial install

When only global nuxi is available, we get this:

image

We can make it better now considering there is a global CLI with instructions or auto install

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • autofix-ci/action ea32e3a12414e6d3183163c3424a7d7a8631ad84
.github/workflows/ci.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
npm
package.json
  • @nuxt/eslint-config ^0.3.6
  • @nuxt/kit ^3.11.2
  • @nuxt/schema ^3.11.2
  • @nuxt/test-utils ^3.12.0
  • @types/http-proxy ^1.17.14
  • @types/node ^20.12.7
  • @types/semver ^7.5.8
  • @types/ws ^8.5.10
  • c12 ^1.10.0
  • changelogen ^0.5.5
  • chokidar ^3.6.0
  • citty ^0.1.6
  • clipboardy ^4.0.0
  • colorette ^2.0.20
  • consola ^3.2.3
  • destr ^2.0.3
  • eslint ^8.57.0
  • execa ^8.0.1
  • fuse.js ^7.0.0
  • giget ^1.2.3
  • h3 ^1.11.1
  • httpxy ^0.1.5
  • jiti ^1.21.0
  • listhen ^1.7.2
  • magicast ^0.3.3
  • mlly ^1.6.1
  • nuxt ^3.11.2
  • nypm ^0.3.8
  • ofetch ^1.3.4
  • pathe ^1.1.2
  • perfect-debounce ^1.0.0
  • pkg-types ^1.0.3
  • prettier ^3.2.5
  • scule ^1.3.0
  • semver ^7.6.0
  • unbuild ^2.0.0
  • unws ^0.2.4
  • vue-tsc ^2.0.12
  • ws ^8.16.0
  • fsevents ~2.3.3
  • node ^16.10.0 || >=18.0.0
  • nuxt ^3.11.2
  • h3 ^1.11.1
  • pnpm 8.15.6
playground/package.json
  • pnpm 8.15.6

  • Check this box to trigger a request for Renovate to run again on this repository

Is it possible to support with integrating to (name, Nuxt options, UI framework, TypeScript, linter, testing framework, etc as we done in nuxt 2

Describe the feature

In nuxt3 ,create a empty project ,
there are not questions like to select (name, Nuxt options, UI framework, TypeScript, linter, testing framework, etc as we done in nuxt 2.
The zero configration that reason of I choose Nuxt , do we still support it as nuxt2 in Nuxt3 create project?

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Support for adding multiple module at once

Use case

It would be nice to be able to add multiple modules in one command, e.g. nuxi-ng module add @vueuse/nuxt @unocss/nuxt

and in some cases, we need to install multiple packages and add one of them into modules, e.g. vuefire

I'd love to help if needed, thanks

Warning when installing "nuxt2-only" modules

Describe the feature

Hey 👋🏻

I was wondering if it'd be possible to introduce some warning when people try to use modules that aren't ready for Nuxt2 yet. This could improve DX and reduce frustration.

See e.g. nuxt/nuxt#14942 and (possibly) nuxt/nuxt#14768

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

CLI Wizard

I really liked the cli wizard in nuxt2.
image
Will it return in nuxt3 at some point?

Runtime module mismatch version of installed npm package

Environment

  • Operating System: Darwin
  • Node Version: v18.16.0
  • Nuxt Version: 3.6.2
  • Nitro Version: 2.5.2
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: devtools, modules
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://github.com/LeonardoRick/temp-nuxt-bug

Steps to reproduce:

  1. Clone the project and set node version to 18
  2. Comment "@nuxtjs/i18n" inside nuxt.config.ts modules definition (otherwise I couldn't even run npm install without an error)
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: [
    // "@nuxtjs/i18n"
  ]
})
  1. Run npm i
  2. Uncomment "@nuxtjs/i18n" insode nuxt.config.ts
  3. Run npx nuxi info
  4. Run npm ls

Describe the bug

npm ls                
nuxt-app@ /Users/leonardorick/Documents/cre8tive/git/leonardorick/temp-nuxt-bug
├── @nuxt/[email protected]
├── @nuxtjs/[email protected]
├── @types/[email protected]
└── [email protected]

My npm ls shows the right version of @nuxtjs/i18n (8.0.0-beta.13) but nuxt seems to not recognize it properly since it's showing the wrong version on npx nuxi info (7.3.1)

This is causing my application to not being able to start.

I already tried running rm -rf node_modules package-lock.json && npx nuxi cleanup and as this thread implies, this seems not to be a i18n problem in this case.

Am I missing something?

`nuxt doctor`

would be handy to have a command to diagnose issues. It could include utilities to resolve package dependency issues, such as:

  1. outdated versions of unjs utils (defu, untyped)
    nuxt/nuxt#14768
    nuxt/nuxt#14538
  2. nuxt 2 modules in dep list (even if not in nuxt.config)
    https://github.com/nuxt/nuxt.js/issues/14945
  3. monorepo hoisting issues (though nuxt/nuxt#11074 implementation should have dealt with some of this)
  4. mismatched (or multiple) versions of vue deps
    nuxt/nuxt#14952
  5. incorrect casing in nuxt folders (on a case-insensitive file system)

running info command on a workspace directory can throw error

Running nuxi info on a directory without a lockfile can throw an error if it is part of a corepack-enabled workspace

# running within nuxt/nuxt monorepo
❯ bunx nuxi-ng@latest info playground

 ERROR  Command failed: yarn --version                                                        08:58:47

  at checkExecSyncError (node:child_process:885:11)
  at execSync (node:child_process:957:15)
  at getPackageManagerVersion (node_modules/.pnpm/file+..+nuxt+cli+nuxi-ng-0.2.0.tgz/node_modules/nuxi-ng/dist/shared/nuxi-ng.0fad3f53.mjs:23:10)
  at Object.run (node_modules/.pnpm/file+..+nuxt+cli+nuxi-ng-0.2.0.tgz/node_modules/nuxi-ng/dist/chunks/info.mjs:64:31)
  at runCommand$1 (node_modules/.pnpm/file+..+nuxt+cli+nuxi-ng-0.2.0.tgz/node_modules/nuxi-ng/dist/shared/nuxi-ng.9b055368.mjs:1644:15)
  at async runCommand$1 (node_modules/.pnpm/file+..+nuxt+cli+nuxi-ng-0.2.0.tgz/node_modules/nuxi-ng/dist/shared/nuxi-ng.9b055368.mjs:1638:7)
  at async runMain$1 (node_modules/.pnpm/file+..+nuxt+cli+nuxi-ng-0.2.0.tgz/node_modules/nuxi-ng/dist/shared/nuxi-ng.9b055368.mjs:1756:7)

`nitro.devProxy` for websocket is not working

Environment

Nuxt 3.7

Reproduction

Nuxt 3.7

Describe the bug

Config:

nitro:{
  devProxy: {
    '/proxy': {
      target: `http://localhost:8080`,
      changeOrigin: true,
      ws: true,
    },
}

In web:
image

image

image

If direct connect to Websocket Server:
image

Additional context

No response

Logs

No response

Automatic check and alert when using too old version of Node

Describe the feature

I think it would make sense if Nuxt notifies the user if it is using a version of Node that is too old for nuxt3 during start up.
Just a cheaky little text explaining what version the user is on and what the recommended version is probably enough.

I just spent far too much time to admit trying to debug a weird issue with my project that turned out to be because I was on an old version of node 16. It works fine in 18. I have to constantly switch between when going between projects.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Automatically check latest nuxt release and inform in CLI

Users could often miss the new releases. A globally cached manifest, can keep such information and warn in CLI (nicely!) to suggest upgrading to the latest available release using simple nuxi upgrade

I like to also extend it for important sub-dependencies such as Vue and Nitropackage (via lockfile) too but probably following up in next steps.

For now putting a pending label in this idea since working on CLI infra packages to make it a solid and better tested addition.

General Feedback regarding the CLI

Really nice work on this new CLI tool!

Can't wait to try it out in the battleground of production projects :)

I have some general feedback regarding it that I wanted to share with you.

  1. I am not so sure about global nuxt command. This is something that we have experimented in VSF when we have created our own CLI some time ago and we found out that users prefer to use known and generally selected appraoches such as using the package manager to run your project. In the case of nuxt dev I think that majority of the users will still be using yarn/pnpm/npm instead as it is the same case with Docker for example. It is a common pattern and everyone are used to it.
  2. Adding modules from CLI will be such a great addition. We will be able to skip the step of registering them in the modules array. It may not sound that great but really, installing and using Tailwind with one command instead of two is a game changer. In here I also have a question. I proposed a solution some time ago to the core nuxt framework to detect modules that are installed in package.json and registering them automatically in the moduels array. Or to have a postInstall hook that would add the module to the array. Should we focus on the new CLI approach here or is there a space for functionality that I proposed? :)
  3. Is there a plan to support project scaffolding as it was in Nuxt 2? I think that majority of the users are asking for this.

Extendable `nuxi add` with custom templates from modules

Describe the feature

(edited by @pi0) Original title: nuxi add content <name>

I am currently creating my website with nuxt content and realized that nuxi does not have a template for content (content pages).

I've been reviewing the code a bit and I would like to contribute with this.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

`@nuxt/schema` is a dependency

currently nuxi-ng build depends on @nuxt/schema as rollup adds import '@nuxt/schema' to chunks, even though these are type-only imports and not used in production.

To replicate, try npx nuxi-ng@latest prepare /some/directory

manage project structure with CLI

This is a superset of nuxt/nuxt.js#13552 and a requirement of devtools vision.

Nuxt heavily depends on filesystem structure to configure project. As a result, we introduce filesystem entities such as pages, components, composables and plugins.

However, it is not easy to manage such entities. Creating a page, see what components are scanned, what plugins are available, what pages are there and mapped to which routes, etc.

The idea is to expose entity namespaces from nuxi cli to manage these. Some examples:

nuxi pages add <name>
nuxi pages show
nuxi pages update /blog/* --meta title="Blog:"

nuxi plugins add <name>
nuxi plugins show
nuxi plugins disable <name>

nuxi composables show

Related: nuxi module * (https://github.com/nuxt/framework/discussions/569)

By exposing this functionality from CLI (and later an API service), they can be used both for CLI lovers and also nuxt devtools to easily manage entities without duplicating logic.

Roadmap:

  • Scaffold shortcuts for nuxi add <template> <name> as nuxi <template> add <name>
  • Implement show for each
  • Update utilities - penging unjs template (@pi0) (meanwhile ideas welcome)
  • Wait for devtools to share vision and next steps

Entities we can start with:

  • component
  • composable
  • layout
  • middleware
  • page
  • plugin
  • api

public release roadmap

Apart from team discussions about long-term maintenance, we need to open the CLI experience to the public as soon as possible when meeting the first vision goals to gather feedback and allow community involvement and contributions with beta testers.

[todo: the checklist to be written]


Related topics:

Nuxt 3.7 is ignoring devServer on nuxt.config.ts

Environment

Reproduction

just create a new project using npx nuxi@latest init my-app and add
devServer: { host: DEV_URL, https: { key: DEV_KEY, cert: DEV_CERT } },
to nuxt.config.ts

Describe the bug

When using pnpm dev on previous versions, it used to log on the terminal my localhost ip and my dns + https, but now even when using --host to reveal, it just logs localhost and my ip, both http like bellow
Nuxt 3.7.0 with Nitro 2.6.1 ➜ Local: http://localhost:3000/ ➜ Network: http://152.84.120.30:3000/ [QR code ⬇️ ]
And when using the dns on the browser, it doesnt work.

Additional context

I dont really know if its a bug or theres a new way to use a dns and cert on nuxt 3.7, I couldnt find it on the the release note.
Thanks for the help! ❤️

Logs

No response

Compatibility with `nuxi dev 3.6` args

  • Missing -o shortcut for --open
  • Missing -p shortcut for --port
  • Missing -h shotcut for --host (cannot do because -h is help alias in citty)
  • --ssl-cert / --ssl-key (to be deprecated)

npx [email protected] dev --help           
Nuxi 3.6.5                                                                                                                                        11:39:41 PM
> Usage: npx nuxi dev [rootDir] [--dotenv] [--log-level] [--clipboard] [--open, -o] [--port, -p] [--host, -h] [--https] [--ssl-cert] [--ssl-key]  11:39:41 PM

⋮ Run nuxt development server

Use npx nuxi [command] --help to see help for each command
npx [email protected] dev --help
Run nuxt development server (nuxi-ng dev)                                                                                                         11:40:52 PM

USAGE nuxi-ng dev [OPTIONS] [ROOTDIR]

ARGUMENTS

  ROOTDIR    Root Directory

OPTIONS

                 --cwd    Current working directory                                                                               
            --logLevel    Log level                                                                                               
                --port    Port to listen on (use PORT environment variable to override)                                           
                --host    Host to listen on (use HOST environment variable to override)                                           
           --clipboard    Copy the URL to the clipboard                                                                           
                --open    Open the URL in the browser                                                                             
               --https    Enable HTTPS                                                                                            
          --https.cert    Path to TLS certificate used with HTTPS in PEM format                                                   
           --https.key    Path to TLS key used with HTTPS in PEM format                                                           
           --https.pfx    Path to PKCS#12 (.p12/.pfx) keystore containing a TLS certificate and Key                               
    --https.passphrase    Passphrase used for TLS key or keystore                                                                 
  --https.validityDays    Validity in days of the autogenerated TLS certificate (https: true)                                     
       --https.domains    Comma seperated list of domains and IPs, the autogenerated certificate should be valid for (https: true)
           --publicURL    Displayed public URL (used for QR code)                                                                 
                  --qr    Display The QR code of public URL when available                                                        
              --public    Listen to all network interfaces                                                                        
              --tunnel    Open a tunnel using https://github.com/unjs/untun                                                       
              --dotenv    Path to .env file                                                                                       
               --clear    Clear console on restart                                                                                
             --sslCert    Path to SSL certificate                                                                                 
              --sslKey    Path to SSL key    

Error when installing into current folder

Environment


  • Operating System: Windows_NT
  • Node Version: v20.2.0
  • Nuxt Version: 0.0.0
  • Nitro Version: -
  • Package Manager: unknown
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Following this section of docs: https://nuxt.com/docs/getting-started/installation#new-project

  1. Open project folder in editor/ide
  2. Run pnpm dlx nuxi@latest init .

Describe the bug

Script fails with status 1 when installing into current directory

Additional context

No response

Logs

Nuxi 3.6.5                                                                                                                                                                                                                20:11:31

 ERROR  Error: Destination <path to project folder> already exists.                                                                                                                                    20:11:32  

 ERROR  Command failed with exit code 1: nuxi init .

allow initialising new nuxt app in a non-empty root directory

Environment

Nuxt CLI v3.0.0-rc.4

------------------------------
- Operating System: `Linux`
- Node Version:     `v16.15.0`
- Nuxt Version:     `0.0.0`
- Package Manager:  `unknown`
- Builder:          `webpack`
- User Config:      `-`
- Runtime Modules:  `-`
- Build Modules:    `-`
------------------------------

Reproduction

  1. Create new, empty folder
  2. Run git init
  3. Run npx nuxi init ./
  4. Get error: Directory is not empty. Please pick another name or remove it first. Aborting.

Describe the bug

From the end-user perspective, this directory is empty. It of course has a .git folder, but as a user I don't see why this should mean I cannot initialise a new app here.

When setting up a project, I might often initialise a git repo or clone a blank repo before initialising an app. The current behavior prevents initialising a Nuxt app in the current folder in this case.

Additional context

I came across this when attempting to initialise a Nuxt app on a CodeSandbox Projects. I can see this being a platform on more high-level platforms or IDEs in the future, as they might provide a git-based workflow where the git project has already been created.

User can work around this by creating the project in a sub folder and then manually moving all generated files to the root level.

Screen.Recording.2022-06-26.at.13.55.45.mp4

Logs

Logs to show difference between empty folder, and folder after git init:

Development/ mkdir _demo1
_demo1

Development/ cd _demo1/

_demo1/ ls -la
total 0
drwxr-xr-x   2 jerryjappinen  staff    64 Jun 26 13:59 .
drwxr-xr-x  35 jerryjappinen  staff  1120 Jun 26 13:59 ..

_demo1/ npx nuxi init ./
Need to install the following packages:
  nuxi
Ok to proceed? (y) 
Nuxt CLI v3.0.0-27444434.856c01a                                                13:59:42
ℹ cloned nuxt/starter#v3 to /Users/jerryjappinen/Development/_demo1             13:59:42
                                                                                13:59:42
 🎉  Another kryptonian Nuxt project just made! Next steps:

     📁  `cd `

     💿  Install dependencies with `npm install` or `yarn install`

     🚀  Start development server with `npm run dev` or `yarn dev`

     

_demo1/ cd ..

Development/ mkdir _demo2
_demo2

Development/ cd _demo2

_demo2/ git init
Initialized empty Git repository in /Users/jerryjappinen/Development/_demo2/.git/

_demo2/ npx nuxi init ./
Need to install the following packages:
  nuxi
Ok to proceed? (y) 
Nuxt CLI v3.0.0-27444434.856c01a                                                14:00:09

 ERROR  Directory /Users/jerryjappinen/Development/_demo2 is not empty. Please pick another name or remove it first. Aborting.

Init tests

Note: (non unit) Tests need to running against dist as zero-dependency bundle behavior sometimes differs. We might switch in the CI for faster local development.

Allow selecting package manager when creating new project with Nuxi

Describe the feature

Currently, Nuxi creates a README.md file with package manager commands that are inconsistent (yarn, npm and pnpm commands vs npm-only in the last two sections). Providing all three variants for the below four stages might be a little bit verbose.

Nuxt 3 Minimal Starter

Look at the Nuxt 3 documentation to learn more.

Setup

Make sure to install the dependencies:

# yarn
yarn install

# npm
npm install

# pnpm
pnpm install

Development Server

Start the development server on http://localhost:3000

npm run dev

Production

Build the application for production:

npm run build

Locally preview production build:

npm run preview

Check out the deployment documentation for more information.

I really like how one of the backend frameworks, NestJS, provides a nicer DX by prompting a user to select the package manager and installing dependencies for the user:

image

This would allow Nuxi to tweak commands in README.md file according to the chosen package manager, as well as display more accurate messages in the CLI. "Install dependencies with (...)" could be removed and "Start development server with (...)" shortened:

image

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Access to root server on 'listen' hook for websocket setup

Environment



Reproduction

In a module :

nuxt.hook('listen', (server) => {
    // server is not the root server, but it's a proxified server handled by nuxi.
    // unable to do this :
    server.on('upgrade', (req, socket, head) => {
       // handle socket
       // socket.write(...) does nothing
    });
});

Describe the bug

With nuxt 3.7 :
Since nuxi create a proxy for handle only web request beetween root server and devServer, we are unable to attach websockets to the root server.
The server in listen hook is not the root server (listening on localhost:3000), but the devServer (listening on localhost:xxxxx).
Websocket must be attached on the root server for working, because proxy create by nuxi proxify only the web requests.

Additional context

No response

Logs

No response

Doesn't read NUXT_HOST from .env file

Environment

Nuxt project info: 3:00:18 PM



Reproduction

https://codesandbox.io/p/sandbox/nuxtjs-3-7-0-gt3sj6?file=/app.vue:1,1

Describe the bug

After update to the latest version 3.7.0, after i run npm run dev, i saw that it doesn't run on the host from .env file.

I have tried with several ways like HOST, NITRO_HOST in the package.json file but it doesn't want to work.
I have tried with removing .nuxt folder and node_modules but still the same, on the reproduction i dont think that it will work, because there is no interface with that ip at all.

Additional context

No response

Logs

No response

nuxi `prepare` or `build` hangs

Environment



Reproduction

https://stackblitz.com/edit/github-khexbq?file=package.json

Describe the bug

image

Doing a npm install stucks at the above position , doing a npx nuxi upgrade --force fixes the issue,
Conflicting during deploying .

image

Additional context

No response

### Logs

+ npm install

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/[email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react

npm WARN   react@"18.2.0" from [email protected]

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   12 more (react-konva, styled-components, its-fine, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react@"^16.13.1" from @scaleflex/[email protected]

npm WARN node_modules/@scaleflex/icons

npm WARN   @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/ui

npm WARN   1 more (react-filerobot-image-editor)

npm WARN 

npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react

npm WARN   peer react@"^16.13.1" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/icons

npm WARN     @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/[email protected]

npm WARN     node_modules/@scaleflex/ui

npm WARN     1 more (react-filerobot-image-editor)

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/[email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react-dom

npm WARN   react-dom@"18.2.0" from [email protected]

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   5 more (react-konva, styled-components, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react-dom@"^16.13.1" from @scaleflex/[email protected]

npm WARN node_modules/@scaleflex/icons

npm WARN   @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/ui

npm WARN   1 more (react-filerobot-image-editor)

npm WARN 

npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react-dom

npm WARN   peer react-dom@"^16.13.1" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/icons

npm WARN     @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/[email protected]

npm WARN     node_modules/@scaleflex/ui

npm WARN     1 more (react-filerobot-image-editor)

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/[email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react

npm WARN   react@"18.2.0" from [email protected]

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   12 more (react-konva, styled-components, its-fine, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react@"^16.13.1" from @scaleflex/[email protected]

npm WARN node_modules/@scaleflex/ui

npm WARN   @scaleflex/ui@"1.0.0-beta.99" from [email protected]

npm WARN   node_modules/react-filerobot-image-editor

npm WARN 

npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react

npm WARN   peer react@"^16.13.1" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/ui

npm WARN     @scaleflex/ui@"1.0.0-beta.99" from [email protected]

npm WARN     node_modules/react-filerobot-image-editor

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/[email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react-dom

npm WARN   react-dom@"18.2.0" from [email protected]

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   5 more (react-konva, styled-components, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react-dom@"^16.13.1" from @scaleflex/[email protected]

npm WARN node_modules/@scaleflex/ui

npm WARN   @scaleflex/ui@"1.0.0-beta.99" from [email protected]

npm WARN   node_modules/react-filerobot-image-editor

npm WARN 

npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react-dom

npm WARN   peer react-dom@"^16.13.1" from @scaleflex/[email protected]

npm WARN   node_modules/@scaleflex/ui

npm WARN     @scaleflex/ui@"1.0.0-beta.99" from [email protected]

npm WARN     node_modules/react-filerobot-image-editor



> [email protected] postinstall

> nuxt prepare



[warn] Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.

[success] Types generated in .nuxt

internal team dicussions

Apart from feedbacks collection, I like to individually know the vision from @nuxt/framework team members. adding output here for transparency. The project is super early right now almost no commits. Will probably reach out soon.

CLI command to switch between nightly and stable nuxt channels

We introduced an edge channel since Nuxt 2, mainly for internally testing changes before public releases. This allows opting-in to beta test features ahead of time for the community too.

Manual migration is currently documented here: https://v3.nuxtjs.org/guide/going-further/edge-channel.

The idea is to make it easy to opt-in and opt-out from edge release channel and also be able to keep it updated. @Atinux previously shared the idea of nuxi edge on|off an @AndreyYolkin in nuxt/framework#6998 using nuxi upgrade --channel edge. I like both actually because they complete each other and can be combined:

  • nuxi upgrade edge: Change dependency to npm:nuxt3 and upgrade to the latest edge
  • nuxi upgrade stable: Change dependency to nuxt with the latest RC tag

Pass `extends` via CLI

Describe the feature

I think it would be great to pass the extends field via the CLI (nuxt build, nuxt dev). It would clean up nuxt.config.js and the Nuxt call could be refactored away.

So I could do something like this: nuxt dev --extends @me/nuxt-config and start with no nuxt.config.js.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

`nuxi dev --test`

Enabling HMR testing when developing the Nuxt applicative itself can be intuitive.

By introducing a new --test flag to dev command, we can initiate @test/utils and pass existing instance of nuxt created by CLI to run tests against with (and also watch for changes)

`nuxi upgrade` for edge channel switch

Environment

------------------------------
- Operating System: `Darwin`
- Node Version:     `v18.0.0`
- Nuxt Version:     `3.0.0-rc.1`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `runtimeConfig`, `telemetry`, `srcDir`, `ssr`, `typescript`, `modules`, `meta`, `css`
- Runtime Modules:  `~/modules/app-customisations.ts`, `@nuxtjs/[email protected]`
- Build Modules:    `-`
------------------------------

Reproduction

set nuxt to npm:nuxt3@latest then run nuxi upgrade

Describe the bug

If I try to keep to the edge by "nuxt": "npm:nuxt3@latest" nuxi upgrade sets my package.json to "nuxt": "^3.0.0-rc.1".

Additional context

Related discussion: https://github.com/nuxt/framework/discussions/4479
Workaround for now is npm i && nuxi prepare

Logs

No response

`nuxt devtools enable|disable` works only with `--command` flag

Problem

According to the docs, users can just type nuxi devtools enable to enable devtools in the project. Howerver, after #47 enable/disable flag can only be submitted with --command before the value.

There I need to ask: which way is preferred for the future? Should we change documentation or fix the command itself?

Extra info to help:

1. There is the code, where nuxi expect to have --command flag:
if (!['enable', 'disable'].includes(ctx.args.command)) {

2. There I logged ctx.args:

image

3. There is the run without --command flag, as documented:

image

4. There is the run with --command flag:

image

CLI Scaffolding progress

One of the new features of nuxi cli, is the ability to scaffold templates for common components such as pages, plugins, etc.

Thanks to the nice initiative from @Baroshem (via nuxt/framework#3841) we have the functionality to try with nuxi add 💚 (docs: https://v3.nuxtjs.org/docs/usage/cli/#add)

This issue is to track the roadmap of this feature.

Feature roadmap:

  • nuxi add (#3841)
  • entity management shortcuts (nuxi pages add <name>) (#3903)
  • CLI API service (pending devtools project)
  • Template util from unjs (@pi0)
  • External template support (ideas welcome)

Templates:

  • component
  • composable
  • layout
  • middlware
  • page
  • plugin
  • api
  • app
  • error
  • config
  • nuxtignore
  • tsconfig
  • serverMiddleware
  • tests/

Feedbacks are more than welcome!

Support custom sub-commands

It might eventually become part of citty but we need to support nuxt-{command} binaries as default command fallback.

PR welcome for this :)

Paths printed by nuxi cannot be opened in VS Code by ctrl + clicking

Environment

  • Operating System: Linux
  • Node Version: v16.13.0
  • Nuxt Version: 3.0.0-rc.1
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: target, alias, nitro, ssr, meta, css, tailwindcss, modules, watch, runtimeConfig, build, storybook
  • Runtime Modules: @nuxtjs/[email protected], @pinia/[email protected], ./modules/storybook
  • Build Modules: -

Reproduction

https://gitpod.io/#https://github.com/JabRef/JabRefOnline/pull/1009

Describe the bug

In VS Code, clicking on paths in the terminal output of nuxi converts forward slashes to backward slashes. Given an output such as

yarn run v1.22.17
$ /workspace/JabRefOnline/node_modules/.bin/nuxi build
Nuxt CLI v3.0.0-rc.1                                                                                                           09:52:45
ℹ Merging Tailwind config from ~/tailwind.config.cjs                                                          nuxt:tailwindcss 09:52:49

ctrl +clicking on:

  • /workspace/JabRefOnline/node_modules/.bin/nuxi: successfully opens nuxi in the editor
  • ~/tailwind.config.cjs: VS code opens a file selector prefilled with ~\tailwind.config.cjs (not the backward slash). Only after changing \ to /, VS is able to find and open the file.

This affects all paths printed by nuxi, also in exceptions and stack traces.

Additional context

No response

Logs

No response

Add an `attach` command to nuxi CLI to install modules

Describe the feature

Frame 48 (4)

This issue proposes the addition of a new command, nuxi attach, to the CLI, allowing users to install Nuxt modules and update the nuxt.config.ts file accordingly.

Currently, there is no straightforward way to install Nuxt modules and automatically update the nuxt.config.ts file with the installed modules. This often requires manual installation and editing of the configuration file.

This would make a fantastic addition to the nuxi CLI! 😄 Both Qwik and Astro have already implemented similar features within their CLIs, which have been highly beneficial to their users.

Proposed Changes

  • Implement the nuxi attach command in the CLI.

Usage

nuxi attach <module>
  • The nuxi attach command will take the name of the desired Nuxt module as an argument and install the equivalent package.

Example

# Tailwind
nuxi attach tailwind # Will install @nuxtjs/tailwindcss

# Pinia
nuxi attach pinia # Will install @pinia/nuxt

# Apollo
nuxi attach apollo # Will install @nuxtjs/apollo
  • It will run the appropriate npm|pnpm|yarn add command to install the package as a dev dependency.
  • The command will then update the nuxt.config.ts file by adding the installed module to the modules array.
  • If the modules key is not present in the defineNuxtConfig(), it will be added with the installed module as the first entry.

Expected benefits

  1. Simplifies the process of installing Nuxt modules by providing a dedicated command.
  2. Automates the update of the nuxt.config.ts file, reducing manual editing and potential errors.
  3. Improves developer productivity and enhances the overall user experience.

Tasks

  • Implement the nuxi attach command in the CLI.
  • Update the nuxt.config.ts file with the installed modules.
  • Test the functionality of the nuxi attach command with different Nuxt modules.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Autofix.ci App Not Installed

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix the main branch. If you are the repository owner, please install the app and then restart the CI workflow! 😃

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.