Skip to content

Instantly share code, notes, and snippets.

View pawelgalazka's full-sized avatar

Paweł Gałązka pawelgalazka

View GitHub Profile
@pawelgalazka
pawelgalazka / index.html
Created October 3, 2016 06:40
Firenpm: generated demo/index.html
<!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>
@pawelgalazka
pawelgalazka / package.json
Last active October 3, 2016 06:41
Firenpm: generated package.json
{
"name": "test-project",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"author": "",
"license": "MIT",
"scripts": {
"test": "run test"
},
@pawelgalazka
pawelgalazka / index.js
Created October 3, 2016 06:49
Firenpm: react example for demo/index.js
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')
)
@pawelgalazka
pawelgalazka / index.js
Created October 3, 2016 06:51
Firenpm: react example for src/index.js
import React from 'react'
const MyComponent = () => {
return (
<div>Hello</div>
)
}
export default MyComponent
@pawelgalazka
pawelgalazka / structure.txt
Created October 3, 2016 06:53
Firenpm: generated directory structure
|- lib
|- src
| |- index.js
| |- index.test.js
|
|- config
| |- webpack.js
|
|- demo
| |- index.html
@pawelgalazka
pawelgalazka / runfile.js
Created October 4, 2016 02:07
runjs tricks example (medium article)
import { run } from 'runjs'
export function test (what, mode = 'node') {
if (mode == 'browser') {
} else {
}
}
@pawelgalazka
pawelgalazka / runfile.js
Created October 4, 2016 02:08
runjs tricks example (medium article)
import { run } from 'runjs'
export function clean () {
}
export function build () {
process.on('SIGINT', clean)
try {
} catch (e) {
@pawelgalazka
pawelgalazka / runfile.js
Created October 4, 2016 02:10
runjs tricks example (medium article)
import { run } from 'runjs'
function log () {
}
export function start () {
run('http-server .', {async: true}).then((output) => {
log(output)
}).catch((error) => {
@pawelgalazka
pawelgalazka / package.json
Last active April 21, 2017 22:14
package.json pattern for react component
{
"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"
},
@pawelgalazka
pawelgalazka / runfile.js
Last active August 9, 2017 08:41
Example of runfile.js (for medium article)
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}`)
}