Skip to content

Commit

Permalink
Merge pull request ElemeFE#37 from QingWei-Li/master
Browse files Browse the repository at this point in the history
Update config, default require commonjs package
  • Loading branch information
Leopoldthecoder authored Sep 9, 2016
2 parents d3d2e62 + 6da89b1 commit c30003d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 31 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
- 修复 Table 中被固定列的高度不与其他列的高度协调的问题
- 修复 Time Picker 的 `picker-options` 属性
- 修复一些组件图标丢失的问题
- 修复远程搜索的 Select 在 Form 中的显示问题
- 修复 远程搜索的 Select 在 Form 中的显示问题
- 修复 Input Number 输入小数和非数字值时的问题
- 修复 Select 选中 value 为 0 的值时绑定值不更新的问题
- 优化 增加打包成 commonjs 且不压缩的文件,默认引入 commonjs

#### 非兼容性更新
- Menu 组件 `mode` 属性默认值修改为 `vertical`
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "element-ui",
"version": "1.0.0-rc.1",
"description": "A Component Library for Vue.js.",
"main": "lib/index.js",
"main": "lib/element-ui.common.js",
"files": [
"lib",
"src"
],
"scripts": {
"dev": "npm i && (node bin/iconInit.js & node bin/build-entry.js) && cooking watch -c scripts/cooking.demo.js",
"dist": "del -f lib && cooking build -c scripts/cooking.conf.js -p && cooking build -c scripts/cooking.component.js -p && npm run build:theme",
"dist": "del -f lib && cooking build -c scripts/cooking.conf.js,scripts/cooking.common.js -p && cooking build -c scripts/cooking.component.js -p && npm run build:theme",
"dist:all": "node bin/build-all.js && npm run build:theme",
"build:theme": "gulp build --gulpfile packages/theme-default/gulpfile.js && cp-cli packages/theme-default/lib lib/theme-default",
"deploy": "cooking build -c scripts/cooking.demo.js -p",
Expand Down
4 changes: 2 additions & 2 deletions packages/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
}
},
width: String,
width: [String, Number],
height: String,
height: [String, Number],
fit: {
type: Boolean,
Expand Down
21 changes: 21 additions & 0 deletions scripts/cooking.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var cooking = require('cooking');
var path = require('path');

cooking.set({
entry: './src/index.js',
dist: './lib',
clean: false,
format: 'cjs',
extends: ['vue2'],
minimize: false,
alias: {
main: path.join(__dirname, '../src'),
packages: path.join(__dirname, '../packages'),
examples: path.join(__dirname, '../examples')
},
externals: { vue: 'vue' }
});

cooking.add('output.filename', 'element-ui.common.js');
cooking.add('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);
module.exports = cooking.resolve();
16 changes: 7 additions & 9 deletions scripts/cooking.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ cooking.set({
dist: './lib',
clean: false,
format: 'cjs',
extractCSS: '[name]/style.css',
extends: ['vue2']
extends: ['vue2'],
minimize: false,
alias: {
main: path.join(__dirname, '../src'),
packages: path.join(__dirname, '../packages'),
examples: path.join(__dirname, '../examples')
}
});

cooking.add('output.filename', '[name]/index.js');

cooking.add('resolve.alias', {
'main': path.join(__dirname, '../src'),
'packages': path.join(__dirname, '../packages'),
'examples': path.join(__dirname, '../examples')
});

var externals = {};
Object.keys(Components).forEach(function(key) {
externals[`packages/${key}/index.js`] = `element-ui/lib/${key}`;
Expand All @@ -46,5 +45,4 @@ cooking.add('externals', Object.assign({
}, externals));

cooking.add('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);

module.exports = cooking.resolve();
31 changes: 14 additions & 17 deletions scripts/cooking.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@ cooking.set({
clean: false,
format: 'umd',
moduleName: 'ELEMENT',
extractCSS: 'style.css',
extends: ['vue2']
extends: ['vue2'],
alias: {
main: path.join(__dirname, '../src'),
packages: path.join(__dirname, '../packages'),
examples: path.join(__dirname, '../examples')
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
}
});

cooking.add('output.filename', 'index.js');

cooking.add('resolve.alias', {
'main': path.join(__dirname, '../src'),
'packages': path.join(__dirname, '../packages'),
'examples': path.join(__dirname, '../examples')
});

cooking.add('externals.vue', {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
});

cooking.add('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);

module.exports = cooking.resolve();

0 comments on commit c30003d

Please sign in to comment.