lincd-cli 0.2.11 → 0.2.12
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/.env-cmdrc.json +2 -2
- package/defaults/app-with-backend/.vscode/launch.json +12 -0
- package/defaults/app-with-backend/frontend/scripts/build.js +8 -3
- package/defaults/app-with-backend/frontend/src/App.tsx +11 -11
- package/defaults/app-with-backend/frontend/src/index.tsx +6 -0
- package/defaults/app-with-backend/frontend/src/package.ts +1 -1
- package/defaults/app-with-backend/package.json +3 -3
- package/defaults/package/src/backend.ts +1 -0
- package/defaults/package/src/package.ts +1 -1
- package/lib/cli-methods.js +162 -5
- package/lib/cli.js +3 -0
- package/package.json +6 -4
- package/utils.js +0 -39
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"development": {
|
|
3
3
|
"NODE_ENV": "development",
|
|
4
4
|
"SITE_ROOT": "http://localhost:4000",
|
|
5
5
|
"DATA_ROOT": "http://localhost:4000/data"
|
|
6
6
|
},
|
|
7
|
-
"
|
|
7
|
+
"production": {
|
|
8
8
|
"NODE_ENV": "production",
|
|
9
9
|
"SITE_ROOT": "[define me in .env-cmdrc.json]",
|
|
10
10
|
"DATA_ROOT": "http://localhost:4000/data"
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
const webpack = require('webpack');
|
|
3
3
|
const config = require('lincd-server/site.webpack.config');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const {buildMetadata} = require('lincd-cli/lib/cli-methods');
|
|
6
|
+
|
|
7
|
+
webpack(config, async (err, stats) => {
|
|
7
8
|
if (err) {
|
|
8
9
|
console.error(err.stack || err);
|
|
9
10
|
if (err.details) {
|
|
@@ -17,7 +18,7 @@ webpack(config, (err, stats) => {
|
|
|
17
18
|
console.log('Finished running webpack with errors.');
|
|
18
19
|
info.errors.forEach((e) => console.error(e));
|
|
19
20
|
} else {
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
console.log(
|
|
22
23
|
stats.toString({
|
|
23
24
|
chunks: false,
|
|
@@ -32,6 +33,10 @@ webpack(config, (err, stats) => {
|
|
|
32
33
|
// console.log(
|
|
33
34
|
// chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
|
|
34
35
|
// );
|
|
36
|
+
|
|
37
|
+
//build metadata (JSON-LD files containing metadata about the lincd components, shapes & ontologies in this app or its packages)
|
|
38
|
+
let updatedPaths = await buildMetadata();
|
|
39
|
+
console.log(chalk.green("Updated metadata:\n")+" - "+updatedPaths.map(p => chalk.magenta(p.replace(process.cwd(),''))).join("\n - "));
|
|
35
40
|
}
|
|
36
41
|
process.exit();
|
|
37
42
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {Link} from 'react-router-dom';
|
|
2
|
-
import {lazy, Suspense} from 'react';
|
|
2
|
+
import React,{lazy, Suspense} from 'react';
|
|
3
3
|
import {ErrorBoundary} from 'react-error-boundary';
|
|
4
4
|
import Spinner from './components/Spinner';
|
|
5
5
|
import {Route, Routes} from 'react-router-dom';
|
|
6
|
-
import {Storage} from 'lincd/lib/utils/Storage';
|
|
7
|
-
import {FrontendFileStore} from 'lincd-server/lib/shapes/FrontendFileStore';
|
|
8
6
|
|
|
9
7
|
//Note that by default LINCD apps are set up with support for SCSS (sass) and CSS Modules
|
|
10
8
|
//So any .scss file needs to be imported by itself
|
|
@@ -17,14 +15,15 @@ import style from './App.scss.json';
|
|
|
17
15
|
const Home = lazy(() => import('./pages/Home' /* webpackPrefetch: true */));
|
|
18
16
|
const Page1 = lazy(() => import('./pages/Page1' /* webpackPrefetch: true */));
|
|
19
17
|
|
|
20
|
-
//store all quads in a file on the backend named 'main'
|
|
21
|
-
export const store = new FrontendFileStore('main');
|
|
22
|
-
Storage.setDefaultStore(store);
|
|
23
|
-
|
|
24
18
|
declare var window;
|
|
25
|
-
export default function App({
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
export default function App({
|
|
20
|
+
assets = typeof window !== 'undefined' ? window['assetManifest'] : {},
|
|
21
|
+
//on the frontend data will not be set yet, but it will be present in the initial HTML as a script tag with JSON-LD inside, with the ID: lincd_data
|
|
22
|
+
//so here we read that back to the data variable, so that the rendering (of that same <script> tag) will be identical as the backend
|
|
23
|
+
data = typeof document !== 'undefined' ? document.getElementById('lincd_data')?.innerText : null,
|
|
24
|
+
}) {
|
|
25
|
+
return (
|
|
26
|
+
<Html assets={assets} data={data} title="${name} - LINCD App">
|
|
28
27
|
<Suspense fallback={<Spinner />}>
|
|
29
28
|
<ErrorBoundary FallbackComponent={Error}>
|
|
30
29
|
<Content />
|
|
@@ -91,7 +90,7 @@ function Header() {
|
|
|
91
90
|
);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
function Html({assets, children, title}) {
|
|
93
|
+
function Html({assets, data, children, title}) {
|
|
95
94
|
return (
|
|
96
95
|
<html lang="en">
|
|
97
96
|
{globalThis.document?.head ? (
|
|
@@ -104,6 +103,7 @@ function Html({assets, children, title}) {
|
|
|
104
103
|
<link rel="stylesheet" href={assets['main.css']} />
|
|
105
104
|
{assets['tailwind-cdn'] && <script src={assets['tailwind-cdn']}></script>}
|
|
106
105
|
<title>{title}</title>
|
|
106
|
+
<script id='lincd_data' type='application/ld+json' dangerouslySetInnerHTML={{__html: data}} />
|
|
107
107
|
</head>
|
|
108
108
|
)}
|
|
109
109
|
<body>
|
|
@@ -5,6 +5,12 @@ import {hydrateRoot} from 'react-dom/client';
|
|
|
5
5
|
import {BrowserRouter} from 'react-router-dom';
|
|
6
6
|
import App from './App';
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import {Storage} from 'lincd/lib/utils/Storage';
|
|
9
|
+
import {FrontendFileStore} from 'lincd-server/lib/shapes/FrontendFileStore';
|
|
10
|
+
|
|
11
|
+
//store all quads in a file on the backend named 'main'
|
|
12
|
+
export const store = new FrontendFileStore('main');
|
|
13
|
+
Storage.setDefaultStore(store);
|
|
8
14
|
|
|
9
15
|
hydrateRoot(
|
|
10
16
|
document,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import {linkedPackage} from 'lincd/lib/utils/Module';
|
|
2
|
-
export const {linkedComponent, linkedShape, linkedUtil, linkedOntology, registerPackageExport, registerPackageModule, packageExports, packageName} =
|
|
2
|
+
export const {linkedComponent, linkedSetComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology, registerPackageExport, registerPackageModule, packageExports, packageName} =
|
|
3
3
|
linkedPackage('${hyphen_name}');
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npm run server:dev",
|
|
20
|
-
"build": "env-cmd -e
|
|
21
|
-
"server:dev": "env-cmd -e
|
|
22
|
-
"server:prod": "env-cmd -e
|
|
20
|
+
"build": "env-cmd -e production node frontend/scripts/build.js",
|
|
21
|
+
"server:dev": "env-cmd -e development nodemon --watch ../../modules/lincd-server/lib --watch ../../modules/lincd-server/site.webpack.config.js ./backend/server.js",
|
|
22
|
+
"server:prod": "env-cmd -e production nodemon -e js,json s ./backend/server.js"
|
|
23
23
|
},
|
|
24
24
|
"workspaces" : [
|
|
25
25
|
"packages/*"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//import your providers here (providers only run in the backend)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import {linkedPackage} from 'lincd/lib/utils/Module';
|
|
2
2
|
|
|
3
|
-
export const {linkedComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology, registerPackageModule, registerPackageExport, packageExports} =
|
|
3
|
+
export const {linkedComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology, registerPackageModule, registerPackageExport, packageExports, packageName} =
|
|
4
4
|
linkedPackage('${package_name}');
|
package/lib/cli-methods.js
CHANGED
|
@@ -60,16 +60,34 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
60
60
|
}
|
|
61
61
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
62
62
|
};
|
|
63
|
+
var __values = (this && this.__values) || function(o) {
|
|
64
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
65
|
+
if (m) return m.call(o);
|
|
66
|
+
if (o && typeof o.length === "number") return {
|
|
67
|
+
next: function () {
|
|
68
|
+
if (o && i >= o.length) o = void 0;
|
|
69
|
+
return { value: o && o[i++], done: !o };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
73
|
+
};
|
|
63
74
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
64
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
65
76
|
};
|
|
66
77
|
exports.__esModule = true;
|
|
67
|
-
exports.executeCommandForPackage = exports.addCapacitor = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishUpdated = exports.buildPackage = exports.register = exports.createPackage = exports.createComponent = exports.createSetComponent = exports.createShape = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.createApp = void 0;
|
|
78
|
+
exports.executeCommandForPackage = exports.addCapacitor = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishUpdated = exports.buildPackage = exports.buildMetadata = exports.register = exports.createPackage = exports.createComponent = exports.createSetComponent = exports.createShape = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.createApp = void 0;
|
|
68
79
|
var path_1 = __importDefault(require("path"));
|
|
69
80
|
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
70
81
|
var utils_1 = require("./utils");
|
|
71
82
|
var chalk_1 = __importDefault(require("chalk"));
|
|
72
83
|
var child_process_1 = require("child_process");
|
|
84
|
+
var package_metadata_js_1 = require("lincd-modules/lib/scripts/package-metadata.js");
|
|
85
|
+
var models_1 = require("lincd/lib/models");
|
|
86
|
+
var Module_1 = require("lincd-modules/lib/shapes/Module");
|
|
87
|
+
var env_cmd_1 = require("env-cmd");
|
|
88
|
+
var JSONLDWriter_1 = require("lincd-jsonld/lib/utils/JSONLDWriter");
|
|
89
|
+
var NameSpace_1 = require("lincd/lib/utils/NameSpace");
|
|
90
|
+
var Prefix_1 = require("lincd/lib/utils/Prefix");
|
|
73
91
|
var glob = require('glob');
|
|
74
92
|
var variables = {};
|
|
75
93
|
var open = require('open');
|
|
@@ -94,7 +112,7 @@ var createApp = function (name, basePath) {
|
|
|
94
112
|
// fs.copySync(path.join(__dirname, '..', 'defaults', 'app'), targetFolder);
|
|
95
113
|
log("Creating new LINCD application '" + name + "'");
|
|
96
114
|
//replace variables in some copied files
|
|
97
|
-
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/package.ts', 'frontend/src/App.scss.json', 'frontend/src/components/Spinner.scss.json');
|
|
115
|
+
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/package.ts', 'frontend/src/App.scss.json', '.vscode/launch.json', 'frontend/src/components/Spinner.scss.json');
|
|
98
116
|
return [4 /*yield*/, hasYarnInstalled()];
|
|
99
117
|
case 1:
|
|
100
118
|
hasYarn = _b.sent();
|
|
@@ -294,7 +312,7 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
|
|
|
294
312
|
return [2 /*return*/, runStack(stack)];
|
|
295
313
|
}
|
|
296
314
|
else {
|
|
297
|
-
onStackEnd(results.filter(Boolean));
|
|
315
|
+
onStackEnd(dependencies, results.filter(Boolean));
|
|
298
316
|
}
|
|
299
317
|
return [2 /*return*/];
|
|
300
318
|
}
|
|
@@ -670,7 +688,7 @@ function getSourceFolder(basePath) {
|
|
|
670
688
|
return path_1["default"].join(basePath, 'src');
|
|
671
689
|
}
|
|
672
690
|
else {
|
|
673
|
-
console.warn(
|
|
691
|
+
console.warn('Cannot find source folder');
|
|
674
692
|
return path_1["default"].join(basePath, 'src');
|
|
675
693
|
}
|
|
676
694
|
}
|
|
@@ -939,10 +957,149 @@ var register = function (registryURL) {
|
|
|
939
957
|
}
|
|
940
958
|
};
|
|
941
959
|
exports.register = register;
|
|
960
|
+
var buildMetadata = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
961
|
+
var app, envVars, updatedPaths, localPackagePaths, metadataFolder, _loop_1, localPackagePaths_1, localPackagePaths_1_1, _a, packageCodeName, packagePath, lincdPackagePath, isAppPackage, e_1_1, packageMetaData, metadataFile;
|
|
962
|
+
var e_1, _b;
|
|
963
|
+
return __generator(this, function (_c) {
|
|
964
|
+
switch (_c.label) {
|
|
965
|
+
case 0: return [4 /*yield*/, (0, env_cmd_1.GetEnvVars)({
|
|
966
|
+
envFile: {
|
|
967
|
+
filePath: '.env-cmdrc.json'
|
|
968
|
+
}
|
|
969
|
+
})];
|
|
970
|
+
case 1:
|
|
971
|
+
envVars = _c.sent();
|
|
972
|
+
if (envVars[process.env.NODE_ENV] && envVars[process.env.NODE_ENV].SITE_ROOT) {
|
|
973
|
+
//get the site root of the current environment
|
|
974
|
+
app = models_1.NamedNode.getOrCreate(envVars[process.env.NODE_ENV].SITE_ROOT);
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
warn('Cannot find environment variable SITE_ROOT. Make sure SITE_ROOT is set (likely in .env-cmdrc.json) for the current environment: ' +
|
|
978
|
+
process.env.NODE_ENV);
|
|
979
|
+
app = models_1.NamedNode.create();
|
|
980
|
+
}
|
|
981
|
+
updatedPaths = [];
|
|
982
|
+
localPackagePaths = getLocalPackagePaths();
|
|
983
|
+
metadataFolder = path_1["default"].join(process.cwd(), 'data', 'metadata');
|
|
984
|
+
return [4 /*yield*/, fs_extra_1["default"].ensureDir(metadataFolder)];
|
|
985
|
+
case 2:
|
|
986
|
+
_c.sent(); //{recursive:true} but not needed with fs-extra
|
|
987
|
+
_loop_1 = function (packageCodeName, packagePath, lincdPackagePath, isAppPackage) {
|
|
988
|
+
var errors;
|
|
989
|
+
return __generator(this, function (_d) {
|
|
990
|
+
switch (_d.label) {
|
|
991
|
+
case 0:
|
|
992
|
+
errors = false;
|
|
993
|
+
return [4 /*yield*/, (0, package_metadata_js_1.getPackageMetadata)(packagePath, lincdPackagePath).then(function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
994
|
+
var pkg, lincdApp, packageMetaData_1, metadataFile_1;
|
|
995
|
+
return __generator(this, function (_a) {
|
|
996
|
+
switch (_a.label) {
|
|
997
|
+
case 0:
|
|
998
|
+
if (!(response.errors.length > 0)) return [3 /*break*/, 1];
|
|
999
|
+
// console.log(JSON.stringify(response));
|
|
1000
|
+
warn('Error processing ' + packagePath + ':\n' + response.errors.join('\n'));
|
|
1001
|
+
// throw response
|
|
1002
|
+
errors = true;
|
|
1003
|
+
return [3 /*break*/, 3];
|
|
1004
|
+
case 1:
|
|
1005
|
+
pkg = Module_1.Module.getFromURI(response.packageUri);
|
|
1006
|
+
lincdApp = (0, NameSpace_1.createNameSpace)('http://lincd.org/ont/lincd-app/');
|
|
1007
|
+
Prefix_1.Prefix.add('lincdApp', 'http://lincd.org/ont/lincd-app/');
|
|
1008
|
+
if (isAppPackage) {
|
|
1009
|
+
//Note: this needs to match with LincdWebApp.ownPackage accessor;
|
|
1010
|
+
app.overwrite(lincdApp('ownPackage'), pkg.namedNode);
|
|
1011
|
+
}
|
|
1012
|
+
else {
|
|
1013
|
+
//Note: this needs to match with LincdWebApp.packages accessor;
|
|
1014
|
+
app.set(lincdApp('maintainsPackage'), pkg.namedNode);
|
|
1015
|
+
}
|
|
1016
|
+
packageMetaData_1 = JSON.stringify(response.result, null, 2);
|
|
1017
|
+
metadataFile_1 = path_1["default"].join(metadataFolder, packageCodeName + '.json');
|
|
1018
|
+
return [4 /*yield*/, fs_extra_1["default"].writeFile(metadataFile_1, packageMetaData_1).then(function () {
|
|
1019
|
+
updatedPaths.push(metadataFile_1);
|
|
1020
|
+
})];
|
|
1021
|
+
case 2:
|
|
1022
|
+
_a.sent();
|
|
1023
|
+
_a.label = 3;
|
|
1024
|
+
case 3: return [2 /*return*/];
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
}); })];
|
|
1028
|
+
case 1:
|
|
1029
|
+
_d.sent();
|
|
1030
|
+
return [2 /*return*/];
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1034
|
+
_c.label = 3;
|
|
1035
|
+
case 3:
|
|
1036
|
+
_c.trys.push([3, 8, 9, 10]);
|
|
1037
|
+
localPackagePaths_1 = __values(localPackagePaths), localPackagePaths_1_1 = localPackagePaths_1.next();
|
|
1038
|
+
_c.label = 4;
|
|
1039
|
+
case 4:
|
|
1040
|
+
if (!!localPackagePaths_1_1.done) return [3 /*break*/, 7];
|
|
1041
|
+
_a = __read(localPackagePaths_1_1.value, 4), packageCodeName = _a[0], packagePath = _a[1], lincdPackagePath = _a[2], isAppPackage = _a[3];
|
|
1042
|
+
return [5 /*yield**/, _loop_1(packageCodeName, packagePath, lincdPackagePath, isAppPackage)];
|
|
1043
|
+
case 5:
|
|
1044
|
+
_c.sent();
|
|
1045
|
+
_c.label = 6;
|
|
1046
|
+
case 6:
|
|
1047
|
+
localPackagePaths_1_1 = localPackagePaths_1.next();
|
|
1048
|
+
return [3 /*break*/, 4];
|
|
1049
|
+
case 7: return [3 /*break*/, 10];
|
|
1050
|
+
case 8:
|
|
1051
|
+
e_1_1 = _c.sent();
|
|
1052
|
+
e_1 = { error: e_1_1 };
|
|
1053
|
+
return [3 /*break*/, 10];
|
|
1054
|
+
case 9:
|
|
1055
|
+
try {
|
|
1056
|
+
if (localPackagePaths_1_1 && !localPackagePaths_1_1.done && (_b = localPackagePaths_1["return"])) _b.call(localPackagePaths_1);
|
|
1057
|
+
}
|
|
1058
|
+
finally { if (e_1) throw e_1.error; }
|
|
1059
|
+
return [7 /*endfinally*/];
|
|
1060
|
+
case 10: return [4 /*yield*/, JSONLDWriter_1.JSONLDWriter.stringify(app, process.env.NODE_ENV === 'development')];
|
|
1061
|
+
case 11:
|
|
1062
|
+
packageMetaData = _c.sent();
|
|
1063
|
+
metadataFile = path_1["default"].join(metadataFolder, '_app.json');
|
|
1064
|
+
return [4 /*yield*/, fs_extra_1["default"].writeFile(metadataFile, packageMetaData).then(function () {
|
|
1065
|
+
updatedPaths.push(metadataFile);
|
|
1066
|
+
})];
|
|
1067
|
+
case 12:
|
|
1068
|
+
_c.sent();
|
|
1069
|
+
return [2 /*return*/, updatedPaths];
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
}); };
|
|
1073
|
+
exports.buildMetadata = buildMetadata;
|
|
1074
|
+
function getLocalPackagePaths() {
|
|
1075
|
+
var packagePaths = [];
|
|
1076
|
+
//add the APP package itself
|
|
1077
|
+
var appPackagePath = process.cwd();
|
|
1078
|
+
var appLincdPackagePath = path_1["default"].join(appPackagePath, 'frontend', 'src', 'package.ts');
|
|
1079
|
+
if (fs_extra_1["default"].existsSync(appPackagePath)) {
|
|
1080
|
+
var packageJSON = (0, utils_1.getPackageJSON)(appPackagePath);
|
|
1081
|
+
packagePaths.push([packageJSON.name, appPackagePath, appLincdPackagePath, true]);
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
console.log('Not a LINCD app');
|
|
1085
|
+
}
|
|
1086
|
+
//NOTE: we could also switch to checking 'workspaces'?
|
|
1087
|
+
var packagesFolder = path_1["default"].join(process.cwd(), 'packages');
|
|
1088
|
+
if (fs_extra_1["default"].existsSync(packagesFolder)) {
|
|
1089
|
+
var localPackages = fs_extra_1["default"].readdirSync(packagesFolder);
|
|
1090
|
+
localPackages.forEach(function (packageFolderName) {
|
|
1091
|
+
packagePaths.push([
|
|
1092
|
+
packageFolderName,
|
|
1093
|
+
path_1["default"].join(packagesFolder, packageFolderName),
|
|
1094
|
+
path_1["default"].join(packagesFolder, packageFolderName, 'lib', 'package.js'),
|
|
1095
|
+
]);
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
return packagePaths;
|
|
1099
|
+
}
|
|
942
1100
|
var buildPackage = function (target, target2, packagePath, logResults) {
|
|
943
1101
|
if (packagePath === void 0) { packagePath = process.cwd(); }
|
|
944
1102
|
if (logResults === void 0) { logResults = true; }
|
|
945
|
-
console.trace("How here? ####");
|
|
946
1103
|
if (target == 'production' || target == 'es5' || target == 'es6' || !target) {
|
|
947
1104
|
if (!fs_extra_1["default"].existsSync(path_1["default"].join(packagePath, 'Gruntfile.js'))) {
|
|
948
1105
|
console.warn("No Gruntfile found at ".concat(packagePath, "\\Gruntfile.js. Cannot build."));
|
package/lib/cli.js
CHANGED
|
@@ -76,6 +76,9 @@ program
|
|
|
76
76
|
program.command('build [target] [target2]', { isDefault: true }).action(function (target, target2) {
|
|
77
77
|
(0, cli_methods_1.buildPackage)(target, target2);
|
|
78
78
|
});
|
|
79
|
+
program.command('build-metadata').action(function () {
|
|
80
|
+
(0, cli_methods_1.buildMetadata)();
|
|
81
|
+
});
|
|
79
82
|
program.command('publish-updated').action(function () {
|
|
80
83
|
return (0, cli_methods_1.publishUpdated)();
|
|
81
84
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lincd-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Command line tools for the lincd.js library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -58,9 +58,11 @@
|
|
|
58
58
|
"grunt-webpack": "^5.0.0",
|
|
59
59
|
"license-info-webpack-plugin": "^3.0.0",
|
|
60
60
|
"lincd": "^0.5",
|
|
61
|
+
"lincd-app": "^0.1",
|
|
61
62
|
"lincd-jsonld": "^0.1.13",
|
|
63
|
+
"lincd-modules": "^0.1",
|
|
62
64
|
"load-grunt-tasks": "^5.1.0",
|
|
63
|
-
"mini-css-extract-plugin": "^2.
|
|
65
|
+
"mini-css-extract-plugin": "^2.7.5",
|
|
64
66
|
"open": "^8.4.0",
|
|
65
67
|
"postcss": "^8.4.17",
|
|
66
68
|
"postcss-import": "^15.0.0",
|
|
@@ -72,14 +74,14 @@
|
|
|
72
74
|
"sass": "^1.55.0",
|
|
73
75
|
"sass-loader": "^13.0.2",
|
|
74
76
|
"source-map-loader": "^4.0.0",
|
|
75
|
-
"tailwindcss": "^3.
|
|
77
|
+
"tailwindcss": "^3.2.7",
|
|
76
78
|
"terser-webpack-plugin": "^5.3.6",
|
|
77
79
|
"ts-loader": "^9.4.1",
|
|
78
80
|
"ts-node": "10.7",
|
|
79
81
|
"tsc-hooks": "^1.1.1",
|
|
80
82
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
81
83
|
"typescript": "4.8.4",
|
|
82
|
-
"webpack": "^5.
|
|
84
|
+
"webpack": "^5.76.3",
|
|
83
85
|
"webpack-bundle-analyzer": "^4.6.1",
|
|
84
86
|
"webpack-license-plugin": "^4.2.2"
|
|
85
87
|
},
|
package/utils.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getShapes = exports.getShapesJSONLD = exports.getPackageJSON = void 0;
|
|
4
|
-
var fs = require("fs");
|
|
5
|
-
var path = require("path");
|
|
6
|
-
var SHACL_Shape_1 = require("lincd/lib/shapes/SHACL_Shape");
|
|
7
|
-
var CoreSet_1 = require("lincd/lib/collections/CoreSet");
|
|
8
|
-
var JSONLDWriter_1 = require("lincd-jsonld/lib/JSONLDWriter");
|
|
9
|
-
var getPackageJSON = function (root) {
|
|
10
|
-
if (root === void 0) { root = process.cwd(); }
|
|
11
|
-
var packagePath = path.join(root, 'package.json');
|
|
12
|
-
if (fs.existsSync(packagePath)) {
|
|
13
|
-
return JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
14
|
-
}
|
|
15
|
-
else if (root === process.cwd()) {
|
|
16
|
-
console.warn('Could not find package.json. Make sure you run this command from the root of a lincd module or a lincd yarn workspace');
|
|
17
|
-
process.exit();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.getPackageJSON = getPackageJSON;
|
|
21
|
-
function getShapesJSONLD(moduleExports) {
|
|
22
|
-
return JSONLDWriter_1.JSONLDWriter.stringify(getShapes(moduleExports));
|
|
23
|
-
}
|
|
24
|
-
exports.getShapesJSONLD = getShapesJSONLD;
|
|
25
|
-
function getShapes(moduleExports) {
|
|
26
|
-
var shapes = new CoreSet_1.CoreSet();
|
|
27
|
-
for (var key in moduleExports) {
|
|
28
|
-
var moduleExport = moduleExports[key];
|
|
29
|
-
// console.log(key, Object.keys(moduleExports[key]));
|
|
30
|
-
if (moduleExport.shape) {
|
|
31
|
-
// console.log(Object.keys(moduleExport.shape));
|
|
32
|
-
if (moduleExport.shape && moduleExport.shape instanceof SHACL_Shape_1.SHACL_Shape) {
|
|
33
|
-
shapes.add(moduleExport.shape);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return shapes;
|
|
38
|
-
}
|
|
39
|
-
exports.getShapes = getShapes;
|