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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Demo</title> | |
<script src="bundle.js"></script> | |
</head> | |
<body> | |
<div id="react-app"></div> | |
</body> |
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
{ | |
"name": "test-project", | |
"version": "1.0.0", | |
"description": "", | |
"main": "lib/index.js", | |
"author": "", | |
"license": "MIT", | |
"scripts": { | |
"test": "run test" | |
}, |
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
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import MyComponent from '../src' | |
import '../style.css' | |
document.addEventListener('DOMContentLoaded', () => { | |
ReactDOM.render( | |
<MyComponent />, | |
document.querySelector('#react-app') | |
) |
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
import React from 'react' | |
const MyComponent = () => { | |
return ( | |
<div>Hello</div> | |
) | |
} | |
export default MyComponent |
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
|- lib | |
|- src | |
| |- index.js | |
| |- index.test.js | |
| | |
|- config | |
| |- webpack.js | |
| | |
|- demo | |
| |- index.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
import { run } from 'runjs' | |
export function test (what, mode = 'node') { | |
if (mode == 'browser') { | |
} else { | |
} | |
} |
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
import { run } from 'runjs' | |
export function clean () { | |
} | |
export function build () { | |
process.on('SIGINT', clean) | |
try { | |
} catch (e) { |
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
import { run } from 'runjs' | |
function log () { | |
} | |
export function start () { | |
run('http-server .', {async: true}).then((output) => { | |
log(output) | |
}).catch((error) => { |
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
{ | |
"name": "react-component", | |
"version": "1.0.0", | |
"main": "lib/index.js", | |
"scripts": { | |
"build": "babel src --out-dir lib --ignore test.js", | |
"lint": "eslint src", | |
"test": "npm run lint && npm run build && jest --env=jsdom", | |
"clean": "rm -rf node_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
import { run, option } from 'runjs' | |
export function clean () { | |
run('rm -rf node_modules') | |
run('rm -rf build') | |
} | |
export function lint (path = '.') { | |
option(this, 'fix') ? run(`eslint ${path} --fix`) : run(`eslint ${path}`) | |
} |
OlderNewer