Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
feat: add api-key option
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipPyrek committed Feb 25, 2024
1 parent 8b23575 commit 79a59c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ There's no need install this CLI. Just use it directly to create your projects.
With npx

```bash
npx create-buttonize@latest
npx create-buttonize
```

Or with npm 6+
Expand Down Expand Up @@ -62,7 +62,15 @@ Pass in the following (optional) options.
Instead of the standard starter, you can choose from multiple examples.

```bash
npx create-buttonize@latest --template=examples/discount-code-generator
npx create-buttonize --template=examples/discount-code-generator
```

### `--api-key`

API Key to be pre-filled in the project.

```bash
npx create-buttonize --api-key=btnz_mybuttonizekey1234567
```

---
Expand All @@ -74,7 +82,7 @@ npx create-buttonize@latest --template=examples/discount-code-generator
Specify a project name, instead of typing it into the interactive prompt.

```bash
npx create-buttonize@latest my-buttonize-app
npx create-buttonize my-buttonize-app
```

---
Expand Down
6 changes: 5 additions & 1 deletion bin/create-buttonize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ program
.name('create-buttonize')
.description('CLI to create Buttonize example apps')
.option('--template <template>', 'Use a specific template')
.option('--api-key <api-key>', 'Pre-fill API Key in the template')
.argument('[name]', 'The name of your project')
.action(async (argumentName, opts) => {
const cwd = process.cwd()
Expand Down Expand Up @@ -67,7 +68,10 @@ program
await execute({
source: preset,
destination,
parameters: parameters ?? {}
parameters: {
apiKey: opts.apiKey ?? 'btnz_mybuttonizekey1234567',
...(parameters ?? {})
}
})
spinner.succeed('Copied template files')
console.log()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ExampleStack extends cdk.Stack {
super(scope, id, props)

Buttonize.init(this, {
apiKey: 'btnz_mybuttonizekey1234567',
apiKey: '@@apiKey',
externalId: 'CHANGE-ME-some-random-external-id'
})

Expand Down

0 comments on commit 79a59c1

Please sign in to comment.