Pre-transpile babel for npm packaging

This commit is contained in:
Nadav Ivgi 2018-03-06 06:48:48 +02:00
parent 0740210ac7
commit bdabed94c8
15 changed files with 14 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
.env
dist

4
.npmignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
.env
src
start.sh

View File

@ -3,9 +3,11 @@
"version": "0.1.1",
"description": "",
"scripts": {
"start": "./start.sh"
"start": "./start.sh",
"dist": "babel -d dist src",
"prepublishOnly": "npm run dist"
},
"bin": "cli.js",
"bin": "dist/cli.js",
"author": "Nadav Ivgi",
"license": "MIT",
"keywords": [ "bitcoin", "lightning", "lightning-charge", "micropayments" ],

View File

@ -25,7 +25,7 @@ Object.assign(app.locals, {
, prettybytes: require('pretty-bytes')
, markdown: require('markdown-it')()
, qruri: require('qruri')
, version: require('./package').version
, version: require('../package').version
, pretty: (conf.env === 'development')
})

View File

@ -4,9 +4,8 @@ const path = require('path')
, fs = require('fs')
require('babel-polyfill')
require('babel-register')
const templatePath = path.join(__dirname, '_filebazaar.yaml.example')
const templatePath = path.join(__dirname, '..', '_filebazaar.yaml.example')
if (process.argv[2] === 'init') {
const directory = process.argv[3] || process.cwd()

View File

@ -25,8 +25,8 @@ module.exports = basePath => {
config.invoice_ttl = config.invoice_ttl || +process.env.INVOICE_TTL || 3600 // 1 hour
config.download_ttl = config.download_ttl || +process.env.DOWNLOAD_TTL || 172800 // 2 days
config.views_dir = config.views_dir || process.env.VIEWS_DIR || path.join(__dirname, '..', 'views')
config.static_dir = config.static_dir || process.env.STATIC_DIR || path.join(__dirname, '..', 'static')
config.views_dir = config.views_dir || process.env.VIEWS_DIR || path.join(__dirname, '..', '..', 'views')
config.static_dir = config.static_dir || process.env.STATIC_DIR || path.join(__dirname, '..', '..', 'static')
config.theme = config.theme || process.env.THEME || 'yeti'
config.css = config.css || process.env.CSS

View File

@ -1,3 +1,3 @@
#!/bin/bash
[ -f .env ] && source .env
babel-node app.js
babel-node src/app.js