Compare commits

..

11 Commits

Author SHA1 Message Date
calebboyd 931af404ae chore: bump rc 2017-11-26 09:10:04 -06:00
Tim f83298a0af fix(download): remove the ghToken for binary download
The github token is only needed for the API access and will confuse amazon S3 when it is passed to the download:

```
<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>InvalidArgument</Code><Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message><ArgumentName>Authorization</ArgumentName><ArgumentValue>token herebesecrettoken</ArgumentValue><RequestId>7CCDB87CF1347C29</RequestId><HostId>xyyeVP5ImwDePFMXAZheNYLnXQBsVCka4U6KLWKCjynHNpQZxzfBdl4sRfUbORSul8c8YNwux8w=</HostId></Error>
```

Refs #425
2017-11-26 08:08:28 -07:00
calebboyd 717e825b17 chore: lint 2017-11-25 21:53:16 -06:00
calebboyd 5ac0afb0dd feat(options): add ability to pass a github token 2017-11-25 21:51:41 -06:00
Ishai Jaffe 23f550818b fix(shim): properly serialize path 2017-11-14 14:57:39 -05:00
calebboyd 3d18eae18a chore: bump rc 2017-10-27 21:21:47 -05:00
Artem Derevnjuk 6f553d0fba fix(embed-node): import missing module to work with fs (#416) 2017-10-27 21:17:26 -05:00
calebboyd aba3047191 fix: only add extension when targeting windows 2017-10-25 23:35:26 -05:00
calebboyd 52b58a107d feat: enable fake-argv by default 2017-10-21 22:48:42 -05:00
calebboyd ec734e4fb1 chore: use yarn in circle-ci 2017-10-20 17:38:20 -05:00
calebboyd 7c755e666f chore: bump fuse-box 2017-10-17 16:56:44 -05:00
10 changed files with 37 additions and 18 deletions
+4
View File
@@ -164,6 +164,10 @@ compile({
- default: `false`
- #### `fakeArgv: boolean`
- fake the entry point file name (`process.argv[1]`). If nexe was used with stdin this will be `'[stdin]'`.
- #### `ghToken: string`
- Provide a Github Token for accessing nexe releases
- This is usually needed in CI environments
- default: `process.env.GITHUB_TOKEN`
- #### `sourceUrl: string`
- Provide an alternate url for the node source code
- Note: temporary files will still be created for this under the specified version
+7 -1
View File
@@ -1,3 +1,9 @@
dependencies:
override:
- export NVS_HOME="$HOME/.nvs" && git clone https://github.com/jasongin/nvs "$NVS_HOME" && . "$NVS_HOME/nvs.sh" install
- nvs add lts && nvs link lts && nvs use default
- npm i yarn -g
- yarn
test:
override:
- npm run asset-compile
- yarn run asset-compile
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "nexe",
"description": "Create a single executable out of your Node.js application",
"license": "MIT",
"version": "2.0.0-rc.16",
"version": "2.0.0-rc.22",
"contributors": [
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
"Jared Allard <jaredallard@outlook.com>",
@@ -38,7 +38,7 @@
"app-builder": "^5.1.0",
"chalk": "^1.1.3",
"download": "^6.2.0",
"fuse-box": "^2.3.4-beta.5",
"fuse-box": "^2.3.4-beta.11",
"globby": "^6.1.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
+1
View File
@@ -1,5 +1,6 @@
import { createHash } from 'crypto'
import * as path from 'path'
import * as fs from 'fs'
export interface EmbedNodeModuleOptions {
[key: string]: { additionalFiles: string[] } | true
+1
View File
@@ -0,0 +1 @@
//TODO
+5
View File
@@ -185,6 +185,9 @@ export class NexeCompiler<T extends NexeOptions = NexeOptions> {
'User-Agent': 'nexe (https://www.npmjs.com/package/nexe)'
}
}
if (this.options.ghToken) {
downloadOptions.headers.Authorization = 'token ' + this.options.ghToken
}
const githubRelease = await getLatestGitRelease(downloadOptions)
const assetName = target.toString()
const asset = githubRelease.assets.find(x => x.name === assetName)
@@ -193,6 +196,8 @@ export class NexeCompiler<T extends NexeOptions = NexeOptions> {
throw new Error(`${assetName} not available, create it using the --build flag`)
}
const filename = this.getNodeExecutableLocation(target)
// Remove the authorization, as the download is done via amazon S3 and does not need the token
delete downloadOptions.headers.Authorization
await download(asset.browser_download_url, dirname(filename), downloadOptions).on(
'response',
(res: IncomingMessage) => {
+11 -8
View File
@@ -33,6 +33,7 @@ export interface NexeOptions {
plugins: (string | NexePatch)[]
native: any
empty: boolean
ghToken: string
sourceUrl?: string
enableStdIn?: boolean
python?: string
@@ -81,7 +82,8 @@ const alias = {
m: 'make',
h: 'help',
l: 'loglevel',
'fake-argv': 'fakeArgv'
'fake-argv': 'fakeArgv',
'gh-token': 'ghToken'
}
const argv = parseArgv(process.argv, { alias, default: { ...defaults, enableStdIn: true } })
const g = c.gray
@@ -218,19 +220,20 @@ function normalizeOptions(input?: Partial<NexeOptions>): NexeOptions {
options.loglevel = extractLogLevel(options)
options.flags = flatten(opts.flag, options.flags)
options.targets = flatten(opts.target, options.targets).map(getTarget)
if (!options.targets.length) {
options.targets.push(getTarget())
}
options.ghToken = options.ghToken || process.env.GITHUB_TOKEN || ''
options.make = flatten(options.vcBuild, options.make)
options.configure = flatten(options.configure)
options.resources = flatten(opts.resource, options.resources)
options.rc = options.rc || extractCliMap(/^rc-.*/, options)
options.output = isWindows
? `${(options.output || options.name).replace(/\.exe$/, '')}.exe`
: `${options.output || options.name}`
options.output =
(options.targets[0] as NexeTarget).platform === 'windows'
? `${(options.output || options.name).replace(/\.exe$/, '')}.exe`
: `${options.output || options.name}`
options.output = resolve(cwd, options.output)
if (!options.targets.length) {
options.targets.push(getTarget())
}
if (options.build) {
const { arch } = options.targets[0] as NexeTarget
if (isWindows) {
-1
View File
@@ -32,7 +32,6 @@ async function getJson<T>(url: string, options?: any) {
return JSON.parse((await got(url, options)).body) as T
}
//TODO only build the latest of each major...?
function isBuildableVersion(version: string) {
const major = +version.split('.')[0]
return !~[0, 1, 2, 3, 4, 5, 7].indexOf(major) || version === '4.8.4'
+3 -3
View File
@@ -23,13 +23,13 @@ export default function(compiler: NexeCompiler, next: () => Promise<void>) {
//compiler.shims.push(wrap('{/{replace:lib/steps/shim-require.js}}'))
if (compiler.options.fakeArgv) {
if (compiler.options.fakeArgv !== false) {
const nty = !process.stdin.isTTY
const input = nty ? '[stdin]' : compiler.options.input
const input = nty ? '[stdin]' : JSON.stringify(compiler.options.input)
compiler.shims.push(
wrap(`
var r = require('path').resolve;
process.argv.splice(1,0, ${nty ? `'${input}'` : `r("${input}")`});`)
process.argv.splice(1,0, ${nty ? `'${input}'` : `r(${input})`});`)
)
}
+3 -3
View File
@@ -1000,9 +1000,9 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
mkdirp ">=0.5 0"
rimraf "2"
fuse-box@^2.3.4-beta.5:
version "2.3.4-beta.9"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.3.4-beta.9.tgz#e52054eac8d4fbe8bcc6130bb418ae645fb2adea"
fuse-box@^2.3.4-beta.11:
version "2.3.4-beta.11"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.3.4-beta.11.tgz#76c0e6938e0e73ea00676f46d8691c6efa226d40"
dependencies:
acorn "^5.1.2"
acorn-jsx "^4.0.1"