mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
chore: update and cleanup workspace (#4450)
* fix(test-utils): resolve nuxi locally
This commit is contained in:
parent
4712e99411
commit
24923db992
36
package.json
36
package.json
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nuxt-framework",
|
"name": "nuxt-framework",
|
||||||
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
@ -10,16 +11,17 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "FORCE_COLOR=1 lerna run prepack --stream --no-prefix",
|
"build": "FORCE_COLOR=1 lerna run prepack --stream --no-prefix",
|
||||||
|
"cleanup": "rimraf 'packages/**/node_modules' 'examples/**/node_modules' 'node_modules'",
|
||||||
|
"dev": "yarn run nuxi dev playground",
|
||||||
|
"dev:build": "yarn run nuxi build playground",
|
||||||
"example": "yarn workspace example-$0 dev",
|
"example": "yarn workspace example-$0 dev",
|
||||||
"example:build": "yarn workspace example-$0 build",
|
"example:build": "yarn workspace example-$0 build",
|
||||||
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
|
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
|
||||||
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
|
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
|
||||||
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
|
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
|
||||||
"nuxi": "./node_modules/.bin/nuxi",
|
"nuxi": "node ./packages/nuxi/bin/nuxi.mjs",
|
||||||
"nuxt": "./node_modules/.bin/nuxi",
|
"nuxt": "node ./packages/nuxi/bin/nuxi.mjs",
|
||||||
"play": "echo use yarn dev && exit 1",
|
"play": "echo use yarn dev && exit 1",
|
||||||
"dev": "yarn run nuxi dev playground",
|
|
||||||
"dev:build": "yarn run nuxi build playground",
|
|
||||||
"release": "yarn && yarn lint && FORCE_COLOR=1 lerna publish -m \"chore: release\" && yarn stub",
|
"release": "yarn && yarn lint && FORCE_COLOR=1 lerna publish -m \"chore: release\" && yarn stub",
|
||||||
"stub": "lerna run prepack -- --stub",
|
"stub": "lerna run prepack -- --stub",
|
||||||
"test:fixtures": "yarn nuxi prepare test/fixtures/basic && JITI_ESM_RESOLVE=1 vitest run --dir test",
|
"test:fixtures": "yarn nuxi prepare test/fixtures/basic && JITI_ESM_RESOLVE=1 vitest run --dir test",
|
||||||
@ -30,22 +32,22 @@
|
|||||||
"version": "yarn && git add yarn.lock"
|
"version": "yarn && git add yarn.lock"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"jiti": "^1.13.0",
|
"@nuxt/kit": "link:./packages/kit",
|
||||||
"nitropack-dev": "link:../nitropack",
|
"@nuxt/schema": "link:./packages/schema",
|
||||||
"nuxt": "workspace:./packages/nuxt",
|
"@nuxt/test-utils": "link:./packages/test-utils",
|
||||||
"vite": "^2.9.5",
|
"@nuxt/vite": "link:./packages/vite",
|
||||||
|
"@nuxt/webpack": "link:./packages/webpack",
|
||||||
|
"nuxi": "link:./packages/nuxi",
|
||||||
|
"nuxt": "link:./packages/nuxt",
|
||||||
|
"nuxt3": "link:./packages/nuxt",
|
||||||
"unbuild": "^0.7.4"
|
"unbuild": "^0.7.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/carbon": "^1.1.3",
|
|
||||||
"@nuxtjs/eslint-config": "^9.0.0",
|
|
||||||
"@nuxtjs/eslint-config-typescript": "^9.0.0",
|
"@nuxtjs/eslint-config-typescript": "^9.0.0",
|
||||||
"@types/jsdom": "^16",
|
|
||||||
"@types/node": "^16.11.27",
|
"@types/node": "^16.11.27",
|
||||||
"@types/object-hash": "^2",
|
"@types/rimraf": "^3",
|
||||||
"@unocss/reset": "^0.31.6",
|
"@unocss/reset": "^0.31.6",
|
||||||
"case-police": "^0.5.3",
|
"case-police": "^0.5.3",
|
||||||
"esbuild": "^0.14.36",
|
|
||||||
"eslint": "^8.13.0",
|
"eslint": "^8.13.0",
|
||||||
"eslint-plugin-jsdoc": "^39.2.3",
|
"eslint-plugin-jsdoc": "^39.2.3",
|
||||||
"execa": "^6.1.0",
|
"execa": "^6.1.0",
|
||||||
@ -54,17 +56,15 @@
|
|||||||
"jiti": "^1.13.0",
|
"jiti": "^1.13.0",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
"markdownlint-cli": "^0.31.1",
|
"markdownlint-cli": "^0.31.1",
|
||||||
"miniflare": "^1.4.1",
|
|
||||||
"object-hash": "^3.0.0",
|
|
||||||
"pathe": "^0.2.0",
|
"pathe": "^0.2.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.6.3",
|
||||||
"unbuild": "^0.7.4",
|
"unbuild": "^0.7.4",
|
||||||
"vitest": "^0.9.3",
|
"vitest": "^0.9.3",
|
||||||
"vue-router": "^4.0.14",
|
|
||||||
"vue-tsc": "^0.34.7"
|
"vue-tsc": "^0.34.7"
|
||||||
},
|
},
|
||||||
|
"packageManager": "yarn@3.2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
|
"node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
|
||||||
},
|
}
|
||||||
"packageManager": "yarn@3.2.0"
|
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,20 @@ import { resolve } from 'node:path'
|
|||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
import { getRandomPort, waitForPort } from 'get-port-please'
|
import { getRandomPort, waitForPort } from 'get-port-please'
|
||||||
import { fetch as _fetch, $fetch as _$fetch, FetchOptions } from 'ohmyfetch'
|
import { fetch as _fetch, $fetch as _$fetch, FetchOptions } from 'ohmyfetch'
|
||||||
|
import * as _kit from '@nuxt/kit'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
|
// @ts-ignore type cast
|
||||||
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
export async function startServer () {
|
export async function startServer () {
|
||||||
const ctx = useTestContext()
|
const ctx = useTestContext()
|
||||||
await stopServer()
|
await stopServer()
|
||||||
const port = await getRandomPort()
|
const port = await getRandomPort()
|
||||||
ctx.url = 'http://localhost:' + port
|
ctx.url = 'http://localhost:' + port
|
||||||
if (ctx.options.dev) {
|
if (ctx.options.dev) {
|
||||||
ctx.serverProcess = execa('npx', ['nuxi', 'dev'], {
|
const nuxiCLI = await kit.resolvePath('nuxi/cli')
|
||||||
|
ctx.serverProcess = execa(nuxiCLI, ['dev'], {
|
||||||
cwd: ctx.nuxt.options.rootDir,
|
cwd: ctx.nuxt.options.rootDir,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: {
|
env: {
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import { fileURLToPath } from 'node:url'
|
|
||||||
import { promises as fs } from 'node:fs'
|
|
||||||
import { resolve } from 'pathe'
|
|
||||||
|
|
||||||
async function run () {
|
|
||||||
const examplesRoot = resolve(fileURLToPath(import.meta.url), '../../examples')
|
|
||||||
|
|
||||||
const examples = await fs.readdir(examplesRoot)
|
|
||||||
|
|
||||||
const data = await Promise.all(examples.map(async (name) => {
|
|
||||||
const path = resolve(examplesRoot, name)
|
|
||||||
if ((await fs.lstat(path)).isFile()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const github = `https://github.com/nuxt/framework/tree/main/examples/${name}`
|
|
||||||
const stackblitz = `https://stackblitz.com/github/nuxt/framework/tree/main/examples/${name}?file=app.vue&terminal=dev`
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
path,
|
|
||||||
github,
|
|
||||||
stackblitz
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
const table = '| Example | Source | Playground |\n|---|---|---|\n' + data.filter(Boolean).map(i => `| \`${i.name}\` | [GitHub](${i.github}) | [Play Online](${i.stackblitz}) |`).join('\n')
|
|
||||||
|
|
||||||
await fs.writeFile(resolve(examplesRoot, 'README.md'), `# Nuxt 3 Examples\n\n${table}\n`, 'utf-8')
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
Loading…
Reference in New Issue
Block a user