chore: update and cleanup workspace (#4450)

* fix(test-utils): resolve nuxi locally
This commit is contained in:
pooya parsa 2022-04-20 12:19:30 +02:00 committed by GitHub
parent 4712e99411
commit 24923db992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 318 additions and 856 deletions

View File

@ -1,5 +1,6 @@
{
"name": "nuxt-framework",
"private": true,
"license": "MIT",
"type": "module",
"workspaces": [
@ -10,16 +11,17 @@
],
"scripts": {
"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:build": "yarn workspace example-$0 build",
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
"nuxi": "./node_modules/.bin/nuxi",
"nuxt": "./node_modules/.bin/nuxi",
"nuxi": "node ./packages/nuxi/bin/nuxi.mjs",
"nuxt": "node ./packages/nuxi/bin/nuxi.mjs",
"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",
"stub": "lerna run prepack -- --stub",
"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"
},
"resolutions": {
"jiti": "^1.13.0",
"nitropack-dev": "link:../nitropack",
"nuxt": "workspace:./packages/nuxt",
"vite": "^2.9.5",
"@nuxt/kit": "link:./packages/kit",
"@nuxt/schema": "link:./packages/schema",
"@nuxt/test-utils": "link:./packages/test-utils",
"@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"
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.3",
"@nuxtjs/eslint-config": "^9.0.0",
"@nuxtjs/eslint-config-typescript": "^9.0.0",
"@types/jsdom": "^16",
"@types/node": "^16.11.27",
"@types/object-hash": "^2",
"@types/rimraf": "^3",
"@unocss/reset": "^0.31.6",
"case-police": "^0.5.3",
"esbuild": "^0.14.36",
"eslint": "^8.13.0",
"eslint-plugin-jsdoc": "^39.2.3",
"execa": "^6.1.0",
@ -54,17 +56,15 @@
"jiti": "^1.13.0",
"lerna": "^4.0.0",
"markdownlint-cli": "^0.31.1",
"miniflare": "^1.4.1",
"object-hash": "^3.0.0",
"pathe": "^0.2.0",
"rimraf": "^3.0.2",
"typescript": "^4.6.3",
"unbuild": "^0.7.4",
"vitest": "^0.9.3",
"vue-router": "^4.0.14",
"vue-tsc": "^0.34.7"
},
"packageManager": "yarn@3.2.0",
"engines": {
"node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
},
"packageManager": "yarn@3.2.0"
}
}

View File

@ -2,15 +2,20 @@ import { resolve } from 'node:path'
import { execa } from 'execa'
import { getRandomPort, waitForPort } from 'get-port-please'
import { fetch as _fetch, $fetch as _$fetch, FetchOptions } from 'ohmyfetch'
import * as _kit from '@nuxt/kit'
import { useTestContext } from './context'
// @ts-ignore type cast
const kit: typeof _kit = _kit.default || _kit
export async function startServer () {
const ctx = useTestContext()
await stopServer()
const port = await getRandomPort()
ctx.url = 'http://localhost:' + port
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,
stdio: 'inherit',
env: {

View File

@ -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()

1100
yarn.lock

File diff suppressed because it is too large Load Diff