Unverified Commit 6e5ce3ba authored by Sendya's avatar Sendya

chore: fix dist build

parent ca937412
{
"env": {
"test": {
"presets": [
["env", { "targets": { "node": "current" } }]
],
"plugins": [
"transform-vue-jsx",
"transform-object-assign",
"transform-object-rest-spread",
"transform-class-properties",
"transform-runtime"
]
}
}
}
> 1%
last 2 versions
not ie <= 10
NODE_ENV=production
IS_ANALYZ=true
\ No newline at end of file
node_modules/
**/*.spec.*
**/style/
*.html
{
"root": true,
"env": {
"browser": true,
"node": true,
"jasmine": true,
"jest": true,
"es6": true
},
"parserOptions": {
"parser": "babel-eslint"
},
"extends": ["plugin:vue/strongly-recommended", "prettier"],
"rules": {
"no-var": "error",
"camelcase": "off",
"no-extra-boolean-cast": "off",
"semi": [2, "never", {"beforeStatementContinuationChars": "never"}],
"vue/require-prop-types": "off",
"vue/require-default-prop": "off",
"vue/no-reserved-keys": "off",
"vue/prop-name-casing": "off",
"vue/max-attributes-per-line": [
2,
{
"singleline": 20,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}
]
}
}
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/strongly-recommended',
'@vue/standard'
],
rules: {
// 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': 'off',
'no-debugger': 'off',
'generator-star-spacing': 'off',
'no-mixed-operators': 0,
'vue/max-attributes-per-line': [
2,
{
'singleline': 5,
'multiline': {
'max': 1,
'allowFirstLine': false
}
}
],
'vue/attribute-hyphenation': 0,
'vue/html-self-closing': 0,
'vue/component-name-in-template-casing': 0,
'vue/html-closing-bracket-spacing': 0,
'vue/singleline-html-element-content-newline': 0,
'vue/no-unused-components': 0,
'vue/multiline-html-element-content-newline': 0,
'vue/no-use-v-if-with-v-for': 0,
'vue/html-closing-bracket-newline': 0,
'vue/no-parsing-error': 0,
'no-tabs': 0,
'quotes': [
2,
'single',
{
'avoidEscape': true,
'allowTemplateLiterals': true
}
],
'semi': [
2,
'never',
{
'beforeStatementContinuationChars': 'never'
}
],
'no-delete-var': 2,
'prefer-const': [
2,
{
'ignoreReadBeforeAssign': false
}
]
},
parserOptions: {
parser: 'babel-eslint'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
]
}
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# See https://help.github.com/ignore-files/ for more about ignoring files.
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
# dependencies
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# testing
/coverage
# Optional REPL history
.node_repl_history
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
# Output of 'npm pack'
*.tgz
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json*
# Yarn Integrity file
.yarn-integrity
# IDE
/.idea
# dotenv environment variables file
.env
lib/
es/
dist/
build/
.vscode
# next.js build output
.next
# publish
*.tgz
\ No newline at end of file
const libDir = process.env.LIB_DIR;
const transformIgnorePatterns = [
'/dist/', 'node_modules\/[^/]+?\/(?!(es|node_modules)\/)', // Ignore modules without es dir
];
module.exports = {
testURL: 'http://localhost/',
moduleFileExtensions: [
"js",
"jsx",
"json",
"vue",
],
modulePathIgnorePatterns: ['/_site/'],
testPathIgnorePatterns: [
'/node_modules/', 'node'
],
transform: {
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest",
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest"
},
testRegex: libDir === 'dist'
? 'demo\\.test\\.js$'
: '.*\\.test\\.js$',
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
snapshotSerializers: ["<rootDir>/node_modules/jest-serializer-vue"],
collectCoverage: process.env.COVERAGE === 'true',
collectCoverageFrom: [
"src/**/*.{js,jsx,vue}",
],
transformIgnorePatterns
};
**/*.svg
package.json
lib/
es/
dist/
_site/
coverage/
CNAME
LICENSE
yarn.lock
netlify.toml
yarn-error.log
*.sh
*.snap
.gitignore
.npmignore
.prettierignore
.DS_Store
.editorconfig
.eslintignore
**/*.yml
.gitattributes
.stylelintrc
.vcmrc
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"proseWrap": "never",
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
]
}
MIT License
Copyright (c) 2019 vueComponent
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[English](./README.md) | 简体中文
<h1 align="center">Ant Design Pro Layout</h1>
## 使用
```bash
npm i @ant-design-vue/pro-layout --save
// or
yarn add @ant-design-vue/pro-layout
```
```jsx
import ProLayout from '@ant-design-vue/pro-layout'
export default {
name: 'BasicLayout',
render () {
return (
<ProLayout>
<router-view />
</ProLayout>
)
}
}
```
## API
### ProLayout
| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| title | layout in the upper left corner title | VNode \| String | `'Ant Design Pro'` |
| logo | layout top left logo url | VNode \| render | - |
| layout | layout menu mode, sidemenu: right navigation, topmenu: top navigation | 'sidemenu' \| 'topmenu' | `'sidemenu'` |
| contentWidth | content mode of layout, Fluid: fixed width 1200px, Fixed: adaptive | true \| false | `false` |
| theme | Navigation menu theme | 'light' \| 'dark' | `'dark'` |
| menus | vue-router `routes` prop | Object | `[{}]` |
| collapsed | control menu's collapse and expansion | boolean | true |
| handleCollapse | folding collapse event of menu | (collapsed: boolean) => void | - |
| headerRender | custom header render method | (props: BasicLayoutProps) => VNode | - |
| rightContentRender | header right content render method | (props: HeaderViewProps) => VNode | - |
| collapsedButtonRender | custom collapsed button method | (collapsed: boolean) => VNode | - |
> 由于文档正在编写,可能与实际 API 不一致,如需请参考 `/example/` 下例子
const plugins = []
// lazy load ant-design-vue
// if your use import on Demand, Use this code
plugins.push(['import', {
'libraryName': 'ant-design-vue',
'libraryDirectory': 'es',
'style': true // `style: true` 会加载 less 文件
}])
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
[
'@babel/preset-env',
{
'useBuiltIns': 'entry',
'corejs': 3
}
]
],
plugins
}
module.exports = {
preset: '@vue/cli-plugin-unit-jest'
}
{
"name": "@ant-design-vue/pro-layout",
"version": "0.1.1",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"analyz": "vue-cli-service build --mode analyz"
},
"main": "./src/index.js",
"author": "vueComponent",
"repository": {
"type": "git",
"url": "https://github.com/vueComponent/pro-layout"
},
"license":"MIT",
"dependencies": {
"ant-design-vue": "^1.4.4",
"core-js": "^3.1.2",
"umi-request": "^1.2.8",
"vue": "^2.6.10",
"vue-container-query": "^0.1.0",
"vue-i18n": "^8.15.0",
"vue-ls": "^3.2.1",
"vue-router": "^3.0.6",
"vue-svg-component-runtime": "^1.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.0.0",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-plugin-router": "^4.0.0",
"@vue/cli-plugin-unit-jest": "^4.0.0",
"@vue/cli-plugin-vuex": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.1",
"babel-plugin-import": "^1.12.2",
"eslint": "^5.16.0",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-vue": "^5.0.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"vue-svg-icon-loader": "^2.1.1",
"vue-template-compiler": "^2.6.10",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-theme-color-replacer": "^1.3.2"
}
"name": "@ant-design-vue/pro-layout",
"version": "0.1.1-beta",
"main": "./lib/index.js",
"module": "./es/index.js",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/vueComponent/pro-layout"
},
"contributors": [
"tangjinzhou <415800467@qq.com>",
"Sendya <yladmxa@gmail.com>"
],
"license": "MIT",
"scripts": {
"cleanup": "./scripts/cleanup.sh",
"start": "vc-tools run server",
"lint": "eslint -c ./.eslintrc --fix --ext .jsx,.js,.vue ./src",
"compile": "vc-tools run compile --babel-runtime",
"test": "cross-env NODE_ENV=test jest --config .jest.js",
"prepublishOnly": "npm run lint && npm run test && npm run compile && np --no-cleanup --yolo --no-publish"
},
"files": [
"es",
"lib"
],
"peerDependencies": {
"vue": ">=2.5.0",
"vue-template-compiler": ">=2.5.0"
},
"devDependencies": {
"@types/jest": "^24.0.17",
"@types/node": "^10.5.5",
"@types/vue": "^2.0.0",
"@vue/server-test-utils": "1.0.0-beta.16",
"@vue/test-utils": "1.0.0-beta.16",
"babel-core": "^6.26.3",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-runtime": "^6.26.0",
"cross-env": "^5.2.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-vue": "^5.2.3",
"jest": "^23.4.2",
"jest-serializer-vue": "^2.0.2",
"np": "^5.1.1",
"prettier": "^1.18.2",
"vc-tools": "^1.0.0",
"vue": ">=2.5.0",
"vue-jest": "^2.5.0",
"vue-template-compiler": ">=2.5.0"
},
"dependencies": {
"ant-design-vue": "^1.4.6",
"classnames": "^2.2.6",
"insert-css": "^2.0.0",
"lodash": "^4.17.15",
"umi-request": "^1.2.11",
"vue-container-query": "^0.1.0"
},
"config": {
"port": 9528,
"entry": {
"@ant-design-vue/pro-layout": [
"./src/index.js"
]
}
},
"description": "<h1 align=\"center\"> Ant Design Vue Pro Layout </h1>"
}
module.exports = {
plugins: {
autoprefixer: {}
}
}
import { PageHeaderWrapper } from '@/components'
import { PageHeaderWrapper } from './components'
const PageView = {
name: 'PageView',
render () {
return (
<PageHeaderWrapper>
<route-view />
<router-view />
</PageHeaderWrapper>
)
}
......
......@@ -38,7 +38,8 @@ const DocumentTitle = {
required: true
}
},
// eslint-disable-next-line // { props, data, children }
// { props, data, children }
// eslint-disable-next-line
render (createElement, { props, data, children }) {
handleStateChange(props.title, props.prefix)
return children
......
......@@ -15,7 +15,7 @@ export const themeColor = {
return lightens.concat(colorPalettes).concat(rgb)
},
changeColor (newColor) {
var options = {
let options = {
newColors: this.getAntdSerials(newColor), // new colors array, one-to-one corresponde with `matchColors`
changeUrl (cssUrl) {
return `/${cssUrl}` // while router is not `hash` mode, it needs absolute path
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`BlockLayout should render BlockLayout 1`] = `<div><span>demo</span></div>`;
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BlockLayout from '../src/BlockLayout'
describe('BlockLayout', () => {
it('should render BlockLayout', () => {
const wrapper = mount({
render () {
return (
<div>
<BlockLayout>
<span>demo</span>
</BlockLayout>
</div>
)
}
})
expect(wrapper).toMatchSnapshot()
})
})
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/HelloWorld.vue'
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message'
const wrapper = shallowMount(HelloWorld, {
propsData: { msg }
})
expect(wrapper.text()).toMatch(msg)
})
})
const path = require('path')
const { IgnorePlugin } = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const dynamicThemePlugin = require('./config/dynamicTheme.js')
const isProd = process.env.NODE_ENV === 'production'
const isAnalyz = process.env.IS_ANALYZ === 'true'
function resolve (dir) {
return path.join(__dirname, dir)
}
const assetsCDN = {
externals: {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios'
},
assets: {
css: [],
// https://unpkg.com/browse/vue@2.6.10/
js: [
'//cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js',
'//cdn.jsdelivr.net/npm/vue-router@3.1.3/dist/vue-router.min.js',
'//cdn.jsdelivr.net/npm/vuex@3.1.1/dist/vuex.min.js',
'//cdn.jsdelivr.net/npm/axios@0.19.0/dist/axios.min.js'
]
}
}
// vue.config
const defaultConfig = {
configureWebpack: {
plugins: [
// Ignore all locale files of moment.js
new IgnorePlugin(/^\.\/locale$/, /moment$/)
],
resolve: {
alias: {
'@ant-design/icons/lib/dist$': resolve('./example/src/core/antd/icons.js')
}
},
externals: isProd ? assetsCDN.externals : {}
},
chainWebpack: (config) => {
config.entry('app').clear().add('./example/src/main.js')
config.resolve.alias
.set('@config', resolve('./config'))
.set('@example', resolve('./example/src'))
// if `production` env require on cdn assets
isProd && config.plugin('html').tap(args => {
args[0].cdn = assetsCDN.assets
return args
})
// if `IS_ANALYZ` env is TRUE on report bundle info
isAnalyz && config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule.oneOf('inline')
.resourceQuery(/inline/)
.use('vue-svg-icon-loader')
.loader('vue-svg-icon-loader')
.end()
.end()
.oneOf('external')
.use('file-loader')
.loader('file-loader')
.options({
name: 'assets/[name].[hash:8].[ext]'
})
},
css: {
loaderOptions: {
less: {
modifyVars: {
// less vars,customize ant design theme
// 'primary-color': '#F5222D',
// 'link-color': '#F5222D',
// 'border-radius-base': '4px'
},
// DO NOT REMOVE THIS LINE
javascriptEnabled: true
}
}
},
devServer: {
// development server port 8000
port: 8000
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
// proxy: {
// '/api': {
// target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
// ws: false,
// changeOrigin: true
// }
// }
},
// disable source map in production
productionSourceMap: false,
lintOnSave: undefined,
// babel-loader no-ignore node_modules/*
transpileDependencies: []
}
if (!isProd) {
defaultConfig.configureWebpack.plugins.push(dynamicThemePlugin())
}
module.exports = defaultConfig
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment