Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deno): Fix deno argv handling #70

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ class Option {
}

const deno = typeof window !== 'undefined' && window.Deno;
const processArgs = deno ? ['deno'].concat(Deno.args) : process.argv;
const denoScriptPath = deno && typeof window !== 'undefined' && window.location.pathname;
// Adds deno executable and script path to processArgs as "compatibility" layer for node
// See https://github.com/cacjs/cac/issues/69
const processArgs = deno ? ['deno', denoScriptPath].concat(Deno.args) : process.argv;
const platformInfo = deno
? `${Deno.build.os}-${Deno.build.arch} deno-${Deno.version.deno}`
: `${process.platform}-${process.arch} node-${process.version}`;
Expand Down
5 changes: 4 additions & 1 deletion mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,10 @@ class Option {
}

const deno = typeof window !== 'undefined' && window.Deno;
const processArgs = deno ? ['deno'].concat(Deno.args) : process.argv;
const denoScriptPath = deno && typeof window !== 'undefined' && window.location.pathname;
// Adds deno executable and script path to processArgs as "compatibility" layer for node
// See https://github.com/cacjs/cac/issues/69
const processArgs = deno ? ['deno', denoScriptPath].concat(Deno.args) : process.argv;
const platformInfo = deno
? `${Deno.build.os}-${Deno.build.arch} deno-${Deno.version.deno}`
: `${process.platform}-${process.arch} node-${process.version}`;
Expand Down
8 changes: 7 additions & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ declare let window: any
declare let Deno: any

const deno = typeof window !== 'undefined' && window.Deno
const denoScriptPath =
deno && typeof window !== 'undefined' && window.location.pathname

export const processArgs = deno ? ['deno'].concat(Deno.args) : process.argv
// Adds deno executable and script path to processArgs as "compatibility" layer for node
// See https://github.com/cacjs/cac/issues/69
export const processArgs = deno
? ['deno', denoScriptPath].concat(Deno.args)
: process.argv

export const platformInfo = deno
? `${Deno.build.os}-${Deno.build.arch} deno-${Deno.version.deno}`
Expand Down