lincd-cli 1.2.1 → 1.2.2
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/defaults/app-with-backend/lincd.config.js +3 -3
- package/defaults/app-with-backend/package.json +2 -1
- package/defaults/app-with-backend/src/index.tsx +3 -3
- package/defaults/app-with-backend/src/pages/Home.tsx +1 -0
- package/defaults/app-with-backend/src/pages/PageNotFound.tsx +2 -1
- package/defaults/app-with-backend/src/theme.css +61 -66
- package/defaults/app-with-backend/src/types.ts +14 -0
- package/defaults/app-with-backend/tsconfig.json +1 -1
- package/defaults/package/package.json +30 -3
- package/defaults/package/src/index.ts +1 -1
- package/defaults/package/src/ontologies/example-ontology.ts +4 -4
- package/defaults/package/src/package.ts +2 -1
- package/defaults/shape.ts +1 -1
- package/lib/cjs/cli-methods.js +213 -39
- package/lib/cjs/cli-methods.js.map +1 -1
- package/lib/cjs/cli.js +9 -1
- package/lib/cjs/cli.js.map +1 -1
- package/lib/cjs/config-webpack-app.js +35 -33
- package/lib/cjs/config-webpack-app.js.map +1 -1
- package/lib/cjs/config-webpack.js +1 -1
- package/lib/cjs/config-webpack.js.map +1 -1
- package/lib/cjs/package.json +2 -1
- package/lib/cjs/utils.js +12 -5
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/cli-methods.js +205 -37
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.js +10 -2
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/config-webpack-app.js +36 -34
- package/lib/esm/config-webpack-app.js.map +1 -1
- package/lib/esm/config-webpack.js +1 -1
- package/lib/esm/config-webpack.js.map +1 -1
- package/lib/esm/package.json +2 -1
- package/lib/esm/utils.js +12 -5
- package/lib/esm/utils.js.map +1 -1
- package/package.json +2 -1
- /package/defaults/package/src/{types.d.ts → types.ts} +0 -0
package/lib/cjs/cli-methods.js
CHANGED
|
@@ -36,9 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.removeOldFiles = exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.compilePackageCJS = exports.compilePackageESM = exports.compilePackage = exports.buildPackage = exports.register = exports.createPackage = exports.upgradePackages = exports.buildApp = exports.startServer = exports.ensureEnvironmentLoaded = exports.depCheck = exports.depCheckStaged = exports.checkImports = exports.createComponent = exports.createSetComponent = exports.createShape = exports.getScriptDir = exports.setNameVariables = exports.createOntology = exports.createApp = void 0;
|
|
39
|
+
exports.removeOldFiles = exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.compilePackageCJS = exports.compilePackageESM = exports.compilePackage = exports.buildPackage = exports.register = exports.createPackage = exports.upgradePackages = exports.buildBackend = exports.buildFrontend = exports.buildApp = exports.startServer = exports.runMethod = exports.ensureEnvironmentLoaded = exports.depCheck = exports.depCheckStaged = exports.checkImports = exports.createComponent = exports.createSetComponent = exports.createShape = exports.getScriptDir = exports.setNameVariables = exports.createOntology = exports.createApp = void 0;
|
|
40
40
|
exports.warn = warn;
|
|
41
41
|
exports.developPackage = developPackage;
|
|
42
|
+
exports.runOnPackagesGroupedByDependencies = runOnPackagesGroupedByDependencies;
|
|
42
43
|
exports.buildAll = buildAll;
|
|
43
44
|
exports.getLincdPackages = getLincdPackages;
|
|
44
45
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -51,6 +52,7 @@ const utils_js_1 = require("./utils.js");
|
|
|
51
52
|
const fs_1 = require("fs");
|
|
52
53
|
const find_nearest_package_json_1 = require("find-nearest-package-json");
|
|
53
54
|
const LinkedFileStorage_1 = require("lincd/utils/LinkedFileStorage");
|
|
55
|
+
const child_process_2 = require("child_process");
|
|
54
56
|
// import pkg from 'lincd/utils/LinkedFileStorage';
|
|
55
57
|
// const { LinkedFileStorage } = pkg;
|
|
56
58
|
// const config = require('lincd-server/site.webpack.config');
|
|
@@ -895,19 +897,19 @@ invalidImports = new Map()) => {
|
|
|
895
897
|
if ((0, utils_js_1.isImportOutsideOfPackage)(i, depth)) {
|
|
896
898
|
invalidImports.get(filename).push({
|
|
897
899
|
type: 'outside_package',
|
|
898
|
-
importPath: i
|
|
900
|
+
importPath: i,
|
|
899
901
|
});
|
|
900
902
|
}
|
|
901
903
|
if ((0, utils_js_1.isInvalidLINCDImport)(i, depth)) {
|
|
902
904
|
invalidImports.get(filename).push({
|
|
903
905
|
type: 'lincd',
|
|
904
|
-
importPath: i
|
|
906
|
+
importPath: i,
|
|
905
907
|
});
|
|
906
908
|
}
|
|
907
909
|
if ((0, utils_js_1.isImportWithMissingExtension)(i)) {
|
|
908
910
|
invalidImports.get(filename).push({
|
|
909
911
|
type: 'missing_extension',
|
|
910
|
-
importPath: i
|
|
912
|
+
importPath: i,
|
|
911
913
|
});
|
|
912
914
|
}
|
|
913
915
|
});
|
|
@@ -986,7 +988,10 @@ const depCheck = async (packagePath = process.cwd()) => {
|
|
|
986
988
|
if (missingLincdPackages.length > 0) {
|
|
987
989
|
reject(chalk_1.default.red(packagePath.split('/').pop() +
|
|
988
990
|
'\n[ERROR] These LINCD packages are imported but they are not listed in package.json:\n- ' +
|
|
989
|
-
missingLincdPackages.
|
|
991
|
+
missingLincdPackages.map(missedKey => {
|
|
992
|
+
const files = results.missing[missedKey];
|
|
993
|
+
return `${missedKey} (${files.length} files: ${files.join(', ')})`;
|
|
994
|
+
}).join(',\n- ')));
|
|
990
995
|
}
|
|
991
996
|
else if (missing.length > 0) {
|
|
992
997
|
resolve(chalk_1.default.redBright('warning: ' + packagePath.split('/').pop() +
|
|
@@ -1055,6 +1060,81 @@ const ensureEnvironmentLoaded = async () => {
|
|
|
1055
1060
|
}
|
|
1056
1061
|
};
|
|
1057
1062
|
exports.ensureEnvironmentLoaded = ensureEnvironmentLoaded;
|
|
1063
|
+
const runMethod = async (packageName, method, options) => {
|
|
1064
|
+
await (0, exports.ensureEnvironmentLoaded)();
|
|
1065
|
+
if (options.spawn) {
|
|
1066
|
+
let lincdConfig = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lincd.config.js')}`).then(s => __importStar(require(s)))).default;
|
|
1067
|
+
//@ts-ignore
|
|
1068
|
+
const ServerClass = (await Promise.resolve().then(() => __importStar(require('lincd-server/shapes/LincdServer')))).LincdServer;
|
|
1069
|
+
await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
|
|
1070
|
+
let server = new ServerClass({
|
|
1071
|
+
loadAppComponent: async () => (await Promise.resolve(`${path_1.default.join(process.cwd(), 'src', 'App')}`).then(s => __importStar(require(s)))).default,
|
|
1072
|
+
...lincdConfig,
|
|
1073
|
+
});
|
|
1074
|
+
//init the server
|
|
1075
|
+
console.log('Initializing server...');
|
|
1076
|
+
server.initOnly().then(() => {
|
|
1077
|
+
//process the backend method call
|
|
1078
|
+
console.log('Running method ' + method);
|
|
1079
|
+
//mock the request and response objects
|
|
1080
|
+
let request = {
|
|
1081
|
+
body: {},
|
|
1082
|
+
query: {},
|
|
1083
|
+
params: {},
|
|
1084
|
+
headers: {},
|
|
1085
|
+
method: 'POST',
|
|
1086
|
+
url: '/' + packageName + '/' + method,
|
|
1087
|
+
};
|
|
1088
|
+
let response = {
|
|
1089
|
+
status: (statusCode) => {
|
|
1090
|
+
console.log('Response status code:', statusCode);
|
|
1091
|
+
return response;
|
|
1092
|
+
},
|
|
1093
|
+
json: (data) => {
|
|
1094
|
+
console.log('Response data:', data);
|
|
1095
|
+
},
|
|
1096
|
+
send: (data) => {
|
|
1097
|
+
console.log('Response data:', data);
|
|
1098
|
+
},
|
|
1099
|
+
};
|
|
1100
|
+
//TODO; allow sending args
|
|
1101
|
+
server.callBackendMethod(packageName, method, [], request, response).then(() => {
|
|
1102
|
+
console.log('Done');
|
|
1103
|
+
process.exit();
|
|
1104
|
+
});
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
else {
|
|
1108
|
+
//reuse the existing running LincdServer instance.
|
|
1109
|
+
//make a HTTP call
|
|
1110
|
+
//'/call/:pkg/:method',
|
|
1111
|
+
fetch(process.env.SITE_ROOT + '/call/' + packageName + '/' + method, {
|
|
1112
|
+
method: 'POST',
|
|
1113
|
+
headers: {
|
|
1114
|
+
'Content-Type': 'application/json',
|
|
1115
|
+
},
|
|
1116
|
+
}).then((response) => {
|
|
1117
|
+
if (!response.ok) {
|
|
1118
|
+
throw new Error('Network response was not ok');
|
|
1119
|
+
}
|
|
1120
|
+
return response.json();
|
|
1121
|
+
}).then((data) => {
|
|
1122
|
+
console.log('Response data:', data);
|
|
1123
|
+
process.exit();
|
|
1124
|
+
}).catch((error) => {
|
|
1125
|
+
var _a;
|
|
1126
|
+
if (error.code === 'ECONNREFUSED' || ((_a = error.cause) === null || _a === void 0 ? void 0 : _a.code) === 'ECONNREFUSED') {
|
|
1127
|
+
console.error(chalk_1.default.red('Could not connect to the backend server. Is it running?'));
|
|
1128
|
+
console.error(`Make sure you ${chalk_1.default.magenta('run "yarn start" in a separate process')} before calling this method.`);
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
console.error('Error during backend call:', error);
|
|
1132
|
+
}
|
|
1133
|
+
process.exit(1);
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
exports.runMethod = runMethod;
|
|
1058
1138
|
const startServer = async (initOnly = false, ServerClass = null) => {
|
|
1059
1139
|
await (0, exports.ensureEnvironmentLoaded)();
|
|
1060
1140
|
let lincdConfig = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lincd.config.js')}`).then(s => __importStar(require(s)))).default;
|
|
@@ -1073,9 +1153,17 @@ const startServer = async (initOnly = false, ServerClass = null) => {
|
|
|
1073
1153
|
ServerClass = (await Promise.resolve().then(() => __importStar(require('lincd-server/shapes/LincdServer')))).LincdServer;
|
|
1074
1154
|
}
|
|
1075
1155
|
await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
|
|
1156
|
+
let appPromise;
|
|
1157
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
1158
|
+
appPromise = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lib', 'App.js')}`).then(s => __importStar(require(s)))).default;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
appPromise = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'src', 'App.js')}`).then(s => __importStar(require(s)))).default;
|
|
1162
|
+
}
|
|
1076
1163
|
let server = new ServerClass({
|
|
1077
|
-
loadAppComponent: async () =>
|
|
1078
|
-
|
|
1164
|
+
loadAppComponent: async () => {
|
|
1165
|
+
return appPromise;
|
|
1166
|
+
}, ...lincdConfig,
|
|
1079
1167
|
});
|
|
1080
1168
|
//Important to use slice, because when using clusers, child processes need to be able to read the same arguments
|
|
1081
1169
|
let args = process.argv.slice(2);
|
|
@@ -1089,10 +1177,16 @@ const startServer = async (initOnly = false, ServerClass = null) => {
|
|
|
1089
1177
|
};
|
|
1090
1178
|
exports.startServer = startServer;
|
|
1091
1179
|
const buildApp = async () => {
|
|
1180
|
+
await (0, exports.buildFrontend)();
|
|
1181
|
+
await (0, exports.buildBackend)();
|
|
1182
|
+
console.log(chalk_1.default.magenta(`✅ ${process.env.NODE_ENV} app build finished`));
|
|
1183
|
+
};
|
|
1184
|
+
exports.buildApp = buildApp;
|
|
1185
|
+
const buildFrontend = async () => {
|
|
1092
1186
|
await (0, exports.ensureEnvironmentLoaded)();
|
|
1093
1187
|
const webpackAppConfig = await (await Promise.resolve().then(() => __importStar(require('./config-webpack-app.js')))).getWebpackAppConfig();
|
|
1094
|
-
console.log(chalk_1.default.magenta(
|
|
1095
|
-
|
|
1188
|
+
console.log(chalk_1.default.magenta(`🛠 Building ${process.env.NODE_ENV} frontend bundles`));
|
|
1189
|
+
await new Promise((resolve, reject) => {
|
|
1096
1190
|
(0, webpack_1.default)(webpackAppConfig, async (err, stats) => {
|
|
1097
1191
|
if (err) {
|
|
1098
1192
|
console.error(err.stack || err);
|
|
@@ -1130,11 +1224,13 @@ const buildApp = async () => {
|
|
|
1130
1224
|
// and if we want to upload to storage, we need set S3_BUCKET_ENDPOINT
|
|
1131
1225
|
if (process.env.NODE_ENV === 'development' || !process.env.S3_BUCKET_ENDPOINT) {
|
|
1132
1226
|
console.warn('Upload build to storage skip in development environment or S3_BUCKET_ENDPOINT is not set');
|
|
1133
|
-
|
|
1227
|
+
return;
|
|
1228
|
+
// process.exit();
|
|
1134
1229
|
}
|
|
1135
1230
|
if (process.env.APP_ENV) {
|
|
1136
1231
|
console.warn('Not uploading to CDN for app builds');
|
|
1137
|
-
|
|
1232
|
+
return;
|
|
1233
|
+
// process.exit();
|
|
1138
1234
|
}
|
|
1139
1235
|
// load the storage config
|
|
1140
1236
|
const storageConfig = await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
|
|
@@ -1150,6 +1246,12 @@ const buildApp = async () => {
|
|
|
1150
1246
|
}
|
|
1151
1247
|
// get all files in the web directory and then upload them to the storage
|
|
1152
1248
|
const files = await (0, utils_js_1.getFiles)(pathDir);
|
|
1249
|
+
console.log(chalk_1.default.magenta(`🕊 Publishing ${files.length} public files to linked file storage`));
|
|
1250
|
+
const clearSpinner = (0, ora_1.default)({
|
|
1251
|
+
discardStdin: true,
|
|
1252
|
+
text: `Publishing ${files.length} public files`,
|
|
1253
|
+
}).start();
|
|
1254
|
+
let counter = 0;
|
|
1153
1255
|
const uploads = files.map(async (filePath) => {
|
|
1154
1256
|
// read file content
|
|
1155
1257
|
const fileContent = await fs_extra_1.default.promises.readFile(filePath);
|
|
@@ -1157,15 +1259,77 @@ const buildApp = async () => {
|
|
|
1157
1259
|
// example: /Users/username/project/www/index.html -> /project/www/index.html
|
|
1158
1260
|
const pathname = filePath.replace(pathDir, `/${rootDirectory}`);
|
|
1159
1261
|
// upload file to storage
|
|
1160
|
-
|
|
1262
|
+
await LinkedFileStorage_1.LinkedFileStorage.saveFile(pathname, fileContent).then(() => {
|
|
1263
|
+
clearSpinner.text = `${counter++}/${files.length}: - Published ${pathname} `;
|
|
1264
|
+
}).catch(console.error);
|
|
1161
1265
|
});
|
|
1162
1266
|
const urls = await Promise.all(uploads);
|
|
1163
|
-
|
|
1164
|
-
process.exit();
|
|
1267
|
+
clearSpinner.succeed(`${urls.length} files uploaded to storage`);
|
|
1165
1268
|
}
|
|
1166
1269
|
});
|
|
1167
1270
|
};
|
|
1168
|
-
exports.
|
|
1271
|
+
exports.buildFrontend = buildFrontend;
|
|
1272
|
+
const buildBackend = async () => {
|
|
1273
|
+
console.log(chalk_1.default.magenta(`🛠 Preparing ${process.env.NODE_ENV} backend`));
|
|
1274
|
+
//run tsc in the backend folder
|
|
1275
|
+
await (0, exports.ensureEnvironmentLoaded)();
|
|
1276
|
+
const sourceFolder = path_1.default.join(process.cwd(), 'src');
|
|
1277
|
+
const targetFolder = path_1.default.join(process.cwd(), 'lib');
|
|
1278
|
+
// Step 1: Clear lib folder
|
|
1279
|
+
const clearSpinner = (0, ora_1.default)({
|
|
1280
|
+
discardStdin: true,
|
|
1281
|
+
text: 'Clearing lib folder',
|
|
1282
|
+
}).start();
|
|
1283
|
+
try {
|
|
1284
|
+
if (fs_extra_1.default.existsSync(targetFolder)) {
|
|
1285
|
+
await fs_extra_1.default.remove(targetFolder);
|
|
1286
|
+
}
|
|
1287
|
+
clearSpinner.succeed('Lib folder cleared');
|
|
1288
|
+
}
|
|
1289
|
+
catch (e) {
|
|
1290
|
+
console.error(e);
|
|
1291
|
+
clearSpinner.fail('Failed to clear lib folder');
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
// Step 2: Compile TS files
|
|
1295
|
+
const compileSpinner = (0, ora_1.default)({
|
|
1296
|
+
discardStdin: true,
|
|
1297
|
+
text: 'Compiling backend TS files',
|
|
1298
|
+
}).start();
|
|
1299
|
+
try {
|
|
1300
|
+
await (0, utils_js_1.execPromise)(`yarn exec tsc`);
|
|
1301
|
+
compileSpinner.succeed('Backend TS files compiled');
|
|
1302
|
+
}
|
|
1303
|
+
catch (e) {
|
|
1304
|
+
console.error(e);
|
|
1305
|
+
compileSpinner.fail('Failed to compile backend TS files');
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
// Step 3: Copy CSS files
|
|
1309
|
+
const copySpinner = (0, ora_1.default)({
|
|
1310
|
+
discardStdin: true,
|
|
1311
|
+
text: 'Copying CSS files',
|
|
1312
|
+
}).start();
|
|
1313
|
+
try {
|
|
1314
|
+
const cssFiles = await (0, utils_js_1.getFiles)(sourceFolder, '.css');
|
|
1315
|
+
await Promise.all(cssFiles.map((file) => {
|
|
1316
|
+
const targetFile = file.replace(sourceFolder, targetFolder);
|
|
1317
|
+
//ensure the target folder exists
|
|
1318
|
+
const targetDir = path_1.default.dirname(targetFile);
|
|
1319
|
+
if (!fs_extra_1.default.existsSync(targetDir)) {
|
|
1320
|
+
fs_extra_1.default.mkdirSync(targetDir, { recursive: true });
|
|
1321
|
+
}
|
|
1322
|
+
return fs_extra_1.default.copyFile(file, targetFile);
|
|
1323
|
+
}));
|
|
1324
|
+
copySpinner.succeed(`${cssFiles.length} CSS files copied`);
|
|
1325
|
+
}
|
|
1326
|
+
catch (e) {
|
|
1327
|
+
console.error(e);
|
|
1328
|
+
copySpinner.fail('Failed to copy CSS files');
|
|
1329
|
+
}
|
|
1330
|
+
return true;
|
|
1331
|
+
};
|
|
1332
|
+
exports.buildBackend = buildBackend;
|
|
1169
1333
|
const upgradePackages = async () => {
|
|
1170
1334
|
await (0, exports.ensureEnvironmentLoaded)();
|
|
1171
1335
|
// let packages = getLincdPackages();
|
|
@@ -1492,6 +1656,10 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
|
|
|
1492
1656
|
});
|
|
1493
1657
|
});
|
|
1494
1658
|
};
|
|
1659
|
+
buildStep({
|
|
1660
|
+
name: 'Checking imports',
|
|
1661
|
+
apply: () => (0, exports.checkImports)(packagePath + '/src'),
|
|
1662
|
+
});
|
|
1495
1663
|
buildStep({
|
|
1496
1664
|
name: 'Compiling ESM',
|
|
1497
1665
|
apply: async () => {
|
|
@@ -1538,16 +1706,12 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
|
|
|
1538
1706
|
return (0, exports.removeOldFiles)(packagePath);
|
|
1539
1707
|
},
|
|
1540
1708
|
});
|
|
1541
|
-
buildStep({
|
|
1542
|
-
name: 'Checking imports',
|
|
1543
|
-
apply: () => (0, exports.checkImports)(packagePath),
|
|
1544
|
-
});
|
|
1545
1709
|
buildStep({
|
|
1546
1710
|
name: 'Checking dependencies',
|
|
1547
1711
|
apply: () => (0, exports.depCheck)(packagePath),
|
|
1548
1712
|
});
|
|
1549
1713
|
let success = await buildProcess.catch(err => {
|
|
1550
|
-
let msg = typeof err === 'string' || err instanceof Error ? err.toString() : (err.error && !err.error.toString().includes(
|
|
1714
|
+
let msg = typeof err === 'string' || err instanceof Error ? err.toString() : (err.error && !err.error.toString().includes('Command failed:') ? err.error : err.stdout + '\n' + err.stderr);
|
|
1551
1715
|
if (logResults) {
|
|
1552
1716
|
spinner.stopAndPersist({
|
|
1553
1717
|
symbol: chalk_1.default.red('✖'),
|
|
@@ -1619,7 +1783,7 @@ const compilePackageCJS = async (packagePath = process.cwd()) => {
|
|
|
1619
1783
|
return res === '';
|
|
1620
1784
|
}).catch(err => {
|
|
1621
1785
|
return {
|
|
1622
|
-
error: err.stdout
|
|
1786
|
+
error: err.stdout,
|
|
1623
1787
|
};
|
|
1624
1788
|
});
|
|
1625
1789
|
};
|
|
@@ -1840,16 +2004,26 @@ var buildUpdated = async function (back, target, target2, useGitForLastModified
|
|
|
1840
2004
|
// let packages = getLocalLincdModules();
|
|
1841
2005
|
let packages = getLocalLincdPackageMap();
|
|
1842
2006
|
// console.log(packages);
|
|
1843
|
-
let jsonldPkgUpdated = await
|
|
2007
|
+
// let jsonldPkgUpdated = await needsRebuilding(
|
|
2008
|
+
// packages.get('lincd-jsonld'),
|
|
2009
|
+
// useGitForLastModified,
|
|
2010
|
+
// );
|
|
1844
2011
|
// let cliPkgUpdated = await needsRebuilding(packages.get('lincd-cli'), useGitForLastModified);
|
|
1845
2012
|
//if either cli or jsonldPkg needs to be rebuilt
|
|
1846
2013
|
// if (jsonldPkgUpdated || cliPkgUpdated) {
|
|
1847
|
-
if (jsonldPkgUpdated)
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
2014
|
+
// if (jsonldPkgUpdated)
|
|
2015
|
+
// {
|
|
2016
|
+
// await execPromise(
|
|
2017
|
+
// 'yarn exec tsc && echo "compiled lincd-jsonld"',
|
|
2018
|
+
// false,
|
|
2019
|
+
// false,
|
|
2020
|
+
// {
|
|
2021
|
+
// cwd: packages.get('lincd-jsonld').path,
|
|
2022
|
+
// },
|
|
2023
|
+
// true,
|
|
2024
|
+
// );
|
|
2025
|
+
// // await execPromise('yarn build-core', false, false, {}, true);
|
|
2026
|
+
// }
|
|
1853
2027
|
let rebuildAllModules = false;
|
|
1854
2028
|
// if (cliPkgUpdated) {
|
|
1855
2029
|
// rebuildAllModules = true;
|
|
@@ -1863,9 +2037,10 @@ var buildUpdated = async function (back, target, target2, useGitForLastModified
|
|
|
1863
2037
|
return async (pkg) => {
|
|
1864
2038
|
// debugInfo('# Checking package ' + pkg.packageName);
|
|
1865
2039
|
let needRebuild = await (0, utils_js_1.needsRebuilding)(pkg, useGitForLastModified);
|
|
1866
|
-
if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated)
|
|
1867
|
-
|
|
1868
|
-
|
|
2040
|
+
// if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated)
|
|
2041
|
+
// {
|
|
2042
|
+
// needRebuild = true;
|
|
2043
|
+
// }
|
|
1869
2044
|
if (needRebuild || rebuildAllModules) {
|
|
1870
2045
|
//TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
|
|
1871
2046
|
// log(packageName+' modified since last commit on '+now.toString());
|
|
@@ -1887,7 +2062,7 @@ var buildUpdated = async function (back, target, target2, useGitForLastModified
|
|
|
1887
2062
|
}
|
|
1888
2063
|
else if (typeof res === 'string') {
|
|
1889
2064
|
warn(chalk_1.default.red('Failed to build ' + pkg.packageName));
|
|
1890
|
-
|
|
2065
|
+
console.log(res);
|
|
1891
2066
|
process.exit(1);
|
|
1892
2067
|
}
|
|
1893
2068
|
})
|
|
@@ -2044,15 +2219,14 @@ var executeCommandForPackage = function (packageName, command) {
|
|
|
2044
2219
|
if (packageDetails) {
|
|
2045
2220
|
log('Executing \'cd ' +
|
|
2046
2221
|
packageDetails.path +
|
|
2047
|
-
' && yarn
|
|
2222
|
+
' && yarn lincd' +
|
|
2048
2223
|
(command ? ' ' + command : '') +
|
|
2049
2224
|
'\'');
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
(command ? ' ' + command : ''));
|
|
2225
|
+
(0, child_process_2.spawn)(process.platform === 'win32' ? 'yarn.cmd' : 'yarn', // Windows quirk
|
|
2226
|
+
['lincd', command || null], {
|
|
2227
|
+
cwd: packageDetails.path,
|
|
2228
|
+
stdio: 'inherit',
|
|
2229
|
+
});
|
|
2056
2230
|
}
|
|
2057
2231
|
else {
|
|
2058
2232
|
warn('Could not find a pkg who\'s name (partially) matched ' +
|