Skip to content

Commit

Permalink
No prompting in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Jan 15, 2024
1 parent 7f2d322 commit c460d55
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,35 @@ deploySite.then(info => { console.log('done deploying site!') })
.catch(e => { throw e })
```

## Bin

`async-neocities` ships a bin that lets you deploy to neocities locally or in CI.

It's interactive and will help you set up your config and keys.


```console
Usage: async-neocities [options]

Example: async-neocities --src public

--help, -h print help text
--src, -s The directory to deploy to neocities (default: "public")
--cleanup, -c Destructively clean up orphaned files on neocities
--protect, -p String to minimatch files which will never be cleaned up
--status Print auth status of current working directory
--print-key Print api-key status of current working directory
--clear-key Remove the currently assoicated API key
--force-auth Force re-authorization of current working directory

async-neocities (v2.1.6)
```

You can set the flags with ENV vars

- `ASYNC_NEOCITIES_API_KEY` or `NEOCITIES_API_TOKEN`: the API token matching the site name.
- `ASYNC_NEOCITIES_SITE_NAME`: the name of the site to deploy to.

## API

### `import { NeocitiesAPIClient } from 'async-neocities'`
Expand Down
10 changes: 10 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const cfg = createApplicationConfig(pkg.name)

const args = parseArgs({ options })

const isCI = process.env['CI']

if (args.values['version']) {
console.log(pkg.version)
process.exit(0)
Expand Down Expand Up @@ -174,6 +176,10 @@ async function main () {
} else {
// Config file not found or siteName is missing
console.log('deploy-to-neocities.json not found or siteName is missing.')
if (isCI) {
console.log('Running in CI, skipping prompts')
process.exit(1)
}
console.log('Please enter siteName:')

// Setup readline interface
Expand Down Expand Up @@ -210,6 +216,10 @@ async function main () {

// Ask user for Neocities password
// Ask user for password
if (isCI) {
console.log('Running in CI, skipping prompts')
process.exit(1)
}
const password = await passwordPrompt('Enter Neocities password: ')

if (!password) {
Expand Down

0 comments on commit c460d55

Please sign in to comment.