prettify-bru 0.1.4 → 0.1.5

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 ADDED
@@ -0,0 +1,11 @@
1
+ # Prettify Bru Files
2
+
3
+ To install in your project, run:
4
+
5
+ `npm i prettify-bru`
6
+
7
+ Boom, now you're ready you can run:
8
+
9
+ `npx prettify-bru -d .`
10
+
11
+ The above command will sweep through all directories looking to `.bru` files and it will find any `body:json` blocks and prettify the JSON inside.
package/cli.js CHANGED
@@ -1,3 +1,35 @@
1
1
  #!/usr/bin/env node
2
+ const yargs = require('yargs')
3
+ .usage(`
4
+ Usage: $0 [-d] path
2
5
 
3
- console.log('Hello World')
6
+ Running the command with no arguments will modify all files
7
+
8
+ `).options({
9
+ path: {
10
+ default: '.',
11
+ },
12
+ })
13
+ .describe({
14
+ d: 'Dry-run (Files will not be modified)',
15
+ h: 'Display this help message',
16
+ })
17
+ .boolean(['d', 'h'])
18
+ .help()
19
+ .alias('h', 'help')
20
+ .alias('d', 'check')
21
+ .alias('d', 'dry-run');
22
+
23
+ const argv = yargs.argv;
24
+
25
+ if (argv.h) {
26
+ yargs.showHelp();
27
+ } else {
28
+ go(argv.d, argv.path);
29
+ }
30
+
31
+ function go(argv) {
32
+ const module = require('./index');
33
+
34
+ module.go(argv.d, argv.path)
35
+ }
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ exports.go = function (dryRun, path) {
2
+ console.log("go() method inside index.js");
3
+ console.log(dryRun, path);
4
+ };
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "prettify-bru",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Prettifies JSON and JavaScript blocks in Bruno .bru files",
5
- "bin": {
6
- "prettify-bru": "./cli.js"
7
- },
8
5
  "keywords": [
9
6
  "bruno",
10
7
  "bru",
@@ -25,7 +22,13 @@
25
22
  "license": "GPL-3.0-or-later",
26
23
  "author": "Martin Joiner (http://martinjoiner.co.uk)",
27
24
  "type": "module",
28
- "main": "index.js",
25
+ "bin": {
26
+ "prettify-bru": "./cli.js"
27
+ },
28
+ "dependencies": {
29
+ "yargs": "15.4.1"
30
+ },
31
+ "main": "index",
29
32
  "scripts": {
30
33
  "test": "test"
31
34
  }
package/src/hello.js DELETED
@@ -1,2 +0,0 @@
1
- console.log('Hello World');
2
-