Skip to content

Commit

Permalink
fix: fix IE<=10 class static properties assign
Browse files Browse the repository at this point in the history
  • Loading branch information
imcuttle committed Apr 16, 2018
1 parent 1a982b7 commit 9bdfe9a
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 41 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 30 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@
"description": "View & Model are mixed now via react mobx.",
"scripts": {
"babel": "rimraf packages && babel srcPackages -d packages -D",
"rollup": "rimraf dist && rollup -c --silent",
"rollup": "rimraf dist && rollup -c --silent && babel dist/*.js --plugins=transform-proto-to-assign --no-babelrc -d .",
"watch": "npm run rollup -- -w",
"prepare": "run-p rollup babel",
"test:all": "npm run prepare && run-p test test:cy:run",
"test": "jest && npm run size",
"test:cy:ci":
"npm-run-all --race --parallel \"gojs:open -- -s -i binding.js\" \"cy:run -- --record --key {1}\" --",
"test:cy:ci": "npm-run-all --race --parallel \"gojs:open -- -s -i binding.js\" \"cy:run -- --record --key {1}\" --",
"test:cy:run": "run-p --race \"gojs -- -s\" cy:run",
"test:cy:open": "run-p gojs cy:open",
"gojs": "npm run gojs:open -- --noopen",
"gojs:open": "gojs examples -p 8001",
"cy:run": "cypress run",
"cy:open": "cypress open",
"clean-picidae":
"rimraf node_modules/picidae/node_modules/{react,react-dom,react-router,history}",
"clean-picidae": "rimraf node_modules/picidae/node_modules/{react,react-dom,react-router,history}",
"picidae": "picidae start -c _site/picidae.config.js",
"lint": "eslint ./src --fix",
"precommit": "lint-staged",
"commitmsg": "commitlint -e $GIT_PARAMS",
"changelog":
"conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"gen-release-note": "node scripts/gen-release-notes.js",
"preversion": "npm run test:all",
"version": "run-p changelog gen-release-note",
Expand All @@ -48,16 +45,26 @@
}
],
"lint-staged": {
"src/**/*.{js,jsx}": ["eslint --fix", "git add"]
"src/**/*.{js,jsx}": [
"eslint --fix",
"git add"
]
},
"main": "dist/react-mobx-vm.js",
"module": "dist/react-mobx-vm.es.js",
"jsnext:main": "dist/react-mobx-vm.es.js",
"cdn": "dist/react-mobx-vm.umd.min.js",
"unpkg": "dist/react-mobx-vm.umd.min.js",
"jsdelivr": "dist/react-mobx-vm.umd.min.js",
"files": ["dist", "packages"],
"keywords": ["imcuttle", "View & Model", "react-mobx-vm"],
"files": [
"dist",
"packages"
],
"keywords": [
"imcuttle",
"View & Model",
"react-mobx-vm"
],
"author": "imcuttle",
"license": "MIT",
"peerDependencies": {
Expand All @@ -77,6 +84,7 @@
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-proto-to-assign": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
Expand Down Expand Up @@ -128,8 +136,15 @@
"jest": {
"testEnvironment": "jsdom",
"setupTestFrameworkScriptFile": "<rootDir>/test/setup/react.js",
"collectCoverageFrom": ["src/**/*.js", "srcPackage/**/*.js"],
"coverageReporters": ["json", "text", "lcov"]
"collectCoverageFrom": [
"src/**/*.js",
"srcPackage/**/*.js"
],
"coverageReporters": [
"json",
"text",
"lcov"
]
},
"dependencies": {
"babel-runtime": "^6.26.0",
Expand All @@ -150,6 +165,8 @@
}
},
"commitlint": {
"extends": ["@commitlint/config-conventional"]
"extends": [
"@commitlint/config-conventional"
]
}
}
59 changes: 31 additions & 28 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@ const plugins = [
exclude: 'node_modules/**',
runtimeHelpers: true,
babelrc: false,
'presets': [
presets: [
[
'env',
{
'targets': {
'node': '6',
'browsers': ['ie>=9']
targets: {
node: '6',
browsers: ['ie>=9']
},
'loose': true,
'useBuiltIns': true,
'modules': false
loose: true,
useBuiltIns: true,
modules: false
}
],
'react'
],
'plugins': [
plugins: [
'external-helpers',
// 'add-module-exports',
[
'transform-react-jsx', {
'pragma': 'h'
'transform-react-jsx',
{
pragma: 'h'
}
],
'lodash',
Expand All @@ -57,10 +58,10 @@ const plugins = [
'transform-runtime',
{
helpers: false,
'polyfill': false,
'regenerator': true
polyfill: false,
regenerator: true
}
]
],
]
}),
resolve({
Expand All @@ -72,12 +73,7 @@ const plugins = [
filesize()
]

const external = [
'react',
'mobx',
'mobx-react',
'prop-types'
]
const external = ['react', 'mobx', 'mobx-react', 'prop-types']

export default [
{
Expand All @@ -103,9 +99,12 @@ export default [
name: 'reactMobxVM'
},
external,
plugins: plugins.concat(uglify(), replace({
'process.env.NODE_ENV': JSON.stringify('production')
})),
plugins: plugins.concat(
uglify(),
replace({
'process.env.NODE_ENV': JSON.stringify('production')
})
),
sourceMap: true
},
{
Expand All @@ -115,9 +114,11 @@ export default [
format: 'es'
},
external: id => {
return id.startsWith('babel-runtime')
|| id.startsWith('lodash')
|| ['qs'].concat(external).includes(id)
return (
id.startsWith('babel-runtime') ||
id.startsWith('lodash') ||
['qs'].concat(external).includes(id)
)
},
plugins,
sourceMap: true
Expand All @@ -129,9 +130,11 @@ export default [
format: 'cjs'
},
external: id => {
return id.startsWith('babel-runtime')
|| id.startsWith('lodash')
|| ['qs'].concat(external).includes(id)
return (
id.startsWith('babel-runtime') ||
id.startsWith('lodash') ||
['qs'].concat(external).includes(id)
)
},
plugins,
sourceMap: true
Expand Down

0 comments on commit 9bdfe9a

Please sign in to comment.