Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Conan committed Jan 18, 2019
0 parents commit 3380317
Show file tree
Hide file tree
Showing 1,078 changed files with 114,645 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Editor directories and files
.DS_Store
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
.vscode

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
package-lock.json
coverage
.nyc_output
# ///////////////////////////

11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "8.10.0"
before_script:
- lerna bootstrap --ignore-scripts
- cd packages/easy-chameleon && npm i && cd ../../
- cd packages/chameleon-tool && npm i && cd ../../
script:
- npm run coverage
after_script:
- cat coverage/lcov.info | node_modules/.bin/codecov
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

# 介绍

[![Build Status](https://www.travis-ci.org/didi/chameleon.svg?branch=master)](https://www.travis-ci.org/didi/chameleon)

**Chameleon**/kəˈmiːlɪən/,简写`CML`,中文名`卡梅龙`;中文意思`变色龙`,意味着就像变色龙一样能适应不同环境的跨端整体解决方案。

## 背景
研发同学在端内既追求h5的灵活性,也要追求性能趋近于原生。
面对入口扩张,主端、独立端、微信小程序、支付宝小程序、百度小程序、Android厂商联盟快应用,单一功能在各平台都要重复实现,开发和维护成本成倍增加。迫切需要维护一套代码可以构建多入口的解决方案,历经近20个月打磨,滴滴跨端解决方案Chameleon终于发布。真正专注于让一套代码运行多端。



## 设计理念

软件架构设计里面最基础的概念“拆分”和“合并”,拆分的意义是“分而治之”,将复杂问题拆分成单一问题解决,比如后端业务系统的”微服务化“设计;“合并”的意义是将同样的业务需求抽象收敛到一块,达成高效率高质量的目的,例如后端业务系统中的“中台服务”设计。

而 Chameleon 属于后者,通过定义统一的语言框架+<a href="https://didi.github.io/chameleon/doc/framework/polymorphism/intro.html">统一多态协议</a>,从多端(对应多个独立服务)业务中抽离出自成体系、连续性强、可维护强的“前端中台服务”。

### 跨端目标

虽然不同各端环境千变万化,但万变不离其宗的是 MVVM 架构思想,**Chameleon 目标是让MVVM跨端环境大统一**

![Alt text](https://didi.github.io/chameleon/doc/assets/mvvm3.png)


## 学习全景图

![Alt text](https://didi.github.io/chameleon/doc/assets/architecture.png)


## 开发语言
从事过网页编程的人知道,网页编程采用的是HTML + CSS + JS这样的组合,同样道理,chameleon中采用的是 CML + CMSS + JS。

[JS](https://didi.github.io/chameleon/doc/logic/logic.html)语法用于处理页面的逻辑层,与普通网页编程相比,本项目目标定义标准MVVM框架,拥有完整的生命周期,watch,computed,数据双向绑定等优秀的特性,能够快速提高开发速度、降低维护成本。

[CML](https://didi.github.io/chameleon/doc/view/cml.html)(Chameleon Markup Language)用于描述页面的结构,我们知道HTML是有一套标准的语义化标签,例如文本是`<span>` 按钮是`<button>`。CML同样具有一套标准的标签,我们将标签定义为`组件`,CML为用户提供了一系列[组件](https://didi.github.io/chameleon/doc/component/base/base.html)。同时CML中还支持<b>模板语法</b>,例如条件渲染、列表渲染,数据绑定等等。同时,CML支持使用[类VUE语法](https://didi.github.io/chameleon/doc/view/vue.html),让你更快入手。


[CMSS](https://didi.github.io/chameleon/doc/view/cmss.html)(Chameleon Style Sheets)用于描述CML页面结构的样式语言,其具有大部分CSS的特性,并且还可以支持各种css的预处语言`less stylus`

<b>通过以上对于开发语言的介绍,相信你看到只要是有过网页编程知识的人都可以快速的上手chameleon的开发</b>。


## 丰富的组件
在用CML写页面时,chameleon提供了[丰富的组件](https://didi.github.io/chameleon/doc/component/component.html)供开发者使用,内置的有`button switch radio checkbox`等组件,扩展的有`c-picker c-dialog c-loading`等等,覆盖了开发工作中常用的组件。

## 丰富的API

为了方便开发者的高效开发,chameleon提供了[丰富的API库](https://didi.github.io/chameleon/doc/api/api.html),发布为npm包`chameleon-api`,里面包括了网络请求、数据存储、地理位置、系统信息、动画等方法。
## 自由定制API和组件
基于强大的[多态协议](https://didi.github.io/chameleon/doc/framework/polymorphism/intro.html),可自由扩展任意API和组件,不强依赖框架的更新。各端原始项目中已积累大量组件,也能直接引入到跨端项目中使用。
## <a href="https://didi.github.io/chameleon/doc/framework/polymorphism/check.html">智能规范校验</a>
代码规范校验,当出现不符合规范要求的代码时,编辑器会展示智能提示,不用挨个调试各端代码,同时命令行启动窗口也会提示代码的错误位置。

## <a href="https://didi.github.io/chameleon/doc/framework/progressive.html">渐进式跨端</a>
既想一套代码运行多端,又不用大刀阔斧的重构项目,可以将多端重用组件用Chameleon开发,直接在原有项目里面调用。

## <a href="https://didi.github.io/chameleon/doc/framework/framework.html">先进前端开发体验</a>

Chameleon 不仅仅是跨端解决方案。基于优秀的前端打包工具Webpack,吸收了业内多年来积累的最有用的工程化设计,提供了前端基础开发脚手架命令工具,帮助端开发者从开发、联调、测试、上线等全流程高效的完成业务开发。

## 联系我们

[ChameleonCore@didiglobal.com](mailto:ChameleonCore@didiglobal.com)

## 微信 & QQ交流群

**微信**<br />
<img width="150px" src="https://didi.github.io/chameleon/doc/assets/qr-wechat.jpeg" />

<br />

**QQ**<br />
<img width="150px" src="https://didi.github.io/chameleon/doc/assets/qr-qq.jpeg" />
43 changes: 43 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"packages": [
"packages/babel-plugin-chameleon-import",
"packages/chameleon-css-loader",
"packages/chameleon-dev-proxy",
"packages/chameleon-errors-webpack-plugin",
"packages/chameleon-linter",
"packages/chameleon-loader",
"packages/chameleon-miniapp-target",
"packages/chameleon-mixins",
"packages/chameleon-template-parse",
"packages/chameleon-templates",
"packages/chameleon-tool-utils",
"packages/chameleon-vue-precompiler",
"packages/chameleon-webpack-plugin",
"packages/chameleon-weex-vue-loader",
"packages/cml-component-parser",
"packages/cml-htmllinter",
"packages/cml-interface-parser",
"packages/cml-js-parser",
"packages/interface-loader",
"packages/runtime-check",
"packages/url-loader",
"packages/webpack-check-plugin",
"packages/webpack-dev-middleware",
"packages/webpack-liveload-middleware"
],
"version": "0.0.28",
"command": {
"publish": {
"allowBranch": "master",
"npmClient": "npm",
"verifyAccess": false,
"registry": "https://registry.npmjs.org/"
},
"add": {
"registry": "https://registry.npmjs.org/"
},
"bootstrap": {
"registry": "https://registry.npmjs.org/"
}
}
}
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "root",
"private": true,
"scripts": {
"build": "lerna run build",
"publish": "npm run build && lerna publish",
"coverage": "sh ./test/test.sh",
"clear": "rm -rf package-lock.json packages/*/package-lock.json",
"clear-all": "rimraf package-lock.json packages/*/node_modules packages/*/package-lock.json"
},
"devDependencies": {
"istanbul": "^0.4.5",
"lerna": "^3.5.1"
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-istanbul": "^0.12.2",
"codecov": "^3.1.0",
"coveralls": "^3.0.2",
"mocha": "*",
"nyc": "*",
"rimraf": "^2.6.3"
}
}
16 changes: 16 additions & 0 deletions packages/babel-plugin-chameleon-import/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions packages/babel-plugin-chameleon-import/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*/__tests__
6 changes: 6 additions & 0 deletions packages/babel-plugin-chameleon-import/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "eslint-config-airbnb/base",
"rules": {
"no-console": [0]
}
}
7 changes: 7 additions & 0 deletions packages/babel-plugin-chameleon-import/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
tmp
node_modules
coverage
lib
*.log
*.log.*
5 changes: 5 additions & 0 deletions packages/babel-plugin-chameleon-import/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
tmp
node_modules
coverage
__tests__
6 changes: 6 additions & 0 deletions packages/babel-plugin-chameleon-import/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- 8
- 10
after_success:
- npm run test
53 changes: 53 additions & 0 deletions packages/babel-plugin-chameleon-import/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "babel-plugin-chameleon-import",
"version": "0.0.28",
"description": "Component modular import plugin for babel.",
"repository": {
"type": "git",
"url": "https://github.com/ant-design/babel-plugin-import"
},
"main": "src/index.js",
"scripts": {
"debug": "umi-tools test",
"lint": "eslint --ext .js src",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"pre-commit": [
"lint"
],
"keywords": [
"babel-plugin",
"antd"
],
"author": "Chameleon-Team",
"license": "Apache",
"mail": "ChameleonCore@didiglobal.com",
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "^7.0.0-0",
"babel-preset-umi": "^1.0.0",
"coveralls": "^2.11.6",
"eslint": "^2.7.0",
"eslint-config-airbnb": "^6.2.0",
"material-ui": "^0.15.4",
"pre-commit": "~1.1.2",
"react-toolbox": "^1.2.5",
"umi-tools": "^0.1.4"
},
"babel": {
"presets": [
"umi"
]
},
"files": [
"src",
"lib",
"package.json",
"README.md"
],
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/runtime": "^7.0.0"
}
}
Loading

0 comments on commit 3380317

Please sign in to comment.