@aetherpush/cli 0.1.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.
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = sign;
4
+ const fs = require("fs/promises");
5
+ const hashUtils = require("./hash-utils");
6
+ const path = require("path");
7
+ const jwt = require("jsonwebtoken");
8
+ const file_utils_1 = require("./utils/file-utils");
9
+ const CURRENT_CLAIM_VERSION = "1.0.0";
10
+ // TODO(7A): rename to ".aetherrelease" when the Aether SDK ships.
11
+ // Keep ".codepushrelease" for now to maintain compatibility with
12
+ // react-native-code-push apps deploying against Aether servers.
13
+ const METADATA_FILE_NAME = ".codepushrelease";
14
+ async function sign(privateKeyPath, updateContentsPath) {
15
+ if (!privateKeyPath) {
16
+ return Promise.resolve(null);
17
+ }
18
+ let privateKey;
19
+ try {
20
+ privateKey = await fs.readFile(privateKeyPath);
21
+ }
22
+ catch (err) {
23
+ return Promise.reject(new Error(`The path specified for the signing key ("${privateKeyPath}") was not valid.`));
24
+ }
25
+ // If releasing a single file, copy the file to a temporary 'Aether' directory in which to publish the release
26
+ try {
27
+ if (!(0, file_utils_1.isDirectory)(updateContentsPath)) {
28
+ updateContentsPath = (0, file_utils_1.copyFileToTmpDir)(updateContentsPath);
29
+ }
30
+ }
31
+ catch (error) {
32
+ return Promise.reject(error);
33
+ }
34
+ const signatureFilePath = path.join(updateContentsPath, METADATA_FILE_NAME);
35
+ let prevSignatureExists = true;
36
+ try {
37
+ await fs.access(signatureFilePath, fs.constants.F_OK);
38
+ }
39
+ catch (err) {
40
+ if (err.code === "ENOENT") {
41
+ prevSignatureExists = false;
42
+ }
43
+ else {
44
+ return Promise.reject(new Error(`Could not delete previous release signature at ${signatureFilePath}.
45
+ Please, check your access rights.`));
46
+ }
47
+ }
48
+ if (prevSignatureExists) {
49
+ console.log(`Deleting previous release signature at ${signatureFilePath}`);
50
+ await fs.unlink(signatureFilePath);
51
+ }
52
+ const hash = await hashUtils.generatePackageHashFromDirectory(updateContentsPath, path.join(updateContentsPath, ".."));
53
+ const claims = {
54
+ claimVersion: CURRENT_CLAIM_VERSION,
55
+ contentHash: hash,
56
+ };
57
+ return new Promise((resolve, reject) => {
58
+ jwt.sign(claims, privateKey, { algorithm: "RS256" }, async (err, signedJwt) => {
59
+ if (err) {
60
+ reject(new Error("The specified signing key file was not valid"));
61
+ return;
62
+ }
63
+ try {
64
+ await fs.writeFile(signatureFilePath, signedJwt);
65
+ console.log(`Generated a release signature and wrote it to ${signatureFilePath}`);
66
+ resolve();
67
+ }
68
+ catch (error) {
69
+ reject(error);
70
+ }
71
+ });
72
+ });
73
+ }
74
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../script/sign.ts"],"names":[],"mappings":";;AAiBA,uBAkEC;AAnFD,kCAAkC;AAClC,0CAA0C;AAC1C,6BAA6B;AAC7B,oCAAoC;AACpC,mDAAmE;AAEnE,MAAM,qBAAqB,GAAW,OAAO,CAAC;AAC9C,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,MAAM,kBAAkB,GAAW,kBAAkB,CAAC;AAOvC,KAAK,UAAU,IAAI,CAAC,cAAsB,EAAE,kBAA0B;IACnF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,OAAO,CAAO,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,UAAkB,CAAC;IAEvB,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,cAAc,mBAAmB,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,8GAA8G;IAC9G,IAAI,CAAC;QACH,IAAI,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AE,UAAU,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,GAAU,EAAE,SAAiB,EAAE,EAAE;YAC3F,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,CAAC,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC,CAAC;gBAClE,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,CAAC,GAAG,CAAC,iDAAiD,iBAAiB,EAAE,CAAC,CAAC;gBAClF,OAAO,EAAE,CAAC;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // Copyright (c) Aether. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CommandType = void 0;
5
+ var CommandType;
6
+ (function (CommandType) {
7
+ CommandType[CommandType["accessKeyAdd"] = 0] = "accessKeyAdd";
8
+ CommandType[CommandType["accessKeyPatch"] = 1] = "accessKeyPatch";
9
+ CommandType[CommandType["accessKeyList"] = 2] = "accessKeyList";
10
+ CommandType[CommandType["accessKeyRemove"] = 3] = "accessKeyRemove";
11
+ CommandType[CommandType["appAdd"] = 4] = "appAdd";
12
+ CommandType[CommandType["appList"] = 5] = "appList";
13
+ CommandType[CommandType["appRemove"] = 6] = "appRemove";
14
+ CommandType[CommandType["appRename"] = 7] = "appRename";
15
+ CommandType[CommandType["appTransfer"] = 8] = "appTransfer";
16
+ CommandType[CommandType["collaboratorAdd"] = 9] = "collaboratorAdd";
17
+ CommandType[CommandType["collaboratorList"] = 10] = "collaboratorList";
18
+ CommandType[CommandType["collaboratorRemove"] = 11] = "collaboratorRemove";
19
+ CommandType[CommandType["debug"] = 12] = "debug";
20
+ CommandType[CommandType["deploymentAdd"] = 13] = "deploymentAdd";
21
+ CommandType[CommandType["deploymentHistory"] = 14] = "deploymentHistory";
22
+ CommandType[CommandType["deploymentHistoryClear"] = 15] = "deploymentHistoryClear";
23
+ CommandType[CommandType["deploymentList"] = 16] = "deploymentList";
24
+ CommandType[CommandType["deploymentMetrics"] = 17] = "deploymentMetrics";
25
+ CommandType[CommandType["deploymentRemove"] = 18] = "deploymentRemove";
26
+ CommandType[CommandType["deploymentRename"] = 19] = "deploymentRename";
27
+ CommandType[CommandType["login"] = 20] = "login";
28
+ CommandType[CommandType["logout"] = 21] = "logout";
29
+ CommandType[CommandType["patch"] = 22] = "patch";
30
+ CommandType[CommandType["promote"] = 23] = "promote";
31
+ CommandType[CommandType["register"] = 24] = "register";
32
+ CommandType[CommandType["release"] = 25] = "release";
33
+ CommandType[CommandType["releaseReact"] = 26] = "releaseReact";
34
+ CommandType[CommandType["rollback"] = 27] = "rollback";
35
+ CommandType[CommandType["sessionList"] = 28] = "sessionList";
36
+ CommandType[CommandType["sessionRemove"] = 29] = "sessionRemove";
37
+ CommandType[CommandType["whoami"] = 30] = "whoami";
38
+ })(CommandType || (exports.CommandType = CommandType = {}));
39
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../script/types/cli.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAI7C,IAAY,WAgCX;AAhCD,WAAY,WAAW;IACrB,6DAAY,CAAA;IACZ,iEAAc,CAAA;IACd,+DAAa,CAAA;IACb,mEAAe,CAAA;IACf,iDAAM,CAAA;IACN,mDAAO,CAAA;IACP,uDAAS,CAAA;IACT,uDAAS,CAAA;IACT,2DAAW,CAAA;IACX,mEAAe,CAAA;IACf,sEAAgB,CAAA;IAChB,0EAAkB,CAAA;IAClB,gDAAK,CAAA;IACL,gEAAa,CAAA;IACb,wEAAiB,CAAA;IACjB,kFAAsB,CAAA;IACtB,kEAAc,CAAA;IACd,wEAAiB,CAAA;IACjB,sEAAgB,CAAA;IAChB,sEAAgB,CAAA;IAChB,gDAAK,CAAA;IACL,kDAAM,CAAA;IACN,gDAAK,CAAA;IACL,oDAAO,CAAA;IACP,sDAAQ,CAAA;IACR,oDAAO,CAAA;IACP,8DAAY,CAAA;IACZ,sDAAQ,CAAA;IACR,4DAAW,CAAA;IACX,gEAAa,CAAA;IACb,kDAAM,CAAA;AACR,CAAC,EAhCW,WAAW,2BAAX,WAAW,QAgCtB"}
@@ -0,0 +1,18 @@
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
+ __exportStar(require("./rest-definitions"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../script/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=rest-definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-definitions.js","sourceRoot":"","sources":["../../../script/types/rest-definitions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright (c) Aether. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../script/types.ts"],"names":[],"mappings":";AAAA,6CAA6C"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBinaryOrZip = isBinaryOrZip;
4
+ exports.isDirectory = isDirectory;
5
+ exports.fileExists = fileExists;
6
+ exports.copyFileToTmpDir = copyFileToTmpDir;
7
+ exports.fileDoesNotExistOrIsDirectory = fileDoesNotExistOrIsDirectory;
8
+ exports.normalizePath = normalizePath;
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+ const rimraf = require("rimraf");
12
+ const temp = require("temp");
13
+ function isBinaryOrZip(path) {
14
+ return path.search(/\.zip$/i) !== -1 || path.search(/\.apk$/i) !== -1 || path.search(/\.ipa$/i) !== -1;
15
+ }
16
+ function isDirectory(path) {
17
+ return fs.statSync(path).isDirectory();
18
+ }
19
+ function fileExists(file) {
20
+ try {
21
+ return fs.statSync(file).isFile();
22
+ }
23
+ catch (_e) {
24
+ return false;
25
+ }
26
+ }
27
+ ;
28
+ function copyFileToTmpDir(filePath) {
29
+ if (!isDirectory(filePath)) {
30
+ const outputFolderPath = temp.mkdirSync("aether");
31
+ rimraf.sync(outputFolderPath);
32
+ fs.mkdirSync(outputFolderPath);
33
+ const outputFilePath = path.join(outputFolderPath, path.basename(filePath));
34
+ fs.writeFileSync(outputFilePath, fs.readFileSync(filePath));
35
+ return outputFolderPath;
36
+ }
37
+ }
38
+ function fileDoesNotExistOrIsDirectory(path) {
39
+ try {
40
+ return isDirectory(path);
41
+ }
42
+ catch (_error) {
43
+ return true;
44
+ }
45
+ }
46
+ function normalizePath(filePath) {
47
+ //replace all backslashes coming from cli running on windows machines by slashes
48
+ return filePath.replace(/\\/g, "/");
49
+ }
50
+ //# sourceMappingURL=file-utils.js.map
@@ -0,0 +1 @@
1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,CAAC,CAAC,CAAC;QAE5D,OAAO,gBAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAgB,6BAA6B,CAAC,IAAY;IACxD,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,QAAgB;IAC5C,gFAAgF;IAChF,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@aetherpush/cli",
3
+ "version": "0.1.0",
4
+ "description": "Command-line interface for Aether — over-the-air updates for React Native apps.",
5
+ "main": "./bin/script/index.js",
6
+ "types": "./bin/script/index.d.ts",
7
+ "scripts": {
8
+ "start": "node ./bin/script/cli.js",
9
+ "build": "tsc",
10
+ "clean": "rimraf bin",
11
+ "typecheck": "tsc --noEmit",
12
+ "prettier": "prettier --write \"./**/*.ts\"",
13
+ "lint": "npx eslint ./script/**/*.ts",
14
+ "lint:fix": "npx eslint ./script/**/*.ts --fix",
15
+ "test": "jest"
16
+ },
17
+ "bin": {
18
+ "aether": "bin/script/cli.js"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Monoradioactivo/aether-cli.git"
23
+ },
24
+ "author": "Aether",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/Monoradioactivo/aether-cli/issues"
28
+ },
29
+ "homepage": "https://github.com/Monoradioactivo/aether-cli#readme",
30
+ "keywords": [
31
+ "aether",
32
+ "aetherpush",
33
+ "react-native",
34
+ "ota",
35
+ "codepush",
36
+ "cli",
37
+ "deployment",
38
+ "updates"
39
+ ],
40
+ "engines": {
41
+ "node": ">=22"
42
+ },
43
+ "files": [
44
+ "bin/",
45
+ "README.md",
46
+ "LICENSE"
47
+ ],
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "registry": "https://registry.npmjs.org/"
51
+ },
52
+ "dependencies": {
53
+ "backslash": "^0.2.0",
54
+ "chalk": "^4.1.2",
55
+ "cli-table": "^0.3.11",
56
+ "email-validator": "^2.0.4",
57
+ "gradle-to-js": "2.0.1",
58
+ "jsonwebtoken": "^9.0.2",
59
+ "moment": "^2.29.4",
60
+ "parse-duration": "^2.1.6",
61
+ "plist": "^3.1.1",
62
+ "progress": "^2.0.3",
63
+ "prompt": "^1.3.0",
64
+ "properties": "^1.2.1",
65
+ "rimraf": "^2.5.1",
66
+ "semver": "^7.5.3",
67
+ "simctl": "^3.0.0",
68
+ "temp": "^0.9.4",
69
+ "which": "^5.0.0",
70
+ "wordwrap": "1.0.0",
71
+ "xcode": "^0.9.1",
72
+ "xml2js": "^0.6.0",
73
+ "yargs": "^17.7.2",
74
+ "yazl": "^2.5.1"
75
+ },
76
+ "overrides": {
77
+ "lodash": "^4.17.21",
78
+ "xmldom": "npm:@xmldom/xmldom@^0.8.10"
79
+ },
80
+ "devDependencies": {
81
+ "@types/jest": "^30.0.0",
82
+ "@types/node": "^25.9.0",
83
+ "@typescript-eslint/eslint-plugin": "^8.59.4",
84
+ "@typescript-eslint/parser": "^8.59.4",
85
+ "eslint": "^8.45.0",
86
+ "jest": "^30.4.2",
87
+ "prettier": "^2.8.8",
88
+ "ts-jest": "^29.4.10",
89
+ "typescript": "^5.1.3",
90
+ "yauzl": "^3.3.0"
91
+ }
92
+ }