@react-native-oh/react-native-harmony-cli 0.0.24 → 0.0.26
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/.prettierrc +6 -6
- package/jest.config.js +5 -5
- package/package.json +57 -52
- package/react-native.config.js +10 -10
- package/src/assetResolver.ts +21 -44
- package/src/codegen/core/CodeGenerator.ts +9 -0
- package/src/codegen/core/CodegenError.ts +3 -3
- package/src/codegen/core/EventUtils.ts +18 -18
- package/src/codegen/core/TypeAnnotationToTS.test.ts +75 -75
- package/src/codegen/core/TypeAnnotationToTS.ts +188 -188
- package/src/codegen/core/UberSchema.ts +142 -99
- package/src/codegen/core/index.ts +5 -5
- package/src/codegen/generators/{ComponentCodeGenerator.ts → ComponentCodeGeneratorArkTS.ts} +112 -98
- package/src/codegen/generators/ComponentCodeGeneratorCAPI.ts +114 -0
- package/src/codegen/generators/GlueCodeGenerator.ts +109 -0
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +115 -95
- package/src/codegen/generators/UberGeneratorV1.ts +64 -0
- package/src/codegen/generators/UberGeneratorV2.ts +91 -0
- package/src/codegen/generators/index.ts +6 -3
- package/src/codegen/index.ts +2 -2
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +116 -0
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +55 -49
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +93 -85
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +210 -202
- package/src/codegen/templates/GeneratedPackageHTemplate.ts +107 -0
- package/src/codegen/templates/IndexTSTemplate.ts +53 -33
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +130 -124
- package/src/codegen/templates/TurboModuleCppTemplate.ts +54 -47
- package/src/codegen/templates/TurboModuleHTemplate.ts +35 -26
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +90 -81
- package/src/codegen/templates/index.ts +9 -8
- package/src/commands/bundle-harmony.ts +203 -202
- package/src/commands/codegen-harmony.ts +272 -143
- package/src/commands/create-metro-host-constants.ts +48 -48
- package/src/commands/index.ts +6 -5
- package/src/commands/pack-harmony.ts +121 -121
- package/src/commands/unpack-harmony.ts +231 -231
- package/src/commands/verify-package-harmony.ts +106 -0
- package/src/core/AbsolutePath.ts +50 -43
- package/src/core/CodegenConfig.ts +62 -54
- package/src/core/DescriptiveError.ts +61 -61
- package/src/core/OHPackageJSON5.ts +23 -0
- package/src/core/PackageJSON.ts +75 -63
- package/src/core/ProjectDependenciesManager.ts +77 -77
- package/src/core/ValidationError.ts +1 -1
- package/src/core/ValueObject.ts +2 -2
- package/src/core/fs.ts +31 -31
- package/src/core/index.ts +9 -8
- package/src/index.ts +20 -18
- package/src/io/Logger.ts +68 -68
- package/src/io/TarGz.ts +26 -0
- package/src/io/fsUtils.ts +24 -24
- package/src/io/index.ts +3 -2
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +28 -0
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +24 -0
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +18 -0
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +47 -0
- package/src/package-verifier/checks/index.ts +4 -0
- package/src/package-verifier/index.ts +2 -0
- package/src/package-verifier/types.ts +12 -0
- package/src/package-verifier/verify-package.ts +117 -0
- package/tsconfig.build.json +6 -6
- package/tsconfig.json +2 -2
- package/dist/assetResolver.js +0 -41
- package/dist/codegen/core/Codegen.js +0 -35
- package/dist/codegen/core/CodegenError.js +0 -7
- package/dist/codegen/core/EventUtils.js +0 -19
- package/dist/codegen/core/TypeAnnotationToTS.js +0 -132
- package/dist/codegen/core/UberSchema.js +0 -74
- package/dist/codegen/core/index.js +0 -21
- package/dist/codegen/generators/ComponentCodeGenerator.js +0 -66
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +0 -64
- package/dist/codegen/generators/PackageCodeGenerator.js +0 -52
- package/dist/codegen/generators/index.js +0 -19
- package/dist/codegen/index.js +0 -18
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +0 -55
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +0 -78
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +0 -181
- package/dist/codegen/templates/IndexTSTemplate.js +0 -31
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +0 -117
- package/dist/codegen/templates/TurboModuleCppTemplate.js +0 -45
- package/dist/codegen/templates/TurboModuleHTemplate.js +0 -32
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +0 -64
- package/dist/codegen/templates/index.js +0 -24
- package/dist/commands/bundle-harmony.js +0 -179
- package/dist/commands/codegen-harmony.js +0 -110
- package/dist/commands/create-metro-host-constants.js +0 -61
- package/dist/commands/index.js +0 -21
- package/dist/commands/pack-harmony.js +0 -100
- package/dist/commands/unpack-harmony.js +0 -184
- package/dist/core/AbsolutePath.js +0 -41
- package/dist/core/CodegenConfig.js +0 -53
- package/dist/core/DescriptiveError.js +0 -49
- package/dist/core/PackageJSON.js +0 -53
- package/dist/core/ProjectDependenciesManager.js +0 -70
- package/dist/core/ValidationError.js +0 -6
- package/dist/core/ValueObject.js +0 -2
- package/dist/core/fs.js +0 -36
- package/dist/core/index.js +0 -24
- package/dist/index.js +0 -13
- package/dist/io/Logger.js +0 -71
- package/dist/io/fsUtils.js +0 -23
- package/dist/io/index.js +0 -18
- package/src/codegen/core/Codegen.ts +0 -44
- package/src/codegen/generators/PackageCodeGenerator.ts +0 -73
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.commandCodegenHarmony = void 0;
|
|
16
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
17
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
-
const core_1 = require("../core");
|
|
19
|
-
const codegen_1 = require("../codegen");
|
|
20
|
-
const io_1 = require("../io");
|
|
21
|
-
exports.commandCodegenHarmony = {
|
|
22
|
-
name: 'codegen-harmony',
|
|
23
|
-
description: 'Generates a glue layer and native utilities from Turbo Module or Fabric Components specifications',
|
|
24
|
-
options: [
|
|
25
|
-
{
|
|
26
|
-
name: '--rnoh-module-path <path>',
|
|
27
|
-
description: 'Specifies the relative path to the rnoh OHOS module',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: '--cpp-output-path <path>',
|
|
31
|
-
description: 'Specifies the relative path to the output directory intended for storing generated C++ files',
|
|
32
|
-
default: './harmony/entry/src/main/cpp/generated',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: '--project-root-path <path>',
|
|
36
|
-
description: 'Relative path to package root',
|
|
37
|
-
default: '.',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: '--debug [boolean]',
|
|
41
|
-
description: 'Enables logging details',
|
|
42
|
-
default: false,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
func: (_argv, _config, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const logger = new io_1.Logger();
|
|
47
|
-
try {
|
|
48
|
-
validateArgs(args);
|
|
49
|
-
const etsOutputPath = new core_1.AbsolutePath(args.rnohModulePath).copyWithNewSegment('generated');
|
|
50
|
-
const cppOutputPath = new core_1.AbsolutePath(args.cppOutputPath);
|
|
51
|
-
const projectRootPath = new core_1.AbsolutePath(args.projectRootPath);
|
|
52
|
-
const codegen = createCodegen(cppOutputPath, etsOutputPath);
|
|
53
|
-
const uberSchema = yield codegen_1.UberSchema.fromProjectRootPath(new core_1.AbsolutePath(args.projectRootPath));
|
|
54
|
-
const fileContentByPath = codegen.generate(uberSchema);
|
|
55
|
-
if (args.debug) {
|
|
56
|
-
logger.debug((styles) => styles.gray(JSON.stringify(uberSchema.getValue(), null, 2)));
|
|
57
|
-
}
|
|
58
|
-
saveCodegenResult(fileContentByPath, cppOutputPath, etsOutputPath);
|
|
59
|
-
logCodegenResult(logger, fileContentByPath, projectRootPath);
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
if (err instanceof core_1.DescriptiveError) {
|
|
63
|
-
logger.descriptiveError(err);
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
};
|
|
70
|
-
function validateArgs(args) {
|
|
71
|
-
if (!args.rnohModulePath) {
|
|
72
|
-
throw new core_1.DescriptiveError({
|
|
73
|
-
whatHappened: "--rnoh-module-path argument wasn't provided",
|
|
74
|
-
whatCanUserDo: {
|
|
75
|
-
default: [
|
|
76
|
-
'Please provide a path to the native React Native for Open Harmony module (rnoh) which is probably located somewhere in "<PROJECT_ROOT>/harmony" directory',
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function createCodegen(cppOutputPath, etsOutputPath) {
|
|
83
|
-
return new codegen_1.Codegen(new codegen_1.PackageCodeGenerator(cppOutputPath, etsOutputPath), {
|
|
84
|
-
Component: new codegen_1.ComponentCodeGenerator(cppOutputPath, etsOutputPath.copyWithNewSegment('components')),
|
|
85
|
-
NativeModule: new codegen_1.NativeModuleCodeGenerator(cppOutputPath, etsOutputPath.copyWithNewSegment('turboModules')),
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function saveCodegenResult(fileContentByPath, cppOutputPath, etsOutputPath) {
|
|
89
|
-
prepareDirectory(cppOutputPath);
|
|
90
|
-
prepareDirectory(etsOutputPath);
|
|
91
|
-
prepareDirectory(etsOutputPath.copyWithNewSegment('components'));
|
|
92
|
-
prepareDirectory(etsOutputPath.copyWithNewSegment('turboModules'));
|
|
93
|
-
fileContentByPath.forEach((fileContent, path) => {
|
|
94
|
-
node_fs_1.default.writeFileSync(path.getValue(), fileContent);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function prepareDirectory(path) {
|
|
98
|
-
(0, core_1.maybeMakeDirectories)(path);
|
|
99
|
-
(0, core_1.maybeRemoveFilesInDirectory)(path);
|
|
100
|
-
}
|
|
101
|
-
function logCodegenResult(logger, fileContentByPath, projectRootPath) {
|
|
102
|
-
const sortedRelativePathStrings = Array.from(fileContentByPath.keys()).map((path) => node_path_1.default.relative(projectRootPath.getValue(), path.getValue()));
|
|
103
|
-
sortedRelativePathStrings.sort();
|
|
104
|
-
sortedRelativePathStrings.forEach((pathStr) => {
|
|
105
|
-
logger.info((styles) => styles.gray(`• ${pathStr}`));
|
|
106
|
-
});
|
|
107
|
-
logger.info(() => '');
|
|
108
|
-
logger.info((styles) => `Generated ${styles.green(styles.bold(fileContentByPath.size))} file(s)`, { prefix: true });
|
|
109
|
-
logger.info(() => '');
|
|
110
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.commandCreateMetroConstantsHarmony = void 0;
|
|
16
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
17
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
18
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
19
|
-
exports.commandCreateMetroConstantsHarmony = {
|
|
20
|
-
name: 'create-metro-host-constants-harmony',
|
|
21
|
-
description: 'Creates a Typescript file that exports constant with IP of the host machine. That IP is later used to connect to the Metro server from a physical device.',
|
|
22
|
-
options: [
|
|
23
|
-
{
|
|
24
|
-
name: '--output <string>',
|
|
25
|
-
description: 'Output file',
|
|
26
|
-
default: './harmony/entry/src/main/ets/codegen/MetroHostConstants.ts',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
func: (argv, config, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
createMetroHostConstants(node_path_1.default.resolve(args.output));
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
function createMetroHostConstants(outputPath) {
|
|
34
|
-
const networkInterfacesByName = node_os_1.default.networkInterfaces();
|
|
35
|
-
const getIP = () => {
|
|
36
|
-
var _a;
|
|
37
|
-
for (let name of Object.keys(networkInterfacesByName)) {
|
|
38
|
-
for (let net of (_a = networkInterfacesByName[name]) !== null && _a !== void 0 ? _a : []) {
|
|
39
|
-
// skip over non-ipv4 and internal (i.e. 127.0.0.1) addresses
|
|
40
|
-
if (net.family === 'IPv4' && !net.internal) {
|
|
41
|
-
return net.address;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return;
|
|
46
|
-
};
|
|
47
|
-
const ip = getIP();
|
|
48
|
-
const tsCode = [
|
|
49
|
-
'// This file is autogenerated. Do not modify it manually.',
|
|
50
|
-
'',
|
|
51
|
-
`export const METRO_SERVER_IP = '${ip}';\n`,
|
|
52
|
-
];
|
|
53
|
-
node_fs_1.default.writeFile(outputPath, tsCode.join('\n'), (err) => {
|
|
54
|
-
if (err) {
|
|
55
|
-
console.error(`Error writing to ${outputPath}:`, err);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
console.log(`Created file at ${outputPath}`);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
package/dist/commands/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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("./bundle-harmony"), exports);
|
|
18
|
-
__exportStar(require("./pack-harmony"), exports);
|
|
19
|
-
__exportStar(require("./unpack-harmony"), exports);
|
|
20
|
-
__exportStar(require("./create-metro-host-constants"), exports);
|
|
21
|
-
__exportStar(require("./codegen-harmony"), exports);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.commandPackHarmony = void 0;
|
|
16
|
-
const glob_1 = require("glob");
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const tar_1 = __importDefault(require("tar"));
|
|
19
|
-
const fs_1 = __importDefault(require("fs"));
|
|
20
|
-
const core_1 = require("../core");
|
|
21
|
-
const ignore_1 = __importDefault(require("ignore"));
|
|
22
|
-
const json5_1 = __importDefault(require("json5"));
|
|
23
|
-
exports.commandPackHarmony = {
|
|
24
|
-
name: 'pack-harmony',
|
|
25
|
-
description: 'Pack native code. Used for package development.',
|
|
26
|
-
options: [
|
|
27
|
-
{
|
|
28
|
-
name: '--oh-module-path <string>',
|
|
29
|
-
description: 'Path to the OH module',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: '--harmony-dir-path <string>',
|
|
33
|
-
description: 'Path to the harmony dir',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: '--package-json-path <string>',
|
|
37
|
-
description: 'Path to the package.json',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
func: (argv, config, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
try {
|
|
42
|
-
yield pack(path_1.default.resolve(args.harmonyDirPath), path_1.default.resolve(args.ohModulePath), path_1.default.resolve(args.packageJsonPath));
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
if (err instanceof core_1.ValidationError) {
|
|
46
|
-
console.error('[ERROR]', err.message);
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
throw err;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
};
|
|
55
|
-
function pack(harmonyDirPath, ohModuleDirPath, packageJSONPath) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
syncVersions(packageJSONPath, path_1.default.join(ohModuleDirPath, 'oh-package.json5'));
|
|
58
|
-
if (!fs_1.default.existsSync(harmonyDirPath)) {
|
|
59
|
-
fs_1.default.mkdirSync(harmonyDirPath, { recursive: true });
|
|
60
|
-
}
|
|
61
|
-
yield createTGZFromDir(ohModuleDirPath, path_1.default.join(harmonyDirPath, `${path_1.default.parse(ohModuleDirPath).name}.tar.gz`));
|
|
62
|
-
yield createTGZFromDir(harmonyDirPath, path_1.default.join(path_1.default.dirname(harmonyDirPath), 'harmony.tar.gz'));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function syncVersions(packageJSONFilePath, ohPackageJSONFilePath) {
|
|
66
|
-
const packageJSONFileContent = JSON.parse(fs_1.default.readFileSync(packageJSONFilePath, { encoding: 'utf-8' }));
|
|
67
|
-
if (fs_1.default.existsSync(ohPackageJSONFilePath)) {
|
|
68
|
-
const ohPackageJSONFileContent = json5_1.default.parse(fs_1.default.readFileSync(ohPackageJSONFilePath, { encoding: 'utf-8' }));
|
|
69
|
-
ohPackageJSONFileContent['version'] = packageJSONFileContent['version'];
|
|
70
|
-
fs_1.default.writeFileSync(ohPackageJSONFilePath, json5_1.default.stringify(ohPackageJSONFileContent, null, 2));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function createTGZFromDir(dirPath, outputFilePath) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const ig = getIgnoreUtil(path_1.default.join(dirPath, '.tarignore'));
|
|
76
|
-
const filesToInclude = (0, glob_1.globSync)('**', {
|
|
77
|
-
cwd: dirPath,
|
|
78
|
-
nodir: true,
|
|
79
|
-
}).filter((path) => !ig.ignores(path));
|
|
80
|
-
yield createArchive(outputFilePath, dirPath, filesToInclude);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function getIgnoreUtil(tarignorePath) {
|
|
84
|
-
if (!fs_1.default.existsSync(tarignorePath)) {
|
|
85
|
-
return (0, ignore_1.default)();
|
|
86
|
-
}
|
|
87
|
-
return (0, ignore_1.default)().add(fs_1.default.readFileSync(tarignorePath).toString());
|
|
88
|
-
}
|
|
89
|
-
function createArchive(outputFilePath, packageDirPath, filesToInclude) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
if (filesToInclude.length === 0) {
|
|
92
|
-
throw new core_1.ValidationError('Nothing to pack');
|
|
93
|
-
}
|
|
94
|
-
yield tar_1.default.c({
|
|
95
|
-
gzip: true,
|
|
96
|
-
file: outputFilePath,
|
|
97
|
-
cwd: packageDirPath,
|
|
98
|
-
}, filesToInclude);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.commandUnpackHarmony = void 0;
|
|
16
|
-
const io_1 = require("../io");
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const fs_1 = __importDefault(require("fs"));
|
|
19
|
-
const zlib_1 = __importDefault(require("zlib"));
|
|
20
|
-
const tar_1 = __importDefault(require("tar"));
|
|
21
|
-
const json5_1 = __importDefault(require("json5"));
|
|
22
|
-
const core_1 = require("../core");
|
|
23
|
-
exports.commandUnpackHarmony = {
|
|
24
|
-
name: 'unpack-harmony',
|
|
25
|
-
description: 'Unpacks native code.',
|
|
26
|
-
options: [
|
|
27
|
-
{
|
|
28
|
-
name: '--project-root-path <path>',
|
|
29
|
-
description: 'Relative path to package root',
|
|
30
|
-
default: '.',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: '--output-dir <string>',
|
|
34
|
-
description: 'Output directory to which OH modules should be unpacked to',
|
|
35
|
-
default: './harmony/rnoh_modules',
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
func: (argv, config, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
try {
|
|
40
|
-
yield unpack(new core_1.AbsolutePath(args.projectRootPath), new core_1.AbsolutePath(args.outputDir));
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
if (err instanceof core_1.ValidationError) {
|
|
44
|
-
console.error('[ERROR]', err.message);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
throw err;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}),
|
|
52
|
-
};
|
|
53
|
-
function unpack(projectRootPath, outputDirPath) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const logger = new io_1.Logger();
|
|
56
|
-
const projectDependenciesManager = new core_1.ProjectDependenciesManager(projectRootPath);
|
|
57
|
-
logger.info((styles) => styles.bold(`Unpacking RNOH modules`), {
|
|
58
|
-
prefix: true,
|
|
59
|
-
});
|
|
60
|
-
let unpackedArchivesCount = 0;
|
|
61
|
-
let skippedArchivesCount = 0;
|
|
62
|
-
yield projectDependenciesManager.forEachAsync((dependency) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const packageJSON = dependency.readPackageJSON();
|
|
64
|
-
const harmonyArchivePath = dependency
|
|
65
|
-
.getRootPath()
|
|
66
|
-
.copyWithNewSegment('harmony.tar.gz');
|
|
67
|
-
const pkgHarmonyDirPath = dependency
|
|
68
|
-
.getRootPath()
|
|
69
|
-
.copyWithNewSegment('harmony');
|
|
70
|
-
const harmonyTarGzPathStr = dependency
|
|
71
|
-
.getRootPath()
|
|
72
|
-
.copyWithNewSegment('harmony.tar.gz')
|
|
73
|
-
.relativeTo(projectRootPath)
|
|
74
|
-
.getValue();
|
|
75
|
-
if (packageJSON.version &&
|
|
76
|
-
shouldUnpack(harmonyArchivePath, pkgHarmonyDirPath, outputDirPath, packageJSON.version)) {
|
|
77
|
-
if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue())) {
|
|
78
|
-
/**
|
|
79
|
-
* After fresh install, harmony.tar.gz wasn't unpacked to harmony. Updating npm package should remove unpacked harmony dir.
|
|
80
|
-
*/
|
|
81
|
-
logger.info((styles) => `[${styles.cyan('unpacking')}] ${styles.gray(harmonyTarGzPathStr)}`);
|
|
82
|
-
yield unpackTarGz(harmonyArchivePath, pkgHarmonyDirPath);
|
|
83
|
-
unpackedArchivesCount++;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
skippedArchivesCount++;
|
|
87
|
-
logger.info((styles) => `[${styles.yellow('skipped')}] ${styles.gray(harmonyTarGzPathStr)}`);
|
|
88
|
-
}
|
|
89
|
-
const ohModulesInfo = getOhModulesInfo(pkgHarmonyDirPath, outputDirPath);
|
|
90
|
-
for (const ohModuleInfo of ohModulesInfo) {
|
|
91
|
-
const moduleArchivePathStr = dependency
|
|
92
|
-
.getRootPath()
|
|
93
|
-
.copyWithNewSegment('harmony', ohModuleInfo.archiveFileName)
|
|
94
|
-
.relativeTo(projectRootPath)
|
|
95
|
-
.getValue();
|
|
96
|
-
logger.info((styles) => `[${styles.cyan('unpacking')}] ${styles.gray(moduleArchivePathStr)}`);
|
|
97
|
-
unpackedArchivesCount++;
|
|
98
|
-
yield unpackTarGz(ohModuleInfo.archivePath, ohModuleInfo.computedModulePath);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
if (fs_1.default.existsSync(harmonyArchivePath.getValue())) {
|
|
103
|
-
skippedArchivesCount++;
|
|
104
|
-
logger.info((styles) => `[${styles.yellow('skipped')}] ${styles.gray(harmonyTarGzPathStr)}`);
|
|
105
|
-
}
|
|
106
|
-
const ohModulesInfo = getOhModulesInfo(pkgHarmonyDirPath, outputDirPath);
|
|
107
|
-
for (const ohModuleInfo of ohModulesInfo) {
|
|
108
|
-
const moduleArchivePathStr = dependency
|
|
109
|
-
.getRootPath()
|
|
110
|
-
.copyWithNewSegment('harmony', ohModuleInfo.archiveFileName)
|
|
111
|
-
.relativeTo(projectRootPath)
|
|
112
|
-
.getValue();
|
|
113
|
-
skippedArchivesCount++;
|
|
114
|
-
logger.info((styles) => `[${styles.yellow('skipped')}] ${styles.gray(moduleArchivePathStr)}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}));
|
|
118
|
-
logger.info((styles) => `\nUnpacked: ${styles.cyan(unpackedArchivesCount)}, Skipped: ${styles.yellow(skippedArchivesCount)}`);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function shouldUnpack(harmonyArchivePath, pkgHarmonyDirPath, outputDirPath, nodePackageVersion) {
|
|
122
|
-
if (!fs_1.default.existsSync(harmonyArchivePath.getValue()))
|
|
123
|
-
return false;
|
|
124
|
-
if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue()))
|
|
125
|
-
return true;
|
|
126
|
-
const ohModulesInfo = getOhModulesInfo(pkgHarmonyDirPath, outputDirPath);
|
|
127
|
-
for (const ohModuleInfo of ohModulesInfo) {
|
|
128
|
-
if (!fs_1.default.existsSync(ohModuleInfo.computedModulePath.getValue()) ||
|
|
129
|
-
getOhPackageVersion(ohModuleInfo.computedModulePath) !==
|
|
130
|
-
nodePackageVersion) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
function getOhPackageVersion(modulePath) {
|
|
137
|
-
const ohPackagePath = modulePath.copyWithNewSegment('oh-package.json5');
|
|
138
|
-
if (!fs_1.default.existsSync(ohPackagePath.getValue()))
|
|
139
|
-
return null;
|
|
140
|
-
const content = fs_1.default.readFileSync(ohPackagePath.getValue(), {
|
|
141
|
-
encoding: 'utf-8',
|
|
142
|
-
});
|
|
143
|
-
return json5_1.default.parse(content)['version'];
|
|
144
|
-
}
|
|
145
|
-
function getOhModulesInfo(pkgHarmonyDirPath, outputDirPath) {
|
|
146
|
-
const results = [];
|
|
147
|
-
if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue()))
|
|
148
|
-
return [];
|
|
149
|
-
const names = fs_1.default.readdirSync(pkgHarmonyDirPath.getValue());
|
|
150
|
-
for (const name of names) {
|
|
151
|
-
if (name.endsWith('.tar.gz')) {
|
|
152
|
-
const archivePath = pkgHarmonyDirPath.copyWithNewSegment(name);
|
|
153
|
-
const computedModuleName = path_1.default
|
|
154
|
-
.parse(archivePath.getValue())
|
|
155
|
-
.name.split('.')[0];
|
|
156
|
-
const computedModulePath = outputDirPath.copyWithNewSegment(computedModuleName);
|
|
157
|
-
results.push({
|
|
158
|
-
archivePath,
|
|
159
|
-
archiveFileName: name,
|
|
160
|
-
computedModulePath,
|
|
161
|
-
computedModuleName,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return results;
|
|
166
|
-
}
|
|
167
|
-
function unpackTarGz(archivePath, outputDirPath) {
|
|
168
|
-
if (!fs_1.default.existsSync(outputDirPath.getValue())) {
|
|
169
|
-
fs_1.default.mkdirSync(outputDirPath.getValue(), { recursive: true });
|
|
170
|
-
}
|
|
171
|
-
const readStream = fs_1.default.createReadStream(archivePath.getValue());
|
|
172
|
-
const writeStream = tar_1.default.extract({
|
|
173
|
-
cwd: outputDirPath.getValue(),
|
|
174
|
-
});
|
|
175
|
-
readStream.pipe(zlib_1.default.createGunzip()).pipe(writeStream);
|
|
176
|
-
return new Promise((resolve, reject) => {
|
|
177
|
-
writeStream.on('finish', () => {
|
|
178
|
-
resolve(undefined);
|
|
179
|
-
});
|
|
180
|
-
writeStream.on('error', (err) => {
|
|
181
|
-
reject(err);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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.AbsolutePath = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
class AbsolutePath {
|
|
9
|
-
static fromSegments(...segments) {
|
|
10
|
-
return new AbsolutePath(node_path_1.default.join(...segments));
|
|
11
|
-
}
|
|
12
|
-
constructor(path) {
|
|
13
|
-
this.value = '';
|
|
14
|
-
this.value = node_path_1.default.resolve(path);
|
|
15
|
-
}
|
|
16
|
-
getValue() {
|
|
17
|
-
return this.value;
|
|
18
|
-
}
|
|
19
|
-
copyWithNewSegment(...relativePath) {
|
|
20
|
-
return new AbsolutePath(node_path_1.default.join(this.getValue(), ...relativePath));
|
|
21
|
-
}
|
|
22
|
-
getExtension() {
|
|
23
|
-
const maybeExtWithDot = node_path_1.default.extname(this.value);
|
|
24
|
-
if (maybeExtWithDot) {
|
|
25
|
-
return maybeExtWithDot.substring(1);
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
relativeTo(absolutePath) {
|
|
30
|
-
return new RelativePath(node_path_1.default.relative(absolutePath.getValue(), this.value));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.AbsolutePath = AbsolutePath;
|
|
34
|
-
class RelativePath {
|
|
35
|
-
constructor(value) {
|
|
36
|
-
this.value = value;
|
|
37
|
-
}
|
|
38
|
-
getValue() {
|
|
39
|
-
return this.value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
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.CodegenConfig = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const io_1 = require("../io");
|
|
9
|
-
const DescriptiveError_1 = require("./DescriptiveError");
|
|
10
|
-
class CodegenConfig {
|
|
11
|
-
static fromRawCodegenConfig(rawCodegenConfig, packageRootPath, projectRootPath, packageName) {
|
|
12
|
-
var _a;
|
|
13
|
-
const SUPPORTED_SPEC_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
|
|
14
|
-
const specPaths = ((_a = rawCodegenConfig.specPaths) !== null && _a !== void 0 ? _a : []).map((rawSpecPath) => {
|
|
15
|
-
if (rawSpecPath.startsWith('~')) {
|
|
16
|
-
return projectRootPath.copyWithNewSegment(rawSpecPath.replace('~', ''));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return packageRootPath.copyWithNewSegment(rawSpecPath);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const specFilePaths = specPaths.flatMap((specPath) => {
|
|
23
|
-
if (!node_fs_1.default.existsSync(specPath.getValue())) {
|
|
24
|
-
throw new DescriptiveError_1.DescriptiveError({
|
|
25
|
-
whatHappened: `No such file or directory: ${specPath.getValue()}`,
|
|
26
|
-
whatCanUserDo: {
|
|
27
|
-
default: [
|
|
28
|
-
`Please verify in "${packageName}/package.json::harmony::codegenConfig". If you are not the maintainer of this package, please report this problem to the package maintainer.`,
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
if (node_fs_1.default.lstatSync(specPath.getValue()).isDirectory()) {
|
|
34
|
-
return (0, io_1.findFilePathsWithExtensions)(specPath, SUPPORTED_SPEC_EXTENSIONS);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const ext = specPath.getExtension();
|
|
38
|
-
if (ext && SUPPORTED_SPEC_EXTENSIONS.includes(ext)) {
|
|
39
|
-
return [specPath];
|
|
40
|
-
}
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return new CodegenConfig(specFilePaths);
|
|
45
|
-
}
|
|
46
|
-
constructor(specFilePaths) {
|
|
47
|
-
this.specFilePaths = specFilePaths;
|
|
48
|
-
}
|
|
49
|
-
getSpecFilePaths() {
|
|
50
|
-
return this.specFilePaths;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.CodegenConfig = CodegenConfig;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DescriptiveError = void 0;
|
|
4
|
-
class DescriptiveError extends Error {
|
|
5
|
-
constructor(data) {
|
|
6
|
-
super(data.whatHappened);
|
|
7
|
-
this.data = data;
|
|
8
|
-
}
|
|
9
|
-
isUnexpected() {
|
|
10
|
-
return 'unexpected' in this.data;
|
|
11
|
-
}
|
|
12
|
-
getMessage() {
|
|
13
|
-
return this.data.whatHappened;
|
|
14
|
-
}
|
|
15
|
-
getSuggestionsByRole() {
|
|
16
|
-
if ('whatCanUserDo' in this.data) {
|
|
17
|
-
return this.data.whatCanUserDo;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
getDetails() {
|
|
24
|
-
var _a;
|
|
25
|
-
if (!this.data.extraData) {
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
if (typeof this.data.extraData === 'string') {
|
|
29
|
-
return this.data.extraData.trim();
|
|
30
|
-
}
|
|
31
|
-
if (this.data.extraData instanceof Error) {
|
|
32
|
-
let lines = [
|
|
33
|
-
`${this.data.extraData.name}: ${this.data.extraData.message}`,
|
|
34
|
-
];
|
|
35
|
-
for (let stackEntry of ((_a = this.data.extraData.stack) !== null && _a !== void 0 ? _a : '').split('\n')) {
|
|
36
|
-
lines.push('');
|
|
37
|
-
lines.push(stackEntry);
|
|
38
|
-
}
|
|
39
|
-
return lines.join('\n');
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
return JSON.stringify(this.data.extraData, null, 2);
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
return '';
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.DescriptiveError = DescriptiveError;
|
package/dist/core/PackageJSON.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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.PackageJSON = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const CodegenConfig_1 = require("./CodegenConfig");
|
|
9
|
-
const DescriptiveError_1 = require("./DescriptiveError");
|
|
10
|
-
class PackageJSON {
|
|
11
|
-
static fromProjectRootPath(packageRootPath, projectRootPath) {
|
|
12
|
-
const packageJSONPath = packageRootPath.copyWithNewSegment('package.json');
|
|
13
|
-
if (!fs_1.default.existsSync(packageJSONPath.getValue())) {
|
|
14
|
-
throw new DescriptiveError_1.DescriptiveError({
|
|
15
|
-
whatHappened: "Couldn't find 'package.json'",
|
|
16
|
-
whatCanUserDo: {
|
|
17
|
-
default: [
|
|
18
|
-
'Check if the path to project root is correct',
|
|
19
|
-
'Try changing working directory to project root',
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
extraData: packageJSONPath.getValue(),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return new PackageJSON(JSON.parse(fs_1.default.readFileSync(packageJSONPath.getValue()).toString()), packageRootPath, projectRootPath);
|
|
26
|
-
}
|
|
27
|
-
constructor(rawPackageJSON, packageRootPath, projectRootPath) {
|
|
28
|
-
this.rawPackageJSON = rawPackageJSON;
|
|
29
|
-
this.packageRootPath = packageRootPath;
|
|
30
|
-
this.projectRootPath = projectRootPath;
|
|
31
|
-
}
|
|
32
|
-
get name() {
|
|
33
|
-
return this.rawPackageJSON.name;
|
|
34
|
-
}
|
|
35
|
-
get version() {
|
|
36
|
-
return this.rawPackageJSON.version;
|
|
37
|
-
}
|
|
38
|
-
maybeCreateCodegenConfig() {
|
|
39
|
-
var _a;
|
|
40
|
-
/**
|
|
41
|
-
* Shared codegenConfig is not used on purpose. Android, iOS and other platforms shouldn't
|
|
42
|
-
* generate code for harmony-specific packages. The shape of this codegenConfig is different
|
|
43
|
-
* that the shape of the shared config, to allow specifying which specific turbo modules or
|
|
44
|
-
* fabric components should be code generated.
|
|
45
|
-
*/
|
|
46
|
-
const rawCodegenConfig = (_a = this.rawPackageJSON.harmony) === null || _a === void 0 ? void 0 : _a.codegenConfig;
|
|
47
|
-
if (!rawCodegenConfig) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(rawCodegenConfig, this.packageRootPath, this.projectRootPath, this.name);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.PackageJSON = PackageJSON;
|