فهرست منبع

build: remove lerna

Evan You 6 سال پیش
والد
کامیت
cd5ba7cfcc
8فایلهای تغییر یافته به همراه37 افزوده شده و 929 حذف شده
  1. 20 3
      .github/contributing.md
  2. 1 3
      jest.config.js
  3. 0 5
      lerna.json
  4. 4 2
      package.json
  5. 0 6
      packages/runtime-core/__tests__/version.spec.ts
  6. 2 2
      rollup.config.js
  7. 2 2
      scripts/bootstrap.js
  8. 8 906
      yarn.lock

+ 20 - 3
.github/contributing.md

@@ -51,7 +51,6 @@ A high level overview of tools used:
 - [Rollup](https://rollupjs.org) for bundling
 - [Jest](https://jestjs.io/) for unit testing
 - [Prettier](https://prettier.io/) for code formatting
-- [Lerna](https://github.com/lerna/lerna) for monorepo management
 
 ## Scripts
 
@@ -134,7 +133,7 @@ $ yarn test fileName -t 'test name'
 
 ## Project Structure
 
-This project uses a [monorepo](https://github.com/lerna/lerna#about) structure and contains the following packages:
+This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) setup which hosts a number of associated packages under the `packages` directory:
 
 - `reactivity`: The reactivity system. It can be used standalone as a framework-agnostic package.
 
@@ -158,12 +157,30 @@ This project uses a [monorepo](https://github.com/lerna/lerna#about) structure a
 
 - `vue`: The public facing "full build" which includes both the runtime AND the compiler.
 
-Note that when importing these packages, the `@vue/` prefix is needed:
+### Importing Packages
+
+The packages can import each other directly using their package names. Note that when importing a package, the name listed in its `package.json` should be used. Most of the time the `@vue/` prefix is needed:
 
 ``` js
 import { h } from '@vue/runtime-core'
 ```
 
+This is made possible via several configurations:
+
+- For TypeScript, `compilerOptions.path` in `tsconfig.json`
+- For Jest, `moduleNameMapping` in `jest.config.js`
+- For plain Node.js, they are linked using [Yarn Workspaces](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).
+
+### Package Dependencies
+
+There are some rules to follow when importing across package boundaries:
+
+- Never use direct relative paths when importing items from another package - export it in the source package and import it at the package level.
+
+- Compiler packages should not import items from the runtime, and vice versa. If something needs to be shared between the compiler-side and runtime-side, it should be extracted into `@vue/shared` instead.
+
+- If a package (A) has a non-type import from another package (B), package (B) should be listed as a dependency in the `package.json` of package (A). This is because the packages are externalized in the ESM-bundler/CJS builds and type declaration files, so the dependency packages must be actually installed as a dependency when consumed from package registries.
+
 ## Contributing Tests
 
 Unit tests are collocated with the code being tested in each package, inside directories named `__tests__`. Consult the [Jest docs](https://jestjs.io/docs/en/using-matchers) and existing test cases for how to write new test specs. Here are some additional guidelines:

+ 1 - 3
jest.config.js

@@ -1,11 +1,9 @@
-const lernaJson = require('./lerna.json')
-
 module.exports = {
   preset: 'ts-jest',
   globals: {
     __DEV__: true,
     __TEST__: true,
-    __VERSION__: lernaJson.version,
+    __VERSION__: require('./package.json').version,
     __BROWSER__: false,
     __RUNTIME_COMPILE__: true,
     __FEATURE_OPTIONS__: true,

+ 0 - 5
lerna.json

@@ -1,5 +0,0 @@
-{
-  "npmClient": "yarn",
-  "useWorkspaces": true,
-  "version": "3.0.0-alpha.1"
-}

+ 4 - 2
package.json

@@ -1,5 +1,6 @@
 {
   "private": true,
+  "version": "3.0.0-alpha.1",
   "workspaces": [
     "packages/*"
   ],
@@ -11,7 +12,8 @@
     "size": "yarn size-runtime && yarn size-compiler",
     "lint": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
     "test": "node scripts/build.js vue -f global -d && jest",
-    "test-dts": "node scripts/build.js reactivity runtime-core runtime-dom -t -f esm && tsd"
+    "test-dts": "node scripts/build.js reactivity runtime-core runtime-dom -t -f esm && tsd",
+    "release": "node scripts/release.js"
   },
   "types": "test-dts/index.d.ts",
   "tsd": {
@@ -39,10 +41,10 @@
     "@types/puppeteer": "^2.0.0",
     "brotli": "^1.3.2",
     "chalk": "^2.4.2",
+    "enquirer": "^2.3.2",
     "execa": "^2.0.4",
     "fs-extra": "^8.1.0",
     "jest": "^24.9.0",
-    "lerna": "^3.16.4",
     "lint-staged": "^9.2.3",
     "minimist": "^1.2.0",
     "prettier": "~1.14.0",

+ 0 - 6
packages/runtime-core/__tests__/version.spec.ts

@@ -1,6 +0,0 @@
-import { version } from '../src'
-import lernaJson from '../../../lerna.json'
-
-test('version', () => {
-  expect(version).toBe(lernaJson.version)
-})

+ 2 - 2
rollup.config.js

@@ -3,12 +3,12 @@ import path from 'path'
 import ts from 'rollup-plugin-typescript2'
 import replace from '@rollup/plugin-replace'
 import json from '@rollup/plugin-json'
-import lernaJson from './lerna.json'
 
 if (!process.env.TARGET) {
   throw new Error('TARGET package must be specified via --environment flag.')
 }
 
+const masterVersion = require('./package.json').version
 const packagesDir = path.resolve(__dirname, 'packages')
 const packageDir = path.resolve(packagesDir, process.env.TARGET)
 const name = path.basename(packageDir)
@@ -137,7 +137,7 @@ function createReplacePlugin(
 ) {
   return replace({
     __COMMIT__: `"${process.env.COMMIT}"`,
-    __VERSION__: `"${lernaJson.version}"`,
+    __VERSION__: `"${masterVersion}"`,
     __DEV__: isBundlerESMBuild
       ? // preserve to be handled by bundlers
         `(process.env.NODE_ENV !== 'production')`

+ 2 - 2
scripts/bootstrap.js

@@ -3,7 +3,7 @@
 const args = require('minimist')(process.argv.slice(2))
 const fs = require('fs')
 const path = require('path')
-const baseVersion = require('../lerna.json').version
+const version = require('../package.json').version
 
 const packagesDir = path.resolve(__dirname, '../packages')
 const files = fs.readdirSync(packagesDir)
@@ -26,7 +26,7 @@ files.forEach(shortName => {
   if (args.force || !pkgExists) {
     const json = {
       name,
-      version: baseVersion,
+      version,
       description: name,
       main: 'index.js',
       module: `dist/${shortName}.esm-bundler.js`,

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 8 - 906
yarn.lock


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است