Skip to content

Commit

Permalink
refactor: move cli to standalone package
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 19, 2023
1 parent 5996b87 commit 60064ec
Show file tree
Hide file tree
Showing 50 changed files with 6,232 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["@nuxt/eslint-config"],
"rules": {
"no-extra-semi": 0
}
}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm lint
- run: pnpm build
- run: pnpm test:dist
# - run: pnpm vitest --coverage && rm -rf coverage/tmp
# - uses: codecov/codecov-action@v3
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.vscode
.nuxt
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
1 change: 1 addition & 0 deletions .nuxtrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
telemetry.enabled=false
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"vueIndentScriptAndStyle": false
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Nuxt Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# nuxi-ng

💫 Next Generation CLI Experience for [Nuxt](https://nuxt.com/).

### 🌐 Global

Elegant and powerful `nuxt` command accessible immediately from everywhere. To bootstrap, init, develop, extend build and deploy Nuxt project.

### 🧩 Modular

New architucture allows composing CLI sub-commands and features from various sources, making Nuxt CLI as extendable and hackable as Nuxt itself!

### 🤖 Automated

Bootstraping a project, adding a new module or dependency, upgrading Nuxt, changing configuration, creating a template are one command away!

### 💫 Elegant

With better core integration, experience an informative and fancier CLI than ever!

### 🔌 Programmatic

Exposing Programmatic API interface, allows interacting with CLI using Devtools and Web Browser.

### ⚡️ Rapid Development

With independent versioning and self-upgrade support, we can deliver new updates even faster and work on new ideas.

## Usage

### Install Globally (recommended)

```bash
npm i -g nuxi-ng
```

You can now use `nuxt` command to start your projects in development mode:

```bash
nuxt dev
```

### Add to the Project

Install the new CLI dependency:

```bash
# pnpm
pnpm add -D nuxi-ng

# yarn
yarn add -D nuxi-ng

# npm
npm i -D nuxi-ng
```

Change scripts:

```json
{
"scripts": {
"dev": "nuxi-ng dev",
"start": "nuxi-ng start",
"build": "nuxi-ng build",
"generate": "nuxi-ng generate"
}
}
```

## License

MIT
File renamed without changes.
16 changes: 5 additions & 11 deletions packages/nuxi/build.config.ts → build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,21 @@ export default defineBuildConfig({
rollup: {
inlineDependencies: true,
resolve: {
exportConditions: ['production', 'node'] as any
}
exportConditions: ['production', 'node'] as any,
},
},
entries: [
'src/cli',
'src/cli-run',
'src/cli-wrapper',
'src/index'
],
entries: ['src/cli', 'src/cli-run', 'src/cli-wrapper', 'src/index'],
externals: [
'@nuxt/kit',
'@nuxt/schema',
'@nuxt/test-utils',
'fsevents',
// TODO: Fix rollup/unbuild issue
'node:url',
'node:buffer',
'node:path',
'node:child_process',
'node:process',
'node:path',
'node:os'
]
'node:os',
],
})
84 changes: 84 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "nuxi-ng",
"version": "0.3.5",
"repository": "nuxt/nuxt",
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.mjs",
"./cli": "./bin/nuxi.mjs"
},
"types": "./dist/index.d.ts",
"bin": {
"nuxi": "./bin/nuxi.mjs",
"nuxi-ng": "./bin/nuxi.mjs",
"nuxt": "./bin/nuxi.mjs",
"nuxt-cli": "./bin/nuxi.mjs"
},
"files": [
"bin",
"dist"
],
"scripts": {
"build": "unbuild",
"build:stub": "unbuild --stub",
"dev": "nuxi-ng dev ./playground",
"lint": "eslint . && prettier --check src",
"lint:fix": "eslint --fix . && prettier --write src",
"prepack": "unbuild",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm build && pnpm test:dist",
"test:dist": "node ./bin/nuxi.mjs info"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.1.1",
"@nuxt/kit": "^3.5.3",
"@nuxt/schema": "^3.5.3",
"@types/clear": "^0.1.2",
"@types/flat": "^5.0.2",
"@types/http-proxy": "^1.17.11",
"@types/mri": "^1.1.1",
"@types/node": "^20.3.1",
"@types/semver": "^7.5.0",
"boxen": "^7.1.0",
"c12": "^1.4.1",
"changelogen": "^0.5.3",
"chokidar": "^3.5.3",
"clear": "^0.1.0",
"clipboardy": "^3.0.0",
"colorette": "^2.0.20",
"consola": "^3.1.0",
"deep-object-diff": "^1.1.9",
"destr": "^2.0.0",
"eslint": "^8.43.0",
"execa": "^7.1.1",
"flat": "^5.0.2",
"fuse.js": "^6.6.2",
"get-port-please": "^3.0.1",
"giget": "^1.1.2",
"h3": "^1.6.6",
"http-proxy": "^1.18.1",
"jiti": "^1.18.2",
"listhen": "^1.0.4",
"magicast": "^0.2.9",
"mlly": "^1.3.0",
"mri": "^1.2.0",
"nuxt": "^3.5.3",
"nypm": "^0.2.1",
"ofetch": "^1.1.0",
"pathe": "^1.1.1",
"perfect-debounce": "^1.0.0",
"pkg-types": "^1.0.3",
"prettier": "^2.8.8",
"scule": "^1.0.0",
"semver": "^7.5.2",
"unbuild": "^1.2.1"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"packageManager": "pnpm@8.3.1",
"engines": {
"node": "^14.18.0 || >=16.10.0"
}
}
File renamed without changes.
Loading

0 comments on commit 60064ec

Please sign in to comment.