@a5gard/bifrost-plugin 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  Plugin installer / wizard for bifrost projects.
4
4
 
5
- ## Installing A Plugin
6
5
 
7
6
  ### Interactive Mode
8
7
 
9
8
  Once your project has completed its installation process, you may now cd into the newly created directory and run:
10
9
 
11
10
  ```bash
12
- bunx bifrost-plugin
11
+ bunx @a5gard/bifrost-plugin
13
12
  ```
14
13
 
15
14
  Entering interactive mode it will display the following options:
@@ -17,22 +16,24 @@ Entering interactive mode it will display the following options:
17
16
  - Plugin wizard ( guide in creating your own plugin )
18
17
  - Submit Plugin
19
18
 
20
- ## `List available plugins to install`
19
+ ## Installing A Plugin
20
+
21
+ ### `List available plugins to install`
21
22
 
22
23
  Running the following command will start plugin installation process:
23
24
 
24
25
  ```bash
25
- bunx bifrost-plugin list
26
+ bunx @a5gard/bifrost-plugin list
26
27
  ```
27
28
 
28
- The installer will then obtain the list of available plugins to choose from the bifrost-plugin repo (owner `8an3`) from the file labeled `registry.bifrost`
29
+ The installer will then obtain the list of available plugins to choose from the @a5gard/bifrost-plugin repo (owner `8an3`) from the file labeled `registry.bifrost`
29
30
 
30
31
  ### Direct Installation
31
32
 
32
33
  or you may use the supplied method
33
34
 
34
35
  ```bash
35
- bunx bifrost-plugin otp-auth-plugin
36
+ bunx @a5gard/bifrost-plugin otp-auth-plugin
36
37
  ```
37
38
 
38
39
  Which will immediatly start the installation process, after scanning your projects config.bifrost to see if the platforms match for compatibility to ensure you are installing the correct plugin.
@@ -43,7 +44,7 @@ Which will immediatly start the installation process, after scanning your projec
43
44
  Running the following command will start the create plugin wizard:
44
45
 
45
46
  ```bash
46
- bunx bifrost-plugin create
47
+ bunx @a5gard/bifrost-plugin create
47
48
  ```
48
49
 
49
50
  Where it will then inquirer:
@@ -129,7 +130,7 @@ When installing a plugin it will prompt the user to either confirm the default s
129
130
  Running the following command will start the submission process without the need of interactive mode:
130
131
 
131
132
  ```bash
132
- bunx bifrost-plugin submit
133
+ bunx @a5gard/bifrost-plugin submit
133
134
  ```
134
135
 
135
136
  Selecting this option will automate the submission process for you, adding your plugin to the libraries registry. Allowing you to share you plugin with others that will also be posted on the site to allow users to find it more easily.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
- import prompts5 from "prompts";
5
+ import inquirer4 from "inquirer";
6
6
  import chalk5 from "chalk";
7
7
 
8
8
  // src/utils.ts
@@ -29,13 +29,13 @@ import path3 from "path";
29
29
  import { execSync } from "child_process";
30
30
  import ora from "ora";
31
31
  import chalk2 from "chalk";
32
- import prompts2 from "prompts";
32
+ import inquirer2 from "inquirer";
33
33
 
34
34
  // src/config-manager.ts
35
35
  import fs2 from "fs-extra";
36
36
  import path2 from "path";
37
37
  import chalk from "chalk";
38
- import prompts from "prompts";
38
+ import inquirer from "inquirer";
39
39
  async function processConfigFiles(pluginGithub, configs) {
40
40
  for (const config of configs) {
41
41
  const targetPath = path2.join(process.cwd(), config.targetFile);
@@ -61,16 +61,18 @@ Target file ${config.targetFile} does not exist. Skipping...`));
61
61
  console.log(chalk.gray("\u2500".repeat(50)));
62
62
  console.log(configContent);
63
63
  console.log(chalk.gray("\u2500".repeat(50)));
64
- const { action } = await prompts({
65
- type: "select",
66
- name: "action",
67
- message: `How would you like to handle ${config.targetFile}?`,
68
- choices: [
69
- { title: "Auto-apply changes", value: "auto" },
70
- { title: "Copy to clipboard (manual)", value: "manual" },
71
- { title: "Skip this configuration", value: "skip" }
72
- ]
73
- });
64
+ const { action } = await inquirer.prompt([
65
+ {
66
+ type: "list",
67
+ name: "action",
68
+ message: `How would you like to handle ${config.targetFile}?`,
69
+ choices: [
70
+ { name: "Auto-apply changes", value: "auto" },
71
+ { name: "Copy to clipboard (manual)", value: "manual" },
72
+ { name: "Skip this configuration", value: "skip" }
73
+ ]
74
+ }
75
+ ]);
74
76
  if (action === "skip") {
75
77
  console.log(chalk.yellow(`Skipped ${config.targetFile}`));
76
78
  continue;
@@ -228,21 +230,25 @@ async function installPlugin(pluginGithub, projectPlatform) {
228
230
  }
229
231
  spinner = ora("Installing plugin files...").start();
230
232
  for (const file of pluginConfig.files) {
231
- const shouldUseDefault = await prompts2({
232
- type: "confirm",
233
- name: "useDefault",
234
- message: `Install ${file.name} to ${file.location}?`,
235
- initial: true
236
- });
233
+ const { useDefault } = await inquirer2.prompt([
234
+ {
235
+ type: "confirm",
236
+ name: "useDefault",
237
+ message: `Install ${file.name} to ${file.location}?`,
238
+ default: true
239
+ }
240
+ ]);
237
241
  let finalTargetPath = path3.join(process.cwd(), file.location);
238
- if (!shouldUseDefault.useDefault) {
239
- const customLocation = await prompts2({
240
- type: "text",
241
- name: "location",
242
- message: `Enter custom location for ${file.name}:`,
243
- initial: file.location
244
- });
245
- finalTargetPath = path3.join(process.cwd(), customLocation.location);
242
+ if (!useDefault) {
243
+ const { location } = await inquirer2.prompt([
244
+ {
245
+ type: "input",
246
+ name: "location",
247
+ message: `Enter custom location for ${file.name}:`,
248
+ default: file.location
249
+ }
250
+ ]);
251
+ finalTargetPath = path3.join(process.cwd(), location);
246
252
  }
247
253
  const fileUrl = `https://raw.githubusercontent.com/${pluginGithub}/main/files/${file.name}`;
248
254
  const fileResponse = await fetch(fileUrl);
@@ -310,46 +316,46 @@ function detectPackageManager() {
310
316
  import fs4 from "fs-extra";
311
317
  import path4 from "path";
312
318
  import chalk3 from "chalk";
313
- import prompts3 from "prompts";
319
+ import inquirer3 from "inquirer";
314
320
  import { execSync as execSync2 } from "child_process";
315
321
  async function createPlugin() {
316
322
  console.log(chalk3.blue.bold("\n\u{1F680} Bifrost Plugin Creator\n"));
317
- const answers = await prompts3([
323
+ const answers = await inquirer3.prompt([
318
324
  {
319
- type: "text",
325
+ type: "input",
320
326
  name: "name",
321
327
  message: "Plugin name:",
322
328
  validate: (value) => value.length > 0 ? true : "Plugin name is required"
323
329
  },
324
330
  {
325
- type: "select",
331
+ type: "list",
326
332
  name: "platform",
327
333
  message: "Select platform:",
328
334
  choices: [
329
- { title: "Remix", value: "remix" },
330
- { title: "Next.js", value: "nextjs" },
331
- { title: "Vite", value: "vite" },
332
- { title: "Other", value: "other" }
335
+ { name: "Remix", value: "remix" },
336
+ { name: "Next.js", value: "nextjs" },
337
+ { name: "Vite", value: "vite" },
338
+ { name: "Other", value: "other" }
333
339
  ]
334
340
  },
335
341
  {
336
- type: "text",
342
+ type: "input",
337
343
  name: "description",
338
344
  message: "Description:",
339
345
  validate: (value) => value.length > 0 ? true : "Description is required"
340
346
  },
341
347
  {
342
- type: "text",
348
+ type: "input",
343
349
  name: "tags",
344
350
  message: "Tags (comma-separated):",
345
- initial: "",
346
- format: (value) => value ? value.split(",").map((t) => t.trim()).filter(Boolean) : []
351
+ default: "",
352
+ filter: (value) => value ? value.split(",").map((t) => t.trim()).filter(Boolean) : []
347
353
  },
348
354
  {
349
355
  type: "confirm",
350
356
  name: "addLibraries",
351
357
  message: "Would you like to supply required libraries now?",
352
- initial: false
358
+ default: false
353
359
  }
354
360
  ]);
355
361
  if (!answers.name) {
@@ -359,32 +365,38 @@ async function createPlugin() {
359
365
  let libraries = [];
360
366
  if (answers.addLibraries) {
361
367
  console.log(chalk3.gray("\nFormat: @remix-run/react, remix-auth, react"));
362
- const { libraryInput } = await prompts3({
363
- type: "text",
364
- name: "libraryInput",
365
- message: "Libraries:",
366
- initial: ""
367
- });
368
+ const { libraryInput } = await inquirer3.prompt([
369
+ {
370
+ type: "input",
371
+ name: "libraryInput",
372
+ message: "Libraries:",
373
+ default: ""
374
+ }
375
+ ]);
368
376
  if (libraryInput) {
369
377
  libraries = libraryInput.split(",").map((l) => l.trim()).filter(Boolean);
370
378
  }
371
379
  }
372
- const { githubUsername } = await prompts3({
373
- type: "text",
374
- name: "githubUsername",
375
- message: "GitHub username:",
376
- validate: (value) => value.length > 0 ? true : "GitHub username is required"
377
- });
380
+ const { githubUsername } = await inquirer3.prompt([
381
+ {
382
+ type: "input",
383
+ name: "githubUsername",
384
+ message: "GitHub username:",
385
+ validate: (value) => value.length > 0 ? true : "GitHub username is required"
386
+ }
387
+ ]);
378
388
  if (!githubUsername) {
379
389
  console.log(chalk3.yellow("\nPlugin creation cancelled"));
380
390
  process.exit(0);
381
391
  }
382
- const { autoGithub } = await prompts3({
383
- type: "confirm",
384
- name: "autoGithub",
385
- message: "Auto-create and push to GitHub?",
386
- initial: true
387
- });
392
+ const { autoGithub } = await inquirer3.prompt([
393
+ {
394
+ type: "confirm",
395
+ name: "autoGithub",
396
+ message: "Auto-create and push to GitHub?",
397
+ default: true
398
+ }
399
+ ]);
388
400
  const pluginDir = path4.join(process.cwd(), answers.name);
389
401
  if (await fs4.pathExists(pluginDir)) {
390
402
  console.error(chalk3.red(`
@@ -460,7 +472,7 @@ build/
460
472
  console.log(chalk3.cyan("Next steps:"));
461
473
  console.log(chalk3.gray(` 1. Add your plugin files to ${answers.name}/files/`));
462
474
  console.log(chalk3.gray(` 2. Update plugin.bifrost with file mappings`));
463
- console.log(chalk3.gray(" 3. Submit to registry: https://bifrost-plugins.dev/submit"));
475
+ console.log(chalk3.gray(" 3. Submit to registry: https://@a5gard/bifrost-plugins.dev/submit"));
464
476
  console.log();
465
477
  }
466
478
  function generateReadme(config, username) {
@@ -471,7 +483,7 @@ ${config.description}
471
483
  ## Installation
472
484
 
473
485
  \`\`\`bash
474
- bunx bifrost-plugin ${config.name}
486
+ bunx @a5gard/bifrost-plugin ${config.name}
475
487
  \`\`\`
476
488
 
477
489
  ## Platform
@@ -509,9 +521,7 @@ Add your plugin files to the \`files/\` directory and update \`plugin.bifrost\`
509
521
 
510
522
  ## Submit to Registry
511
523
 
512
- Once your plugin is ready, submit it to the Bifrost Plugin Registry:
513
-
514
- \u{1F517} [Submit Plugin](https://bifrost-plugins.dev/submit)
524
+ Once your plugin is ready, submit it to the Bifrost Plugin Registry either on the site via the submit button or cli \`bunx @a5gard/bifrost-plugin submit\`
515
525
 
516
526
  ## Development
517
527
 
@@ -527,9 +537,9 @@ MIT \xA9 ${username}
527
537
 
528
538
  ## Links
529
539
 
530
- - [Bifrost Plugin Registry](https://bifrost-plugins.dev)
531
- - [Plugin Documentation](https://bifrost-plugins.dev/docs)
532
- - [Submit a Plugin](https://bifrost-plugins.dev/submit)
540
+ - [Bifrost Plugin Registry](https://github.com/A5GARD/BIFROST-PLUGIN)
541
+ - [Plugin Documentation](https://github.com/A5GARD/BIFROST-PLUGIN)
542
+ - [Submit a Plugin](https://github.com/A5GARD/BIFROST-PLUGIN)
533
543
  `;
534
544
  }
535
545
 
@@ -537,10 +547,10 @@ MIT \xA9 ${username}
537
547
  import fs5 from "fs-extra";
538
548
  import path5 from "path";
539
549
  import chalk4 from "chalk";
540
- import prompts4 from "prompts";
550
+ import prompts from "prompts";
541
551
  import { execSync as execSync3 } from "child_process";
542
- var REGISTRY_REPO = "8an3/bifrost-plugin";
543
- var REGISTRY_FILE = "dist/registry.bifrost";
552
+ var REGISTRY_REPO = "A5GARD/BIFROST-PLUGIN";
553
+ var REGISTRY_FILE = "registry.bifrost";
544
554
  async function submitPlugin() {
545
555
  console.log(chalk4.blue.bold("\n\u{1F4E4} Submit Plugin to Registry\n"));
546
556
  const pluginConfigPath = path5.join(process.cwd(), "plugin.bifrost");
@@ -559,7 +569,7 @@ async function submitPlugin() {
559
569
  console.log(`Tags: ${chalk4.white(pluginConfig.tags.join(", "))}`);
560
570
  console.log(`Libraries: ${chalk4.white(pluginConfig.libraries.join(", "))}`);
561
571
  console.log(chalk4.gray("\u2500".repeat(50)));
562
- const { confirm } = await prompts4({
572
+ const { confirm } = await prompts({
563
573
  type: "confirm",
564
574
  name: "confirm",
565
575
  message: "Submit this plugin to the registry?",
@@ -697,16 +707,18 @@ Error: ${error instanceof Error ? error.message : "Unknown error"}`));
697
707
  });
698
708
  async function interactiveMode() {
699
709
  console.log(chalk5.blue.bold("\n\u{1F309} bifrost Plugin Manager\n"));
700
- const { action } = await prompts5({
701
- type: "select",
702
- name: "action",
703
- message: "What would you like to do?",
704
- choices: [
705
- { title: "List available plugins to install", value: "list" },
706
- { title: "Plugin wizard (create your own plugin)", value: "create" },
707
- { title: "Submit plugin to registry", value: "submit" }
708
- ]
709
- });
710
+ const { action } = await inquirer4.prompt([
711
+ {
712
+ type: "list",
713
+ name: "action",
714
+ message: "What would you like to do?",
715
+ choices: [
716
+ { name: "List available plugins to install", value: "list" },
717
+ { name: "Plugin wizard (create your own plugin)", value: "create" },
718
+ { name: "Submit plugin to registry", value: "submit" }
719
+ ]
720
+ }
721
+ ]);
710
722
  if (!action) {
711
723
  console.log(chalk5.yellow("\nCancelled"));
712
724
  process.exit(0);
@@ -738,15 +750,17 @@ async function listPlugins() {
738
750
  console.log(chalk5.yellow(`No plugins available for platform: ${projectConfig.platform}`));
739
751
  process.exit(0);
740
752
  }
741
- const { selectedPlugin } = await prompts5({
742
- type: "select",
743
- name: "selectedPlugin",
744
- message: "Select a plugin to install:",
745
- choices: compatiblePlugins.map((p) => ({
746
- title: `${p.name} - ${p.description}`,
747
- value: p
748
- }))
749
- });
753
+ const { selectedPlugin } = await inquirer4.prompt([
754
+ {
755
+ type: "list",
756
+ name: "selectedPlugin",
757
+ message: "Select a plugin to install:",
758
+ choices: compatiblePlugins.map((p) => ({
759
+ name: `${p.name} - ${p.description}`,
760
+ value: p
761
+ }))
762
+ }
763
+ ]);
750
764
  if (!selectedPlugin) {
751
765
  console.log(chalk5.yellow("Installation cancelled"));
752
766
  process.exit(0);
@@ -0,0 +1,8 @@
1
+ [
2
+ {
3
+ "name": "otp-auth-plugin",
4
+ "platform": "remix",
5
+ "github": "8an3/otp-auth-plugin",
6
+ "description": "One time password authentication plugin for Remix"
7
+ }
8
+ ]
package/package.json CHANGED
@@ -1,41 +1,44 @@
1
- {
2
- "name": "@a5gard/bifrost-plugin",
3
- "version": "1.0.1",
4
- "description": "Plugin installer / wizard for bifrost projects",
5
- "type": "module",
6
- "bin": {
7
- "bifrost-plugin": "dist/index.js"
8
- },
9
- "scripts": {
10
- "build": "tsup src/index.ts --format esm --dts --clean",
11
- "dev": "tsup src/index.ts --format esm --dts --watch",
12
- "typecheck": "tsc --noEmit"
13
- },
14
- "files": [
15
- "dist"
16
- ],
17
- "keywords": [
18
- "bifrost",
19
- "plugin",
20
- "cli"
21
- ],
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "author": "8an3",
26
- "license": "MIT",
27
- "dependencies": {
28
- "commander": "^11.1.0",
29
- "prompts": "^2.4.2",
30
- "chalk": "^5.3.0",
31
- "ora": "^8.0.1",
32
- "fs-extra": "^11.2.0"
33
- },
34
- "devDependencies": {
35
- "@types/node": "^20.11.5",
36
- "@types/prompts": "^2.4.9",
37
- "@types/fs-extra": "^11.0.4",
38
- "typescript": "^5.3.3",
39
- "tsup": "^8.0.1"
40
- }
41
- }
1
+ {
2
+ "name": "@a5gard/bifrost-plugin",
3
+ "version": "1.0.3",
4
+ "description": "Plugin installer / wizard for bifrost projects",
5
+ "type": "module",
6
+ "bin": {
7
+ "bifrost-plugin": "dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "copy-registry": "bun copy-registry.js",
11
+ "build:tsup": "tsup src/index.ts --format esm --dts --clean",
12
+ "build": "npm run build:tsup && npm run copy-registry ",
13
+ "dev": "tsup src/index.ts --format esm --dts --watch",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "bifrost",
21
+ "plugin",
22
+ "cli"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "author": "8an3",
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "chalk": "^5.3.0",
31
+ "commander": "^11.1.0",
32
+ "fs-extra": "^11.2.0",
33
+ "inquirer": "^13.2.2",
34
+ "ora": "^8.0.1",
35
+ "prompts": "^2.4.2"
36
+ },
37
+ "devDependencies": {
38
+ "@types/fs-extra": "^11.0.4",
39
+ "@types/node": "^20.11.5",
40
+ "@types/prompts": "^2.4.9",
41
+ "tsup": "^8.0.1",
42
+ "typescript": "^5.3.3"
43
+ }
44
+ }