Skip to content

Commit

Permalink
添加build
Browse files Browse the repository at this point in the history
Fix #7
  • Loading branch information
otakustay committed Oct 10, 2016
1 parent 757b1c7 commit ab68542
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.babelrc
.fecsrc
build.sh
11 changes: 10 additions & 1 deletion bin/cli → bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@ let getConfigOverrides = argv => {
let help = () => {
let intent = ' ';

let packageInfo = (() => {
try {
return JSON.parse(readFileSync(join(__dirname, '..', 'package.json')));
}
catch (ex) {
return JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json')));
}
})();

let content = [
'Version:',
intent + require('../package.json').version,
intent + packageInfo.version,
'',
'Usage:',
intent + 'danmaku [args ...] [file ...]',
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
babel -d dist/lib lib
babel -d dist/bin bin
3 changes: 2 additions & 1 deletion lib/ass/style.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let decimalToHex = n => n.toString(16).padStart(2, 0);
let pad = s => (s.length < 2 ? '0' + s : s);
let decimalToHex = n => pad(n.toString(16));
let formatColor = (opacity, {r, g, b}) => '&H' + [opacity, b, g, r].map(decimalToHex).join('');

export default ({fontName, fontSize, opacity}) => {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "danmaku-to-ass",
"version": "0.0.8",
"description": "Convert bilibili & acfun danmaku to ass subtitle",
"main": "dist/index.js",
"main": "dist/lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"clean": "rm -r dist",
"compile": "sh build.sh",
"prepublish": "npm run clean && npm run compile"
},
"keywords": [
"danmaku",
Expand All @@ -14,6 +16,7 @@
"author": "otakustay",
"license": "LGPL-3.0",
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-stage-0": "^6.16.0"
Expand All @@ -25,6 +28,6 @@
"xml-parser": "^1.2.1"
},
"bin": {
"danmaku": "./bin/cli"
"danmaku": "dist/bin/cli.js"
}
}

0 comments on commit ab68542

Please sign in to comment.