chore: parcel to kkt tools.

pull/169/head
jaywcjlove 5 years ago
parent 9be21faab9
commit c0361d2164

@ -1,9 +0,0 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}

@ -0,0 +1,34 @@
import path from 'path';
export const loaderOneOf = [
require.resolve('@kkt/loader-less')
];
export const moduleScopePluginOpts = [
path.resolve(process.cwd(), 'README.md')
];
export default (conf, opts, webpack) => {
conf.output.path = path.resolve(process.cwd(), 'doc');
const pkg = require(path.resolve(process.cwd(), 'package.json'));
// Webpack parses md file text
conf.module.rules.map((item) => {
if (item.oneOf) {
item.oneOf.unshift({
test: /\.md$/,
use: require.resolve('raw-loader'),
});
}
return item;
});
// Get the project version.
conf.plugins.push(
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
})
);
return conf;
}

@ -1,8 +0,0 @@
{
"modules": true,
"plugins": {
"autoprefixer": {
"grid": true
}
}
}

@ -69,7 +69,7 @@ var _keyMap = {
tab: 9,
clear: 12,
enter: 13,
"return": 13,
return: 13,
esc: 27,
escape: 27,
space: 32,
@ -78,7 +78,7 @@ var _keyMap = {
right: 39,
down: 40,
del: 46,
"delete": 46,
delete: 46,
ins: 45,
insert: 45,
home: 36,

@ -67,7 +67,7 @@ var _keyMap = {
tab: 9,
clear: 12,
enter: 13,
"return": 13,
return: 13,
esc: 27,
escape: 27,
space: 32,
@ -76,7 +76,7 @@ var _keyMap = {
right: 39,
down: 40,
del: 46,
"delete": 46,
delete: 46,
ins: 45,
insert: 45,
home: 36,

4
dist/hotkeys.js vendored

@ -73,7 +73,7 @@
tab: 9,
clear: 12,
enter: 13,
"return": 13,
return: 13,
esc: 27,
escape: 27,
space: 32,
@ -82,7 +82,7 @@
right: 39,
down: 40,
del: 46,
"delete": 46,
delete: 46,
ins: 45,
insert: 45,
home: 36,

@ -1,6 +1,8 @@
if (process.env.NODE_ENV === 'production') {
// eslint-disable-next-line global-require
module.exports = require('./dist/hotkeys.common.min.js');
} else {
// eslint-disable-next-line global-require
module.exports = require('./dist/hotkeys.common.js');
}

23327
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -8,14 +8,13 @@
"scripts": {
"lint": "eslint --ext .js src website",
"deploy": "node scripts/build.js && npm run doc:build && gh-pages -d doc",
"build": "node scripts/build.js && npm run doc:build && npm run lint",
"build": "node scripts/build.js && npm run doc && npm run lint",
"watch": "node scripts/watch.js",
"pretest": "npm run build",
"test": "jest --coverage",
"test:watch": "jest --watch",
"doc": "npm run doc:dev",
"doc:dev": "cross-env NODE_ENV=development parcel website/index.html --out-dir doc --no-cache",
"doc:build": "rimraf doc && cross-env NODE_ENV=production parcel build website/index.html --out-dir doc --public-url ./ --no-cache --no-source-maps"
"doc": "cross-env PUBLIC_URL=. ENTRYDIR=website kkt build",
"doc:dev": "cross-env PUBLIC_URL=. ENTRYDIR=website kkt start"
},
"files": [
"index.d.ts",
@ -50,13 +49,10 @@
},
"dependencies": {},
"devDependencies": {
"@babel/core": "7.9.0",
"@babel/plugin-external-helpers": "7.8.3",
"@babel/plugin-transform-runtime": "7.9.0",
"@babel/preset-env": "7.9.0",
"@babel/preset-react": "7.9.4",
"@uiw/react-github-corners": "1.1.3",
"autoprefixer": "9.7.5",
"@kkt/loader-less": "^5.6.1",
"@uiw/react-github-corners": "^1.1.3",
"@uiw/react-shields": "^1.1.0",
"@uiw/reset.css": "^1.0.3",
"babel-eslint": "10.1.0",
"bannerjs": "1.0.7",
"classnames": "2.2.6",
@ -71,11 +67,10 @@
"highlight.js": "9.18.1",
"husky": "4.2.3",
"jest": "25.2.4",
"kkt": "^5.6.1",
"less": "3.11.1",
"parcel-bundler": "1.12.4",
"parcel-plugin-markdown-string": "1.4.2",
"postcss-modules": "1.5.0",
"puppeteer": "2.1.1",
"raw-loader": "^4.0.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-markdown": "4.3.1",
@ -86,5 +81,17 @@
"rollup-plugin-node-resolve": "5.2.0",
"uglify-js": "3.8.1",
"zlib": "1.0.5"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

@ -1,13 +1,15 @@
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hotkeys.js - A robust Javascript library for capturing keyboard input.</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="A robust Javascript library for capturing keyboard input and key combinations entered. It has no dependencies. Try to press your keyboard, The following button will highlight.">
</head>
<body>
<div id="root"></div>
<script src="./index.js"></script>
</body>
</html>
</html>

@ -1,12 +1,12 @@
import React, { Component } from 'react';
import GithubCorner from '@uiw/react-github-corners';
import { Github } from '@uiw/react-shields';
import KeyBoard from './components/KeyBoard';
import Footer from './components/Footer';
import Markdown from './components/Markdown';
import GithubShields from './components/GithubShields';
import styles from './styles/index.less';
import styles from './styles/index.module.less';
import DocumentStr from '../README.md';
import hotkeys from '../dist/hotkeys.common';
import hotkeys from '..';
import pkg from '../package.json';
export default class App extends Component {
@ -129,31 +129,14 @@ export default class App extends Component {
keyCode={keyCode}
/>
<Markdown source={DocumentStrSource} />
<GithubShields
source={[
{
href: 'https://github.com/jaywcjlove/hotkeys/stargazers',
img: 'https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg',
},
{
href: 'https://github.com/jaywcjlove/hotkeys/network',
img: 'https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg',
},
{
href: 'https://github.com/jaywcjlove/hotkeys/watchers',
img: 'https://img.shields.io/github/watchers/jaywcjlove/hotkeys.svg?label=Watch',
},
{
href: 'https://github.com/jaywcjlove/followers',
img: 'https://img.shields.io/github/followers/jaywcjlove.svg',
},
{
href: 'https://gitee.com/jaywcjlove/hotkeys',
img: 'https://jaywcjlove.github.io/sb/ico/gitee.svg',
},
]}
/>
<Footer name="Kenny Wong" href="http://jaywcjlove.github.io" year="2015-present" />
<Footer name="Kenny Wong" href="http://jaywcjlove.github.io" year="2015-present">
<Github user="jaywcjlove" repo="hotkeys">
<Github.Social href="https://github.com/jaywcjlove/hotkeys" type="forks" />
<Github.Social href="https://github.com/jaywcjlove/hotkeys" type="stars" />
<Github.Social href="https://github.com/jaywcjlove/hotkeys" type="watchers" />
<Github.Social href="https://github.com/jaywcjlove/hotkeys" type="followers" />
</Github>
</Footer>
</div>
);
}

@ -1,12 +1,13 @@
import React from 'react';
import style from './Footer.less';
import style from './Footer.module.less';
export default function Footer({ name, href, year }) {
export default function Footer({ name, href, year, children }) {
return (
<div className={style.footer}>
{children}
<div>
Licensed under MIT. (Yes it&acute;s free and
<a href="https://github.com/jaywcjlove/hotkeys">open-sourced</a>
<a href="https://github.com/jaywcjlove/hotkeys"> open-sourced</a>
)
</div>
<div>

@ -1,20 +0,0 @@
import React from 'react';
import styles from './GithubShields.less';
// source = [
// {
// href: 'https://github.com/jaywcjlove/hotkeys/network',
// img: 'https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg?style=social'
// },
// ]
export default function GithubShields({ source }) {
return (
<div className={styles.shields}>
{source.map((item, idx) => (
<a key={`${idx}${item.href}`} href={item.href} target="_blank" rel="noopener noreferrer">
<img src={item.img} alt="" />
</a>
))}
</div>
);
}

@ -1,8 +0,0 @@
.shields {
padding: 60px 0 0 0;
text-align:center;
a + a{
margin-left: 10px;
}
}

@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import styles from './KeyBoard.less';
import styles from './KeyBoard.module.less';
const keyCode = [
{ keycode: 27, name: ['esc'] },

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import ReactMarkdown from 'react-markdown';
import hljs from 'highlight.js';
import classNames from 'classnames';
import styles from './styles/index.less';
import styles from './styles/index.module.less';
hljs.configure({
tabReplace: ' ', // 2 spaces

@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import '@uiw/reset.css';
import './styles/reset.less';
ReactDOM.render(<App />, document.getElementById('root'));

@ -1,43 +1,13 @@
html {
font-size: 14px;
background: #e0e0e0;
}
/* margin */
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, img, form, applet, fieldset, legend, button, input, textarea, th, table, tr, td{
margin: 0;
padding: 0;
border: none;
*, *:before, *:after {
box-sizing: inherit !important;
}
/* body */
body {
font-family: "微软雅黑";
font-size: 12px;
color:#535353;
position: relative;
font-family: "PingHei","Lucida Grande", "Lucida Sans Unicode", "STHeitiSC-Light", "Helvetica","Arial","Verdana","sans-serif";
background: #f8f8f8 url(../assets/bg.jpg) repeat top left;
}
body, div, fieldset, form, h1, h2, h3, h4, h5, h6, html, p {
-webkit-text-size-adjust: none
}
/* img */
img {
padding: 0;
margin: 0;
vertical-align: top;
border: none;
}
/* div */
li,ul {
list-style: none;
margin: 0 auto;
padding: 0 auto;
display: block;
user-select: none;
a {
text-decoration: none;
}
Loading…
Cancel
Save