2014-04-18 22:24:20 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2014-06-10 02:54:56 +00:00
|
|
|
var yargs = require('yargs');
|
|
|
|
var path = require('path');
|
2014-04-18 22:24:20 +00:00
|
|
|
var index = require('../src/index');
|
|
|
|
|
2014-06-10 02:54:56 +00:00
|
|
|
var opts = yargs
|
|
|
|
.usage('Usage: $0 [options]')
|
|
|
|
.options({
|
|
|
|
'input': {
|
|
|
|
description: 'Path to the folder with all photos/videos',
|
|
|
|
},
|
|
|
|
'output': {
|
|
|
|
description: 'Output path for the static website',
|
|
|
|
},
|
2016-09-18 18:29:17 +00:00
|
|
|
'index': {
|
|
|
|
description: 'Name of the First page in the flow. Defaults to index.html'
|
|
|
|
},
|
2014-06-10 02:54:56 +00:00
|
|
|
'title': {
|
|
|
|
description: 'Website title',
|
|
|
|
default: 'My gallery'
|
|
|
|
},
|
|
|
|
'thumb-size': {
|
|
|
|
description: 'Thumbnail size in pixels (square)',
|
|
|
|
default: 120
|
|
|
|
},
|
|
|
|
'large-size': {
|
|
|
|
description: 'Fullscreen size in pixels (height)',
|
|
|
|
default: 1000
|
|
|
|
},
|
2014-11-29 07:30:57 +00:00
|
|
|
'original-photos': {
|
|
|
|
description: 'Allow download of full-size photos (true|false)',
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
'original-videos': {
|
|
|
|
description: 'Allow download of full-size videos (true|false)',
|
|
|
|
default: false
|
|
|
|
},
|
2014-06-09 12:21:33 +00:00
|
|
|
'sort-folders': {
|
|
|
|
description: 'How to sort gallery folders (name | date)',
|
|
|
|
default: 'date'
|
|
|
|
},
|
2014-06-10 02:54:56 +00:00
|
|
|
'css': {
|
|
|
|
description: 'Extra CSS file for styling'
|
|
|
|
},
|
|
|
|
'config': {
|
|
|
|
description: 'Optional JSON config file (one key per argument)'
|
2014-10-05 11:48:49 +00:00
|
|
|
},
|
|
|
|
'google-analytics': {
|
|
|
|
description: 'Code for Google Analytics tracking'
|
2014-06-10 02:54:56 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.config('config')
|
|
|
|
.demand(['input', 'output'])
|
|
|
|
.argv;
|
2014-04-18 22:24:20 +00:00
|
|
|
|
|
|
|
index.build({
|
2014-10-05 11:48:49 +00:00
|
|
|
input: path.resolve(opts['input']),
|
|
|
|
output: path.resolve(opts['output']),
|
|
|
|
title: opts['title'],
|
|
|
|
thumbSize: opts['thumb-size'],
|
|
|
|
largeSize: opts['large-size'],
|
2014-11-29 07:30:57 +00:00
|
|
|
originalPhotos: opts['original-photos'] + '' === 'true',
|
|
|
|
originalVideos: opts['original-videos'] + '' === 'true',
|
2014-10-05 11:48:49 +00:00
|
|
|
sortFolders: opts['sort-folders'],
|
|
|
|
css: opts['css'],
|
2016-09-18 18:29:17 +00:00
|
|
|
googleAnalytics: opts['google-analytics'],
|
|
|
|
index: opts['index']
|
2014-04-18 22:24:20 +00:00
|
|
|
});
|