mirror of https://github.com/vuejs/core.git
workflow: update paths for private packages in `dev` script (#11668)
This commit is contained in:
parent
334d47ddf3
commit
38fe300abb
|
@ -32,7 +32,7 @@
|
||||||
"dev-sfc-serve": "vite packages-private/sfc-playground --host",
|
"dev-sfc-serve": "vite packages-private/sfc-playground --host",
|
||||||
"dev-sfc-run": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime\" \"dev vue -ipf esm-browser-runtime\" \"dev server-renderer -if esm-bundler\" dev-sfc-serve",
|
"dev-sfc-run": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime\" \"dev vue -ipf esm-browser-runtime\" \"dev server-renderer -if esm-bundler\" dev-sfc-serve",
|
||||||
"serve": "serve",
|
"serve": "serve",
|
||||||
"open": "open http://localhost:3000/packages/template-explorer/local.html",
|
"open": "open http://localhost:3000/packages-private/template-explorer/local.html",
|
||||||
"build-sfc-playground": "run-s build-all-cjs build-runtime-esm build-browser-esm build-ssr-esm build-sfc-playground-self",
|
"build-sfc-playground": "run-s build-all-cjs build-runtime-esm build-browser-esm build-ssr-esm build-sfc-playground-self",
|
||||||
"build-all-cjs": "node scripts/build.js vue runtime compiler reactivity shared -af cjs",
|
"build-all-cjs": "node scripts/build.js vue runtime compiler reactivity shared -af cjs",
|
||||||
"build-runtime-esm": "node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime",
|
"build-runtime-esm": "node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime",
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// smaller files and provides better tree-shaking.
|
// smaller files and provides better tree-shaking.
|
||||||
|
|
||||||
import esbuild from 'esbuild'
|
import esbuild from 'esbuild'
|
||||||
|
import fs from 'node:fs'
|
||||||
import { dirname, relative, resolve } from 'node:path'
|
import { dirname, relative, resolve } from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import { createRequire } from 'node:module'
|
import { createRequire } from 'node:module'
|
||||||
|
@ -52,11 +53,17 @@ const postfix = format.endsWith('-runtime')
|
||||||
? `runtime.${format.replace(/-runtime$/, '')}`
|
? `runtime.${format.replace(/-runtime$/, '')}`
|
||||||
: format
|
: format
|
||||||
|
|
||||||
|
const privatePackages = fs.readdirSync('packages-private')
|
||||||
|
|
||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
const pkg = require(`../packages/${target}/package.json`)
|
const pkgBase = privatePackages.includes(target)
|
||||||
|
? `packages-private`
|
||||||
|
: `packages`
|
||||||
|
const pkgBasePath = `../${pkgBase}/${target}`
|
||||||
|
const pkg = require(`${pkgBasePath}/package.json`)
|
||||||
const outfile = resolve(
|
const outfile = resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
`../packages/${target}/dist/${
|
`${pkgBasePath}/dist/${
|
||||||
target === 'vue-compat' ? `vue` : target
|
target === 'vue-compat' ? `vue` : target
|
||||||
}.${postfix}.${prod ? `prod.` : ``}js`,
|
}.${postfix}.${prod ? `prod.` : ``}js`,
|
||||||
)
|
)
|
||||||
|
@ -122,7 +129,7 @@ for (const target of targets) {
|
||||||
|
|
||||||
esbuild
|
esbuild
|
||||||
.context({
|
.context({
|
||||||
entryPoints: [resolve(__dirname, `../packages/${target}/src/index.ts`)],
|
entryPoints: [resolve(__dirname, `${pkgBasePath}/src/index.ts`)],
|
||||||
outfile,
|
outfile,
|
||||||
bundle: true,
|
bundle: true,
|
||||||
external,
|
external,
|
||||||
|
|
Loading…
Reference in New Issue