forked from vercel/pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue vercel#1192 & only compress VFS if --compress is set
- Loading branch information
1 parent
31e408f
commit 6da3cfd
Showing
9 changed files
with
270 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output* | ||
test.sqlite | ||
package-lock* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const assert = require('assert'); | ||
const utils = require('../utils.js'); | ||
|
||
assert(!module.parent); | ||
assert(__dirname === process.cwd()); | ||
|
||
/* eslint-disable no-unused-vars */ | ||
const target = process.argv[2] || 'host'; | ||
const ext = process.platform === 'win32' ? '.exe' : ''; | ||
const cmd = process.platform === 'win32' ? '.cmd' : ''; | ||
const output = './output' + ext; | ||
const input = './package.json'; | ||
|
||
// remove any possible left-over | ||
utils.vacuum.sync('./node_modules'); | ||
|
||
const version = utils.exec.sync('node --version'); | ||
console.log('node version = ', version); | ||
|
||
// launch `npm install` | ||
const npmlog = utils.exec.sync('npm' + cmd + ' install'); | ||
// console.log('npm log :', npmlog); | ||
|
||
utils.pkg.sync(['--target', target, '--output', output, input], { | ||
expect: 0, | ||
}); | ||
|
||
// ----------------------------------------------------------------------- | ||
// Execute programm outside pjg | ||
const logRef = utils.spawn.sync( | ||
'node', | ||
[path.join(__dirname, 'src/index.js')], | ||
{ | ||
cwd: __dirname, | ||
expect: 0, | ||
stdio: ['inherit', 'pipe', 'pipe'], | ||
} | ||
); | ||
|
||
const log = utils.spawn.sync(path.join(__dirname, output), [], { | ||
cwd: __dirname, | ||
expect: 0, | ||
stdio: ['inherit', 'pipe', 'pipe'], | ||
}); | ||
|
||
if (logRef.stdout !== log.stdout) { | ||
console.log('expecting', logRef.stdout); | ||
console.log('but got =', log.stdout); | ||
process.exit(1); | ||
} | ||
if (logRef.stderr !== log.stderr) { | ||
console.log('expecting', logRef.stderr); | ||
console.log('but got =', log.stderr); | ||
process.exit(1); | ||
} | ||
|
||
utils.vacuum.sync(output); | ||
utils.vacuum.sync('node_modules'); | ||
utils.vacuum.sync('package-lock.json'); | ||
console.log('Done'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "pkg-express", | ||
"version": "1.0.0", | ||
"description": "Illustrates issue between pkg 5.2.X and express (works with with pkg pre 5.2.X).", | ||
"repository": "", | ||
"main": "src/index.js", | ||
"bin": "src/index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"postinstall": "npm run make", | ||
"start": "node .", | ||
"make": "pkg . -o ./dist/pkg-express.exe" | ||
}, | ||
"dependencies": { | ||
"express": "^4.17.1", | ||
"pug": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"pkg": "5.2.1" | ||
}, | ||
"pkg": { | ||
"assets": "./public/views/*.pug" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
html | ||
head | ||
title Hello World! | ||
body | ||
p Hello World! | ||
|
||
|
Oops, something went wrong.