@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 +9 -8
- package/dist/index.js +103 -89
- package/dist/registry.bifrost +8 -0
- package/package.json +44 -41
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
|
-
##
|
|
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
|
|
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
|
|
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
|
|
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
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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 (!
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
|
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
|
|
323
|
+
const answers = await inquirer3.prompt([
|
|
318
324
|
{
|
|
319
|
-
type: "
|
|
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: "
|
|
331
|
+
type: "list",
|
|
326
332
|
name: "platform",
|
|
327
333
|
message: "Select platform:",
|
|
328
334
|
choices: [
|
|
329
|
-
{
|
|
330
|
-
{
|
|
331
|
-
{
|
|
332
|
-
{
|
|
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: "
|
|
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: "
|
|
348
|
+
type: "input",
|
|
343
349
|
name: "tags",
|
|
344
350
|
message: "Tags (comma-separated):",
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
|
|
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
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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
|
|
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://
|
|
531
|
-
- [Plugin Documentation](https://
|
|
532
|
-
- [Submit a Plugin](https://
|
|
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
|
|
550
|
+
import prompts from "prompts";
|
|
541
551
|
import { execSync as execSync3 } from "child_process";
|
|
542
|
-
var REGISTRY_REPO = "
|
|
543
|
-
var REGISTRY_FILE = "
|
|
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
|
|
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
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
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
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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);
|
package/package.json
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@a5gard/bifrost-plugin",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Plugin installer / wizard for bifrost projects",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"chalk": "^5.3.0",
|
|
31
|
-
"
|
|
32
|
-
"fs-extra": "^11.2.0"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
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
|
+
}
|