@react-native-oh/react-native-harmony-cli 0.0.40 → 0.0.41
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/README.md +11 -11
- package/dist/assetResolver.js +43 -74
- package/dist/autolinking/Autolinking.js +178 -179
- package/dist/codegen/core/CodegenError.js +3 -23
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
- package/dist/codegen/core/UberSchema.js +57 -96
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
- package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
- package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -23
- package/dist/codegen/generators/UberGeneratorV2.js +34 -35
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
- package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +53 -8
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
- package/dist/codegen/templates/IndexTSTemplate.js +37 -17
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
- package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
- package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
- package/dist/commands/bundle-harmony.js +53 -138
- package/dist/commands/codegen-harmony.js +105 -165
- package/dist/commands/codegen-lib-harmony.js +76 -116
- package/dist/commands/create-metro-host-constants.js +18 -47
- package/dist/commands/init.js +537 -961
- package/dist/commands/link-harmony.js +33 -71
- package/dist/commands/pack-harmony.js +47 -108
- package/dist/commands/run-harmony.js +372 -518
- package/dist/commands/unpack-harmony.js +105 -198
- package/dist/commands/verify-package-harmony.js +54 -108
- package/dist/core/AbsolutePath.js +31 -47
- package/dist/core/CodegenConfig.js +24 -22
- package/dist/core/DescriptiveError.js +18 -37
- package/dist/core/FileSystem.js +14 -18
- package/dist/core/OHPackageJSON5.js +17 -23
- package/dist/core/PackageJSON.js +26 -42
- package/dist/core/ProjectDependenciesManager.js +40 -92
- package/dist/core/ValidationError.js +2 -22
- package/dist/core/fs.js +9 -6
- package/dist/index.js +1 -1
- package/dist/io/CliExecutor.js +46 -98
- package/dist/io/Logger.js +40 -46
- package/dist/io/RealFS.js +35 -88
- package/dist/io/TarGz.js +11 -8
- package/dist/io/__fixtures__.js +79 -141
- package/dist/io/fsUtils.js +13 -12
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
- package/dist/package-verifier/verify-package.js +55 -132
- package/dist/simulator/LaunchSimulator.js +224 -301
- package/harmony/rnoh-hvigor-plugin-0.3.0.tgz +0 -0
- package/jest.config.js +12 -12
- package/package.json +78 -78
- package/react-native.config.js +17 -17
- package/tsconfig.build.json +6 -6
- package/tsconfig.json +2 -2
package/dist/io/__fixtures__.js
CHANGED
|
@@ -5,21 +5,6 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
var __extends = (this && this.__extends) || (function () {
|
|
9
|
-
var extendStatics = function (d, b) {
|
|
10
|
-
extendStatics = Object.setPrototypeOf ||
|
|
11
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
12
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
13
|
-
return extendStatics(d, b);
|
|
14
|
-
};
|
|
15
|
-
return function (d, b) {
|
|
16
|
-
if (typeof b !== "function" && b !== null)
|
|
17
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18
|
-
extendStatics(d, b);
|
|
19
|
-
function __() { this.constructor = d; }
|
|
20
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
|
-
};
|
|
22
|
-
})();
|
|
23
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -29,167 +14,120 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
29
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
15
|
});
|
|
31
16
|
};
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
-
function step(op) {
|
|
37
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
39
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
40
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
-
switch (op[0]) {
|
|
42
|
-
case 0: case 1: t = op; break;
|
|
43
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
-
default:
|
|
47
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
-
if (t[2]) _.ops.pop();
|
|
52
|
-
_.trys.pop(); continue;
|
|
53
|
-
}
|
|
54
|
-
op = body.call(thisArg, _);
|
|
55
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
-
}
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
19
|
};
|
|
59
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
21
|
exports.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
FakeCliExecutor.prototype.run = function (command, options) {
|
|
76
|
-
var commandWithArgs = command;
|
|
22
|
+
const core_1 = require("../core");
|
|
23
|
+
const CliExecutor_1 = require("./CliExecutor");
|
|
24
|
+
const memfs_1 = require("memfs");
|
|
25
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
26
|
+
const Logger_1 = require("./Logger");
|
|
27
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
28
|
+
class FakeCliExecutor extends CliExecutor_1.CliExecutor {
|
|
29
|
+
constructor(onRun) {
|
|
30
|
+
super();
|
|
31
|
+
this.onRun = onRun;
|
|
32
|
+
this.commands = [];
|
|
33
|
+
}
|
|
34
|
+
run(command, options) {
|
|
35
|
+
let commandWithArgs = command;
|
|
77
36
|
if (options.args) {
|
|
78
37
|
commandWithArgs += options.args.join(' ');
|
|
79
38
|
}
|
|
80
39
|
this.commands.push(commandWithArgs);
|
|
81
40
|
return this.onRun(commandWithArgs);
|
|
82
|
-
}
|
|
83
|
-
|
|
41
|
+
}
|
|
42
|
+
getCommands() {
|
|
84
43
|
return this.commands;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}(CliExecutor_1.CliExecutor));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
88
46
|
exports.FakeCliExecutor = FakeCliExecutor;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
MemFSDirent.prototype.isDirectory = function () {
|
|
47
|
+
class MemFSDirent extends core_1.Dirent {
|
|
48
|
+
constructor(rawDirent) {
|
|
49
|
+
super();
|
|
50
|
+
this.rawDirent = rawDirent;
|
|
51
|
+
}
|
|
52
|
+
isDirectory() {
|
|
97
53
|
return this.rawDirent.isDirectory();
|
|
98
|
-
}
|
|
99
|
-
|
|
54
|
+
}
|
|
55
|
+
isSymbolicLink() {
|
|
100
56
|
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
return MemFSDirent;
|
|
117
|
-
}(core_1.Dirent));
|
|
118
|
-
var MemFS = /** @class */ (function (_super) {
|
|
119
|
-
__extends(MemFS, _super);
|
|
120
|
-
function MemFS(initialFileStructure) {
|
|
121
|
-
var _this = _super.call(this) || this;
|
|
122
|
-
_this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
123
|
-
return _this;
|
|
124
|
-
}
|
|
125
|
-
MemFS.prototype.existsSync = function (path) {
|
|
57
|
+
}
|
|
58
|
+
get name() {
|
|
59
|
+
return this.rawDirent.name.toString();
|
|
60
|
+
}
|
|
61
|
+
get path() {
|
|
62
|
+
return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class MemFS extends core_1.FS {
|
|
66
|
+
constructor(initialFileStructure) {
|
|
67
|
+
super();
|
|
68
|
+
this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
69
|
+
}
|
|
70
|
+
existsSync(path) {
|
|
126
71
|
return this.fs.existsSync(path.toString());
|
|
127
|
-
}
|
|
128
|
-
|
|
72
|
+
}
|
|
73
|
+
readTextSync(path) {
|
|
129
74
|
return this.fs.readFileSync(path.toString()).toString();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
143
|
-
});
|
|
144
|
-
})];
|
|
75
|
+
}
|
|
76
|
+
readText(path) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
this.fs.readFile(path.toString(), {}, (err, data) => {
|
|
80
|
+
var _a;
|
|
81
|
+
if (err) {
|
|
82
|
+
reject(err);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
86
|
+
});
|
|
145
87
|
});
|
|
146
88
|
});
|
|
147
|
-
}
|
|
148
|
-
|
|
89
|
+
}
|
|
90
|
+
writeTextSync(path, data) {
|
|
149
91
|
return this.fs.writeFileSync(path.toString(), data);
|
|
150
|
-
}
|
|
151
|
-
|
|
92
|
+
}
|
|
93
|
+
readDirentsSync(path, options) {
|
|
152
94
|
return this.fs
|
|
153
95
|
.readdirSync(path.toString(), {
|
|
154
96
|
withFileTypes: true,
|
|
155
97
|
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
156
98
|
})
|
|
157
|
-
.flatMap(
|
|
99
|
+
.flatMap((dataOutOrDirent) => {
|
|
158
100
|
if (!(dataOutOrDirent instanceof Dirent_1.default)) {
|
|
159
101
|
return [];
|
|
160
102
|
}
|
|
161
103
|
return [new MemFSDirent(dataOutOrDirent)];
|
|
162
104
|
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
}(core_1.FS));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
166
107
|
exports.MemFS = MemFS;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
MockedLogger.prototype.debug = function (prepareMsg) {
|
|
108
|
+
class MockedLogger extends Logger_1.Logger {
|
|
109
|
+
constructor() {
|
|
110
|
+
super(...arguments);
|
|
111
|
+
this.logs = [];
|
|
112
|
+
}
|
|
113
|
+
debug(prepareMsg) {
|
|
175
114
|
chalk_1.default.level = 0;
|
|
176
115
|
this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
|
|
177
|
-
}
|
|
178
|
-
|
|
116
|
+
}
|
|
117
|
+
info(prepareMsg, options) {
|
|
179
118
|
chalk_1.default.level = 0;
|
|
180
119
|
this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
|
|
181
|
-
}
|
|
182
|
-
|
|
120
|
+
}
|
|
121
|
+
warn(prepareMsg) {
|
|
183
122
|
chalk_1.default.level = 0;
|
|
184
123
|
this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
|
|
185
|
-
}
|
|
186
|
-
|
|
124
|
+
}
|
|
125
|
+
descriptiveError(error) {
|
|
187
126
|
chalk_1.default.level = 0;
|
|
188
127
|
this.logs.push({ type: 'error', msg: error.getMessage() });
|
|
189
|
-
}
|
|
190
|
-
|
|
128
|
+
}
|
|
129
|
+
getLogs() {
|
|
191
130
|
return this.logs;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}(Logger_1.Logger));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
195
133
|
exports.MockedLogger = MockedLogger;
|
package/dist/io/fsUtils.js
CHANGED
|
@@ -5,25 +5,26 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.findFilePathsWithExtensions = findFilePathsWithExtensions;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function findFilePathsWithExtensions(dirPath, fileExtensions, options) {
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
15
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
16
|
+
const node_fs_2 = require("node:fs");
|
|
17
|
+
function findFilePathsWithExtensions(dirPath, fileExtensions, options = {}) {
|
|
15
18
|
var _a;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
21
|
-
var file = files_1[_i];
|
|
19
|
+
const fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
|
|
20
|
+
let results = [];
|
|
21
|
+
const files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
|
|
22
|
+
for (const file of files) {
|
|
22
23
|
if (!(file instanceof node_fs_2.Dirent) &&
|
|
23
24
|
!(file instanceof Dirent_1.default)) {
|
|
24
25
|
continue;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
const path = dirPath.copyWithNewSegment(file.name.toString());
|
|
27
28
|
if (fs.lstatSync(path.toString()).isDirectory()) {
|
|
28
29
|
results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
|
|
29
30
|
}
|
|
@@ -14,58 +14,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
19
|
};
|
|
44
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
21
|
exports.createHarmonyDirContainsOnlyHarsCheck = createHarmonyDirContainsOnlyHarsCheck;
|
|
46
|
-
|
|
22
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
47
23
|
function createHarmonyDirContainsOnlyHarsCheck(npmPackagePath, hasNpmPackageNativeCode) {
|
|
48
|
-
var _this = this;
|
|
49
24
|
return {
|
|
50
25
|
checkIf: 'harmony_directory_contains_only_one_har_file',
|
|
51
|
-
run:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return [2 /*return*/, 'pass'];
|
|
68
|
-
});
|
|
69
|
-
}); },
|
|
26
|
+
run: () => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (!hasNpmPackageNativeCode) {
|
|
28
|
+
return 'skip';
|
|
29
|
+
}
|
|
30
|
+
const harmonyPath = npmPackagePath
|
|
31
|
+
.copyWithNewSegment('harmony')
|
|
32
|
+
.getValue();
|
|
33
|
+
const fileOrDirNames = node_fs_1.default.readdirSync(harmonyPath);
|
|
34
|
+
if (fileOrDirNames.length !== 1) {
|
|
35
|
+
return { status: 'fail', message: JSON.stringify(fileOrDirNames) };
|
|
36
|
+
}
|
|
37
|
+
if (!fileOrDirNames[0].endsWith('.har')) {
|
|
38
|
+
return 'fail';
|
|
39
|
+
}
|
|
40
|
+
return 'pass';
|
|
41
|
+
}),
|
|
70
42
|
};
|
|
71
43
|
}
|
|
@@ -14,52 +14,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
19
|
};
|
|
44
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
21
|
exports.createHarmonyDirExistsCheck = createHarmonyDirExistsCheck;
|
|
46
|
-
|
|
22
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
47
23
|
function createHarmonyDirExistsCheck(packagePath, hasNativeCode) {
|
|
48
|
-
var _this = this;
|
|
49
24
|
return {
|
|
50
25
|
checkIf: 'package_has_harmony_dir',
|
|
51
|
-
run:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return [2 /*return*/, 'pass'];
|
|
62
|
-
});
|
|
63
|
-
}); },
|
|
26
|
+
run: () => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const harmonyDirExist = node_fs_1.default.existsSync(packagePath.copyWithNewSegment('harmony').getValue());
|
|
28
|
+
if (!hasNativeCode) {
|
|
29
|
+
return 'skip';
|
|
30
|
+
}
|
|
31
|
+
if (!harmonyDirExist) {
|
|
32
|
+
return 'fail';
|
|
33
|
+
}
|
|
34
|
+
return 'pass';
|
|
35
|
+
}),
|
|
64
36
|
};
|
|
65
37
|
}
|
|
@@ -14,48 +14,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
19
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
18
|
exports.createNpmAndOhPackageVersionsAreEqualCheck = createNpmAndOhPackageVersionsAreEqualCheck;
|
|
46
19
|
function createNpmAndOhPackageVersionsAreEqualCheck(npmPackageVersion, ohPackageVersion) {
|
|
47
|
-
var _this = this;
|
|
48
20
|
return {
|
|
49
21
|
checkIf: 'npm_and_oh_package_versions_are_equal',
|
|
50
|
-
run:
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
}); },
|
|
22
|
+
run: () => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return npmPackageVersion === ohPackageVersion
|
|
24
|
+
? 'pass'
|
|
25
|
+
: {
|
|
26
|
+
status: 'fail',
|
|
27
|
+
message: `expected OH package version (${ohPackageVersion}) to match NPM version (${npmPackageVersion})`,
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
60
30
|
};
|
|
61
31
|
}
|
|
@@ -14,69 +14,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
19
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
18
|
exports.createOhPackageNameFollowsNamingConventionCheck = createOhPackageNameFollowsNamingConventionCheck;
|
|
46
19
|
function createOhPackageNameFollowsNamingConventionCheck(npmPackageName, ohPackageName) {
|
|
47
|
-
|
|
48
|
-
var npmPackageNameInfo = getPackageNameInfo(npmPackageName);
|
|
20
|
+
const npmPackageNameInfo = getPackageNameInfo(npmPackageName);
|
|
49
21
|
return {
|
|
50
22
|
checkIf: 'oh_package_name_is_derived_from_npm_package_name',
|
|
51
|
-
run:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
});
|
|
74
|
-
}); },
|
|
23
|
+
run: () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (npmPackageNameInfo.organizationName) {
|
|
25
|
+
const expectedOHPackageName = `@rnoh/${npmPackageNameInfo.organizationName}--${npmPackageNameInfo.unscopedName}`;
|
|
26
|
+
return expectedOHPackageName === ohPackageName
|
|
27
|
+
? 'pass'
|
|
28
|
+
: {
|
|
29
|
+
status: 'fail',
|
|
30
|
+
message: `expected '${expectedOHPackageName}', got: ${ohPackageName}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const expectedOHPackageName = `@rnoh/${npmPackageNameInfo.unscopedName}`;
|
|
35
|
+
return expectedOHPackageName === ohPackageName
|
|
36
|
+
? 'pass'
|
|
37
|
+
: {
|
|
38
|
+
status: 'fail',
|
|
39
|
+
message: `expected '${expectedOHPackageName}', got: ${ohPackageName}`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
75
43
|
};
|
|
76
44
|
}
|
|
77
45
|
function getPackageNameInfo(packageName) {
|
|
78
46
|
if (packageName.startsWith('@') && packageName.includes('/')) {
|
|
79
|
-
|
|
47
|
+
const [part1, part2] = packageName.split('/');
|
|
80
48
|
return {
|
|
81
49
|
organizationName: part1.replace('@', ''),
|
|
82
50
|
unscopedName: part2,
|