Apply standard/enforced code format with prettier.
This commit marks applying prettier to the whole of git history up to this point and prettier is used to enforce format via pre-commit hook. The command used was: `git filter-branch -f --tree-filter 'prettier --no-config --single-quote --tab-width=1 --print-width=100 --use-tabs --trailing-comma=none --prose-wrap=always --write "{.,{packages,bin}/**}/*.{js,json,md}" || echo "Error formatting, possibly invalid JS"' -- --all`
This commit is contained in:
parent
dde7bb3e70
commit
3328248274
@ -35,7 +35,7 @@ silly.
|
||||
|
||||
These are `npm --global` dependencies:
|
||||
|
||||
* [Lerna 2.0.0](https://lernajs.io/)
|
||||
- [Lerna 2.0.0](https://lernajs.io/)
|
||||
|
||||
# Installation
|
||||
|
||||
|
||||
4
bin/pre-commit.sh
Normal file
4
bin/pre-commit.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
nodejs node_modules/lerna/bin/lerna.js run pre-commit\
|
||||
&& npm run check_code_format
|
||||
@ -12,7 +12,8 @@ const CDP = require('chrome-remote-interface');
|
||||
const SPEC_DIR = 'spec';
|
||||
const TEST_FILENAME = '.spec_runner.html';
|
||||
const HOST = '127.0.0.1';
|
||||
const PORT = 10080;
|
||||
// Randomize the port so we can just run again if there's a stuck process.
|
||||
const PORT = Math.floor(Math.random() * 40000) + 1025;
|
||||
|
||||
const DEBUG =
|
||||
typeof process.env['DEBUG'] === 'string'
|
||||
@ -150,7 +151,9 @@ async function runTestsInChrome() {
|
||||
|
||||
Network.requestWillBeSent(result => reqMap.set(result.requestId, result.request.url));
|
||||
Network.loadingFailed(result =>
|
||||
consolePrint(`\x1b[31mNetwork Error: ${result.errorText} for ${reqMap.get(result.requestId)}`)
|
||||
consolePrint(
|
||||
`\x1b[31mNetwork Error: ${result.errorText} for ${reqMap.get(result.requestId)}`
|
||||
)
|
||||
);
|
||||
|
||||
Runtime.exceptionThrown(result =>
|
||||
|
||||
@ -5,9 +5,13 @@
|
||||
"husky": "1.0.0-rc.13",
|
||||
"lerna": "2.0.0-beta.32"
|
||||
},
|
||||
"scripts": {
|
||||
"check_code_format": "nodejs node_modules/prettier/bin-prettier.js --config ./prettier.config.js --list-different \"{.,{packages,bin}/**/!(dist)}/*.{js,json,md}\"",
|
||||
"format_code": "nodejs node_modules/prettier/bin-prettier.js --config ./prettier.config.js --write \"{.,{packages,bin}/**/!(dist)}/*.{js,json,md}\""
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lerna run pre-commit"
|
||||
"pre-commit": "sh ./bin/pre-commit.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ container.
|
||||
|
||||
FRPTools is the result of years of learning from the following projects:
|
||||
|
||||
* [KnockoutJS](http://knockoutjs.com/)
|
||||
* [Overture](https://github.com/fastmail/overture)
|
||||
* [Redux](https://redux.js.org/)
|
||||
* [Mithril](https://mithril.js.org/)
|
||||
- [KnockoutJS](http://knockoutjs.com/)
|
||||
- [Overture](https://github.com/fastmail/overture)
|
||||
- [Redux](https://redux.js.org/)
|
||||
- [Mithril](https://mithril.js.org/)
|
||||
|
||||
@ -3,12 +3,16 @@
|
||||
"version": "3.2.1",
|
||||
"description": "Observable Property and Computed data streams",
|
||||
"main": "src/index.js",
|
||||
"files": ["src"],
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node ../../bin/runTests.js ./",
|
||||
"pre-commit": "npm run test"
|
||||
},
|
||||
"keywords": ["reactive"],
|
||||
"keywords": [
|
||||
"reactive"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ myself and to share with friends and family. Along the way it became a learning
|
||||
|
||||
## Features
|
||||
|
||||
* Upload and view images
|
||||
* Save files to Backblaze B2 storage.
|
||||
- Upload and view images
|
||||
- Save files to Backblaze B2 storage.
|
||||
|
||||
## Development Philosophy
|
||||
|
||||
@ -19,9 +19,9 @@ photo gallery for anyone who wishes to escape the social media silos. However, i
|
||||
|
||||
This would not be possible without the giants who have laid the foundation:
|
||||
|
||||
* [Webpack](http://webpack.js.org/)
|
||||
* [DOMVM](http://leeoniya.github.io/domvm/)
|
||||
* [PouchDB](https://pouchdb.com/)
|
||||
- [Webpack](http://webpack.js.org/)
|
||||
- [DOMVM](http://leeoniya.github.io/domvm/)
|
||||
- [PouchDB](https://pouchdb.com/)
|
||||
|
||||
There are many more dependencies. You can find them in the [package.json](./package.json) file.
|
||||
|
||||
@ -36,12 +36,12 @@ localhost certificate exception in order to operate properly.
|
||||
|
||||
In the future, I plan to add:
|
||||
|
||||
* sharable links
|
||||
* local file storage
|
||||
* CSRF for interacting with server component
|
||||
* albums
|
||||
* client-side encryption
|
||||
* video support
|
||||
* Sandstorm support
|
||||
* CORS-based storage: - s3 - remotestorage - Google Cloud? - Dropbox?
|
||||
* tags
|
||||
- sharable links
|
||||
- local file storage
|
||||
- CSRF for interacting with server component
|
||||
- albums
|
||||
- client-side encryption
|
||||
- video support
|
||||
- Sandstorm support
|
||||
- CORS-based storage: - s3 - remotestorage - Google Cloud? - Dropbox?
|
||||
- tags
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
"name": "Gallery",
|
||||
"version": "0.0.1",
|
||||
"description": "Personal photo gallery",
|
||||
"keywords": ["javascript"],
|
||||
"keywords": [
|
||||
"javascript"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
|
||||
@ -50,11 +50,11 @@ export function FocusView(vm, params) {
|
||||
if (windowRatio > imageRatio) {
|
||||
return {
|
||||
height: vw / windowRatio,
|
||||
width: vw / windowRatio * imageRatio
|
||||
width: (vw / windowRatio) * imageRatio
|
||||
};
|
||||
}
|
||||
return {
|
||||
height: vh * windowRatio / imageRatio,
|
||||
height: (vh * windowRatio) / imageRatio,
|
||||
width: vh * windowRatio
|
||||
};
|
||||
},
|
||||
|
||||
@ -32,7 +32,7 @@ export function SectionView(vm, params, key) {
|
||||
const availableWidth = vw - CONTENT_MARGIN_WIDTH;
|
||||
const aspectRatios = pArr.map(aspectRatio);
|
||||
const totalImageRatio = sum(aspectRatios);
|
||||
const rowCount = Math.ceil(totalImageRatio * OPTIMAL_IMAGE_HEIGHT / availableWidth);
|
||||
const rowCount = Math.ceil((totalImageRatio * OPTIMAL_IMAGE_HEIGHT) / availableWidth);
|
||||
const rowRatios = partition(aspectRatios, rowCount);
|
||||
|
||||
let index = 0;
|
||||
@ -41,7 +41,7 @@ export function SectionView(vm, params, key) {
|
||||
const rowTotal = sum(row);
|
||||
const imageRatio = row[0];
|
||||
const portion = imageRatio / rowTotal;
|
||||
let rowHeight = availableWidth * portion / aspectRatio(pArr[index]);
|
||||
let rowHeight = (availableWidth * portion) / aspectRatio(pArr[index]);
|
||||
if (rowHeight > OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER) {
|
||||
rowHeight = OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER;
|
||||
}
|
||||
|
||||
@ -3,12 +3,17 @@
|
||||
"version": "0.9.0",
|
||||
"description": "Expose an API to a web worker and its parent",
|
||||
"main": "src/index.js",
|
||||
"files": ["src"],
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node ../../bin/runTests.js ./",
|
||||
"pre-commit": "npm run test"
|
||||
},
|
||||
"keywords": ["worker", "webworker"],
|
||||
"keywords": [
|
||||
"worker",
|
||||
"webworker"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
|
||||
@ -3,7 +3,11 @@
|
||||
"version": "1.0.1",
|
||||
"description": "Document Management Layer for PouchDB",
|
||||
"main": "src/index.js",
|
||||
"files": ["dist", "lib", "src"],
|
||||
"files": [
|
||||
"dist",
|
||||
"lib",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node ../../bin/runTests.js ./",
|
||||
"pre-commit": "npm run test"
|
||||
|
||||
@ -3,9 +3,13 @@
|
||||
"version": "2.1.0",
|
||||
"description": "A DOM-abstraction communicator",
|
||||
"main": "src/index.js",
|
||||
"files": ["src"],
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {},
|
||||
"keywords": ["router"],
|
||||
"keywords": [
|
||||
"router"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -16,43 +16,43 @@ const router = Router(routeSpecArray, rootURL='#'):
|
||||
|
||||
An array of objects with the following properties:
|
||||
|
||||
* `name` _string_ - an optional string that can be referred to in the `href` and `goto` instance
|
||||
- `name` _string_ - an optional string that can be referred to in the `href` and `goto` instance
|
||||
methods. Duplicate names are not allowed.
|
||||
|
||||
* `path` _string_ - the path template for this route. Path templates are matched in the order of the
|
||||
- `path` _string_ - the path template for this route. Path templates are matched in the order of the
|
||||
array. Example:
|
||||
|
||||
`"/"` - for the root path `"/articles"` - another static path `"/article/:id"` - a path with a
|
||||
variable `"/:unknownRoute"` - the last route could catch erroneous routes. Unmatched urls will
|
||||
automatically route here.
|
||||
|
||||
* `vars` _object_ - an optional object mapping variable names in the path template to a regular
|
||||
- `vars` _object_ - an optional object mapping variable names in the path template to a regular
|
||||
expression for validation
|
||||
|
||||
* `enter` _function_ - a function for when this route is entered. The `enter` function receives two
|
||||
- `enter` _function_ - a function for when this route is entered. The `enter` function receives two
|
||||
parameters:
|
||||
|
||||
* _route instance object_ - this is a object that contains properties:
|
||||
- _route instance object_ - this is a object that contains properties:
|
||||
|
||||
* `name` _string_ - the route name
|
||||
* `vars` _object_ - an object holding any variables parsed from the path
|
||||
* `path` _string_ - the path as received
|
||||
- `name` _string_ - the route name
|
||||
- `vars` _object_ - an object holding any variables parsed from the path
|
||||
- `path` _string_ - the path as received
|
||||
|
||||
* _router instance object_ - (see below)
|
||||
- _router instance object_ - (see below)
|
||||
|
||||
The `enter` function may return a callback that will be called instead of the `enter` function for
|
||||
further navigate events that will be handled by this route (with different variables). This allows
|
||||
`enter` to establish a context for the route it handles.
|
||||
|
||||
* `exit` _function_ - an optional function that will be called before calling `enter` of the next
|
||||
- `exit` _function_ - an optional function that will be called before calling `enter` of the next
|
||||
path. `exit` has the option to delay the call to `enter` by returning a promise. This is intended
|
||||
for handling transition animations. If the route's `enter` function returns a callback, `exit`
|
||||
will not be called if the same route receives navigation but with different variables. `exit`
|
||||
receives the parameters similarly to `enter`:
|
||||
|
||||
* _route instance object_ - for the route being exited
|
||||
* _route instance object_ - for the route yet-to-be entered
|
||||
* _router instance object_ - (see below)
|
||||
- _route instance object_ - for the route being exited
|
||||
- _route instance object_ - for the route yet-to-be entered
|
||||
- _router instance object_ - (see below)
|
||||
|
||||
### rootURL (optional string)
|
||||
|
||||
@ -62,24 +62,24 @@ The url prefix of all paths. This should always be `#` unless you're nesting rou
|
||||
|
||||
The returned instance provides these methods:
|
||||
|
||||
* `goto(url: string)` or `goto(pathName: string, vars: object)`
|
||||
- `goto(url: string)` or `goto(pathName: string, vars: object)`
|
||||
|
||||
Match to a route by relative url or pathName and a vars object. Navigate there.
|
||||
|
||||
* `href(pathName: string, vars: object)`
|
||||
- `href(pathName: string, vars: object)`
|
||||
|
||||
Build a relative url based on the name and supplied vars.
|
||||
|
||||
* `start(initialRoute: string)`
|
||||
- `start(initialRoute: string)`
|
||||
|
||||
Listen to `window.onhashchange` for route changes. The `initialRoute` will be passed to `goto()`
|
||||
if there is no current route in `window.location`.
|
||||
|
||||
* `stop()`
|
||||
- `stop()`
|
||||
|
||||
Cancel subscription to `window.onhashchange`
|
||||
|
||||
* `current()`
|
||||
- `current()`
|
||||
|
||||
Get the current _route instance object_ as was provided to the current routes `enter` function.
|
||||
|
||||
|
||||
@ -3,12 +3,16 @@
|
||||
"version": "2.1.0",
|
||||
"description": "A slim and unopinionated router",
|
||||
"main": "src/index.js",
|
||||
"files": ["src"],
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node ../../bin/runTests.js ./",
|
||||
"pre-commit": "npm run test"
|
||||
},
|
||||
"keywords": ["router"],
|
||||
"keywords": [
|
||||
"router"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@ -37,16 +37,16 @@ pre-compression gains can result in post-compression losses. YMMV.
|
||||
|
||||
# Abstractions
|
||||
|
||||
* `undefined`
|
||||
* `requestAnimationFrame`
|
||||
* `Array.isArray`
|
||||
* `Array.from`
|
||||
* `Object.keys`
|
||||
* `document`
|
||||
* `typeof obj === 'function'`
|
||||
* `typeof obj === 'string'`
|
||||
* `typeof obj === 'number'`
|
||||
* `null`
|
||||
* `obj === undefined`
|
||||
* `obj === null`
|
||||
* `fn.apply(context, params)`
|
||||
- `undefined`
|
||||
- `requestAnimationFrame`
|
||||
- `Array.isArray`
|
||||
- `Array.from`
|
||||
- `Object.keys`
|
||||
- `document`
|
||||
- `typeof obj === 'function'`
|
||||
- `typeof obj === 'string'`
|
||||
- `typeof obj === 'number'`
|
||||
- `null`
|
||||
- `obj === undefined`
|
||||
- `obj === null`
|
||||
- `fn.apply(context, params)`
|
||||
|
||||
@ -3,8 +3,12 @@
|
||||
"version": "1.1.0",
|
||||
"description": "Javascript and DOM abstractions for smaller minifiable code",
|
||||
"main": "src/index.js",
|
||||
"files": ["src"],
|
||||
"keywords": ["javascript"],
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"keywords": [
|
||||
"javascript"
|
||||
],
|
||||
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
|
||||
12
prettier.config.js
Normal file
12
prettier.config.js
Normal file
@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
printWidth: 100,
|
||||
tabWidth: 1,
|
||||
useTabs: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'none',
|
||||
bracketSpacing: true,
|
||||
semi: true,
|
||||
requirePragma: false,
|
||||
proseWrap: 'always',
|
||||
arrowParens: 'avoid'
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user