Add standalone gulp mode. This changes the webpack task to only do a static build

This commit is contained in:
Daniel Jönsson 2018-03-14 16:07:09 +01:00
parent 12177f2ec2
commit 1133e23305
3 changed files with 14 additions and 5 deletions

View file

@ -1,3 +0,0 @@
#!/usr/bin/env node
// fimfic2epub 1.7.15
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.w={},o(o.s=6)}([function(e,t){e.exports=require("../package.json")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("../dist/fimfic2epub")},function(e,t){e.exports=require("mithril/test-utils/browserMock")},function(e,t){e.exports=require("commander")},function(e,t,o){"use strict";const n=o(5).command("fimfic2epub <story> [filename]").description(o(0).description).version(o(0).version).option("-d, --dir <path>","Directory to store ebook in. Is prepended to filename").option("-t, --title <value>","Set the title of the story").option("-a, --author <value>","Set the author of the story").option("-c, --no-comments-link","Don't add link to online comments").option("-H, --no-headings","Don't add headings to chapters").option("-r, --no-reading-ease","Don't calculate Flesch reading ease").option("-e, --no-external","Don't embed external resources, such as images (breaks EPUB spec)").option("-n, --no-notes","Don't include author notes").option("-i, --notes-index","Create an index with all author notes at the end of the ebook").option("-p, --paragraphs <style>","Select a paragraph style <spaced|indented|indentedall|both>","spaced").option("-j, --join-subjects","Join dc:subjects to a single value").option("-C, --cover <url>","Set cover image url").parse(process.argv);n.args.length<1&&(console.error("Error: No story id/url provided"),process.exit(1));const r="-"===n.args[1]||"/dev/stdout"===n.args[1];r&&(console.log=console.error,console.log("Outputting to stdout")),o(4)(global);const s=o(3),i=o(2),a=o(1),c=new s(n.args[0],{addCommentsLink:!!n.commentsLink,includeAuthorNotes:!!n.notes,useAuthorNotesIndex:!!n.notesIndex,addChapterHeadings:!!n.headings,includeExternal:!!n.external,paragraphStyle:n.paragraphs,joinSubjects:!!n.joinSubjects,calculateReadingEase:!!n.readingEase,readingEaseWakeupInterval:800});c.coverUrl=n.cover,c.fetchMetadata().then(()=>{n.title&&c.setTitle(n.title),n.author&&c.setAuthorName(n.author)}).then(c.fetchAll.bind(c)).then(c.build.bind(c)).then(()=>{let e,t=(n.args[1]||"").replace("%id%",c.storyInfo.id)||c.filename;n.dir&&(t=a.join(n.dir,t)),e=r?process.stdout:i.createWriteStream(t),c.streamFile(null).pipe(e).on("finish",()=>{r||console.log("Saved story as "+t)})}).catch(e=>{e&&e.stack?console.error(e.stack):console.error("Error: "+(e||"Unknown error")),process.exit(1)})}]);

View file

@ -27,6 +27,14 @@ const sequence = Sequence.use(gulp)
// const inProduction = process.env.NODE_ENV === 'production' || process.argv.indexOf('-p') !== -1
const isStandalone = process.argv.includes('--standalone')
if (isStandalone) {
webpackConfig.shift()
webpackConfig.shift()
webpackConfig.shift()
}
let watchOpts = {
readDelay: 500,
verbose: true,
@ -65,7 +73,11 @@ function webpackTask (callback) {
cached: false,
maxModules: 0
}))
sequence('pack', callback)
if (!isStandalone) {
sequence('pack', callback)
} else {
callback()
}
})
}

View file

@ -1,6 +1,6 @@
{
"name": "fimfic2epub",
"version": "1.7.15",
"version": "1.7.16",
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
"author": "djazz",
"license": "MIT",