Skip to content

Commit 900b5d7

Browse files
committed
init
0 parents  commit 900b5d7

16 files changed

Lines changed: 536 additions & 0 deletions

File tree

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.log*
2+
.cache
3+
.DS_Store
4+
.idea
5+
packages/**/lib
6+
lib/*
7+
!lib/index.js
8+
!lib/style.css
9+
node_modules
10+
example/dist

build/bin/build-all.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const components = require('../../components.json');
4+
const execSync = require('child_process').execSync;
5+
const existsSync = require('fs').existsSync;
6+
const path = require('path');
7+
8+
let componentPaths = [];
9+
10+
delete components.font;
11+
12+
Object.keys(components).forEach(key => {
13+
const filePath = path.join(__dirname, `../../packages/${key}/cooking.conf.js`);
14+
15+
if (existsSync(filePath)) {
16+
componentPaths.push(`packages/${key}/cooking.conf.js`);
17+
}
18+
});
19+
20+
const paths = componentPaths.join(',');
21+
const cli = `node_modules/.bin/cooking build -c ${paths} -p`;
22+
23+
execSync(cli, {
24+
stdio: 'inherit'
25+
});

build/bin/build-entry.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
var Components = require('../../components.json');
2+
var fs = require('fs');
3+
var render = require('json-templater/string');
4+
var uppercamelcase = require('uppercamelcase');
5+
var path = require('path');
6+
7+
var OUTPUT_PATH = path.join(__dirname, '../../src/index.js');
8+
var IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}/index.js\';';
9+
var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});';
10+
var MAIN_TEMPLATE = `{{include}}
11+
import '../src/assets/font/iconfont.css';
12+
13+
const install = function(Vue) {
14+
if (install.installed) return;
15+
16+
{{install}}
17+
Vue.use(InfiniteScroll);
18+
Vue.use(Lazyload, {
19+
loading: require('./assets/loading-spin.svg'),
20+
try: 3
21+
});
22+
23+
Vue.$messagebox = Vue.prototype.$messagebox = MessageBox;
24+
Vue.$toast = Vue.prototype.$toast = Toast;
25+
Vue.$indicator = Vue.prototype.$indicator = Indicator;
26+
};
27+
28+
// auto install
29+
if (typeof window !== 'undefined' && window.Vue) {
30+
install(window.Vue);
31+
};
32+
33+
module.exports = {
34+
install,
35+
version: '{{version}}',
36+
{{list}}
37+
};
38+
`;
39+
40+
delete Components.font;
41+
42+
var ComponentNames = Object.keys(Components);
43+
44+
var includeComponentTemplate = [];
45+
var installTemplate = [];
46+
var listTemplate = [];
47+
48+
ComponentNames.forEach(name => {
49+
var componentName = uppercamelcase(name);
50+
51+
includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
52+
name: componentName,
53+
package: name
54+
}));
55+
56+
if ([
57+
// directives
58+
'InfiniteScroll',
59+
'Lazyload',
60+
61+
// services
62+
'MessageBox',
63+
'Toast',
64+
'Indicator'
65+
].indexOf(componentName) === -1) {
66+
installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
67+
name: componentName,
68+
component: name
69+
}));
70+
}
71+
72+
listTemplate.push(` ${componentName}`);
73+
});
74+
75+
var template = render(MAIN_TEMPLATE, {
76+
include: includeComponentTemplate.join('\n'),
77+
install: installTemplate.join('\n'),
78+
version: process.env.VERSION || require('../../package.json').version,
79+
list: listTemplate.join(',\n')
80+
});
81+
82+
fs.writeFileSync(OUTPUT_PATH, template);
83+
console.log('[build entry] DONE:', OUTPUT_PATH);
84+

build/config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var Components = require('../components.json');
2+
var path = require('path');
3+
var dependencies = require('../package.json').dependencies;
4+
var externals = {};
5+
6+
Object.keys(Components).forEach(function(key) {
7+
externals[`oxygen/packages/${key}/index.js`] = `oxygen/lib/${key}`;
8+
externals[`oxygen/packages/${key}/style.css`] = `oxygen/lib/${key}/style.css`;
9+
});
10+
Object.keys(dependencies).forEach(function(key) {
11+
externals[key] = key;
12+
});
13+
exports.externals = Object.assign({
14+
vue: {
15+
root: 'Vue',
16+
commonjs: 'vue',
17+
commonjs2: 'vue',
18+
amd: 'vue'
19+
}
20+
}, externals);
21+
22+
exports.alias = {
23+
'oxygen': path.join(__dirname, '..'),
24+
'src': path.join(__dirname, '../src')
25+
};
26+
27+
exports.jsexclude = /node_modules|lib/;
28+
29+
exports.extends = ['vue2', 'buble'];
30+

build/release.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
set -e
2+
echo "[Mint UI for Vue 2.0]Enter release version: "
3+
read VERSION
4+
5+
read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
6+
echo # (optional) move to a new line
7+
if [[ $REPLY =~ ^[Yy]$ ]]
8+
then
9+
echo "Releasing $VERSION ..."
10+
11+
# build
12+
VERSION=$VERSION npm run dist
13+
14+
# commit
15+
git add -A
16+
git commit -m "[build] $VERSION"
17+
npm version $VERSION --message "[release] $VERSION"
18+
19+
# publish
20+
git push eleme refs/tags/v$VERSION
21+
git push eleme master
22+
npm publish
23+
fi

components.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cell": "./packages/cell/index.js"
3+
}

lerna.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"lerna": "2.0.0-beta.31",
3+
"version": "independent"
4+
}

package.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "oxygen",
3+
"version": "0.0.1",
4+
"description": "有赞vue wap组件库",
5+
"main": "lib/oxygen.common.js",
6+
"style": "lib/style.css",
7+
"files": [
8+
"lib",
9+
"src",
10+
"packages"
11+
],
12+
"scripts": {
13+
"dev": "npm run bootstrap && npm run build:entry",
14+
"bootstrap": "npm i",
15+
"dist": "npm run clean && npm run build:entry",
16+
"deploy": "npm run build:entry",
17+
"build:entry": "node build/bin/build-entry",
18+
"pub": "sh build/release.sh",
19+
"pub:all": "node build/bin/build-all.js && lerna publish",
20+
"clean": "rimraf lib && rimraf packages/*/lib"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "git@gitlab.qima-inc.com:fe/oxygen.git"
25+
},
26+
"keywords": [
27+
"youzan",
28+
"vue"
29+
],
30+
"author": "youzanfe",
31+
"license": "ISC",
32+
"dependencies": {
33+
"array-find-index": "^1.0.2",
34+
"raf.js": "0.0.4",
35+
"wind-dom": "0.0.3"
36+
},
37+
"devDependencies": {
38+
"css-loader": "^0.25.0",
39+
"extract-text-webpack-plugin": "^1.0.1",
40+
"fastclick": "^1.0.6",
41+
"file-loader": "^0.9.0",
42+
"gh-pages": "^0.11.0",
43+
"html-loader": "^0.4.3",
44+
"html-webpack-plugin": "^2.22.0",
45+
"json-loader": "^0.5.4",
46+
"json-templater": "^1.0.4",
47+
"lerna": "2.0.0-beta.31",
48+
"my-local-ip": "^1.0.0",
49+
"postcss": "^5.2.0",
50+
"postcss-loader": "^0.13.0",
51+
"rimraf": "^2.5.4",
52+
"style-loader": "^0.13.1",
53+
"uppercamelcase": "^1.1.0",
54+
"url-loader": "^0.5.7",
55+
"vue": "^2.1.7",
56+
"vue-loader": "^9.5.3",
57+
"vue-router": "^2.0.0",
58+
"webpack": "^1.13.2",
59+
"webpack-dev-server": "^1.15.1",
60+
"webpack-shell-plugin": "^0.4.3"
61+
}
62+
}

packages/cell/README.md

Whitespace-only changes.

packages/cell/cooking.conf.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var cooking = require('cooking');
2+
var path = require('path');
3+
var config = require('../../build/config');
4+
5+
cooking.set({
6+
entry: {
7+
index: path.join(__dirname, 'index.js')
8+
},
9+
dist: path.join(__dirname, 'lib'),
10+
template: false,
11+
format: 'umd',
12+
moduleName: 'OxygenCell',
13+
extractCSS: 'style.css',
14+
extends: config.extends,
15+
alias: config.alias,
16+
externals: config.externals
17+
});
18+
19+
module.exports = cooking.resolve();

0 commit comments

Comments
 (0)