mirror of https://github.com/ElemeFE/element
parent
7abe758878
commit
5ff24db2ff
|
@ -1,2 +1,5 @@
|
|||
popper.js
|
||||
fecha.js
|
||||
release.sh
|
||||
node_modules
|
||||
lib
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const components = require('../components.json');
|
||||
const components = require('../../components.json');
|
||||
const execSync = require('child_process').execSync;
|
||||
const existsSync = require('fs').existsSync;
|
||||
const path = require('path');
|
||||
|
@ -11,10 +11,10 @@ delete components.index;
|
|||
delete components.font;
|
||||
|
||||
Object.keys(components).forEach(key => {
|
||||
const filePath = path.join(__dirname, `../packages/${key}/cooking.conf.js`);
|
||||
const filePath = path.join(__dirname, `../../packages/${key}/cooking.conf.js`);
|
||||
|
||||
if (existsSync(filePath)) {
|
||||
componentPaths.push(`packages/${key}/cooking.conf.js`);
|
||||
componentPaths.push(`../packages/${key}/cooking.conf.js`);
|
||||
}
|
||||
});
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
var Components = require('../components.json');
|
||||
var Components = require('../../components.json');
|
||||
var fs = require('fs');
|
||||
var render = require('json-templater/string');
|
||||
var uppercamelcase = require('uppercamelcase');
|
||||
var path = require('path');
|
||||
|
||||
var OUTPUT_PATH = path.join(__dirname, '../src/index.js');
|
||||
var OUTPUT_PATH = path.join(__dirname, '../../src/index.js');
|
||||
var IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}/index.js\';';
|
||||
var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});';
|
||||
var MAIN_TEMPLATE = `{{include}}
|
||||
|
@ -65,7 +65,7 @@ ComponentNames.forEach(name => {
|
|||
var template = render(MAIN_TEMPLATE, {
|
||||
include: includeComponentTemplate.join('\n'),
|
||||
install: installTemplate.join('\n'),
|
||||
version: require('../package.json').version,
|
||||
version: process.env.VERSION || require('../../package.json').version,
|
||||
list: listTemplate.join(',\n')
|
||||
});
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
var postcss = require('postcss');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var fontFile = fs.readFileSync(path.resolve(__dirname, '../packages/theme-default/src/icon.css'), 'utf8');
|
||||
var fontFile = fs.readFileSync(path.resolve(__dirname, '../../packages/theme-default/src/icon.css'), 'utf8');
|
||||
var nodes = postcss.parse(fontFile).nodes;
|
||||
var classList = [];
|
||||
|
||||
|
@ -17,4 +17,4 @@ nodes.forEach((node) => {
|
|||
}
|
||||
});
|
||||
|
||||
fs.writeFile(path.resolve(__dirname, '../examples/icon.json'), JSON.stringify(classList));
|
||||
fs.writeFile(path.resolve(__dirname, '../../examples/icon.json'), JSON.stringify(classList));
|
|
@ -97,13 +97,13 @@ export default {
|
|||
];
|
||||
|
||||
// 添加到 components.json
|
||||
const componentsFile = require('../components.json');
|
||||
const componentsFile = require('../../components.json');
|
||||
if (componentsFile[componentname]) {
|
||||
console.error(`${componentname} 已存在.`);
|
||||
process.exit(1);
|
||||
}
|
||||
componentsFile[componentname] = [`./packages/${componentname}/index.js`];
|
||||
fileSave(path.join(__dirname, '../components.json'))
|
||||
fileSave(path.join(__dirname, '../../components.json'))
|
||||
.write(JSON.stringify(componentsFile, null, ' '), 'utf8')
|
||||
.end('\n');
|
||||
|
||||
|
@ -115,7 +115,7 @@ Files.forEach(file => {
|
|||
});
|
||||
|
||||
// 添加到 nav.config.json
|
||||
const navConfigFile = require('../examples/nav.config.json');
|
||||
const navConfigFile = require('../../examples/nav.config.json');
|
||||
navConfigFile[navConfigFile.length - 1].list.push({
|
||||
path: `/${componentname}`,
|
||||
name: `${chineseName} (${componentname})`,
|
||||
|
@ -124,7 +124,7 @@ navConfigFile[navConfigFile.length - 1].list.push({
|
|||
: `${componentname} ${chineseName}`
|
||||
});
|
||||
|
||||
fileSave(path.join(__dirname, '../examples/nav.config.json'))
|
||||
fileSave(path.join(__dirname, '../../examples/nav.config.json'))
|
||||
.write(JSON.stringify(navConfigFile, null, ' '), 'utf8')
|
||||
.end('\n');
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
var Components = require('../components.json');
|
||||
var path = require('path');
|
||||
var externals = {};
|
||||
|
||||
Object.keys(Components).forEach(function(key) {
|
||||
externals[`packages/${key}/index.js`] = `element-ui/lib/${key}`;
|
||||
externals[`packages/${key}/style.css`] = `element-ui/lib/${key}/style.css`;
|
||||
externals['main/utils/clickoutside'] = 'element-ui/lib/utils/clickoutside';
|
||||
externals['main/utils/popper'] = 'element-ui/lib/utils/popper';
|
||||
externals['main/utils/vue-popper'] = 'element-ui/lib/utils/vue-popper';
|
||||
});
|
||||
|
||||
exports.externals = Object.assign({
|
||||
vue: {
|
||||
root: 'Vue',
|
||||
commonjs: 'vue',
|
||||
commonjs2: 'vue',
|
||||
amd: 'vue'
|
||||
}
|
||||
}, externals);
|
||||
|
||||
exports.alias = {
|
||||
main: path.resolve(__dirname, '../src'),
|
||||
packages: path.resolve(__dirname, '../packages'),
|
||||
examples: path.resolve(__dirname, '../examples')
|
||||
};
|
||||
|
||||
exports.jsexclude = /node_modules|utils\/popper\.js|utils\/date.\js/;
|
|
@ -1,5 +1,5 @@
|
|||
var cooking = require('cooking');
|
||||
var path = require('path');
|
||||
var config = require('./config');
|
||||
|
||||
cooking.set({
|
||||
entry: './src/index.js',
|
||||
|
@ -8,14 +8,11 @@ cooking.set({
|
|||
format: 'cjs',
|
||||
extends: ['vue2'],
|
||||
minimize: false,
|
||||
alias: {
|
||||
main: path.join(__dirname, '../src'),
|
||||
packages: path.join(__dirname, '../packages'),
|
||||
examples: path.join(__dirname, '../examples')
|
||||
},
|
||||
alias: config.alias,
|
||||
externals: { vue: 'vue' }
|
||||
});
|
||||
|
||||
cooking.add('output.filename', 'element-ui.common.js');
|
||||
cooking.add('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);
|
||||
cooking.add('loader.js.exclude', config.jsexclude);
|
||||
|
||||
module.exports = cooking.resolve();
|
|
@ -0,0 +1,27 @@
|
|||
var cooking = require('cooking');
|
||||
var path = require('path');
|
||||
var Components = require('../components.json');
|
||||
var config = require('./config');
|
||||
var entries = {};
|
||||
|
||||
Object.keys(Components).forEach(function(key) {
|
||||
const compo = Components[key];
|
||||
|
||||
compo[0] = path.join(process.cwd(), compo[0]);
|
||||
entries[key] = compo;
|
||||
});
|
||||
|
||||
cooking.set({
|
||||
entry: entries,
|
||||
dist: './lib',
|
||||
clean: false,
|
||||
format: 'cjs',
|
||||
extends: ['vue2'],
|
||||
minimize: false,
|
||||
externals: config.externals,
|
||||
alias: config.alias
|
||||
});
|
||||
|
||||
cooking.add('output.filename', '[name]/index.js');
|
||||
cooking.add('loader.js.exclude', config.jsexclude);
|
||||
module.exports = cooking.resolve();
|
|
@ -0,0 +1,18 @@
|
|||
var cooking = require('cooking');
|
||||
var config = require('./config');
|
||||
|
||||
cooking.set({
|
||||
entry: './src/index.js',
|
||||
dist: './lib',
|
||||
clean: false,
|
||||
format: 'umd',
|
||||
moduleName: 'ELEMENT',
|
||||
extends: ['vue2'],
|
||||
alias: config.alias,
|
||||
externals: { vue: config.externals.vue }
|
||||
});
|
||||
|
||||
cooking.add('output.filename', 'index.js');
|
||||
cooking.add('loader.js.exclude', config.jsexclude);
|
||||
|
||||
module.exports = cooking.resolve();
|
|
@ -1,8 +1,8 @@
|
|||
var cooking = require('cooking');
|
||||
var path = require('path');
|
||||
var config = require('./config');
|
||||
var md = require('markdown-it')();
|
||||
var Components = require('../components.json');
|
||||
var striptags = require('../examples/utils/strip-tags');
|
||||
var striptags = require('./strip-tags');
|
||||
|
||||
function convert(str) {
|
||||
str = str.replace(/(&#x)(\w{4});/gi, function($0) {
|
||||
|
@ -26,6 +26,7 @@ cooking.set({
|
|||
chunk: true,
|
||||
extractCSS: true,
|
||||
sourceMap: true,
|
||||
alias: config.alias,
|
||||
extends: ['vue2', 'lint'],
|
||||
postcss: function(webapck) {
|
||||
return [
|
||||
|
@ -99,12 +100,6 @@ var wrap = function(render) {
|
|||
};
|
||||
};
|
||||
|
||||
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}/style.css`] = 'null';
|
|
@ -0,0 +1,23 @@
|
|||
set -e
|
||||
echo "Enter release version: "
|
||||
read VERSION
|
||||
|
||||
read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
|
||||
echo # (optional) move to a new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
echo "Releasing $VERSION ..."
|
||||
|
||||
# build
|
||||
VERSION=$VERSION npm run dist
|
||||
|
||||
# commit
|
||||
git add -A
|
||||
git commit -m "[build] $VERSION"
|
||||
npm version $VERSION --message "[release] $VERSION"
|
||||
|
||||
# publish
|
||||
git push origin refs/tags/v$VERSION
|
||||
git push
|
||||
npm publish --tag next
|
||||
fi
|
22
package.json
22
package.json
|
@ -5,19 +5,21 @@
|
|||
"main": "lib/element-ui.common.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"src"
|
||||
"src",
|
||||
"packages"
|
||||
],
|
||||
"scripts": {
|
||||
"build:file": "node bin/iconInit.js & node bin/build-entry.js",
|
||||
"dev": "npm run bootstrap && npm run build:file && cooking watch -c scripts/cooking.demo.js -p",
|
||||
"dist": "npm run lint && npm run build:file && del -f lib && cooking build -c scripts/cooking.conf.js,scripts/cooking.common.js,scripts/cooking.component.js -p && npm run build:theme",
|
||||
"dist:all": "node bin/build-all.js && npm run build:theme",
|
||||
"build:file": "node build/bin/iconInit.js & node build/bin/build-entry.js",
|
||||
"dev": "npm run bootstrap && npm run build:file && cooking watch -c build/cooking.demo.js -p",
|
||||
"dist": "npm run lint && npm run build:file && del -f lib && cooking build -c build/cooking.conf.js,build/cooking.common.js,build/cooking.component.js -p && npm run build:utils && npm run build:theme",
|
||||
"dist:all": "node build/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": "npm run build:file && cooking build -c scripts/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME && gh-pages -d examples/element-ui --remote eleme && del examples/element-ui",
|
||||
"bootstrap": "npm i && lerna bootstrap --loglevel=error",
|
||||
"pub": "npm run dist && kp",
|
||||
"deploy": "npm run build:file && cooking build -c build/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME && gh-pages -d examples/element-ui --remote eleme && del examples/element-ui",
|
||||
"bootstrap": "npm i && lerna bootstrap",
|
||||
"pub": "sh build/release.sh",
|
||||
"pub:all": "npm run dist:all && lerna publish",
|
||||
"lint": "eslint src/** packages/** scripts/** bin/** --ext .js,.vue --ignore-pattern node_modules"
|
||||
"build:utils": "babel src/utils --out-dir lib/utils",
|
||||
"lint": "eslint src/** packages/** build/** --ext .js,.vue --quiet"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -33,6 +35,7 @@
|
|||
"url": "https://github.com/elemefe/element/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.14.0",
|
||||
"babel-core": "^6.14.0",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.0",
|
||||
"babel-loader": "^6.2.5",
|
||||
|
@ -56,7 +59,6 @@
|
|||
"html-webpack-plugin": "^2.22.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"json-templater": "^1.0.4",
|
||||
"kanpai": "^0.7.0",
|
||||
"lerna": "2.0.0-beta.18",
|
||||
"markdown-it": "^6.1.1",
|
||||
"markdown-it-container": "^2.0.0",
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
var cooking = require('cooking');
|
||||
var path = require('path');
|
||||
var Components = require('../components.json');
|
||||
var entries = {};
|
||||
|
||||
Object.keys(Components).forEach(function(key) {
|
||||
const compo = Components[key];
|
||||
|
||||
compo[0] = path.join(process.cwd(), compo[0]);
|
||||
entries[key] = compo;
|
||||
});
|
||||
|
||||
cooking.set({
|
||||
entry: entries,
|
||||
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')
|
||||
}
|
||||
});
|
||||
|
||||
cooking.add('output.filename', '[name]/index.js');
|
||||
|
||||
var externals = {};
|
||||
Object.keys(Components).forEach(function(key) {
|
||||
externals[`packages/${key}/index.js`] = `element-ui/lib/${key}`;
|
||||
externals[`packages/${key}/style.css`] = `element-ui/lib/${key}/style.css`;
|
||||
externals['main/utils/clickoutside'] = 'element-ui/src/utils/clickoutside';
|
||||
externals['main/utils/popper'] = 'element-ui/src/utils/popper';
|
||||
externals['main/utils/vue-popper'] = 'element-ui/src/utils/vue-popper';
|
||||
});
|
||||
|
||||
cooking.add('externals', Object.assign({
|
||||
vue: {
|
||||
root: 'Vue',
|
||||
commonjs: 'vue',
|
||||
commonjs2: 'vue',
|
||||
amd: 'vue'
|
||||
}
|
||||
}, externals));
|
||||
|
||||
cooking.add('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);
|
||||
module.exports = cooking.resolve();
|
|
@ -1,28 +0,0 @@
|
|||
var cooking = require('cooking');
|
||||
var path = require('path');
|
||||
|
||||
cooking.set({
|
||||
entry: './src/index.js',
|
||||
dist: './lib',
|
||||
clean: false,
|
||||
format: 'umd',
|
||||
moduleName: 'ELEMENT',
|
||||
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('loader.js.exclude', /node_modules|utils\/popper\.js|util\/fecha.\js/);
|
||||
module.exports = cooking.resolve();
|
Loading…
Reference in New Issue