-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
190 additions
and
1 deletion.
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,37 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# 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 | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_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 |
---|---|---|
@@ -1,2 +1,18 @@ | ||
# uba-build | ||
# uba build plugin | ||
|
||
## 说明 | ||
|
||
构建`uba`项目打包产出静态资源功能 | ||
|
||
## 使用 | ||
|
||
|
||
```bash | ||
uba build | ||
``` | ||
|
||
|
||
|
||
## 更多 | ||
|
||
如果想挖掘更多的`uba`插件,请点击[Npmjs for uba-*](https://www.npmjs.com/search?q=uba-) |
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,14 @@ | ||
#!/usr/bin/env node | ||
|
||
var argv = require('minimist')(process.argv.slice(2)); | ||
var commands = argv._; | ||
|
||
|
||
var opts = { | ||
cmd: commands, | ||
argv: argv, | ||
name: "uba" | ||
}; | ||
|
||
|
||
require("../src").plugin(opts); |
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 @@ | ||
module.exports = require("./src"); |
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 @@ | ||
{ | ||
"name": "uba-build", | ||
"version": "0.0.1", | ||
"description": "uba plugin for build", | ||
"main": "index.js", | ||
"bin": { | ||
"uba-build": "./bin/uba-build.js" | ||
}, | ||
"scripts": { | ||
"test": "node test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/iuap-design/uba-build.git" | ||
}, | ||
"keywords": [ | ||
"uba", | ||
"build" | ||
], | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/iuap-design/uba-build/issues" | ||
}, | ||
"homepage": "https://github.com/iuap-design/uba-build#readme", | ||
"dependencies": { | ||
"chalk": "^1.1.3", | ||
"minimist": "^1.2.0", | ||
"webpack": "^2.6.0", | ||
"webpack-merge": "^4.1.0" | ||
} | ||
} |
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,44 @@ | ||
var chalk = require("chalk"); | ||
var path = require("path"); | ||
|
||
var webpack = require("webpack"); | ||
|
||
function getHelp() { | ||
console.log(chalk.green(" Usage : ")); | ||
console.log(); | ||
console.log(chalk.green(" uba build")); | ||
console.log(); | ||
process.exit(0); | ||
} | ||
|
||
function getVersion() { | ||
console.log(chalk.green(require("../package.json").version)); | ||
process.exit(0); | ||
} | ||
|
||
function build() { | ||
var webpackConfig = require("./webpack.base"); | ||
webpack(webpackConfig, function(err, stats) { | ||
if(!err){ | ||
console.log("uba build success!"); | ||
}else{ | ||
console.log(err); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { | ||
plugin: function(options) { | ||
commands = options.cmd; | ||
pluginname = options.name; | ||
if (options.argv.h || options.argv.help) { | ||
getHelp(); | ||
} | ||
if (options.argv.v || options.argv.version) { | ||
getVersion(); | ||
} | ||
|
||
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,34 @@ | ||
var path = require("path"); | ||
var webpack = require("webpack"); | ||
var merge = require("webpack-merge"); | ||
|
||
var ubaConfig; | ||
|
||
|
||
|
||
try { | ||
ubaConfig = require(path.resolve(".","uba.config.js")).prodConfig; | ||
} catch (e) { | ||
console.log(e); | ||
process.exit(0); | ||
} finally { | ||
|
||
} | ||
|
||
|
||
|
||
var baseConfig= { | ||
entry: { | ||
|
||
}, | ||
output: { | ||
|
||
}, | ||
module: { | ||
rules: [] | ||
}, | ||
plugins: [] | ||
} | ||
|
||
|
||
module.exports = merge(baseConfig, ubaConfig); |
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,11 @@ | ||
var argv = require('minimist')(process.argv.slice(2)); | ||
var commands = argv._; | ||
|
||
|
||
var opts = { | ||
cmd: commands, | ||
argv: argv, | ||
name: "uba" | ||
}; | ||
|
||
require("./").plugin(opts); |