bcup-cli 1.2.0 → 1.3.0

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/bin/bcup-cli CHANGED
@@ -1,4 +1,2 @@
1
- #!/usr/bin/env node
2
-
3
- require = require('esm')(module /*, options*/);
4
- require('../src/cli.ts').cli(process.argv);
1
+ #!/bin/bash
2
+ exec npx tsx src/cli.ts "$@"
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "bcup-cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Lightweight Buttercup password manager cli",
5
+ "type": "module",
5
6
  "bin": {
6
- "bcup-cli": "bin/bcup-cli"
7
+ "bcup-cli": "bin/cli.mjs"
7
8
  },
8
9
  "main": "index.js",
9
10
  "scripts": {
@@ -25,16 +26,18 @@
25
26
  "dependencies": {
26
27
  "@types/node": "^13.9.2",
27
28
  "arg": "^4.1.3",
28
- "buttercup": "^5.6.0",
29
+ "buttercup": "^7.7.1",
29
30
  "chalk": "^4.1.0",
30
31
  "clipboardy": "^2.3.0",
31
32
  "config": "^3.3.0",
32
33
  "crypto-random-string": "^3.3.0",
33
- "esm": "^3.2.25",
34
34
  "global": "^4.4.0",
35
35
  "js-yaml": "^3.13.1",
36
36
  "lodash": "^4.17.15",
37
37
  "prompt-sync": "^4.2.0",
38
38
  "prompt-sync-history": "^1.0.1"
39
+ },
40
+ "devDependencies": {
41
+ "tsx": "^4.21.0"
39
42
  }
40
43
  }
package/src/cli.ts CHANGED
@@ -1,21 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import arg from 'arg';
4
- import { flatten, uniqBy } from 'lodash';
4
+ import flatten from 'lodash/flatten';
5
+ import uniqBy from 'lodash/uniqBy';
5
6
  import { name, version, description, author, license, repository } from '../package.json';
7
+ import { Vault, FileDatasource, Credentials, init } from 'buttercup';
8
+ import { homedir } from 'os';
9
+ import clipboardy from 'clipboardy'
10
+ import chalk from 'chalk'
11
+ import promptSync from 'prompt-sync';
12
+ import history from 'prompt-sync-history';
6
13
 
7
14
  export function cli(args) {
8
15
  const options = parseArgumentsIntoOptions(args);
9
16
  const debug = options.debug || false;
10
17
  if (debug) console.log(args);
11
- const homedir = require('os').homedir();
12
- const bcupFile = options.bcupPath || `${homedir}/.bcup-cli/vault.bcup`;
18
+ const bcupFile = options.bcupPath || `${homedir()}/.bcup-cli/vault.bcup`;
13
19
 
14
- const { Vault, FileDatasource, Credentials, init, Search } = require('buttercup');
15
- const clipboardy = require('clipboardy');
16
- const chalk = require('chalk');
17
- const prompt = require('prompt-sync')({
18
- history: require('prompt-sync-history')() //open history file
20
+ const prompt = promptSync({
21
+ history: history() //open history file
19
22
  });
20
23
 
21
24
  console.log(`= ${name} v${version} (${description}) =`);
@@ -90,7 +93,6 @@ function invalidSelection(num, max) {
90
93
  }
91
94
 
92
95
  function emphSearch(string, titleSearch) {
93
- const chalk = require('chalk');
94
96
  const re = new RegExp(titleSearch, 'ig');
95
97
 
96
98
  let res;
@@ -118,3 +120,5 @@ function parseArgumentsIntoOptions(rawArgs) {
118
120
  bcupPath: args['--bcup-path'],
119
121
  };
120
122
  }
123
+
124
+ cli(process.argv);