prettify-bru 0.1.6 → 0.1.7

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.
Files changed (4) hide show
  1. package/cli.js +11 -11
  2. package/index.js +1 -1
  3. package/package.json +6 -2
  4. package/src/index.js +1 -10
package/cli.js CHANGED
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env node
2
- const yargs = require('yargs')
3
- .usage(`
2
+
3
+ import yargs from 'yargs';
4
+ import {go} from './index.js';
5
+
6
+ const argv = yargs(process.argv).usage(`
4
7
  Usage: $0 [-d] path
5
8
 
6
9
  Running the command with no arguments will modify all files
7
10
 
8
11
  `).options({
12
+ d: {
13
+ type: 'boolean',
14
+ default: false
15
+ },
9
16
  path: {
10
17
  default: '.',
11
18
  },
@@ -18,18 +25,11 @@ Running the command with no arguments will modify all files
18
25
  .help()
19
26
  .alias('h', 'help')
20
27
  .alias('d', 'check')
21
- .alias('d', 'dry-run');
22
-
23
- const argv = yargs.argv;
28
+ .alias('d', 'dry-run')
29
+ .parse();
24
30
 
25
31
  if (argv.h) {
26
32
  yargs.showHelp();
27
33
  } else {
28
34
  go(argv.d, argv.path);
29
35
  }
30
-
31
- function go(argv) {
32
- const module = require('./index');
33
-
34
- module.go(argv.d, argv.path)
35
- }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- exports.go = function (dryRun, path) {
1
+ export function go(dryRun, path) {
2
2
  console.log("go() method inside index.js");
3
3
  console.log(dryRun, path);
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettify-bru",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Prettifies JSON and JavaScript blocks in Bruno .bru files",
5
5
  "keywords": [
6
6
  "bruno",
@@ -22,13 +22,17 @@
22
22
  "license": "GPL-3.0-or-later",
23
23
  "author": "Martin Joiner (http://martinjoiner.co.uk)",
24
24
  "type": "module",
25
+ "files": [
26
+ "index.js",
27
+ "cli.js",
28
+ "src/"
29
+ ],
25
30
  "bin": {
26
31
  "prettify-bru": "./cli.js"
27
32
  },
28
33
  "dependencies": {
29
34
  "yargs": "15.4.1"
30
35
  },
31
- "main": "./index",
32
36
  "scripts": {
33
37
  "test": "test"
34
38
  }
package/src/index.js CHANGED
@@ -1,12 +1,3 @@
1
- function check() {
1
+ export function check() {
2
2
  console.log("This is check");
3
3
  }
4
-
5
- function format() {
6
- console.log("This is format");
7
- }
8
-
9
- export {
10
- check,
11
- format
12
- };