This repository has been archived by the owner on Jun 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some less-mean linting. Better test-web to run only allTests.
Better entry point ordering @todo redux example Removed example jade Added missing dep They're regex not strings. Updated info on how to use build Is this better or worse? Merged in recent changes for ES6 and updated base Added pre commit hook Merged and working. Angular build. Angular update. Now with linting. Working on fixing some base stuff Cleaning up packages in base. Cleaning up files. Setting better base. Updated eslintrc 0.0.2 Resolver for linting webpack alias. Added environment module. 0.1.0 Updating readme for env 0.1.1 Only lint js files. 0.1.2 Added assets directory No reason to be 2 lines 0.2.0 0.3.0 Moved build to a small node file. Better compile. 0.4.0 Removed specific flags Added webpack dashboard and > [email protected] dev /home/dante/Downloads/repos/browser-base-main > ./node_modules/webpack-dashboard/bin/webpack-dashboard.js -p 8008 -- npm run server �]0;webpack-dashboard��[?1049h�[?1h�=�[1;1r�[?25l�[1;1H�(B�)0�[H�[J�[?1000h�[?1002h�[?1003h�[?1005h�[?1l�>�[34h�[?25h�[H�[J�[?1000l�[?1002l�[?1003l�[?1005l�[?1049l 0.4.1 Some cool progress Events on inputs. Added refresher. Playing with stuff some more Switched to a compiled fn list to run recursive build. Added more logs. Build breaks on local because dashboard. Added explicit favicon. Removed wp dashboard. Reverted to environments only. 0.4.2 0.5.0 Added docs to ignore
- Loading branch information
Showing
21 changed files
with
356 additions
and
118 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["es2015"], | ||
"plugins": ["transform-object-rest-spread"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.jade] | ||
trim_trailing_whitespace = false | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
indent_style = tab |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,54 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'airbnb/base', | ||
settings: { | ||
'import/resolver': 'webpack', | ||
'import/extensions': ['.js'], | ||
}, | ||
extends: [ | ||
'airbnb/base', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
], | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
ecmaFeatures: { | ||
experimentalObjectRestSpread: true | ||
} | ||
}, | ||
rules: { | ||
indent: [2, 'tab'] | ||
// 'no-undef': [1, 'always'], | ||
'prefer-const': [1], | ||
|
||
// use tabs only | ||
indent: [2, 'tab', { SwitchCase: 1 }], | ||
|
||
// use one space anywhere we allow space | ||
'no-multi-spaces': [2], | ||
|
||
// no spaces before a functions parameters. | ||
// good => `function add(a, b){ ... }` | ||
// bad => `function add (a, b){ ... }` | ||
'space-before-function-paren': [2], | ||
|
||
// error if we are reassigning function parameters, | ||
// allow reassigning props of parameters | ||
'no-param-reassign': [2, { 'props': false }], | ||
|
||
// warn when you don't dangle a comma in a multiline object or array def | ||
'comma-dangle': [1, 'always-multiline'], | ||
|
||
// use whatever block padding you want | ||
'padded-blocks': [0], | ||
|
||
// only provide a radix to parseInt if it is not 10 | ||
radix: [2, 'as-needed'], | ||
|
||
// set max line length to a more reasonable number | ||
'max-len': [2, 120], | ||
}, | ||
env: { | ||
mocha: true, | ||
browser: true, | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
[Build Files] | ||
# Build Artifacts | ||
bin | ||
docs | ||
|
||
[Generated Files] | ||
*.log | ||
# Dependencies | ||
node_modules | ||
|
||
# IDE | ||
.tmp/ | ||
.DS_Store | ||
.idea/ | ||
*.sublime-* | ||
|
||
[Dependencies] | ||
node_modules | ||
# Generated / Data files | ||
*.meta | ||
*.log | ||
|
||
# Misc | ||
data/ | ||
|
||
[IDE] | ||
*.sublime-* | ||
# Optional REPL history | ||
.node_repl_history |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,55 @@ | ||
# browser-base | ||
A boilerplate to start developing for the web | ||
# web-base | ||
Use this to start other web projects. It gives you a good base to start from including | ||
+ has an .editorconfig to enforce typographic style like tabs instead of spaces and no trailing whitespace | ||
+ uses eslint to enforce javascript coding conventions such as no `var`s perfer arrow functions, etc | ||
+ compiles es6 using babel and webpack (includes sourcemaps) | ||
+ compiles jade -> html or strings (.tpl) | ||
+ compiles sass -> css adding browser specific prefixes where necessary | ||
|
||
`npm serve` for testing | ||
## New projects | ||
First create a new repository on [github](https://github.com/new) | ||
``` | ||
git clone [email protected]:jplikesbikes/web-base.git newrepos | ||
cd newrepos | ||
git remote rename origin upstream | ||
git remote add origin [email protected]:jplikesbikes/newrepos | ||
git push -u origin master | ||
``` | ||
Update the package.json name and repository. | ||
Update the readme. | ||
Your good to go! | ||
|
||
`npm compile` to build | ||
## Develop | ||
``` | ||
npm install | ||
npm test // run tests | ||
npm run linter // lint and auto fix formatting errors | ||
`npm test` for cli testing | ||
npm run web-test // run tests in browser with webpack-dev-server | ||
open localhost:8080/test.bundle | ||
`npm test-web` to debug in the browser | ||
npm run server // run webpack-dev-server with hot module reloading | ||
open localhost:8080 | ||
``` | ||
|
||
### Environments | ||
The `webpack.config.js` adds an `environment` module alias to a file in the `env` directory. | ||
By default, it points to `env/localhost.js`, but you can point to any file in | ||
`env` by | ||
providing a `--env environmentName` command line arg: | ||
``` | ||
#Compile with import env from `environment` pointing to `env/prod.js` | ||
npm run compiler -- --env prod | ||
``` | ||
|
||
Watching Tests | ||
``` | ||
npm test -- --watch | ||
``` | ||
|
||
Compile into `bin` and deploy to s3 | ||
``` | ||
npm run compiler | ||
npm run aws-deploy s3://your-bucket-here | ||
``` | ||
note you need the aws cli installed for deployment to work |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const wp = require('webpack'); | ||
const merge = require('merge-dirs').default; | ||
const config = require('./webpack.config'); | ||
const del = require('del'); | ||
|
||
delete config.devServer; | ||
|
||
console.log('Clearing bin'); | ||
return del(['./bin']).then(paths => | ||
new Promise((res, rej) => | ||
wp(config, (err, stats) => { | ||
if (err) { | ||
console.error(err); | ||
} | ||
if (stats) { | ||
console.log(stats.toString({ | ||
chunks: true, | ||
colors: true, | ||
hash: true, | ||
timings: true, | ||
assets: true, | ||
modules: true, | ||
children: true | ||
})); | ||
} | ||
console.log('Merging assets'); | ||
merge('./assets', './bin', 'ask'); | ||
console.log('Mergind done'); | ||
return res('Done.'); | ||
}) | ||
) | ||
).then( | ||
res => console.log(res), | ||
rej => console.error(rej) | ||
); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default { | ||
// details | ||
env: 'localhost', | ||
version: 0, | ||
// feature flags | ||
logging: true, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default { | ||
// details | ||
env: 'prod', | ||
version: 0, | ||
// feature flags | ||
logging: false, | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
$color: #222; | ||
$font-size: 16px; | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
doctype html | ||
html(lang="en") | ||
html(lang='en') | ||
head | ||
meta(charset="UTF-8") | ||
meta(name="viewport", content="width=device-width, initial-scale=1") | ||
meta(name="description", content="") | ||
|
||
title Hello World | ||
|
||
script(src="./main.bundle.js", type="text/javascript", async, defer) | ||
meta(charset='UTF-8') | ||
title Demo Page | ||
link( | ||
rel="stylesheet" | ||
type="text/css" | ||
href="./index.css" | ||
) | ||
link( | ||
rel="shortcut icon" | ||
type="image/x-icon" | ||
href="./favicon.ico" | ||
) | ||
body | ||
h1.hidden.content-loading Loading... | ||
|
||
script( | ||
src="app.bundle.js", | ||
async="true", | ||
defer="true" | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This file is loaded with the page | ||
// Use it to put base styles and resets in | ||
|
||
@import "~normalize.css"; | ||
@import "variables"; | ||
|
||
@import url('https://fonts.googleapis.com/css?family=Open+Sans'); | ||
|
||
html { | ||
font-family: 'Open Sans', sans-serif; | ||
color: $color; | ||
font-size: $font-size; | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
require('./main.less'); | ||
import './main.scss'; | ||
import env from 'environment'; | ||
|
||
|
||
console.debug('Hello world', env); | ||
|
||
|
||
|
||
|
||
console.log('Hello World.'); | ||
|
||
// Jade example | ||
var exampleJade = require('./example.jade'); | ||
|
||
document.body.innerHTML = exampleJade({ | ||
name: 'Frank', | ||
age: Math.floor(1 + Math.random() * 50) | ||
}); |
Oops, something went wrong.