@react-native-oh/react-native-harmony-cli 0.0.37 → 0.0.40
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 +74 -43
- package/dist/autolinking/Autolinking.js +183 -179
- package/dist/codegen/core/CodegenError.js +23 -3
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
- package/dist/codegen/core/UberSchema.js +96 -57
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
- package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
- package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -18
- package/dist/codegen/generators/UberGeneratorV2.js +36 -28
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
- package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -53
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
- package/dist/codegen/templates/IndexTSTemplate.js +17 -37
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
- package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
- package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
- package/dist/commands/bundle-harmony.js +138 -53
- package/dist/commands/codegen-harmony.js +175 -104
- package/dist/commands/codegen-lib-harmony.js +116 -76
- package/dist/commands/create-metro-host-constants.js +47 -18
- package/dist/commands/init.js +961 -537
- package/dist/commands/link-harmony.js +71 -33
- package/dist/commands/pack-harmony.js +108 -47
- package/dist/commands/run-harmony.js +518 -374
- package/dist/commands/unpack-harmony.js +198 -105
- package/dist/commands/verify-package-harmony.js +108 -54
- package/dist/core/AbsolutePath.js +47 -31
- package/dist/core/CodegenConfig.js +22 -24
- package/dist/core/DescriptiveError.js +37 -18
- package/dist/core/FileSystem.js +18 -14
- package/dist/core/OHPackageJSON5.js +23 -17
- package/dist/core/PackageJSON.js +42 -26
- package/dist/core/ProjectDependenciesManager.js +96 -46
- package/dist/core/ValidationError.js +22 -2
- package/dist/core/fs.js +6 -9
- package/dist/index.js +1 -1
- package/dist/io/CliExecutor.js +98 -46
- package/dist/io/Logger.js +46 -40
- package/dist/io/RealFS.js +88 -35
- package/dist/io/TarGz.js +8 -11
- package/dist/io/__fixtures__.js +141 -79
- package/dist/io/fsUtils.js +12 -13
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
- package/dist/package-verifier/verify-package.js +132 -55
- package/dist/simulator/LaunchSimulator.js +301 -217
- package/jest.config.js +12 -12
- package/package.json +78 -70
- package/react-native.config.js +17 -17
- package/tsconfig.build.json +6 -6
- package/tsconfig.json +2 -2
- package/.prettierrc +0 -6
- package/src/assetResolver.ts +0 -134
- package/src/autolinking/Autolinking.test.ts +0 -483
- package/src/autolinking/Autolinking.ts +0 -382
- package/src/autolinking/index.ts +0 -8
- package/src/codegen/core/CodeGenerator.ts +0 -16
- package/src/codegen/core/CodegenError.ts +0 -10
- package/src/codegen/core/EventUtils.ts +0 -23
- package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -82
- package/src/codegen/core/TypeAnnotationToTS.ts +0 -195
- package/src/codegen/core/UberSchema.ts +0 -152
- package/src/codegen/core/index.ts +0 -12
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +0 -124
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -128
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -122
- package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -95
- package/src/codegen/generators/LibGlueCodeGenerator.ts +0 -98
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +0 -124
- package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -57
- package/src/codegen/generators/UberGeneratorV1.ts +0 -75
- package/src/codegen/generators/UberGeneratorV2.ts +0 -114
- package/src/codegen/generators/index.ts +0 -15
- package/src/codegen/index.ts +0 -9
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -128
- package/src/codegen/templates/BasePackageHTemplate.ts +0 -159
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +0 -63
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -121
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -222
- package/src/codegen/templates/IndexTSTemplate.ts +0 -62
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +0 -150
- package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -61
- package/src/codegen/templates/TurboModuleHTemplate.ts +0 -42
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -101
- package/src/codegen/templates/index.ts +0 -16
- package/src/commands/bundle-harmony.ts +0 -134
- package/src/commands/codegen-harmony.ts +0 -297
- package/src/commands/codegen-lib-harmony.ts +0 -389
- package/src/commands/create-metro-host-constants.ts +0 -55
- package/src/commands/index.ts +0 -16
- package/src/commands/init.ts +0 -755
- package/src/commands/link-harmony.ts +0 -102
- package/src/commands/pack-harmony.ts +0 -128
- package/src/commands/run-harmony.ts +0 -506
- package/src/commands/types.ts +0 -21
- package/src/commands/unpack-harmony.ts +0 -238
- package/src/commands/verify-package-harmony.ts +0 -113
- package/src/core/AbsolutePath.ts +0 -66
- package/src/core/CodegenConfig.ts +0 -67
- package/src/core/DescriptiveError.ts +0 -68
- package/src/core/FileSystem.ts +0 -57
- package/src/core/OHPackageJSON5.ts +0 -30
- package/src/core/PackageJSON.ts +0 -104
- package/src/core/ProjectDependenciesManager.ts +0 -103
- package/src/core/ValidationError.ts +0 -8
- package/src/core/ValueObject.ts +0 -9
- package/src/core/fs.ts +0 -38
- package/src/core/index.ts +0 -17
- package/src/index.ts +0 -33
- package/src/io/CliExecutor.ts +0 -69
- package/src/io/Logger.ts +0 -112
- package/src/io/RealFS.ts +0 -62
- package/src/io/TarGz.ts +0 -33
- package/src/io/__fixtures__.ts +0 -139
- package/src/io/fsUtils.ts +0 -44
- package/src/io/index.ts +0 -11
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -35
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -31
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -25
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -54
- package/src/package-verifier/checks/index.ts +0 -11
- package/src/package-verifier/index.ts +0 -9
- package/src/package-verifier/types.ts +0 -19
- package/src/package-verifier/verify-package.ts +0 -123
- package/src/simulator/LaunchSimulator.ts +0 -352
- package/src/simulator/index.ts +0 -8
|
@@ -14,12 +14,39 @@ 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
|
+
};
|
|
17
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
45
|
exports.commandLinkHarmony = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
var core_1 = require("../core");
|
|
47
|
+
var io_1 = require("../io");
|
|
48
|
+
var autolinking_1 = require("../autolinking");
|
|
49
|
+
var COMMAND_NAME = 'link-harmony';
|
|
23
50
|
exports.commandLinkHarmony = {
|
|
24
51
|
name: COMMAND_NAME,
|
|
25
52
|
description: 'Handles the automatic linking of RNOH libraries. This command is meant to be used by the RNOH HvigorPlugin.',
|
|
@@ -63,35 +90,46 @@ exports.commandLinkHarmony = {
|
|
|
63
90
|
description: "Lists npm package names to be included from the autolinking process, separated by semicolons. By default every library is included. Can't be used with --excluded-npm-packages.",
|
|
64
91
|
},
|
|
65
92
|
],
|
|
66
|
-
func: (_argv, _config, rawArgs)
|
|
93
|
+
func: function (_argv, _config, rawArgs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
|
+
var logger, fs, autolinking, config, result, err_1;
|
|
67
95
|
var _a, _b;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
return __generator(this, function (_c) {
|
|
97
|
+
switch (_c.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
logger = new io_1.Logger();
|
|
100
|
+
fs = new io_1.RealFS();
|
|
101
|
+
autolinking = new autolinking_1.Autolinking(fs, logger);
|
|
102
|
+
_c.label = 1;
|
|
103
|
+
case 1:
|
|
104
|
+
_c.trys.push([1, 3, , 4]);
|
|
105
|
+
return [4 /*yield*/, autolinking.prepareInput({
|
|
106
|
+
harmonyProjectPath: new core_1.AbsolutePath(rawArgs.harmonyProjectPath),
|
|
107
|
+
nodeModulesPath: new core_1.AbsolutePath(rawArgs.nodeModulesPath),
|
|
108
|
+
cmakeAutolinkPathRelativeToHarmony: rawArgs.cmakeAutolinkPathRelativeToHarmony,
|
|
109
|
+
cppRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.cppRnohPackagesFactoryPathRelativeToHarmony,
|
|
110
|
+
etsRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.etsRnohPackagesFactoryPathRelativeToHarmony,
|
|
111
|
+
ohPackagePathRelativeToHarmony: rawArgs.ohPackagePathRelativeToHarmony,
|
|
112
|
+
excludedNpmPackageNames: new Set(rawArgs.excludeNpmPackages
|
|
113
|
+
? ((_a = rawArgs.excludeNpmPackages) !== null && _a !== void 0 ? _a : '').split(';')
|
|
114
|
+
: undefined),
|
|
115
|
+
includedNpmPackageNames: new Set(rawArgs.includeNpmPackages
|
|
116
|
+
? ((_b = rawArgs.includeNpmPackages) !== null && _b !== void 0 ? _b : '').split(';')
|
|
117
|
+
: undefined),
|
|
118
|
+
})];
|
|
119
|
+
case 2:
|
|
120
|
+
config = _c.sent();
|
|
121
|
+
result = autolinking.evaluate(config);
|
|
122
|
+
autolinking.saveAndLogOutput(result);
|
|
123
|
+
return [3 /*break*/, 4];
|
|
124
|
+
case 3:
|
|
125
|
+
err_1 = _c.sent();
|
|
126
|
+
if (err_1 instanceof core_1.DescriptiveError && !err_1.isUnexpected()) {
|
|
127
|
+
logger.descriptiveError(err_1);
|
|
128
|
+
return [2 /*return*/];
|
|
129
|
+
}
|
|
130
|
+
throw err_1;
|
|
131
|
+
case 4: return [2 /*return*/];
|
|
93
132
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}),
|
|
133
|
+
});
|
|
134
|
+
}); },
|
|
97
135
|
};
|
|
@@ -14,18 +14,42 @@ 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
|
-
|
|
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
|
+
}
|
|
19
43
|
};
|
|
20
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
45
|
exports.commandPackHarmony = void 0;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
var glob_1 = require("glob");
|
|
47
|
+
var path_1 = require("path");
|
|
48
|
+
var tar_1 = require("tar");
|
|
49
|
+
var fs_1 = require("fs");
|
|
50
|
+
var core_1 = require("../core");
|
|
51
|
+
var ignore_1 = require("ignore");
|
|
52
|
+
var json5_1 = require("json5");
|
|
29
53
|
exports.commandPackHarmony = {
|
|
30
54
|
name: 'pack-harmony',
|
|
31
55
|
description: 'Pack native code. Used for package development.',
|
|
@@ -43,47 +67,76 @@ exports.commandPackHarmony = {
|
|
|
43
67
|
description: 'Path to the package.json',
|
|
44
68
|
},
|
|
45
69
|
],
|
|
46
|
-
func: (argv, config, args)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
func: function (argv, config, args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
+
var err_1;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
_a.trys.push([0, 2, , 3]);
|
|
76
|
+
return [4 /*yield*/, pack(path_1.default.resolve(args.harmonyDirPath), path_1.default.resolve(args.ohModulePath), path_1.default.resolve(args.packageJsonPath))];
|
|
77
|
+
case 1:
|
|
78
|
+
_a.sent();
|
|
79
|
+
return [3 /*break*/, 3];
|
|
80
|
+
case 2:
|
|
81
|
+
err_1 = _a.sent();
|
|
82
|
+
if (err_1 instanceof core_1.ValidationError) {
|
|
83
|
+
console.error('[ERROR]', err_1.message);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw err_1;
|
|
88
|
+
}
|
|
89
|
+
return [3 /*break*/, 3];
|
|
90
|
+
case 3: return [2 /*return*/];
|
|
57
91
|
}
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
92
|
+
});
|
|
93
|
+
}); },
|
|
60
94
|
};
|
|
61
95
|
function pack(harmonyDirPath, ohModuleDirPath, packageJSONPath) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
syncVersions(packageJSONPath, path_1.default.join(ohModuleDirPath, 'oh-package.json5'));
|
|
101
|
+
if (!fs_1.default.existsSync(harmonyDirPath)) {
|
|
102
|
+
fs_1.default.mkdirSync(harmonyDirPath, { recursive: true });
|
|
103
|
+
}
|
|
104
|
+
return [4 /*yield*/, createTGZFromDir(ohModuleDirPath, path_1.default.join(harmonyDirPath, "".concat(path_1.default.parse(ohModuleDirPath).name, ".tar.gz")))];
|
|
105
|
+
case 1:
|
|
106
|
+
_a.sent();
|
|
107
|
+
return [4 /*yield*/, createTGZFromDir(harmonyDirPath, path_1.default.join(path_1.default.dirname(harmonyDirPath), 'harmony.tar.gz'))];
|
|
108
|
+
case 2:
|
|
109
|
+
_a.sent();
|
|
110
|
+
return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
69
113
|
});
|
|
70
114
|
}
|
|
71
115
|
function syncVersions(packageJSONFilePath, ohPackageJSONFilePath) {
|
|
72
|
-
|
|
116
|
+
var packageJSONFileContent = JSON.parse(fs_1.default.readFileSync(packageJSONFilePath, { encoding: 'utf-8' }));
|
|
73
117
|
if (fs_1.default.existsSync(ohPackageJSONFilePath)) {
|
|
74
|
-
|
|
118
|
+
var ohPackageJSONFileContent = json5_1.default.parse(fs_1.default.readFileSync(ohPackageJSONFilePath, { encoding: 'utf-8' }));
|
|
75
119
|
ohPackageJSONFileContent['version'] = packageJSONFileContent['version'];
|
|
76
120
|
fs_1.default.writeFileSync(ohPackageJSONFilePath, json5_1.default.stringify(ohPackageJSONFileContent, null, 2));
|
|
77
121
|
}
|
|
78
122
|
}
|
|
79
123
|
function createTGZFromDir(dirPath, outputFilePath) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
124
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
+
var ig, filesToInclude;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
ig = getIgnoreUtil(path_1.default.join(dirPath, '.tarignore'));
|
|
130
|
+
filesToInclude = (0, glob_1.globSync)('**', {
|
|
131
|
+
cwd: dirPath,
|
|
132
|
+
nodir: true,
|
|
133
|
+
}).filter(function (path) { return !ig.ignores(path); });
|
|
134
|
+
return [4 /*yield*/, createArchive(outputFilePath, dirPath, filesToInclude)];
|
|
135
|
+
case 1:
|
|
136
|
+
_a.sent();
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
87
140
|
});
|
|
88
141
|
}
|
|
89
142
|
function getIgnoreUtil(tarignorePath) {
|
|
@@ -93,14 +146,22 @@ function getIgnoreUtil(tarignorePath) {
|
|
|
93
146
|
return (0, ignore_1.default)().add(fs_1.default.readFileSync(tarignorePath).toString());
|
|
94
147
|
}
|
|
95
148
|
function createArchive(outputFilePath, packageDirPath, filesToInclude) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
return __generator(this, function (_a) {
|
|
151
|
+
switch (_a.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
if (filesToInclude.length === 0) {
|
|
154
|
+
throw new core_1.ValidationError('Nothing to pack');
|
|
155
|
+
}
|
|
156
|
+
return [4 /*yield*/, tar_1.default.c({
|
|
157
|
+
gzip: true,
|
|
158
|
+
file: outputFilePath,
|
|
159
|
+
cwd: packageDirPath,
|
|
160
|
+
}, filesToInclude)];
|
|
161
|
+
case 1:
|
|
162
|
+
_a.sent();
|
|
163
|
+
return [2 /*return*/];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
105
166
|
});
|
|
106
167
|
}
|