io.appium.settings 5.6.0 → 5.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.7.0](https://github.com/appium/io.appium.settings/compare/v5.6.0...v5.7.0) (2024-01-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * Make the index typed ([#140](https://github.com/appium/io.appium.settings/issues/140)) ([7020af0](https://github.com/appium/io.appium.settings/commit/7020af0c0ec542b2271b5e4685ff9c63a5faa4c2))
7
+
1
8
  ## [5.6.0](https://github.com/appium/io.appium.settings/compare/v5.5.0...v5.6.0) (2024-01-10)
2
9
 
3
10
 
Binary file
@@ -0,0 +1,4 @@
1
+ export const path: string;
2
+ export * from "./constants";
3
+ export { SettingsApp } from "./client";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":"AAKA,0BAAyC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SettingsApp = exports.path = void 0;
18
+ const source_map_support_1 = require("source-map-support");
19
+ (0, source_map_support_1.install)();
20
+ const utils_1 = require("./utils");
21
+ exports.path = (0, utils_1.getSettingsApkPath)();
22
+ __exportStar(require("./constants"), exports);
23
+ var client_1 = require("./client");
24
+ Object.defineProperty(exports, "SettingsApp", { enumerable: true, get: function () { return client_1.SettingsApp; } });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAA2C;AAC3C,IAAA,4BAAO,GAAE,CAAC;AAEV,mCAA6C;AAEhC,QAAA,IAAI,GAAG,IAAA,0BAAkB,GAAE,CAAC;AACzC,8CAA4B;AAC5B,mCAAuC;AAA9B,qGAAA,WAAW,OAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get the full path to the Settings APK
3
+ *
4
+ * @returns {string}
5
+ */
6
+ export function getSettingsApkPath(): string;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AA4BA;;;;GAIG;AACH,sCAFa,MAAM,CAIlB"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSettingsApkPath = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const MODULE_NAME = 'io.appium.settings';
10
+ /**
11
+ * Tries to synchronously detect the absolute path to the folder
12
+ * where the given `moduleName` is located.
13
+ *
14
+ * @returns {string} Full path to the module root
15
+ */
16
+ function getModuleRootSync() {
17
+ let currentDir = __dirname;
18
+ let isAtFsRoot = false;
19
+ while (!isAtFsRoot) {
20
+ const manifestPath = node_path_1.default.join(currentDir, 'package.json');
21
+ try {
22
+ if (node_fs_1.default.existsSync(manifestPath) &&
23
+ JSON.parse(node_fs_1.default.readFileSync(manifestPath, 'utf8')).name === MODULE_NAME) {
24
+ return currentDir;
25
+ }
26
+ }
27
+ catch (ign) { }
28
+ currentDir = node_path_1.default.dirname(currentDir);
29
+ isAtFsRoot = currentDir.length <= node_path_1.default.dirname(currentDir).length;
30
+ }
31
+ throw new Error(`Cannot find the root of the ${MODULE_NAME} Node.js module`);
32
+ }
33
+ /**
34
+ * Get the full path to the Settings APK
35
+ *
36
+ * @returns {string}
37
+ */
38
+ function getSettingsApkPath() {
39
+ return node_path_1.default.resolve(getModuleRootSync(), 'apks', 'settings_apk-debug.apk');
40
+ }
41
+ exports.getSettingsApkPath = getSettingsApkPath;
42
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,sDAAyB;AAEzB,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,IAAI,UAAU,GAAG,SAAS,CAAC;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,OAAO,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,YAAY,GAAG,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC3D,IAAI,CAAC;YACH,IAAI,iBAAE,CAAC,UAAU,CAAC,YAAY,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBAC3E,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC,CAAA,CAAC;QAChB,UAAU,GAAG,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,UAAU,GAAG,UAAU,CAAC,MAAM,IAAI,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC;IACpE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,iBAAiB,CAAC,CAAC;AAC/E,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB;IAChC,OAAO,mBAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAC7E,CAAC;AAFD,gDAEC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import {install} from 'source-map-support';
2
+ install();
3
+
4
+ import { getSettingsApkPath } from './utils';
5
+
6
+ export const path = getSettingsApkPath();
7
+ export * from './constants';
8
+ export { SettingsApp } from './client';
package/lib/utils.js ADDED
@@ -0,0 +1,36 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+
4
+ const MODULE_NAME = 'io.appium.settings';
5
+
6
+ /**
7
+ * Tries to synchronously detect the absolute path to the folder
8
+ * where the given `moduleName` is located.
9
+ *
10
+ * @returns {string} Full path to the module root
11
+ */
12
+ function getModuleRootSync () {
13
+ let currentDir = __dirname;
14
+ let isAtFsRoot = false;
15
+ while (!isAtFsRoot) {
16
+ const manifestPath = path.join(currentDir, 'package.json');
17
+ try {
18
+ if (fs.existsSync(manifestPath) &&
19
+ JSON.parse(fs.readFileSync(manifestPath, 'utf8')).name === MODULE_NAME) {
20
+ return currentDir;
21
+ }
22
+ } catch (ign) {}
23
+ currentDir = path.dirname(currentDir);
24
+ isAtFsRoot = currentDir.length <= path.dirname(currentDir).length;
25
+ }
26
+ throw new Error(`Cannot find the root of the ${MODULE_NAME} Node.js module`);
27
+ }
28
+
29
+ /**
30
+ * Get the full path to the Settings APK
31
+ *
32
+ * @returns {string}
33
+ */
34
+ export function getSettingsApkPath() {
35
+ return path.resolve(getModuleRootSync(), 'apks', 'settings_apk-debug.apk');
36
+ }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "io.appium.settings",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "App for dealing with Android settings",
5
- "main": "index.js",
5
+ "main": "./build/index.js",
6
+ "types": "./build/index.d.ts",
6
7
  "scripts": {
7
8
  "bump-gradle-version": "node scripts/gradle-version-update.js --package-version=${npm_package_version} && git add app/build.gradle",
8
9
  "lint": "./gradlew lint",
@@ -29,7 +30,6 @@
29
30
  "settings"
30
31
  ],
31
32
  "files": [
32
- "index.js",
33
33
  "lib",
34
34
  "build/lib",
35
35
  "apks",
package/index.js DELETED
@@ -1,9 +0,0 @@
1
- const path = require('node:path');
2
- const { SettingsApp } = require('./build/lib/client');
3
- const constants = require('./build/lib/constants');
4
-
5
- module.exports = {
6
- path: path.resolve(__dirname, 'apks', 'settings_apk-debug.apk'),
7
- SettingsApp,
8
- ...constants,
9
- };