Skip to content

Commit

Permalink
Added sveltekit Authentication support
Browse files Browse the repository at this point in the history
  • Loading branch information
k8pai committed Sep 23, 2023
1 parent c69175a commit 269b5f5
Show file tree
Hide file tree
Showing 7 changed files with 466 additions and 25 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "A nextauth cli to setup a basic application Setup running",
"exports": "./dist/index.js",
"bin": {
"nextauth": "./dist/index.js"
"nextauth": "./dist/nextauth.js",
"svelteauth": "./dist/sveltekit.js"
},
"scripts": {
"build": "tsup src --format cjs,esm --minify --dts",
Expand Down
20 changes: 5 additions & 15 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@ import { Command } from 'commander';
import { cyan, green, magenta, red, yellow, bold, blue } from 'picocolors';
import prompts from 'prompts';
import { providerChoices, providers } from './lib/Providers.js';
import { hasValidProviders, sleep } from './lib/helpers.js';
import { hasValidProviders, onPromptState, sleep } from './lib/helpers.js';
import { NextGenerator } from './lib/generators.js';
import { OptionsType, ProviderOptions } from './typings.js';
import { adapterChoices } from './lib/Adapters.js';
import { createSpinner } from 'nanospinner';

const program = new Command();
const nextauth = new Command();

const onPromptState = (state: any) => {
if (state.aborted) {
// If we don't re-enable the terminal cursor before exiting
// the program, the cursor will remain hidden
process.stdout.write('\x1B[?25h');
process.stdout.write('\n');
process.exit(1);
}
};

program
nextauth
.option('-E, --env', 'update .env file with provider variables as well!')
.option(
'-T, --ts',
Expand Down Expand Up @@ -236,9 +226,9 @@ program

// Adding options for both `next-app` and `next-pages` command!
for (let key in providers) {
program.option(`--${key}`, `Add ${key} Provider.`);
nextauth.option(`--${key}`, `Add ${key} Provider.`);
// nextapp.option(`--${key}`, `Add ${key} Provider.`);
// nextpages.option(`--${key}`, `Add ${key} Provider.`);
}

export default program;
export default nextauth;
5 changes: 0 additions & 5 deletions src/index.ts

This file was deleted.

Loading

0 comments on commit 269b5f5

Please sign in to comment.