@ampify/dev-server
Advanced tools
Comparing version 1.0.2 to 1.0.3
15
index.js
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
const { text } = require('body-parser'); | ||
const { join } = require('path'); | ||
const path = require('path'); | ||
const fs = require('fs').promises; | ||
@@ -13,6 +13,8 @@ | ||
const publicPath = path.resolve(process.argv[2] || './dist'); | ||
app.use(morgan('short')); | ||
app.use(text({ limit: '50mb' })); | ||
app.use( | ||
express.static(join(__dirname, 'public'), { | ||
express.static(publicPath, { | ||
etag: false, | ||
@@ -25,4 +27,9 @@ maxAge: 0, | ||
try { | ||
await fs.writeFile('./public/latest.html', req.body, 'utf-8'); | ||
res.json({ url: `http://localhost:${port}/latest.html` }); | ||
await fs.writeFile( | ||
path.resolve(publicPath, 'index.html'), | ||
req.body, | ||
'utf-8', | ||
); | ||
await res.json({ url: `http://localhost:${port}/index.html` }); | ||
} catch (e) { | ||
@@ -29,0 +36,0 @@ next(e); |
{ | ||
"name": "@ampify/dev-server", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "index.js", | ||
@@ -18,3 +18,3 @@ "bin": "index.js", | ||
}, | ||
"gitHead": "d56c40da463b5969ff8847888fd250eb5f8f2252" | ||
"gitHead": "ef90abff29eabeff22f7b9e84458efd11c03222e" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32
1218
2