-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 44a4ae3
Showing
24 changed files
with
520 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea | ||
.DS_Store | ||
tmp | ||
spm_modules | ||
node_modules | ||
demo/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
coverage | ||
test/fixtures | ||
test/expected | ||
tmp | ||
demo | ||
spm_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"expr": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"indent": 2, | ||
"latedef": "nofunc", | ||
"newcap": true, | ||
"quotmark": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
"lastsemic": true, | ||
"boss": true, | ||
"funcscope": true, | ||
"loopfunc": true, | ||
"smarttabs": true, | ||
"sub": true, | ||
"strict": true, | ||
"node": true, | ||
"esnext": true, | ||
"globals": { | ||
"describe": false, | ||
"xdescribe": false, | ||
"it": false, | ||
"xit": false, | ||
"before": false, | ||
"beforeEach": false, | ||
"after": false, | ||
"afterEach": false, | ||
"define": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea | ||
.DS_Store | ||
tmp | ||
spm_modules | ||
node_modules | ||
demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# History | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# antd | ||
|
||
[](https://npmjs.org/package/antd) | ||
|
||
Development tool for ant.design . | ||
|
||
---- | ||
|
||
## 使用说明 | ||
|
||
### 安装 | ||
|
||
```bash | ||
$ npm i antd -g | ||
``` | ||
|
||
### 脚手架 | ||
|
||
```bash | ||
$ antd init | ||
``` | ||
|
||
这会创建一个 package.json,此外你还需要在 package.json 中配置 entry 声明哪些是入口文件,格式详见:http://webpack.github.io/docs/configuration.html#entry | ||
|
||
### 本地调试 | ||
|
||
```bash | ||
$ antd server | ||
``` | ||
|
||
然后访问 http://127.0.0.1:8000 。 | ||
|
||
### 构建 | ||
|
||
```bash | ||
$ antd build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('win-spawn'); | ||
var join = require('path').join; | ||
var exists = require('fs').existsSync; | ||
var program = require('commander'); | ||
|
||
program | ||
.version(require('../package').version, '-v, --version') | ||
.usage('<command> [options]') | ||
.on('--help', printHelp) | ||
.parse(process.argv); | ||
|
||
var subcmd = program.args[0]; | ||
var args = process.argv.slice(3); | ||
|
||
if (!subcmd) { | ||
program.help(); | ||
} else { | ||
var bin = executable(subcmd); | ||
if (bin) { | ||
spawn(bin, args, {stdio: 'inherit', customFds: [0, 1, 2]}); | ||
} else { | ||
printHelp(); | ||
} | ||
} | ||
|
||
function printHelp() { | ||
console.log(' Commands:'); | ||
console.log(); | ||
console.log(' init initialize'); | ||
console.log(' build build entry files specified in package.json'); | ||
console.log(' server debug with server'); | ||
console.log(); | ||
} | ||
|
||
function executable(subcmd) { | ||
var file = join(__dirname, 'antd-' + subcmd); | ||
if (exists(file)) { | ||
return file; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env node | ||
|
||
var program = require('commander'); | ||
require('gnode'); | ||
|
||
program | ||
.parse(process.argv); | ||
|
||
require('../lib/build')(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env node | ||
|
||
var vfs = require('vinyl-fs'); | ||
var through = require('through2'); | ||
var join = require('path').join; | ||
var basename = require('path').basename; | ||
|
||
var cwd = join(__dirname, '../boilerplate'); | ||
var dest = process.cwd(); | ||
|
||
vfs.src('**/*', {cwd: cwd, cwdbase: true, dot: true}) | ||
.pipe(template(dest)) | ||
.pipe(vfs.dest(dest)) | ||
.on('end', function() { | ||
|
||
}) | ||
.resume(); | ||
|
||
function template(dest) { | ||
return through.obj(function (file, enc, cb) { | ||
if (!file.stat.isFile()) { | ||
return cb(); | ||
} | ||
|
||
console.log('Write %s', simplifyFilename(join(dest, basename(file.path)))); | ||
this.push(file); | ||
cb(); | ||
}); | ||
} | ||
|
||
function simplifyFilename(filename) { | ||
return filename.replace(process.cwd(), "."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env node | ||
|
||
var program = require('commander'); | ||
require('gnode'); | ||
|
||
program | ||
.option('-p, --port <port>', 'port') | ||
.parse(process.argv); | ||
|
||
require('../lib/server')({ | ||
port: program.port | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"ant-design": "https://github.com/ant-design/ant-design.git" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# demo | ||
|
||
---- | ||
|
||
## 使用方法 | ||
|
||
### 安装 antd | ||
|
||
```bash | ||
$ npm install antd -g | ||
``` | ||
|
||
### 安装依赖 | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
### 本地调试 | ||
|
||
```bash | ||
$ antd server | ||
``` | ||
|
||
然后访问 http://127.0.0.1:8000/a.html 。 | ||
|
||
### 构建 | ||
|
||
```bash | ||
$ antd build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>antd demo</title> | ||
<link rel="stylesheet" href="a.css" /> | ||
</head> | ||
<body> | ||
|
||
<h1>antd demo</h1> | ||
<br /><br /> | ||
|
||
<div id="components-progress-demo-circle-dynamic"></div> | ||
|
||
<script src="https://a.alipayobjects.com/react/0.13.2/react.js"></script> | ||
<script src="a.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
require('antd/style/index.less'); | ||
|
||
var ProgressCircle = require('antd/components/progress').Circle; | ||
|
||
var MyProgress = React.createClass({ | ||
getInitialState() { | ||
return { | ||
percent: 0 | ||
}; | ||
}, | ||
componentDidMount: function() { | ||
var self = this; | ||
setInterval(function() { | ||
if (self.state.percent < 100) { | ||
self.state.percent += 4; | ||
} | ||
self.setState({ | ||
percent: self.state.percent | ||
}); | ||
}, 200); | ||
}, | ||
render() { | ||
return <ProgressCircle percent={this.state.percent} />; | ||
} | ||
}); | ||
|
||
React.render( | ||
<MyProgress /> | ||
, document.getElementById('components-progress-demo-circle-dynamic')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"entry": { | ||
"a": "./a.js" | ||
}, | ||
"dependencies": { | ||
"ant-design": "https://github.com/ant-design/ant-design.git" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var shelljs = require('shelljs'); | ||
var join = require('path').join; | ||
var webpack = require('webpack'); | ||
|
||
module.exports = function() { | ||
var printResult = require('../lib/printResult'); | ||
|
||
var cwd = process.cwd(); | ||
shelljs.rm('-rf', join(cwd, './dist')); | ||
|
||
var webpackConfig; | ||
try { | ||
webpackConfig = require(join(cwd, 'webpack.config.js')); | ||
} catch(e) { | ||
webpackConfig = require('../lib/webpack.config.js'); | ||
} | ||
|
||
webpack(webpackConfig, function(err, stats) { | ||
printResult(stats); | ||
console.log(stats.toString()); | ||
if (err) { | ||
console.error(err); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var join = require('path').join; | ||
var webpack = require('webpack'); | ||
var printResult = require('./printResult'); | ||
|
||
module.exports = function () { | ||
var webpackConfig; | ||
|
||
try { | ||
webpackConfig = require(join(process.cwd(), 'config/webpack.dev.config.js')); | ||
} catch (e) { | ||
webpackConfig = require('./webpack.dev.config.js'); | ||
} | ||
|
||
var compiler = webpack(webpackConfig); | ||
compiler.plugin('done', printResult); | ||
|
||
return require('koa-webpack-dev-middleware')(compiler, { | ||
publicPath: '/' | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
module.exports = function(stats) { | ||
stats = stats.toJson(); | ||
|
||
if (stats.errors && stats.errors.length) { | ||
var hasChildError = false; | ||
stats.children.forEach(function(item) { | ||
if (item.errors) { | ||
hasChildError = true; | ||
item.errors.forEach(function(err) { | ||
console.error('error', err); | ||
}); | ||
} | ||
}); | ||
if (!hasChildError) { | ||
stats.errors.forEach(function(err) { | ||
console.error('error', err); | ||
}); | ||
} | ||
console.log(); | ||
} | ||
}; |
Oops, something went wrong.