init
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const components = require('../../components.json');
|
||||
const execSync = require('child_process').execSync;
|
||||
const existsSync = require('fs').existsSync;
|
||||
const path = require('path');
|
||||
|
||||
let componentPaths = [];
|
||||
|
||||
delete components.font;
|
||||
|
||||
Object.keys(components).forEach(key => {
|
||||
const filePath = path.join(__dirname, `../../packages/${key}/cooking.conf.js`);
|
||||
|
||||
if (existsSync(filePath)) {
|
||||
componentPaths.push(`packages/${key}/cooking.conf.js`);
|
||||
}
|
||||
});
|
||||
|
||||
const paths = componentPaths.join(',');
|
||||
const cli = `node_modules/.bin/cooking build -c ${paths} -p`;
|
||||
|
||||
execSync(cli, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
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 IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}/index.js\';';
|
||||
var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});';
|
||||
var MAIN_TEMPLATE = `{{include}}
|
||||
import '../src/assets/font/iconfont.css';
|
||||
|
||||
const install = function(Vue) {
|
||||
if (install.installed) return;
|
||||
|
||||
{{install}}
|
||||
Vue.use(InfiniteScroll);
|
||||
Vue.use(Lazyload, {
|
||||
loading: require('./assets/loading-spin.svg'),
|
||||
try: 3
|
||||
});
|
||||
|
||||
Vue.$messagebox = Vue.prototype.$messagebox = MessageBox;
|
||||
Vue.$toast = Vue.prototype.$toast = Toast;
|
||||
Vue.$indicator = Vue.prototype.$indicator = Indicator;
|
||||
};
|
||||
|
||||
// auto install
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
install(window.Vue);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
install,
|
||||
version: '{{version}}',
|
||||
{{list}}
|
||||
};
|
||||
`;
|
||||
|
||||
delete Components.font;
|
||||
|
||||
var ComponentNames = Object.keys(Components);
|
||||
|
||||
var includeComponentTemplate = [];
|
||||
var installTemplate = [];
|
||||
var listTemplate = [];
|
||||
|
||||
ComponentNames.forEach(name => {
|
||||
var componentName = uppercamelcase(name);
|
||||
|
||||
includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
|
||||
name: componentName,
|
||||
package: name
|
||||
}));
|
||||
|
||||
if ([
|
||||
// directives
|
||||
'InfiniteScroll',
|
||||
'Lazyload',
|
||||
|
||||
// services
|
||||
'MessageBox',
|
||||
'Toast',
|
||||
'Indicator'
|
||||
].indexOf(componentName) === -1) {
|
||||
installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
|
||||
name: componentName,
|
||||
component: name
|
||||
}));
|
||||
}
|
||||
|
||||
listTemplate.push(` ${componentName}`);
|
||||
});
|
||||
|
||||
var template = render(MAIN_TEMPLATE, {
|
||||
include: includeComponentTemplate.join('\n'),
|
||||
install: installTemplate.join('\n'),
|
||||
version: process.env.VERSION || require('../../package.json').version,
|
||||
list: listTemplate.join(',\n')
|
||||
});
|
||||
|
||||
fs.writeFileSync(OUTPUT_PATH, template);
|
||||
console.log('[build entry] DONE:', OUTPUT_PATH);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
var Components = require('../components.json');
|
||||
var path = require('path');
|
||||
var dependencies = require('../package.json').dependencies;
|
||||
var externals = {};
|
||||
|
||||
Object.keys(Components).forEach(function(key) {
|
||||
externals[`oxygen/packages/${key}/index.js`] = `oxygen/lib/${key}`;
|
||||
externals[`oxygen/packages/${key}/style.css`] = `oxygen/lib/${key}/style.css`;
|
||||
});
|
||||
Object.keys(dependencies).forEach(function(key) {
|
||||
externals[key] = key;
|
||||
});
|
||||
exports.externals = Object.assign({
|
||||
vue: {
|
||||
root: 'Vue',
|
||||
commonjs: 'vue',
|
||||
commonjs2: 'vue',
|
||||
amd: 'vue'
|
||||
}
|
||||
}, externals);
|
||||
|
||||
exports.alias = {
|
||||
'oxygen': path.join(__dirname, '..'),
|
||||
'src': path.join(__dirname, '../src')
|
||||
};
|
||||
|
||||
exports.jsexclude = /node_modules|lib/;
|
||||
|
||||
exports.extends = ['vue2', 'buble'];
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
set -e
|
||||
echo "[Mint UI for Vue 2.0]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 eleme refs/tags/v$VERSION
|
||||
git push eleme master
|
||||
npm publish
|
||||
fi
|
||||
Reference in New Issue
Block a user