Browse Source

build: 打包区分 cjs 和 ems

master
suanmei 5 years ago
committed by 拾邑
parent
commit
355cc3bb05
  1. 12
      .babelrc
  2. 2
      lerna.json
  3. 5518
      package-lock.json
  4. 12
      package.json
  5. 48
      packages/core/package-lock.json
  6. 14
      packages/core/package.json
  7. 10
      packages/core/rollup.config.js
  8. 2
      packages/core/tsconfig.json
  9. 13
      rollup.config.js
  10. 3
      tsconfig.json

12
.babelrc

@ -1,5 +1,15 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/typescript"],
"presets": [
[
"@babel/preset-env",
{
"loose": true,
"modules": false
}
],
"@babel/preset-react",
"@babel/typescript"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",

2
lerna.json

@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "0.1.5"
"version": "0.1.8"
}

5518
package-lock.json

File diff suppressed because it is too large

12
package.json

@ -15,6 +15,10 @@
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.9.0",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-strip": "^1.3.2",
"@rollup/plugin-url": "^4.0.2",
"@svgr/rollup": "^5.3.1",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
@ -31,14 +35,14 @@
"prettier": "^2.0.4",
"rollup": "^2.6.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-size-snapshot": "^0.11.0",
"rollup-plugin-strip": "^1.2.2",
"rollup-plugin-url": "^3.0.1",
"typescript": "^3.8.3"
},
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime-corejs3": "^7.9.2",
"@imove/core": "^0.1.6",
"core-js": "^3.6.5",
"ora": "^4.0.3"
}
}

48
packages/core/package-lock.json

@ -1,19 +1,19 @@
{
"name": "@imove/core",
"version": "0.1.5",
"version": "0.1.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/prop-types": {
"version": "15.7.3",
"resolved": "https://registry.npm.taobao.org/@types/prop-types/download/@types/prop-types-15.7.3.tgz",
"integrity": "sha1-KrDV2i5YFflLC51LldHl8kOrLKc=",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==",
"dev": true
},
"@types/react": {
"version": "16.9.34",
"resolved": "https://registry.npm.taobao.org/@types/react/download/@types/react-16.9.34.tgz?cache=0&sync_timestamp=1586464409519&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Freact%2Fdownload%2F%40types%2Freact-16.9.34.tgz",
"integrity": "sha1-99XjMcRo9Tr/7ReopNSIzUTqk0k=",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.34.tgz",
"integrity": "sha512-8AJlYMOfPe1KGLKyHpflCg5z46n0b5DbRfqDksxBLBTUpB75ypDBAO9eCUcjNwE6LCUslwTz00yyG/X9gaVtow==",
"dev": true,
"requires": {
"@types/prop-types": "*",
@ -22,39 +22,39 @@
},
"csstype": {
"version": "2.6.10",
"resolved": "https://registry.npm.taobao.org/csstype/download/csstype-2.6.10.tgz?cache=0&sync_timestamp=1586935655811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcsstype%2Fdownload%2Fcsstype-2.6.10.tgz",
"integrity": "sha1-5jr1DmbXwmbttrMpCc/Qqr4Dkos=",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.10.tgz",
"integrity": "sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==",
"dev": true
},
"fsevents": {
"version": "2.1.2",
"resolved": "https://registry.npm.taobao.org/fsevents/download/fsevents-2.1.2.tgz",
"integrity": "sha1-TAofs0vGjlQ7S4Kp7Dkr+9qECAU=",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
"dev": true,
"optional": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz",
"integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk="
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npm.taobao.org/loose-envify/download/loose-envify-1.4.0.tgz",
"integrity": "sha1-ce5R+nvkyuwaY4OffmgtgTLTDK8=",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"requires": {
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"prop-types": {
"version": "15.7.2",
"resolved": "https://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz",
"integrity": "sha1-UsQedbjIfnK52TYOAga5ncv/psU=",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
"requires": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
@ -63,8 +63,8 @@
},
"react": {
"version": "16.13.1",
"resolved": "https://registry.npm.taobao.org/react/download/react-16.13.1.tgz?cache=0&sync_timestamp=1586484496963&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact%2Fdownload%2Freact-16.13.1.tgz",
"integrity": "sha1-LoGIIvGpdDEiwGPWQQ2FweOv5I4=",
"resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz",
"integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==",
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
@ -73,13 +73,13 @@
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npm.taobao.org/react-is/download/react-is-16.13.1.tgz?cache=0&sync_timestamp=1586484576689&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-is%2Fdownload%2Freact-is-16.13.1.tgz",
"integrity": "sha1-eJcppNw23imZ3BVt1sHZwYzqVqQ="
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"rollup": {
"version": "2.6.1",
"resolved": "https://registry.npm.taobao.org/rollup/download/rollup-2.6.1.tgz",
"integrity": "sha1-g1TmfKp7i/JMJIjZ4vZNor5i7r4=",
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.7.1.tgz",
"integrity": "sha512-c1FCjY8HK1nAq0bTZHaR72ZknpP7p0EjxbcVc6BcmtOosurK//P5jtwxX+f/4fgtbrjczqf0uvR+EdtxpriE8g==",
"dev": true,
"requires": {
"fsevents": "~2.1.2"

14
packages/core/package.json

@ -1,6 +1,6 @@
{
"name": "@imove/core",
"version": "0.1.5",
"version": "0.1.8",
"description": "流程编排",
"keywords": [
"imove",
@ -10,7 +10,8 @@
"author": "suanmei <mr_suanmei@163.com>",
"homepage": "https://github.com/suanmei/iMove#readme",
"license": "MIT",
"main": "lib/core.js",
"main": "dist/core.common.js",
"module": "dist/core.esm.js",
"directories": {
"lib": "lib",
"test": "__tests__"
@ -19,8 +20,7 @@
"lib"
],
"publishConfig": {
"access": "public",
"registry": "http://registry.npmjs.org/"
"access": "public"
},
"repository": {
"type": "git",
@ -28,12 +28,14 @@
},
"scripts": {
"prepublishOnly": "node scripts/prepublishOnly.js",
"declare-type": "tsc --emitDeclarationOnly",
"build": "rollup -c & npm run declare-type"
"build": "rollup -c"
},
"bugs": {
"url": "https://github.com/suanmei/iMove/issues"
},
"dependencies": {
"react": "^16.13.1"
},
"devDependencies": {
"@types/react": "^16.9.34",
"rollup": "^2.6.1"

10
packages/core/rollup.config.js

@ -2,5 +2,15 @@ import rollupBaseConfig from '../../rollup.config';
import pkg from './package.json';
export default Object.assign(rollupBaseConfig, {
output: [
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
},
],
external: Object.keys(pkg.peerDependencies),
});

2
packages/core/tsconfig.json

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib/types"
"outDir": "dist/types"
},
"include": ["./src"]
}

13
rollup.config.js

@ -1,9 +1,9 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import strip from '@rollup/plugin-strip';
import url from '@rollup/plugin-url';
import babel from 'rollup-plugin-babel';
import url from 'rollup-plugin-url';
import svgr from '@svgr/rollup';
import strip from 'rollup-plugin-strip';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
const input = './src/index.tsx';
@ -11,11 +11,6 @@ const extensions = ['.js', '.jsx', '.ts', '.tsx'];
export default {
input,
output: {
file: 'lib/index.js',
format: 'cjs',
sourcemap: true,
},
plugins: [
resolve({ extensions }),
commonjs(),

3
tsconfig.json

@ -1,8 +1,7 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5",
"lib": ["dom", "esnext"],
"target": "esnext",
"module": "commonjs",
"allowJs": false,
"jsx": "react",

Loading…
Cancel
Save