-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pre-deploy pull, new login mechanism and pkg cli updates (#5941)
Co-authored-by: Kaustav Ghosh <kaustav.ghosh19@gmail.com> Co-authored-by: John Hockett <jhockett@users.noreply.github.com> Co-authored-by: Diego Costantino <diego@diegocostantino.com>
- Loading branch information
1 parent
7d48378
commit 7274251
Showing
91 changed files
with
1,861 additions
and
471 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
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
#!/usr/bin/env node | ||
require('../src/index.js').run(); | ||
const args = require('yargs').argv; | ||
const path = args.path; | ||
const platform = args.platform; | ||
const framework = args.framework; | ||
|
||
require('../src/index.js').run({ path, platform, framework }); |
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,52 @@ | ||
const execa = require('execa'); | ||
const path = require('path'); | ||
|
||
const isWin = process.platform.startsWith('win'); | ||
const amplify = isWin ? 'amplify.cmd' : 'amplify'; | ||
const amplifyDev = isWin ? 'amplify-dev.cmd' : 'amplify-dev'; | ||
|
||
const defaultOpts = { | ||
inheritIO: true, | ||
}; | ||
|
||
const callPkgAmplifyWin = async (args, opts) => { | ||
opts = { ...defaultOpts, ...opts }; | ||
const { stdout, stderr } = await execa.command(`cmd /V /C "set PKG_EXECPATH= && ${process.argv[0]} ${args.join(' ')}"`, { | ||
stdio: opts.inheritIO ? 'inherit' : undefined, | ||
shell: 'cmd.exe', | ||
}); | ||
if (stderr) { | ||
throw new Error(`Amplify failed due to ${stderr}`); | ||
} | ||
return stdout; | ||
}; | ||
|
||
const callPkgAmplifyNix = async (args, opts) => { | ||
opts = { ...defaultOpts, ...opts }; | ||
const { stdout, stderr } = await execa.command(`PKG_EXECPATH=; ${process.argv[0]} ${args.join(' ')}`, { | ||
stdio: opts.inheritIO ? 'inherit' : undefined, | ||
shell: 'bash', | ||
}); | ||
if (stderr) { | ||
throw new Error(`Amplify failed due to ${stderr}`); | ||
} | ||
return stdout; | ||
}; | ||
|
||
const callNodeAmplify = async (args, opts) => { | ||
opts = { ...defaultOpts, ...opts }; | ||
const amplifyCmd = path.basename(process.argv[1]) === 'amplify-app-dev' ? amplifyDev : amplify; | ||
const { stdout, stderr } = await execa(amplifyCmd, args, { stdio: opts.inheritIO ? 'inherit' : undefined }); | ||
if (stderr) { | ||
throw new Error(`Amplify failed due to ${stderr}`); | ||
} | ||
return stdout; | ||
}; | ||
|
||
const callPkgAmplify = isWin ? callPkgAmplifyWin : callPkgAmplifyNix; | ||
|
||
const callAmplify = !!process.pkg ? callPkgAmplify : callNodeAmplify; | ||
|
||
module.exports = { | ||
callAmplify, | ||
}; |
Oops, something went wrong.