@wocker/utils 1.0.0 → 1.0.1

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.
@@ -0,0 +1,31 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: publish
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Set up Node.js
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: '18'
20
+ registry-url: 'https://registry.npmjs.org'
21
+
22
+ - name: Install dependencies
23
+ run: npm install
24
+
25
+ - name: Build
26
+ run: npm run build
27
+
28
+ - name: Publish to NPM
29
+ env:
30
+ NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
31
+ run: npm publish
@@ -0,0 +1,2 @@
1
+ /// <reference types="node" />
2
+ export declare const demuxOutput: (buffer: Buffer) => Buffer;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.demuxOutput = void 0;
4
+ const demuxOutput = (buffer) => {
5
+ let nextDataLength = null, output = Buffer.from([]);
6
+ while (buffer.length > 0) {
7
+ const header = bufferSlice(8);
8
+ nextDataLength = header.readUInt32BE(4);
9
+ const content = bufferSlice(nextDataLength);
10
+ output = Buffer.concat([output, content]);
11
+ }
12
+ function bufferSlice(end) {
13
+ const out = buffer.slice(0, end);
14
+ buffer = Buffer.from(buffer.slice(end, buffer.length));
15
+ return out;
16
+ }
17
+ return output;
18
+ };
19
+ exports.demuxOutput = demuxOutput;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
+ export * from "./demuxOutput";
1
2
  export * from "./promptConfirm";
2
3
  export * from "./promptGroup";
3
4
  export * from "./promptSelect";
4
5
  export * from "./promptText";
6
+ export * from "./volumeFormat";
7
+ export * from "./volumeParse";
package/lib/index.js CHANGED
@@ -14,7 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./demuxOutput"), exports);
17
18
  __exportStar(require("./promptConfirm"), exports);
18
19
  __exportStar(require("./promptGroup"), exports);
19
20
  __exportStar(require("./promptSelect"), exports);
20
21
  __exportStar(require("./promptText"), exports);
22
+ __exportStar(require("./volumeFormat"), exports);
23
+ __exportStar(require("./volumeParse"), exports);
@@ -2,5 +2,5 @@ type Options = {
2
2
  message?: string;
3
3
  default?: boolean;
4
4
  };
5
- export declare const promptConfirm: (options: Options) => Promise<any>;
5
+ export declare const promptConfirm: (options: Options) => Promise<boolean>;
6
6
  export { Options as PromptConfirmOptions };
@@ -0,0 +1,6 @@
1
+ export type Volume = {
2
+ source: string;
3
+ destination: string;
4
+ options?: string;
5
+ };
6
+ export declare const volumeFormat: (volume: Volume) => string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.volumeFormat = void 0;
4
+ const volumeFormat = (volume) => {
5
+ const { source, destination, options } = volume;
6
+ return `${source}:${destination}` + (options ? `:${options}` : "");
7
+ };
8
+ exports.volumeFormat = volumeFormat;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const volumeParse = (volume) => {
4
+ const regVolume = /^([^:]+):([^:]+)(?::([^:]+))?$/;
5
+ const [, source, destination, options] = regVolume.exec(volume) || [];
6
+ return {
7
+ source,
8
+ destination,
9
+ options
10
+ };
11
+ };
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@wocker/utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Utils for @wocker",
6
6
  "license": "MIT",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
+ "keywords": [
10
+ "wocker"
11
+ ],
9
12
  "homepage": "https://github.com/kearisp/wocker-utils#readme",
10
13
  "repository": {
11
14
  "type": "git",
@@ -21,9 +24,10 @@
21
24
  "test": "echo \"Error: no test specified\" && exit 1"
22
25
  },
23
26
  "dependencies": {
24
- "inquirer": "^7.0.0"
27
+ "inquirer": "^7.3.3"
25
28
  },
26
29
  "devDependencies": {
30
+ "@types/inquirer": "^7.3.3",
27
31
  "jest": "^29.7.0",
28
32
  "typescript": "^5.2.2"
29
33
  }