Authored by 沈志敏

project init

{
"presets": ["es2015-rollup"],
}
\ No newline at end of file
... ...
{
"env": {
"browser": true,
"es6": true
},
"globals": {
"ENV": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"warn",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"warn",
"single"
],
"semi": [
"error",
"always"
],
"no-undef": 1,
"no-console": 1
}
}
\ No newline at end of file
... ...
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.pyc
*.pyo
.build
node_modules
_site
sea-modules
spm_modules
.cache
dist
web.log
... ...
import jssdk from './src/jssdk';
(function(factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
define([], factory);
} else {
window._jssdk = factory();
}
}(function() {
return jssdk;
}));
\ No newline at end of file
... ...
{
"name": "yoho-js-sdk",
"version": "1.0.0",
"description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。",
"keywords": [
"YOHO!",
"JS-SDK"
],
"main": "index.js",
"scripts": {
"build": "rollup -c"
},
"repository": {
"type": "git",
"url": "git@git.yoho.cn:fe/yoho-js-sdk.git"
},
"author": "shenzm <zhimin.shen@yoho.cn>",
"licenses": "MIT",
"devDependencies": {
"babel-preset-es2015-rollup": "^3.0.0",
"rollup": "^0.38.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^6.0.1",
"rollup-plugin-eslint": "^3.0.0",
"rollup-plugin-json": "^2.1.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1"
}
}
... ...
// Rollup plugins
import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
import json from 'rollup-plugin-json';
const pkg = require('./package.json');
export default {
entry: 'index.js',
dest: `dist/js-sdk/${pkg.version}/jssdk.js`,
format: 'iife',
plugins: [
json({
include: 'node_modules/**',
preferConst: true, // Default: false
}),
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
eslint(),
babel({
exclude: 'node_modules/**',
}),
uglify()
],
};
\ No newline at end of file
... ...
export default {
test() {
console.log("test");
}
};
\ No newline at end of file
... ...