utiller 1.0.220 → 1.0.222
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/lib/utiller/nodeutiller.js +59 -43
- package/package.json +1 -1
|
@@ -1015,7 +1015,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1015
1015
|
_iterator8 = _createForOfIteratorHelper(packagejsons);
|
|
1016
1016
|
_context12.prev = 8;
|
|
1017
1017
|
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
1018
|
-
var path, tempFolderPath, release, pathOfPackageJson, indexFileName, templatePath;
|
|
1018
|
+
var path, tempFolderPath, release, pathOfPackageJson, indexFileName, templatePath, _yield$_this7$upgrade, moduleName, version;
|
|
1019
1019
|
return _regenerator["default"].wrap(function _loop$(_context11) {
|
|
1020
1020
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1021
1021
|
case 0:
|
|
@@ -1025,7 +1025,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1025
1025
|
return !_this7.has(path, projectName);
|
|
1026
1026
|
};
|
|
1027
1027
|
})))) {
|
|
1028
|
-
_context11.next =
|
|
1028
|
+
_context11.next = 44;
|
|
1029
1029
|
break;
|
|
1030
1030
|
}
|
|
1031
1031
|
_context11.next = 4;
|
|
@@ -1049,60 +1049,65 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1049
1049
|
if (_this7.isPathExist(templatePath)) {
|
|
1050
1050
|
_this7.copyFromFolderToDestFolder(templatePath, _this7.persistByPath(_path5["default"].join(release, "template")));
|
|
1051
1051
|
}
|
|
1052
|
-
if (deployToNPMServer) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
//
|
|
1056
|
-
// /** 把所有樣板的版號都提升 */
|
|
1057
|
-
// await this.updateVersionOfTemplate(moduleName, version);
|
|
1052
|
+
if (!deployToNPMServer) {
|
|
1053
|
+
_context11.next = 22;
|
|
1054
|
+
break;
|
|
1058
1055
|
}
|
|
1059
|
-
|
|
1056
|
+
_context11.next = 17;
|
|
1057
|
+
return _this7.upgradePackageJsonVersion(pathOfPackageJson);
|
|
1058
|
+
case 17:
|
|
1059
|
+
_yield$_this7$upgrade = _context11.sent;
|
|
1060
|
+
moduleName = _yield$_this7$upgrade.moduleName;
|
|
1061
|
+
version = _yield$_this7$upgrade.version;
|
|
1062
|
+
_context11.next = 22;
|
|
1063
|
+
return _this7.updateVersionOfTemplate(moduleName, version);
|
|
1064
|
+
case 22:
|
|
1060
1065
|
/** 把package.json release放進去 */
|
|
1061
1066
|
_this7.copySingleFile(pathOfPackageJson, _path5["default"].join(release, "package.json"), undefined, true);
|
|
1062
1067
|
|
|
1063
1068
|
/** 安裝一個沒有devDependency 的node_module */
|
|
1064
1069
|
if (!(forceInstallNodeModule || !_this7.isPathExist(_path5["default"].join(release, "node_module")))) {
|
|
1065
|
-
_context11.next =
|
|
1070
|
+
_context11.next = 28;
|
|
1066
1071
|
break;
|
|
1067
1072
|
}
|
|
1068
|
-
_context11.next =
|
|
1073
|
+
_context11.next = 26;
|
|
1069
1074
|
return _this7.executeCommandLine("cd ".concat(release, " && yarn install --production"));
|
|
1070
|
-
case
|
|
1071
|
-
_context11.next =
|
|
1075
|
+
case 26:
|
|
1076
|
+
_context11.next = 29;
|
|
1072
1077
|
break;
|
|
1073
|
-
case
|
|
1078
|
+
case 28:
|
|
1074
1079
|
_this7.appendInfo("ignore node-module install behavior");
|
|
1075
|
-
case
|
|
1080
|
+
case 29:
|
|
1076
1081
|
_this7.appendInfo("build ".concat(path, " succeed"));
|
|
1077
1082
|
|
|
1078
1083
|
/** 部署到 local server*/
|
|
1079
1084
|
if (!deployToNPMServer) {
|
|
1080
|
-
_context11.next =
|
|
1085
|
+
_context11.next = 33;
|
|
1081
1086
|
break;
|
|
1082
1087
|
}
|
|
1083
|
-
_context11.next = 26;
|
|
1084
|
-
return _this7.executeCommandLine("cd ".concat(release, " && npm publish"));
|
|
1085
|
-
case 26:
|
|
1086
1088
|
_context11.next = 33;
|
|
1089
|
+
return _this7.executeCommandLine("cd ".concat(release, " && npm publish"));
|
|
1090
|
+
case 33:
|
|
1091
|
+
_context11.next = 40;
|
|
1087
1092
|
break;
|
|
1088
|
-
case
|
|
1089
|
-
_context11.prev =
|
|
1093
|
+
case 35:
|
|
1094
|
+
_context11.prev = 35;
|
|
1090
1095
|
_context11.t0 = _context11["catch"](9);
|
|
1091
|
-
_context11.next =
|
|
1096
|
+
_context11.next = 39;
|
|
1092
1097
|
return _this7.deleteSelfByPath(release, true);
|
|
1093
|
-
case
|
|
1098
|
+
case 39:
|
|
1094
1099
|
throw new _index2["default"](9999, "generatePackage \u5831\u932F, ".concat(_context11.t0.message));
|
|
1095
|
-
case
|
|
1096
|
-
_context11.prev =
|
|
1097
|
-
_context11.next =
|
|
1100
|
+
case 40:
|
|
1101
|
+
_context11.prev = 40;
|
|
1102
|
+
_context11.next = 43;
|
|
1098
1103
|
return _this7.deleteSelfByPath(tempFolderPath, true);
|
|
1099
|
-
case
|
|
1100
|
-
return _context11.finish(
|
|
1101
|
-
case
|
|
1104
|
+
case 43:
|
|
1105
|
+
return _context11.finish(40);
|
|
1106
|
+
case 44:
|
|
1102
1107
|
case "end":
|
|
1103
1108
|
return _context11.stop();
|
|
1104
1109
|
}
|
|
1105
|
-
}, _loop, null, [[9,
|
|
1110
|
+
}, _loop, null, [[9, 35, 40, 44]]);
|
|
1106
1111
|
});
|
|
1107
1112
|
_iterator8.s();
|
|
1108
1113
|
case 11:
|
|
@@ -1140,7 +1145,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1140
1145
|
key: "updateVersionOfTemplate",
|
|
1141
1146
|
value: (function () {
|
|
1142
1147
|
var _updateVersionOfTemplate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dependency, newVersion) {
|
|
1143
|
-
var paths, _i, _paths, path, json;
|
|
1148
|
+
var paths, _i, _paths, path, succeedOfPersistFile, json;
|
|
1144
1149
|
return _regenerator["default"].wrap(function _callee12$(_context13) {
|
|
1145
1150
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1146
1151
|
case 0:
|
|
@@ -1148,41 +1153,52 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1148
1153
|
_i = 0, _paths = paths;
|
|
1149
1154
|
case 2:
|
|
1150
1155
|
if (!(_i < _paths.length)) {
|
|
1151
|
-
_context13.next =
|
|
1156
|
+
_context13.next = 24;
|
|
1152
1157
|
break;
|
|
1153
1158
|
}
|
|
1154
1159
|
path = _paths[_i];
|
|
1155
1160
|
if (!this.isPathExist(path)) {
|
|
1156
|
-
_context13.next =
|
|
1161
|
+
_context13.next = 21;
|
|
1157
1162
|
break;
|
|
1158
1163
|
}
|
|
1164
|
+
succeedOfPersistFile = false;
|
|
1159
1165
|
json = this.getJsonObjByFilePath(path);
|
|
1160
1166
|
if (!(json && json.dependencies && json.dependencies[dependency])) {
|
|
1161
|
-
_context13.next =
|
|
1167
|
+
_context13.next = 18;
|
|
1162
1168
|
break;
|
|
1163
1169
|
}
|
|
1164
1170
|
json.dependencies[dependency] = "^".concat(newVersion);
|
|
1165
|
-
_context13.
|
|
1171
|
+
_context13.prev = 9;
|
|
1172
|
+
_context13.next = 12;
|
|
1166
1173
|
return this.writeJsonThanPrettier(path, json);
|
|
1167
|
-
case 10:
|
|
1168
|
-
_context13.next = 14;
|
|
1169
|
-
break;
|
|
1170
1174
|
case 12:
|
|
1171
|
-
|
|
1175
|
+
succeedOfPersistFile = true;
|
|
1176
|
+
_context13.next = 18;
|
|
1177
|
+
break;
|
|
1178
|
+
case 15:
|
|
1179
|
+
_context13.prev = 15;
|
|
1180
|
+
_context13.t0 = _context13["catch"](9);
|
|
1181
|
+
succeedOfPersistFile = true;
|
|
1182
|
+
case 18:
|
|
1183
|
+
if (succeedOfPersistFile) {
|
|
1184
|
+
_context13.next = 21;
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
_context13.next = 21;
|
|
1172
1188
|
return this.updateFileOfSpecificLine(path, " \"".concat(dependency, "\":\"^").concat(newVersion, "\""), function (each) {
|
|
1173
1189
|
return _lodash["default"].startsWith(_lodash["default"].trim(each), "\"".concat(dependency, "\""));
|
|
1174
1190
|
});
|
|
1175
|
-
case
|
|
1191
|
+
case 21:
|
|
1176
1192
|
_i++;
|
|
1177
1193
|
_context13.next = 2;
|
|
1178
1194
|
break;
|
|
1179
|
-
case
|
|
1195
|
+
case 24:
|
|
1180
1196
|
this.copyFromFolderToDestFolder("/Users/davidtu/cross-achieve/high/idea-inventer/utiller/template/", "/Users/davidtu/cross-achieve/high/idea-inventer/newp/template/", true, true);
|
|
1181
|
-
case
|
|
1197
|
+
case 25:
|
|
1182
1198
|
case "end":
|
|
1183
1199
|
return _context13.stop();
|
|
1184
1200
|
}
|
|
1185
|
-
}, _callee12, this);
|
|
1201
|
+
}, _callee12, this, [[9, 15]]);
|
|
1186
1202
|
}));
|
|
1187
1203
|
function updateVersionOfTemplate(_x12, _x13) {
|
|
1188
1204
|
return _updateVersionOfTemplate.apply(this, arguments);
|