bunosh 0.1.2 → 0.1.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/index.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import program from "./src/program";
2
2
  import exec from "./src/tasks/exec";
3
3
  import fetch from "./src/tasks/fetch";
4
+ import writeToFile from "./tasks/writeToFile";
5
+ import io from "./src/io";
6
+
4
7
  import { task, stopOnFail, ignoreFail } from "./src/task";
5
8
 
9
+
6
10
  export { program as bunosh };
7
11
 
8
- export { exec, fetch, task, stopOnFail, ignoreFail};
12
+ export { io, exec, fetch, task, stopOnFail, ignoreFail, writeToFile };
9
13
  export { exec as $ }
10
14
 
11
15
  export function buildCmd(cmd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunosh",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "module": "index.js",
5
5
  "bin": {
6
6
  "bunosh": "./run.js"
package/run.js CHANGED
@@ -3,7 +3,7 @@ import program, { BUNOSHFILE, banner } from "./src/program";
3
3
  import { existsSync, readFileSync } from "fs";
4
4
  import init from "./src/init";
5
5
  import path from "path";
6
- import { say, yell } from './io';
6
+ import { say, yell } from './src/io';
7
7
 
8
8
  const tasksFile = path.join(process.cwd(), BUNOSHFILE);
9
9
 
package/src/io.jsx ADDED
@@ -0,0 +1,47 @@
1
+ import React, {useState, useEffect} from 'react';
2
+ import { Box, Text } from 'ink';
3
+ import { renderOnce, isStaticOutput} from './output';
4
+ import Gradient from 'ink-gradient';
5
+ import BigText from 'ink-big-text';
6
+ import inquirer from 'inquirer';
7
+
8
+ export function say(...args) {
9
+ if (isStaticOutput) {
10
+ console.log(...args);
11
+ return;
12
+ };
13
+
14
+ const colors = ['yellow', 'magenta', 'cyan', 'blue', 'blueBright', 'magentaBright', 'cyanBright', 'whiteBright'];
15
+
16
+ renderOnce(
17
+ <Box gap={1} height={20} overflow='hidden' >
18
+ <Text color='white'>!</Text>
19
+ {args.map((arg, i) => <Text color={colors[i]} key={i}>{arg}</Text>)}
20
+ </Box>
21
+ );
22
+ }
23
+
24
+ export async function ask(question, opts = {}) {
25
+
26
+ const answers = await inquirer.prompt({ name: question, message: question, ...opts })
27
+
28
+ return Object.values(answers)[0];
29
+ }
30
+
31
+ export function yell(text) {
32
+ if (isStaticOutput) {
33
+ console.log();
34
+ console.log(text.toUpperCase());
35
+ console.log();
36
+ return;
37
+ };
38
+
39
+ renderOnce(
40
+ <Box gap={1} marginLeft={1}>
41
+ <Gradient name="teen">
42
+ <BigText text={text}/>
43
+ </Gradient>
44
+
45
+ </Box>
46
+ );
47
+ }
package/files.js DELETED
@@ -1,3 +0,0 @@
1
- import writeToFile from "./src/tasks/writeToFile";
2
-
3
- export { writeToFile };
@@ -1,28 +0,0 @@
1
-
2
- import { exec, fetch, ignoreFail } from 'bunosh';
3
- import { say, yell } from 'bunosh/io';
4
- import { writeToFile } from 'bunosh/files';
5
-
6
- /**
7
- * 🎉 Hello world command
8
- */
9
- export async function helloWorld() {
10
- // use say() to print to the console
11
- // say('Hello World!');
12
-
13
- // use exec`` to execute shell scripts:
14
- // await exec\`git status\`
15
-
16
- // use fetch() to make HTTP requests
17
- // await fetch('https://reqres.in/api/users')
18
-
19
- // add arguments and options to this function if needed
20
- // export async function helloWorld(userName, opts = { force: false })
21
- //
22
- // bunosh hello:world 'bob' --force
23
-
24
- // use ignoreFail(true) to prevent the command from stopping on error
25
-
26
- yell('Heloo Bunosh!');
27
- say('Edit me with bunosh edit');
28
- }