Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show mapping to brower #4

Merged
merged 4 commits into from
Jan 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0"><link rel="shortcut icon" href="dist/lib/main/assets/favicon.ico" type="image/x-icon"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>*{margin:0;padding:0}</style></head><body><div id="root"></div><script type="text/javascript" src="ninoninoni.js?bb575fca4bd4505c1b0b"></script></body></html>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0"><link rel="shortcut icon" href="dist/lib/main/assets/favicon.ico" type="image/x-icon"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>*{margin:0;padding:0}</style></head><body><div id="root"></div><script type="text/javascript" src="ninoninoni.js?67b4cf52645b857dabb9"></script></body></html>
Binary file added dist/lib/main/assets/5795774_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions dist/lib/main/assets/MainPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.MainPage img {
width: 100%;
}

.MainPage .card {
width: 25%;
text-align: center;
cursor: pointer;
}

.MainPage .animate-appear {
animation: 0.3s appear 0s;
}

@keyframes appear {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
5 changes: 0 additions & 5 deletions dist/lib/main/assets/demo.css

This file was deleted.

64 changes: 64 additions & 0 deletions dist/lib/main/layout/1a79a4d60de6718e8e5b326e338ae533.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"BlockGroup": {
"block-623187": {
"x": 158,
"y": 256,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
},
"block-624018": {
"x": 367,
"y": 368,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
},
"block-73377": {
"x": 253,
"y": 525,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
}
},
"TagGroup": {
"tag-626505": {
"x": 167,
"y": 284,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test"
},
"tag-629962": {
"x": 405,
"y": 398,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test2"
},
"tag-80986": {
"x": 286,
"y": 555,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test3"
}
},
"LineGroup": {
"line-77619": { "fromKey": "block-73377", "toKey": "block-623187" },
"line-592694": { "fromKey": "block-623187", "toKey": "block-624018" }
}
}
64 changes: 64 additions & 0 deletions dist/lib/main/layout/1a79a4d60de6718e8e5b326e338ae534.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"BlockGroup": {
"block-623187": {
"x": 158,
"y": 256,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
},
"block-624018": {
"x": 367,
"y": 368,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
},
"block-73377": {
"x": 253,
"y": 525,
"style": {
"width": 100,
"height": 80,
"background": "#F96",
"borderRadius": "10px",
"border": "1px solid #aaa"
}
}
},
"TagGroup": {
"tag-626505": {
"x": 167,
"y": 284,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test"
},
"tag-629962": {
"x": 405,
"y": 398,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test2"
},
"tag-80986": {
"x": 286,
"y": 555,
"style": { "width": 100, "height": 32 },
"editable": false,
"input": "test3"
}
},
"LineGroup": {
"line-77619": { "fromKey": "block-73377", "toKey": "block-623187" },
"line-592694": { "fromKey": "block-623187", "toKey": "block-624018" }
}
}
1 change: 1 addition & 0 deletions dist/lib/main/mapping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"1a79a4d60de6718e8e5b326e338ae533","title":"test1","thumbnailUrl":"dist/lib/main/assets/5795774_0.jpg","hoverText":"测试 layout-1a79a4d60de6718e8e5b326e338ae533.json","createTime":1548564824646,"modifyTime":1548564824646},{"id":"1a79a4d60de6718e8e5b326e338ae534","title":"test1","thumbnailUrl":"dist/lib/main/assets/5795774_0.jpg","hoverText":"测试 layout-1a79a4d60de6718e8e5b326e338ae534.json","createTime":1548564824646,"modifyTime":1548564824646}]
70 changes: 6 additions & 64 deletions dist/ninoninoni.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"kill": "taskkill /f /im node.exe",
"dev": "nino koei -c scripts/build.js -w -d",
"build": "nino koei -c scripts/build.js",
"generate": "node scripts/generateMapping.js",
"prettier": "node ./scripts/prettier.js",
"test": "nino test",
"lint-staged": "lint-staged"
Expand All @@ -33,6 +34,7 @@
"koa-router": "^7.4.0"
},
"devDependencies": {
"date-fns": "^2.0.0-alpha.27",
"eslint": "^5.12.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
Expand Down
11 changes: 11 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');
const cwd = process.cwd();
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
output: {
Expand All @@ -17,5 +18,15 @@ module.exports = {
collapseWhitespace: true,
},
}),
new CopyWebpackPlugin([
{
from: path.join(cwd, '/src/mapping.json'),
to: path.join(cwd, '/dist/lib/main/mapping.json'),
},
{
from: path.join(cwd, '/src/layout'),
to: path.join(cwd, 'dist/lib/main/layout'),
},
]),
],
};
31 changes: 31 additions & 0 deletions scripts/generateMapping.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const fs = require('fs');
const path = require('path');
const cwd = process.cwd();

const files = fs.readdirSync(path.join(cwd, 'src/layout'));
const layoutFiles = files.filter(file => {
return file.endsWith('.json');
});

let layouts = [];
for (let fileName of layoutFiles) {
layouts.push({
id: fileName.replace('.json', ''),
title: 'test1',
thumbnailUrl: 'dist/lib/main/assets/5795774_0.jpg',
hoverText: '测试 layout-' + fileName,
createTime: new Date().getTime(),
modifyTime: new Date().getTime(),
});
}
fs.writeFile(
path.join(cwd, 'src/mapping.json'),
JSON.stringify(layouts),
error => {
if (error) {
throw new Error(error);
}
// eslint-disable-next-line
console.log('generate completed.');
},
);
1 change: 1 addition & 0 deletions scripts/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ignoreFiles = [
'**/**.snap',
'**/dist/**',
'**/**.map',
'**/**.json',
];

const jsFiles = glob.sync('**/*.js*', {
Expand Down
1 change: 1 addition & 0 deletions scripts/start-all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

npm run generate &
npm run dev &
npm run server &
wait
Binary file added src/assets/5795774_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/assets/MainPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.MainPage img {
width: 100%;
}

.MainPage .card {
width: 25%;
text-align: center;
cursor: pointer;
}

.MainPage .animate-appear {
animation: 0.3s appear 0s;
}

@keyframes appear {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
5 changes: 0 additions & 5 deletions src/assets/demo.css

This file was deleted.

Loading