mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 13:15:12 +00:00
chore: use pnpm for framework monorepo (#7895)
Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
parent
9388e65971
commit
74a90c566c
109
.github/workflows/ci.yml
vendored
109
.github/workflows/ci.yml
vendored
@ -3,12 +3,12 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- "docs/**"
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- "docs/**"
|
||||
branches:
|
||||
- main
|
||||
|
||||
@ -25,16 +25,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
run: pnpm build
|
||||
|
||||
- name: Cache dist
|
||||
uses: actions/cache@v3
|
||||
@ -54,16 +55,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
run: pnpm lint
|
||||
|
||||
typecheck:
|
||||
runs-on: ${{ matrix.os }}
|
||||
@ -77,19 +79,20 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Stub
|
||||
run: yarn stub
|
||||
- name: Build (stub)
|
||||
run: pnpm build:stub
|
||||
|
||||
- name: Typecheck
|
||||
run: yarn typecheck
|
||||
run: pnpm typecheck
|
||||
|
||||
test-fixtures:
|
||||
runs-on: ${{ matrix.os }}
|
||||
@ -103,25 +106,47 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Stub
|
||||
run: yarn stub
|
||||
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
|
||||
# Install playwright's binary under custom directory to cache
|
||||
- name: Set Playwright path
|
||||
if: runner.os != 'Windows'
|
||||
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
|
||||
- name: Set Playwright path (windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Cache Playwright's binary
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
# Playwright removes unused browsers automatically
|
||||
# So does not need to add playwright version to key
|
||||
key: ${{ runner.os }}-playwright-bin-v1
|
||||
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
|
||||
|
||||
- name: Install Playwright
|
||||
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
|
||||
run: pnpm playwright install chromium
|
||||
|
||||
- name: Build (stub)
|
||||
run: pnpm build:stub
|
||||
|
||||
- name: Test (unit)
|
||||
run: yarn test:unit
|
||||
run: pnpm test:unit
|
||||
|
||||
- name: Test (fixtures)
|
||||
run: yarn test:fixtures
|
||||
run: pnpm test:fixtures
|
||||
|
||||
- name: Test (fixtures with dev)
|
||||
run: yarn test:fixtures:dev
|
||||
run: pnpm test:fixtures:dev
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=8192
|
||||
|
||||
@ -137,19 +162,41 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Stub
|
||||
run: yarn stub
|
||||
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
|
||||
# Install playwright's binary under custom directory to cache
|
||||
- name: Set Playwright path (non-windows)
|
||||
if: runner.os != 'Windows'
|
||||
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
|
||||
- name: Set Playwright path (windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Cache Playwright's binary
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
# Playwright removes unused browsers automatically
|
||||
# So does not need to add playwright version to key
|
||||
key: ${{ runner.os }}-playwright-bin-v1
|
||||
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
|
||||
|
||||
- name: Install Playwright
|
||||
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
|
||||
run: pnpm playwright install chromium
|
||||
|
||||
- name: Build (stub)
|
||||
run: pnpm build:stub
|
||||
|
||||
- name: Test (fixtures)
|
||||
run: yarn test:fixtures:webpack
|
||||
run: pnpm test:fixtures:webpack
|
||||
|
||||
test-types:
|
||||
needs:
|
||||
@ -165,13 +212,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Restore dist cache
|
||||
uses: actions/cache@v3
|
||||
@ -180,7 +228,7 @@ jobs:
|
||||
key: ${{ matrix.os }}-node-v${{ matrix.node }}-${{ github.sha }}
|
||||
|
||||
- name: Test (types)
|
||||
run: yarn test:types
|
||||
run: pnpm test:types
|
||||
|
||||
build-release:
|
||||
if: |
|
||||
@ -205,13 +253,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Restore dist cache
|
||||
uses: actions/cache@v3
|
||||
|
5
.github/workflows/docs-e2e.yml
vendored
5
.github/workflows/docs-e2e.yml
vendored
@ -19,13 +19,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- run: node ./scripts/crawl.mjs
|
||||
env:
|
||||
|
15
.github/workflows/docs.yml
vendored
15
.github/workflows/docs.yml
vendored
@ -3,14 +3,14 @@ name: Docs
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/docs.yml'
|
||||
- "docs/**"
|
||||
- ".github/workflows/docs.yml"
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/docs.yml'
|
||||
- "docs/**"
|
||||
- ".github/workflows/docs.yml"
|
||||
branches:
|
||||
- main
|
||||
|
||||
@ -25,13 +25,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'yarn'
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint (docs)
|
||||
run: yarn lint:docs
|
||||
run: pnpm lint:docs
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -3,7 +3,8 @@ node_modules
|
||||
jspm_packages
|
||||
|
||||
package-lock.json
|
||||
# */**/yarn.lock
|
||||
*/**/yarn.lock
|
||||
/.yarn
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
@ -13,10 +14,6 @@ package-lock.json
|
||||
.tmp
|
||||
.cache
|
||||
|
||||
# Yarn
|
||||
**/.yarn/cache
|
||||
**/.yarn/*state*
|
||||
|
||||
# Generated dirs
|
||||
dist
|
||||
.nuxt
|
||||
|
@ -1,8 +1,8 @@
|
||||
tasks:
|
||||
- init: |
|
||||
npx yarn install
|
||||
npx yarn stub
|
||||
command: npx yarn play
|
||||
npx pnpm install
|
||||
npx pnpm build:stub
|
||||
command: npx pnpm play
|
||||
|
||||
ports:
|
||||
- port: 3000
|
||||
|
3
.npmrc
Normal file
3
.npmrc
Normal file
@ -0,0 +1,3 @@
|
||||
shamefully-hoist=true
|
||||
strict-peer-dependencies=false
|
||||
shell-emulator=true
|
363
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
363
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
File diff suppressed because one or more lines are too long
9
.yarn/plugins/@yarnpkg/plugin-typescript.cjs
vendored
9
.yarn/plugins/@yarnpkg/plugin-typescript.cjs
vendored
File diff suppressed because one or more lines are too long
801
.yarn/releases/yarn-3.2.4.cjs
vendored
801
.yarn/releases/yarn-3.2.4.cjs
vendored
File diff suppressed because one or more lines are too long
11
.yarnrc.yml
11
.yarnrc.yml
@ -1,11 +0,0 @@
|
||||
nmMode: hardlinks-local
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
|
||||
spec: "@yarnpkg/plugin-typescript"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.2.4.cjs
|
23
README.md
23
README.md
@ -44,28 +44,9 @@ Nuxt's goal is to make web development intuitive and performant with a great dev
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## 💻 Development
|
||||
## Local Development
|
||||
|
||||
- Clone repository
|
||||
- Ensure you have the latest LTS version of Node.js installed
|
||||
- Install dependencies with `npx yarn install`
|
||||
- Run `npx yarn stub` to activate passive development
|
||||
- Open playground with `npx yarn dev`
|
||||
|
||||
Learn more about in our documentation on [how to contribute to Nuxt](https://v3.nuxtjs.org/community/contribution).
|
||||
|
||||
## 📖 Documentation
|
||||
|
||||
We are using [Docus](https://nuxtlabs.com/docus) for documentation (*It is planned to be open sourced in the following weeks*).
|
||||
|
||||
We recommend to install the [Docus extension](https://marketplace.visualstudio.com/items?itemName=NuxtLabs.docus) for VS Code.
|
||||
|
||||
- Run `npx yarn stub` once in the root directory
|
||||
- Go into the docs directory: `cd docs`
|
||||
- Install docs dependencies with `npx yarn install`
|
||||
- Run `npx yarn dev` to start Docus in development mode
|
||||
|
||||
The pages are generated from [docs/content/](./docs/content), you can start editing them to start helping us on documenting Nuxt 3 💚
|
||||
Follow the docs to [Set Up Your Local Development Environment](https://v3.nuxtjs.org/community/framework-contribution#set-up-your-local-development-environment) to contribute to the framework and documentation.
|
||||
|
||||
## License
|
||||
|
||||
|
4
docs/.gitignore
vendored
4
docs/.gitignore
vendored
@ -2,3 +2,7 @@ schema
|
||||
**/*.configuration/nuxt.config.md
|
||||
**/*.configuration/nuxt-config.md
|
||||
static/sw.js
|
||||
|
||||
.yarn/*
|
||||
!.yarn/releases
|
||||
!yarn.lock
|
||||
|
@ -1 +1,3 @@
|
||||
nmMode: hardlinks-local
|
||||
nodeLinker: node-modules
|
||||
yarnPath: .yarn/releases/yarn-3.2.4.cjs
|
||||
|
@ -64,13 +64,13 @@ To contribute to Nuxt, you need to set up a local environment.
|
||||
|
||||
1. Ensure using the latest Node.js (16.x)
|
||||
|
||||
1. Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
||||
1. Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` to have `pnpm` and `yarn`
|
||||
|
||||
1. Run `yarn install` to install the dependencies.
|
||||
1. Run `pnpm install` to install the dependencies.
|
||||
|
||||
> If you are adding a dependency, please use `yarn add`. The `yarn.lock` file is the source of truth for all Nuxt dependencies.
|
||||
> If you are adding a dependency, please use `pnpm add`. The `pnpm-lock.yaml` file is the source of truth for all Nuxt dependencies.
|
||||
|
||||
1. Run `yarn stub` to activate the passive development system
|
||||
1. Run `pnpm build:stub` to activate the passive development system
|
||||
|
||||
1. Check out a branch where you can work and commit your changes:
|
||||
|
||||
@ -86,7 +86,11 @@ git checkout -b my-new-branch
|
||||
|
||||
### Set Up Documentation Website in Local Environment
|
||||
|
||||
1. Follow steps to set up [local development environment](#set-up-your-local-development-environment)
|
||||
1. Change to the `docs/` directory using `cd docs/`
|
||||
1. Install docs dependencies using `yarn install`
|
||||
1. Start docs in development mode using `yarn dev`
|
||||
We are using [Docus](https://nuxtlabs.com/docus) for documentation.
|
||||
|
||||
- Run `pnpm build:stub` once in the root directory
|
||||
- Go into the docs directory: `cd docs`
|
||||
- Install docs dependencies using `yarn install`
|
||||
- Run `yarn dev` to start docs in development mode
|
||||
|
||||
We recommend to install the [Docus extension](https://marketplace.visualstudio.com/items?itemName=NuxtLabs.docus) for VS Code.
|
||||
|
@ -2,8 +2,12 @@ import { join } from 'pathe'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
extends: process.env.WEBSITE_THEME ? join(process.env.WEBSITE_THEME, 'theme') : '@nuxt-themes/website',
|
||||
build: {
|
||||
transpile: [/content-edge/]
|
||||
},
|
||||
nitro: {
|
||||
prerender: {
|
||||
crawlLinks: true,
|
||||
routes: ['/', '/404.html', '/guide/directory-structure/app.config']
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,18 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "yarn gendocs && nuxi dev",
|
||||
"build": "yarn gendocs && nuxi generate --force-build",
|
||||
"build:ci": "./scripts/make-schema.sh && yarn build",
|
||||
"lint:docs": "cd .. && yarn lint:docs",
|
||||
"lint:docs:fix": "cd .. && yarn lint:docs:fix",
|
||||
"build": "yarn gendocs && nuxi generate",
|
||||
"build:ci": "cd .. && corepack enable && pnpm install && pnpm build:stub && cd docs && yarn build",
|
||||
"gendocs": "jiti ./scripts/gen-docs.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"devDependencies": {
|
||||
"@nuxt-themes/docus": "npm:@nuxt-themes/docus-edge@0.1.0-2a7c428",
|
||||
"@nuxt-themes/website": "0.1.6",
|
||||
"jiti": "^1.16.0",
|
||||
"nuxt": "^3.0.0-rc.11"
|
||||
"nuxt": "^3.0.0-rc.11",
|
||||
"pathe": "^0.3.9",
|
||||
"scule": "^0.3.2",
|
||||
"untyped": "^0.5.0"
|
||||
},
|
||||
"packageManager": "yarn@3.2.4"
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd ..
|
||||
yarn install
|
||||
cd packages/schema
|
||||
yarn prepack --stub
|
@ -3498,6 +3498,9 @@ __metadata:
|
||||
"@nuxt-themes/website": 0.1.6
|
||||
jiti: ^1.16.0
|
||||
nuxt: ^3.0.0-rc.11
|
||||
pathe: ^0.3.9
|
||||
scule: ^0.3.2
|
||||
untyped: ^0.5.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -7534,6 +7537,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pathe@npm:^0.3.9":
|
||||
version: 0.3.9
|
||||
resolution: "pathe@npm:0.3.9"
|
||||
checksum: 9afcbaa79c5f8ec603b6b0a20b9accfcec8de57e26738f4a844de4625cfb07cc733b7234387ef42c7ab23a49b91846b6b51cb247584793842a3179539af463df
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"perfect-debounce@npm:^0.1.3":
|
||||
version: 0.1.3
|
||||
resolution: "perfect-debounce@npm:0.1.3"
|
||||
|
24
lerna.json
24
lerna.json
@ -1,24 +0,0 @@
|
||||
{
|
||||
"version": "3.0.0-rc.11",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"conventionalCommits": true,
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"command": {
|
||||
"publish": {
|
||||
"npmClient": "npm"
|
||||
}
|
||||
},
|
||||
"changelog": {
|
||||
"labels": {
|
||||
"feat": "New Feature",
|
||||
"fix": "Bug Fix",
|
||||
"docs": "Documentation",
|
||||
"types": "Types",
|
||||
"perf": "Performance",
|
||||
"refactor": "Refactor"
|
||||
}
|
||||
}
|
||||
}
|
73
package.json
73
package.json
@ -1,54 +1,50 @@
|
||||
{
|
||||
"name": "nuxt-framework",
|
||||
"private": true,
|
||||
"repository": "nuxt/framework",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
"examples/*/*",
|
||||
"test/fixtures/*",
|
||||
"playground"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "FORCE_COLOR=1 lerna run prepack --stream --no-prefix",
|
||||
"changelog": "changelogen",
|
||||
"cleanup": "rimraf 'packages/**/node_modules' 'examples/**/node_modules' 'node_modules'",
|
||||
"dev": "yarn run nuxi dev playground",
|
||||
"dev:build": "yarn run nuxi build playground",
|
||||
"dev:preview": "yarn run nuxi preview playground",
|
||||
"example": "yarn workspace example-$0 dev",
|
||||
"example:build": "yarn workspace example-$0 build",
|
||||
"build": "FORCE_COLOR=1 pnpm --filter './packages/**' prepack",
|
||||
"build:stub": "pnpm --filter './packages/**' prepack --stub",
|
||||
"cleanup": "rimraf 'packages/**/node_modules' 'examples/**/node_modules' 'docs/node_modules' 'playground/node_modules' 'node_modules'",
|
||||
"example": "./scripts/example.sh dev",
|
||||
"example:build": "./scripts/example.sh 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": "NUXT_TELEMETRY_DISABLED=1 JITI_ESM_RESOLVE=1 node ./packages/nuxi/bin/nuxi.mjs",
|
||||
"nuxt": "NUXT_TELEMETRY_DISABLED=1 JITI_ESM_RESOLVE=1 node ./packages/nuxi/bin/nuxi.mjs",
|
||||
"play": "echo use yarn dev && exit 1",
|
||||
"release": "yarn && yarn lint && FORCE_COLOR=1 lerna publish -m \"chore: release\" && yarn stub",
|
||||
"stub": "lerna run prepack -- --stub",
|
||||
"test:fixtures": "NUXT_TELEMETRY_DISABLED=1 yarn nuxi prepare test/fixtures/basic && JITI_ESM_RESOLVE=1 vitest run --dir test",
|
||||
"test:fixtures:dev": "NUXT_TELEMETRY_DISABLED=1 NUXT_TEST_DEV=true yarn test:fixtures",
|
||||
"test:fixtures:webpack": "NUXT_TELEMETRY_DISABLED=1 TEST_WITH_WEBPACK=1 yarn test:fixtures",
|
||||
"test:types": "yarn run nuxi prepare test/fixtures/basic && cd test/fixtures/basic && npx vue-tsc --noEmit",
|
||||
"test:unit": "JITI_ESM_RESOLVE=1 yarn vitest run --dir packages",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"version": "yarn && git add yarn.lock"
|
||||
"nuxi": "NUXT_TELEMETRY_DISABLED=1 JITI_ESM_RESOLVE=1 nuxi",
|
||||
"nuxt": "NUXT_TELEMETRY_DISABLED=1 JITI_ESM_RESOLVE=1 nuxi",
|
||||
"play": "pnpm nuxi build playground",
|
||||
"play:build": "pnpm nuxi build playground",
|
||||
"play:preview": "pnpm nuxi preview playground",
|
||||
"test:fixtures": "NUXT_TELEMETRY_DISABLED=1 pnpm nuxi prepare test/fixtures/basic && JITI_ESM_RESOLVE=1 vitest run --dir test",
|
||||
"test:fixtures:dev": "NUXT_TELEMETRY_DISABLED=1 NUXT_TEST_DEV=true pnpm test:fixtures",
|
||||
"test:fixtures:webpack": "NUXT_TELEMETRY_DISABLED=1 TEST_WITH_WEBPACK=1 pnpm test:fixtures",
|
||||
"test:types": "pnpm nuxi prepare test/fixtures/basic && cd test/fixtures/basic && npx vue-tsc --noEmit",
|
||||
"test:unit": "JITI_ESM_RESOLVE=1 vitest run --dir packages",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"resolutions": {
|
||||
"@nuxt/kit": "link:./packages/kit",
|
||||
"@nuxt/schema": "link:./packages/schema",
|
||||
"@nuxt/test-utils": "link:./packages/test-utils",
|
||||
"@nuxt/vite-builder": "link:./packages/vite",
|
||||
"@nuxt/webpack-builder": "link:./packages/webpack",
|
||||
"nuxi": "link:./packages/nuxi",
|
||||
"nuxt": "link:./packages/nuxt",
|
||||
"nuxt3": "link:./packages/nuxt",
|
||||
"@nuxt/kit": "workspace:*",
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@nuxt/test-utils": "workspace:*",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@nuxt/webpack-builder": "workspace:*",
|
||||
"nuxi": "workspace:*",
|
||||
"nuxt": "workspace:*",
|
||||
"nuxt3": "workspace:nuxt@*",
|
||||
"unbuild": "^0.9.4",
|
||||
"vite": "^3.1.8",
|
||||
"unbuild": "^0.9.4"
|
||||
"vue": "3.2.40"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@nuxt/test-utils": "link:./packages/test-utils",
|
||||
"@nuxt/kit": "workspace:*",
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@nuxt/test-utils": "workspace:*",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@nuxt/webpack-builder": "workspace:*",
|
||||
"@nuxtjs/eslint-config-typescript": "^11.0.0",
|
||||
"@types/crawler": "^1.2.2",
|
||||
"@types/node": "^16.11.65",
|
||||
@ -64,8 +60,9 @@
|
||||
"expect-type": "^0.14.2",
|
||||
"globby": "^13.1.2",
|
||||
"jiti": "^1.16.0",
|
||||
"lerna": "^6.0.1",
|
||||
"markdownlint-cli": "^0.32.2",
|
||||
"nuxi": "workspace:*",
|
||||
"nuxt": "workspace:*",
|
||||
"ohmyfetch": "^0.4.19",
|
||||
"pathe": "^0.3.9",
|
||||
"rimraf": "^3.0.2",
|
||||
@ -78,7 +75,7 @@
|
||||
"vitest": "~0.19.1",
|
||||
"vue-tsc": "^1.0.8"
|
||||
},
|
||||
"packageManager": "yarn@3.2.4",
|
||||
"packageManager": "pnpm@7.12.0",
|
||||
"engines": {
|
||||
"node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0"
|
||||
}
|
||||
|
@ -5,5 +5,8 @@
|
||||
"dev": "nuxi dev",
|
||||
"build": "nuxi build",
|
||||
"start": "nuxi preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
9108
pnpm-lock.yaml
Normal file
9108
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
5
pnpm-workspace.yaml
Normal file
5
pnpm-workspace.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
packages:
|
||||
- "packages/**"
|
||||
- "examples/**"
|
||||
- "playground"
|
||||
- "text/fixtures/*"
|
94
scripts/_utils.ts
Normal file
94
scripts/_utils.ts
Normal file
@ -0,0 +1,94 @@
|
||||
import { promises as fsp } from 'node:fs'
|
||||
import { resolve } from 'pathe'
|
||||
import { globby } from 'globby'
|
||||
|
||||
export interface Dep {
|
||||
name: string,
|
||||
range: string,
|
||||
type: string
|
||||
}
|
||||
|
||||
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
|
||||
export type Package = ThenArg<ReturnType<typeof loadPackage>>
|
||||
|
||||
export async function loadPackage (dir: string) {
|
||||
const pkgPath = resolve(dir, 'package.json')
|
||||
const data = JSON.parse(await fsp.readFile(pkgPath, 'utf-8').catch(() => '{}'))
|
||||
const save = () => fsp.writeFile(pkgPath, JSON.stringify(data, null, 2) + '\n')
|
||||
|
||||
const updateDeps = (reviver: (dep: Dep) => Dep | void) => {
|
||||
for (const type of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
||||
if (!data[type]) { continue }
|
||||
for (const e of Object.entries(data[type])) {
|
||||
const dep: Dep = { name: e[0], range: e[1] as string, type }
|
||||
delete data[type][dep.name]
|
||||
const updated = reviver(dep) || dep
|
||||
data[updated.type] = data[updated.type] || {}
|
||||
data[updated.type][updated.name] = updated.range
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
dir,
|
||||
data,
|
||||
save,
|
||||
updateDeps
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadWorkspace (dir: string) {
|
||||
const workspacePkg = await loadPackage(dir)
|
||||
const pkgDirs = (await globby(['packages/*'], { onlyDirectories: true })).sort()
|
||||
|
||||
const packages: Package[] = []
|
||||
|
||||
for (const pkgDir of pkgDirs) {
|
||||
const pkg = await loadPackage(pkgDir)
|
||||
if (!pkg.data.name) { continue }
|
||||
packages.push(pkg)
|
||||
}
|
||||
|
||||
const find = (name: string) => {
|
||||
const pkg = packages.find(pkg => pkg.data.name === name)
|
||||
if (!pkg) {
|
||||
throw new Error('Workspace package not found: ' + name)
|
||||
}
|
||||
return pkg
|
||||
}
|
||||
|
||||
const rename = (from: string, to: string) => {
|
||||
find(from).data._name = find(from).data.name
|
||||
find(from).data.name = to
|
||||
for (const pkg of packages) {
|
||||
pkg.updateDeps((dep) => {
|
||||
if (dep.name === from && !dep.range.startsWith('npm:')) {
|
||||
dep.range = 'npm:' + to + '@' + dep.range
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const setVersion = (name: string, newVersion: string) => {
|
||||
find(name).data.version = newVersion
|
||||
for (const pkg of packages) {
|
||||
pkg.updateDeps((dep) => {
|
||||
if (dep.name === name) {
|
||||
dep.range = newVersion
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const save = () => Promise.all(packages.map(pkg => pkg.save()))
|
||||
|
||||
return {
|
||||
dir,
|
||||
workspacePkg,
|
||||
packages,
|
||||
save,
|
||||
find,
|
||||
rename,
|
||||
setVersion
|
||||
}
|
||||
}
|
@ -1,100 +1,7 @@
|
||||
import { promises as fsp } from 'node:fs'
|
||||
import { execSync } from 'node:child_process'
|
||||
import { $fetch } from 'ohmyfetch'
|
||||
import { resolve } from 'pathe'
|
||||
import { globby } from 'globby'
|
||||
import { inc } from 'semver'
|
||||
|
||||
interface Dep {
|
||||
name: string,
|
||||
range: string,
|
||||
type: string
|
||||
}
|
||||
|
||||
async function loadPackage (dir: string) {
|
||||
const pkgPath = resolve(dir, 'package.json')
|
||||
const data = JSON.parse(await fsp.readFile(pkgPath, 'utf-8').catch(() => '{}'))
|
||||
const save = () => fsp.writeFile(pkgPath, JSON.stringify(data, null, 2) + '\n')
|
||||
|
||||
const updateDeps = (reviver: (dep: Dep) => Dep | void) => {
|
||||
for (const type of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
||||
if (!data[type]) { continue }
|
||||
for (const e of Object.entries(data[type])) {
|
||||
const dep: Dep = { name: e[0], range: e[1] as string, type }
|
||||
delete data[type][dep.name]
|
||||
const updated = reviver(dep) || dep
|
||||
data[updated.type] = data[updated.type] || {}
|
||||
data[updated.type][updated.name] = updated.range
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
dir,
|
||||
data,
|
||||
save,
|
||||
updateDeps
|
||||
}
|
||||
}
|
||||
|
||||
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
|
||||
type Package = ThenArg<ReturnType<typeof loadPackage>>
|
||||
|
||||
async function loadWorkspace (dir: string) {
|
||||
const workspacePkg = await loadPackage(dir)
|
||||
const pkgDirs = (await globby(workspacePkg.data.workspaces || [], { onlyDirectories: true })).sort()
|
||||
|
||||
const packages: Package[] = []
|
||||
|
||||
for (const pkgDir of pkgDirs) {
|
||||
const pkg = await loadPackage(pkgDir)
|
||||
if (!pkg.data.name) { continue }
|
||||
packages.push(pkg)
|
||||
}
|
||||
|
||||
const find = (name: string) => {
|
||||
const pkg = packages.find(pkg => pkg.data.name === name)
|
||||
if (!pkg) {
|
||||
throw new Error('Workspace package not found: ' + name)
|
||||
}
|
||||
return pkg
|
||||
}
|
||||
|
||||
const rename = (from: string, to: string) => {
|
||||
find(from).data._name = find(from).data.name
|
||||
find(from).data.name = to
|
||||
for (const pkg of packages) {
|
||||
pkg.updateDeps((dep) => {
|
||||
if (dep.name === from && !dep.range.startsWith('npm:')) {
|
||||
dep.range = 'npm:' + to + '@' + dep.range
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const setVersion = (name: string, newVersion: string) => {
|
||||
find(name).data.version = newVersion
|
||||
for (const pkg of packages) {
|
||||
pkg.updateDeps((dep) => {
|
||||
if (dep.name === name) {
|
||||
dep.range = newVersion
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const save = () => Promise.all(packages.map(pkg => pkg.save()))
|
||||
|
||||
return {
|
||||
dir,
|
||||
workspacePkg,
|
||||
packages,
|
||||
save,
|
||||
find,
|
||||
rename,
|
||||
setVersion
|
||||
}
|
||||
}
|
||||
import { loadWorkspace } from './_utils'
|
||||
|
||||
async function main () {
|
||||
const workspace = await loadWorkspace(process.cwd())
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Restore all git changes
|
||||
git restore -s@ -SW -- packages examples
|
||||
|
||||
# Bump versions
|
||||
yarn lerna version --preid rc --no-changelog --exact --no-git-tag-version --no-push -m "chore: release rc"
|
||||
|
||||
# Stage
|
||||
git add --all
|
19
scripts/bump-rc.ts
Normal file
19
scripts/bump-rc.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { inc } from 'semver'
|
||||
import { loadWorkspace } from './_utils'
|
||||
|
||||
async function main () {
|
||||
const workspace = await loadWorkspace(process.cwd())
|
||||
|
||||
for (const pkg of workspace.packages.filter(p => !p.data.private)) {
|
||||
// TODO: Set release type based on changelog after 3.0.0
|
||||
const newVersion = inc(pkg.data.version, 'prerelease', 'rc')
|
||||
workspace.setVersion(pkg.data.name, newVersion!)
|
||||
}
|
||||
|
||||
await workspace.save()
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
3
scripts/example.sh
Executable file
3
scripts/example.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
pnpm --filter example-$2 $1
|
@ -6,17 +6,15 @@ set -xe
|
||||
git restore -s@ -SW -- packages examples
|
||||
|
||||
# Bump versions to edge
|
||||
yarn jiti ./scripts/bump-edge
|
||||
pnpm jiti ./scripts/bump-edge
|
||||
|
||||
# Resolve yarn
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
|
||||
pnpm i --frozen-lockfile=false
|
||||
|
||||
# Update token
|
||||
if [[ ! -z ${NODE_AUTH_TOKEN} ]] ; then
|
||||
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
|
||||
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
|
||||
echo "always-auth=true" >> ~/.npmrc
|
||||
echo "npmAuthToken: ${NODE_AUTH_TOKEN}" >> ~/.yarnrc.yml
|
||||
npm whoami
|
||||
fi
|
||||
|
||||
|
@ -6,7 +6,7 @@ set -e
|
||||
git restore -s@ -SW -- packages examples
|
||||
|
||||
# Build all once to ensure things are nice
|
||||
yarn build
|
||||
pnpm build
|
||||
|
||||
# Release packages
|
||||
for PKG in packages/* ; do
|
||||
|
3
test/fixtures/basic/package.json
vendored
3
test/fixtures/basic/package.json
vendored
@ -3,5 +3,8 @@
|
||||
"name": "fixture-bridge",
|
||||
"scripts": {
|
||||
"build": "nuxi build"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user