-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add --help and parameterize CLI and library
ipfs-deploy [options] path Pin path locally, upload to pinning service, and update DNS Positionals: path The path to deploy [string] [default: "./public/"] Options: --version Show version number [boolean] --help Show help [boolean] -D DON'T update Cloudflare DNS' TXT dnslink [boolean] [default: false] -o Open URL after deploying [boolean] [default: false] -p, --pinner Pinning services to which path will be uploaded [choices: "pinata", "infura"] [default: ["pinata","infura"]] -P DON'T pin remotely, only to local daemon (overrides -p) [boolean] [default: false] Examples: ipfs-deploy _site # Deploys path "_site" to pinata and infura, and updates cloudflare DNS ipfs-deploy -p infura -p pinata # Deploys path "./public/" to pinata and infura, and updates cloudflare DNS ipfs-deploy -p pinata static # Deploys path "static" ONLY to pinata and updates cloudflare DNS ipfs-deploy -D docs # Deploys path "docs" to pinata and infura, and DON'T update DNS
- Loading branch information
1 parent
51db254
commit 726fd8d
Showing
4 changed files
with
149 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,90 @@ | ||
#!/usr/bin/env node | ||
const chalk = require('chalk') | ||
|
||
const deploy = require('../index') | ||
|
||
deploy() | ||
const argv = require('yargs') | ||
.scriptName('ipfs-deploy') | ||
.usage( | ||
'$0 [options] path', | ||
'Pin path locally, upload to pinning service, and update DNS', | ||
yargs => { | ||
yargs | ||
.positional('path', { | ||
type: 'string', | ||
default: './public/', | ||
describe: 'The path to deploy', | ||
}) | ||
.options({ | ||
D: { | ||
type: 'boolean', | ||
default: false, | ||
describe: "DON'T update Cloudflare DNS' TXT dnslink", | ||
}, | ||
o: { | ||
type: 'boolean', | ||
default: false, | ||
describe: 'Open URL after deploying', | ||
}, | ||
p: { | ||
alias: 'pinner', | ||
choices: ['pinata', 'infura'], | ||
default: ['pinata', 'infura'], | ||
describe: `Pinning services to which ${chalk.whiteBright( | ||
'path' | ||
)} will be uploaded`, | ||
}, | ||
P: { | ||
type: 'boolean', | ||
default: false, | ||
describe: | ||
"DON'T pin remotely, only to local daemon (overrides -p)", | ||
}, | ||
}) | ||
.example( | ||
'$0 _site', | ||
`# Deploys path "${chalk.whiteBright( | ||
'_site' | ||
)}" to ${chalk.whiteBright('pinata')} and ${chalk.whiteBright( | ||
'infura' | ||
)}, and updates ${chalk.whiteBright('cloudflare')} DNS` | ||
) | ||
.example( | ||
'$0 -p infura -p pinata', | ||
`# Deploys path "${chalk.whiteBright( | ||
'./public/' | ||
)}" to ${chalk.whiteBright('pinata')} and ${chalk.whiteBright( | ||
'infura' | ||
)}, and updates ${chalk.whiteBright('cloudflare')} DNS` | ||
) | ||
.example( | ||
'$0 -p pinata static', | ||
`# Deploys path "${chalk.whiteBright( | ||
'static' | ||
)}" ONLY to ${chalk.whiteBright( | ||
'pinata' | ||
)} and updates ${chalk.whiteBright('cloudflare')} DNS` | ||
) | ||
.example( | ||
'$0 -D docs', | ||
`# Deploys path "${chalk.whiteBright( | ||
'docs' | ||
)}" to ${chalk.whiteBright('pinata')} and ${chalk.whiteBright( | ||
'infura' | ||
)}, and ${chalk.whiteBright("DON'T")} update DNS` | ||
) | ||
} | ||
) | ||
.help().argv | ||
|
||
function main() { | ||
deploy({ | ||
updateDns: !argv.D, | ||
open: argv.o, | ||
// pinners: argv.p, TODO | ||
// pinRemotely: !argv.P, TODO | ||
publicDirPath: argv.path, | ||
}) | ||
} | ||
|
||
main() |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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