veryfi-lens-wasm 1.0.1 → 1.0.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/copy-wasm.js ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const fs = require('fs-extra');
5
+ const readline = require('readline');
6
+
7
+ console.log('Starting postinstall script...');
8
+
9
+ const sourcePath = path.join(__dirname, 'src/wasm');
10
+
11
+ console.log('Source path:', sourcePath);
12
+
13
+ // Check if the environment is interactive
14
+ const hasInteractiveStdin = process.stdin.isTTY;
15
+
16
+ if (hasInteractiveStdin) {
17
+ const rl = readline.createInterface({
18
+ input: process.stdin,
19
+ output: process.stdout
20
+ });
21
+
22
+ rl.question('Please enter the path to your desired folder: ', (targetPath) => {
23
+ rl.question('Do you want to copy wasm files from veryfi-lens-wasm to the provided directory? (yes/no): ', (answer) => {
24
+ rl.close();
25
+
26
+ if (answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y') {
27
+ fs.copySync(sourcePath, targetPath, { overwrite: true });
28
+ console.log('WASM files copied successfully to', targetPath);
29
+ } else {
30
+ console.log('WASM files were not copied.');
31
+ }
32
+ });
33
+ });
34
+ } else {
35
+ const sourcePath = path.join(__dirname, 'src/wasm');
36
+ const defaultTargetPath = path.join(process.cwd(), 'public/wasm');
37
+ fs.copySync(sourcePath, defaultTargetPath, { overwrite: true });
38
+ console.log('WASM files copied without prompt due to non-interactive environment to', defaultTargetPath);
39
+ }
package/copy-wasm.sh ADDED
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ echo "Starting postinstall script..."
4
+
5
+ SOURCE_PATH="$(dirname "$0")/src/wasm"
6
+
7
+ # Check if the environment is interactive
8
+ if [ -t 0 ]; then
9
+ # Interactive mode
10
+ read -p "Please enter the path to your desired folder: " TARGET_PATH
11
+ read -p "Do you want to copy wasm files from veryfi-lens-wasm to the provided directory? (yes/no): " ANSWER
12
+ if [[ "$ANSWER" == "yes" || "$ANSWER" == "y" ]]; then
13
+ cp -R "$SOURCE_PATH" "$TARGET_PATH"
14
+ echo "WASM files copied successfully to $TARGET_PATH"
15
+ else
16
+ echo "WASM files were not copied."
17
+ fi
18
+ else
19
+ # Non-interactive mode
20
+ PROJECT_ROOT="$(dirname "$(dirname "$(dirname "$0")")")"
21
+ DEFAULT_TARGET_PATH="$PROJECT_ROOT/public/wasm"
22
+ cp -R "$SOURCE_PATH" "$DEFAULT_TARGET_PATH"
23
+ echo "WASM files copied without prompt due to non-interactive environment to $DEFAULT_TARGET_PATH"
24
+ fi
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare module 'veryfi-lens-sdk'
2
+ declare module 'veryfi-lens-sdk/veryfi-lens'
3
+ declare module 'veryfi-lens-sdk/device-uuid'
4
+ declare module 'veryfi-lens-sdk/fingerprint-id'
5
+ declare module 'veryfy-lens-sdk/blur-detector'
6
+ declare module 'veryfy-lens-sdk/lens-wasm'
package/package.json CHANGED
@@ -1,18 +1,16 @@
1
1
  {
2
2
  "name": "veryfi-lens-wasm",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Lens For Web SDK with WASM",
5
5
  "main": "veryfi-lens.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "postinstall": "./copy-wasm.js"
8
8
  },
9
9
  "author": "",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "fs-extra": "^11.1.1",
13
- "path": "^0.12.7"
14
- },
15
- "files": [
16
- "src/*"
17
- ]
13
+ "path": "^0.12.7",
14
+ "readline": "^1.3.0"
15
+ }
18
16
  }