Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 931af404ae | |||
| f83298a0af | |||
| 717e825b17 | |||
| 5ac0afb0dd |
@@ -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
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "nexe",
|
||||
"description": "Create a single executable out of your Node.js application",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-rc.20",
|
||||
"version": "2.0.0-rc.22",
|
||||
"contributors": [
|
||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||
"Jared Allard <jaredallard@outlook.com>",
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
+4
-1
@@ -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
|
||||
@@ -221,6 +223,7 @@ function normalizeOptions(input?: Partial<NexeOptions>): NexeOptions {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user