lincd-cli 0.1.18 → 0.1.20
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/package.json +1 -1
- package/defaults/app/tsconfig.json +6 -3
- package/defaults/app-with-backend/.env-cmdrc.json +11 -11
- package/defaults/app-with-backend/babel.config.js +3 -9
- package/defaults/app-with-backend/backend/server.js +4 -4
- package/defaults/app-with-backend/frontend/scripts/build.js +16 -13
- package/defaults/app-with-backend/frontend/src/App.tsx +24 -27
- package/defaults/app-with-backend/frontend/src/pages/Home.tsx +6 -5
- package/defaults/app-with-backend/package.json +5 -32
- package/defaults/app-with-backend/tsconfig.json +3 -0
- package/defaults/module/package.json +1 -1
- package/defaults/module/src/components/ExampleComponent.tsx +1 -1
- package/defaults/module/src/ontologies/example-ontology.ts +1 -1
- package/defaults/module/src/{module.ts → package.ts} +2 -2
- package/defaults/module/src/shapes/ExampleShapeClass.ts +1 -1
- package/defaults/module/tsconfig.json +8 -4
- package/defaults/shape.ts +1 -1
- package/lib/cli.js +57 -20
- package/lib/config-grunt.js +17 -1
- package/lib/config-webpack.js +1 -1
- package/lib/plugins/declaration-plugin.js +10 -7
- package/lib/plugins/externalise-modules.js +17 -1
- package/lib/utils.js +43 -22
- package/package.json +4 -3
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
"sourceMap": true,
|
|
5
5
|
"target": "es6",
|
|
6
6
|
"outDir": "lib",
|
|
7
|
-
"declaration":
|
|
7
|
+
"declaration": false,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
9
10
|
"resolveJsonModule": true,
|
|
10
11
|
"downlevelIteration": true,
|
|
11
12
|
"experimentalDecorators": true,
|
|
12
13
|
"skipLibCheck": true,
|
|
13
14
|
"jsx": "react",
|
|
14
|
-
"
|
|
15
|
-
|
|
15
|
+
"paths": {
|
|
16
|
+
"react": ["../node_modules/@types/react","../../../node_modules/@types/react"]
|
|
17
|
+
},
|
|
18
|
+
"baseUrl": "./src"
|
|
16
19
|
},
|
|
17
20
|
"files": ["./src/index.tsx"]
|
|
18
21
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
2
|
+
"dev": {
|
|
3
|
+
"NODE_ENV": "development",
|
|
4
|
+
"SITE_ROOT": "http://localhost:4000",
|
|
5
|
+
"DATA_ROOT": "http://localhost:4000/data"
|
|
6
|
+
},
|
|
7
|
+
"prod": {
|
|
8
|
+
"NODE_ENV": "production",
|
|
9
|
+
"SITE_ROOT": "[define me in .env-cmdrc.json]",
|
|
10
|
+
"DATA_ROOT": "http://localhost:4000/data"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"@babel/preset-typescript",
|
|
6
|
-
],
|
|
7
|
-
plugins: [
|
|
8
|
-
"@babel/plugin-transform-runtime"
|
|
9
|
-
],
|
|
10
|
-
};
|
|
2
|
+
presets: ['@babel/preset-env', ['@babel/preset-react', {runtime: 'automatic'}], '@babel/preset-typescript'],
|
|
3
|
+
plugins: ['@babel/plugin-transform-runtime'],
|
|
4
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
require('@babel/register')({
|
|
3
|
-
const LincdServer = require(
|
|
4
|
-
let server = new LincdServer.LincdServer({
|
|
5
|
-
server.start();
|
|
2
|
+
require('@babel/register')({extensions: ['.ts', '.tsx']});
|
|
3
|
+
const LincdServer = require('lincd-server/lib/shapes/LincdServer');
|
|
4
|
+
let server = new LincdServer.LincdServer({loadAppComponent: () => require('../frontend/src/App').default});
|
|
5
|
+
server.start();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
const webpack = require(
|
|
3
|
-
const config = require(
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const config = require('lincd-server/site.webpack.config');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
webpack(config, (err, stats) => {
|
|
5
|
+
webpack(config, (err, stats) => {
|
|
6
|
+
// [Stats Object](#stats-object)
|
|
6
7
|
if (err) {
|
|
7
8
|
console.error(err.stack || err);
|
|
8
9
|
if (err.details) {
|
|
@@ -17,18 +18,20 @@ webpack(config, (err, stats) => { // [Stats Object](#stats-object)
|
|
|
17
18
|
info.errors.forEach((e) => console.error(e));
|
|
18
19
|
} else {
|
|
19
20
|
// console.log(chalk.green('Finished running webpack.'));
|
|
20
|
-
console.log(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
console.log(
|
|
22
|
+
stats.toString({
|
|
23
|
+
chunks: false,
|
|
24
|
+
assets: true,
|
|
25
|
+
entryPoints: false,
|
|
26
|
+
modules: false,
|
|
27
|
+
moduleAssets: false,
|
|
28
|
+
moduleChunks: false,
|
|
29
|
+
colors: true,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
29
32
|
// console.log(
|
|
30
33
|
// chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
|
|
31
34
|
// );
|
|
32
35
|
}
|
|
33
36
|
process.exit();
|
|
34
|
-
});
|
|
37
|
+
});
|
|
@@ -8,9 +8,9 @@ import {FrontendFileStore} from 'lincd-server/lib/shapes/FrontendFileStore';
|
|
|
8
8
|
|
|
9
9
|
//Note that by default LINCD apps are set up with support for SCSS (sass) and CSS Modules
|
|
10
10
|
//So any .scss file needs to be imported by itself
|
|
11
|
-
import
|
|
11
|
+
import './App.scss';
|
|
12
12
|
//and then the .scss.json file needs to be imported to access the class names (this file will be automatically generated)
|
|
13
|
-
import style from
|
|
13
|
+
import style from './App.scss.json';
|
|
14
14
|
|
|
15
15
|
//In React 18 you can use 'lazy' to import pages only when you need them.
|
|
16
16
|
//This will cause webpack to create multiple bundles, and the right one is automatically loaded
|
|
@@ -79,8 +79,7 @@ function Layout({children}) {
|
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function Header()
|
|
83
|
-
{
|
|
82
|
+
function Header() {
|
|
84
83
|
return (
|
|
85
84
|
<header className={style.header}>
|
|
86
85
|
<h1>${name}</h1>
|
|
@@ -95,29 +94,27 @@ function Header()
|
|
|
95
94
|
function Html({assets, children, title}) {
|
|
96
95
|
return (
|
|
97
96
|
<html lang="en">
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/>
|
|
120
|
-
</body>
|
|
97
|
+
<head>
|
|
98
|
+
<meta charSet="utf-8" />
|
|
99
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
100
|
+
<link rel="shortcut icon" href="/static/favicon.ico" />
|
|
101
|
+
<link rel="stylesheet" href={assets['main.css']} />
|
|
102
|
+
{assets['tailwind-cdn'] && <script src={assets['tailwind-cdn']}></script>}
|
|
103
|
+
<title>{title}</title>
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
<noscript
|
|
107
|
+
dangerouslySetInnerHTML={{
|
|
108
|
+
__html: `<b>Enable JavaScript to run this app.</b>`,
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
{children}
|
|
112
|
+
<script
|
|
113
|
+
dangerouslySetInnerHTML={{
|
|
114
|
+
__html: `assetManifest = ${JSON.stringify(assets)};`,
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
</body>
|
|
121
118
|
</html>
|
|
122
119
|
);
|
|
123
120
|
}
|
|
@@ -3,12 +3,13 @@ export default function Home() {
|
|
|
3
3
|
<div>
|
|
4
4
|
<h2>Get started</h2>
|
|
5
5
|
<p>
|
|
6
|
-
Your LINCD App is ready to go
|
|
6
|
+
Your LINCD App is ready to go!
|
|
7
|
+
<br />
|
|
7
8
|
To edit this file, open:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
</p>
|
|
10
|
+
<code>
|
|
11
|
+
<pre>/frontend/src/pages/Home.tsx</pre>
|
|
12
|
+
</code>
|
|
12
13
|
</div>
|
|
13
14
|
);
|
|
14
15
|
}
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"lincd",
|
|
21
21
|
"linked code",
|
|
22
22
|
"linked data",
|
|
23
|
+
"structured data",
|
|
24
|
+
"RDF",
|
|
23
25
|
"semantic web",
|
|
24
26
|
"web3"
|
|
25
27
|
],
|
|
@@ -31,48 +33,19 @@
|
|
|
31
33
|
"@babel/preset-react": "^7.18.6",
|
|
32
34
|
"@babel/preset-typescript": "^7.18.6",
|
|
33
35
|
"@babel/register": "^7.18.9",
|
|
34
|
-
"
|
|
35
|
-
"babel-loader": "^8.2.5",
|
|
36
|
-
"fork-ts-checker-webpack-plugin": "6.2.6",
|
|
37
|
-
"is-object": "^1.0.2",
|
|
38
|
-
"lincd": "^0.3",
|
|
36
|
+
"lincd": "^0.3.6",
|
|
39
37
|
"lincd-jsonld": "^0.1.5",
|
|
40
38
|
"lincd-server": "^0.1",
|
|
41
39
|
"react": "^18.2",
|
|
42
40
|
"react-dom": "^18.2",
|
|
43
41
|
"react-error-boundary": "^3.1.3",
|
|
44
|
-
"react-
|
|
45
|
-
"react-refresh-typescript": "^2.0.7",
|
|
46
|
-
"react-router-dom": "^6.3.0",
|
|
47
|
-
"webpack-dev-middleware": "^5.3.3",
|
|
48
|
-
"webpack-hot-middleware": "^2.25.2"
|
|
42
|
+
"react-router-dom": "^6.3.0"
|
|
49
43
|
},
|
|
50
44
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^17.0.30",
|
|
52
45
|
"@types/react": "^18.0.17",
|
|
53
46
|
"@types/react-dom": "^18.0.6",
|
|
54
|
-
"chalk": "4.1.2",
|
|
55
|
-
"classnames": "^2.3.1",
|
|
56
|
-
"compression": "^1.7.4",
|
|
57
|
-
"concurrently": "^5.3.0",
|
|
58
|
-
"cors": "^2.8.5",
|
|
59
|
-
"cross-env": "^7.0.3",
|
|
60
47
|
"env-cmd": "^10.1.0",
|
|
61
|
-
"css-loader": "^5.2.7",
|
|
62
|
-
"express": "^4.17.1",
|
|
63
|
-
"lincd-cli": "^0.1",
|
|
64
|
-
"mini-css-extract-plugin": "^1.3.3",
|
|
65
48
|
"nodemon": "^2.0.6",
|
|
66
|
-
"
|
|
67
|
-
"postcss-import": "^14.1.0",
|
|
68
|
-
"postcss-modules": "",
|
|
69
|
-
"postcss-nested": "^5.0.6",
|
|
70
|
-
"prettier": "1.19.1",
|
|
71
|
-
"resolve": "1.12.0",
|
|
72
|
-
"sass-loader": "^10.0",
|
|
73
|
-
"tailwindcss": "^3.0.24",
|
|
74
|
-
"typescript": "4.6.4",
|
|
75
|
-
"webpack": "^5.74.0",
|
|
76
|
-
"webpack-cli": "^4.2.0"
|
|
49
|
+
"lincd-cli": "^0.1"
|
|
77
50
|
}
|
|
78
51
|
}
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"resolveJsonModule": true,
|
|
12
12
|
"jsx": "react-jsx",
|
|
13
13
|
"types": ["node", "react", "react-dom"],
|
|
14
|
+
"paths": {
|
|
15
|
+
"react": ["../node_modules/@types/react","../../../node_modules/@types/react"]
|
|
16
|
+
},
|
|
14
17
|
"pretty": true
|
|
15
18
|
},
|
|
16
19
|
"files": ["./frontend/src/index.tsx"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {ExampleShapeClass} from "../shapes/ExampleShapeClass";
|
|
3
|
-
import {linkedComponentClass,linkedComponent} from '../
|
|
3
|
+
import {linkedComponentClass,linkedComponent} from '../package';
|
|
4
4
|
import {LinkedComponentClass} from 'lincd/lib/utils/LinkedComponentClass';
|
|
5
5
|
|
|
6
6
|
export const ExampleComponent = linkedComponent<ExampleShapeClass>(ExampleShapeClass, ({source, sourceShape}) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {NamedNode} from 'lincd/lib/models';
|
|
2
2
|
import {JSONLD} from 'lincd-jsonld/lib/utils/JSONLD';
|
|
3
3
|
import {createNameSpace} from 'lincd/lib/utils/NameSpace';
|
|
4
|
-
import {linkedOntology} from '../
|
|
4
|
+
import {linkedOntology} from '../package';
|
|
5
5
|
//import all the exports of this file as one variable called _this (we need this at the end)
|
|
6
6
|
import * as _this from './${hyphen_name}';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {linkedPackage} from 'lincd/lib/utils/Module';
|
|
2
2
|
|
|
3
3
|
export const {linkedComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology} =
|
|
4
|
-
|
|
4
|
+
linkedPackage('${module_name}');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Shape} from 'lincd/lib/shapes/Shape';
|
|
2
2
|
import {Literal, NamedNode} from 'lincd/lib/models';
|
|
3
|
-
import {linkedShape} from '../
|
|
3
|
+
import {linkedShape} from '../package';
|
|
4
4
|
import {literalProperty} from 'lincd/lib/utils/ShapeDecorators';
|
|
5
5
|
import {${camel_name}} from '../ontologies/${hyphen_name}';
|
|
6
6
|
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
"module": "commonjs",
|
|
4
4
|
"sourceMap": true,
|
|
5
5
|
"target": "es6",
|
|
6
|
+
"moduleResolution": "node",
|
|
6
7
|
"outDir": "lib",
|
|
7
8
|
"declaration": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
8
11
|
"esModuleInterop": true,
|
|
9
12
|
"resolveJsonModule": true,
|
|
10
13
|
"downlevelIteration": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
14
|
"jsx": "react",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
15
|
+
"types": ["node"],
|
|
16
|
+
"paths": {
|
|
17
|
+
"react": ["../node_modules/@types/react","../../../node_modules/@types/react"]
|
|
18
|
+
},
|
|
19
|
+
"baseUrl": "./src"
|
|
16
20
|
},
|
|
17
21
|
"files": ["./src/index.ts"]
|
|
18
22
|
}
|
package/defaults/shape.ts
CHANGED
package/lib/cli.js
CHANGED
|
@@ -36,6 +36,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
40
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
41
|
+
if (!m) return o;
|
|
42
|
+
var i = m.call(o), r, ar = [], e;
|
|
43
|
+
try {
|
|
44
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
45
|
+
}
|
|
46
|
+
catch (error) { e = { error: error }; }
|
|
47
|
+
finally {
|
|
48
|
+
try {
|
|
49
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
50
|
+
}
|
|
51
|
+
finally { if (e) throw e.error; }
|
|
52
|
+
}
|
|
53
|
+
return ar;
|
|
54
|
+
};
|
|
39
55
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
40
56
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
41
57
|
if (ar || !(i in from)) {
|
|
@@ -87,7 +103,7 @@ program
|
|
|
87
103
|
.argument('<suggested-prefix>', 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object')
|
|
88
104
|
.argument('[uribase]', "Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this module");
|
|
89
105
|
program.command('register-local', { hidden: true }).action(function () {
|
|
90
|
-
register('http://localhost:
|
|
106
|
+
register('http://localhost:4101');
|
|
91
107
|
});
|
|
92
108
|
program.command('register-dev', { hidden: true }).action(function () {
|
|
93
109
|
register('https://dev-registry.lincd.org');
|
|
@@ -197,6 +213,9 @@ function developModule(target, mode) {
|
|
|
197
213
|
}
|
|
198
214
|
function checkWorkspaces(rootPath, workspaces, res) {
|
|
199
215
|
// console.log('checking workspaces at '+rootPath+": "+workspaces.toString());
|
|
216
|
+
if (workspaces.packages) {
|
|
217
|
+
workspaces = workspaces.packages;
|
|
218
|
+
}
|
|
200
219
|
workspaces.forEach(function (workspace) {
|
|
201
220
|
var workspacePath = path.join(rootPath, workspace.replace('/*', ''));
|
|
202
221
|
if (workspace.indexOf('/*') !== -1) {
|
|
@@ -224,7 +243,7 @@ function checkModulePath(rootPath, modulePath, res) {
|
|
|
224
243
|
if (pack && pack.workspaces) {
|
|
225
244
|
checkWorkspaces(modulePath, pack.workspaces, res);
|
|
226
245
|
}
|
|
227
|
-
else if (
|
|
246
|
+
else if (pack && pack.lincd === true) {
|
|
228
247
|
res.push({
|
|
229
248
|
path: modulePath,
|
|
230
249
|
moduleName: pack.name,
|
|
@@ -321,7 +340,7 @@ function buildAll(target, target2) {
|
|
|
321
340
|
});
|
|
322
341
|
if (dependentModules.length > 0) {
|
|
323
342
|
failedModules.push(module.moduleName);
|
|
324
|
-
|
|
343
|
+
printBuildResults(failedModules, done);
|
|
325
344
|
console.log(chalk.magenta('Stopping build process because an error occurred whilst building ' +
|
|
326
345
|
module.moduleName +
|
|
327
346
|
', which ' +
|
|
@@ -338,11 +357,19 @@ function buildAll(target, target2) {
|
|
|
338
357
|
}
|
|
339
358
|
})
|
|
340
359
|
.then(function (res) {
|
|
360
|
+
// console.log("RESULT: ",res);
|
|
361
|
+
// if(res && res.includes("Aborted due to warnings"))
|
|
362
|
+
// {
|
|
363
|
+
// failedModules.push(module.moduleName);
|
|
364
|
+
// }
|
|
365
|
+
// else
|
|
366
|
+
// {
|
|
341
367
|
done.add(module);
|
|
368
|
+
// }
|
|
342
369
|
modulesLeft--;
|
|
343
370
|
log(chalk.magenta(modulesLeft + ' modules left'));
|
|
344
|
-
if (modulesLeft == 0
|
|
345
|
-
|
|
371
|
+
if (modulesLeft == 0) {
|
|
372
|
+
printBuildResults(failedModules, done);
|
|
346
373
|
}
|
|
347
374
|
return res;
|
|
348
375
|
});
|
|
@@ -447,7 +474,7 @@ function getLincdModules(rootPath) {
|
|
|
447
474
|
var pack = (0, utils_1.getPackageJSON)();
|
|
448
475
|
if (!pack || !pack.workspaces) {
|
|
449
476
|
for (var i = 0; i <= 3; i++) {
|
|
450
|
-
rootPath = path.join.apply(path, __spreadArray([process.cwd()], Array(i).fill('..'), false));
|
|
477
|
+
rootPath = path.join.apply(path, __spreadArray([process.cwd()], __read(Array(i).fill('..')), false));
|
|
451
478
|
pack = (0, utils_1.getPackageJSON)(rootPath);
|
|
452
479
|
if (pack && pack.workspaces) {
|
|
453
480
|
// log('Found workspace at '+packagePath);
|
|
@@ -657,7 +684,7 @@ var replaceVariablesInFilesWithRoot = function (root) {
|
|
|
657
684
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
658
685
|
files[_i - 1] = arguments[_i];
|
|
659
686
|
}
|
|
660
|
-
return replaceVariablesInFiles.apply(void 0, files.map(function (f) { return path.join(root, f); }));
|
|
687
|
+
return replaceVariablesInFiles.apply(void 0, __spreadArray([], __read(files.map(function (f) { return path.join(root, f); })), false));
|
|
661
688
|
};
|
|
662
689
|
var hasYarnInstalled = function () {
|
|
663
690
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -753,7 +780,7 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
753
780
|
console.warn('Please provide a name as the first argument');
|
|
754
781
|
return [2 /*return*/];
|
|
755
782
|
}
|
|
756
|
-
_a = name.match(/(@[\w\-]+\/)?([\w\-]+)/), packageName = _a[0], scope = _a[1], cleanPackageName = _a[2];
|
|
783
|
+
_a = __read(name.match(/(@[\w\-]+\/)?([\w\-]+)/), 3), packageName = _a[0], scope = _a[1], cleanPackageName = _a[2];
|
|
757
784
|
targetFolder = ensureFolderExists(basePath, cleanPackageName);
|
|
758
785
|
if (!uriBase) {
|
|
759
786
|
uriBase = 'http://lincd.org/ont/' + name;
|
|
@@ -776,7 +803,7 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
776
803
|
'src/index.ts',
|
|
777
804
|
'package.json',
|
|
778
805
|
'Gruntfile.js',
|
|
779
|
-
'src/
|
|
806
|
+
'src/package.ts',
|
|
780
807
|
'src/shapes/ExampleShapeClass.ts',
|
|
781
808
|
'src/ontologies/example-ontology.ts',
|
|
782
809
|
'src/data/example-ontology.json',
|
|
@@ -795,11 +822,11 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
795
822
|
'src/data/example-ontology.json.d.ts',
|
|
796
823
|
].forEach(function (f) {
|
|
797
824
|
var parts = f.split('/');
|
|
798
|
-
var newParts = __spreadArray([], parts,
|
|
799
|
-
var _a = newParts.pop().split('.'), name = _a[0], extensions = _a.slice(1);
|
|
825
|
+
var newParts = __spreadArray([], __read(parts), false);
|
|
826
|
+
var _a = __read(newParts.pop().split('.')), name = _a[0], extensions = _a.slice(1);
|
|
800
827
|
var newName = hyphenName + '.' + extensions.join('.');
|
|
801
|
-
console.log('rename ', path.join(targetFolder, f), path.join.apply(path, __spreadArray(__spreadArray([targetFolder], newParts, false), [newName], false)));
|
|
802
|
-
fs.renameSync(path.join(targetFolder, f), path.join.apply(path, __spreadArray(__spreadArray([targetFolder], newParts, false), [newName], false)));
|
|
828
|
+
console.log('rename ', path.join(targetFolder, f), path.join.apply(path, __spreadArray(__spreadArray([targetFolder], __read(newParts), false), [newName], false)));
|
|
829
|
+
fs.renameSync(path.join(targetFolder, f), path.join.apply(path, __spreadArray(__spreadArray([targetFolder], __read(newParts), false), [newName], false)));
|
|
803
830
|
});
|
|
804
831
|
return [4 /*yield*/, execPromise('yarn --version')["catch"](function (err) {
|
|
805
832
|
console.log('yarn probably not working');
|
|
@@ -890,17 +917,17 @@ var buildFailed = function (output) {
|
|
|
890
917
|
// require('lincd');
|
|
891
918
|
//TODO: replace with actual index file from package.json, or tsconfig
|
|
892
919
|
let indexExports = require(process.cwd() + '/lib/index.js');
|
|
893
|
-
if(indexExports.
|
|
920
|
+
if(indexExports.packageExports)
|
|
894
921
|
{
|
|
895
|
-
let shapeJSONLD = await getShapesJSONLD(indexExports.
|
|
896
|
-
console.log(indexExports.
|
|
922
|
+
let shapeJSONLD = await getShapesJSONLD(indexExports.packageExports);
|
|
923
|
+
console.log(indexExports.packageExports);
|
|
897
924
|
console.log(shapeJSONLD);
|
|
898
925
|
console.log(chalk.bold(chalk.green(moduleName+'/dist/shapes.json')));
|
|
899
926
|
return fs.writeFile(path.join('dist', 'shapes.json'), shapeJSONLD);
|
|
900
927
|
}
|
|
901
928
|
else
|
|
902
929
|
{
|
|
903
|
-
console.warn("Invalid LINCD module. Index file should export a
|
|
930
|
+
console.warn("Invalid LINCD module. Index file should export a packageExports object. See examples.")
|
|
904
931
|
}
|
|
905
932
|
|
|
906
933
|
} else {
|
|
@@ -914,7 +941,11 @@ var register = function (registryURL) {
|
|
|
914
941
|
var moduleName = pack.name;
|
|
915
942
|
var author = pack.author;
|
|
916
943
|
var description = pack.description;
|
|
917
|
-
|
|
944
|
+
var authorName = pack.author;
|
|
945
|
+
if (pack.author.name) {
|
|
946
|
+
authorName = pack.author.name;
|
|
947
|
+
}
|
|
948
|
+
console.log(chalk.cyan('registering ' + authorName + "'s module, " + moduleName + ' ' + version + ' in the LINCD registry'));
|
|
918
949
|
return fetch(registryURL + '/register', {
|
|
919
950
|
method: 'POST',
|
|
920
951
|
headers: {
|
|
@@ -930,6 +961,9 @@ var register = function (registryURL) {
|
|
|
930
961
|
}
|
|
931
962
|
else if (json.result) {
|
|
932
963
|
console.log(chalk.cyan('Response: ') + json.result);
|
|
964
|
+
if (json.warning) {
|
|
965
|
+
console.log(chalk.red('Warning: ') + json.warning);
|
|
966
|
+
}
|
|
933
967
|
}
|
|
934
968
|
})["catch"](function (err) {
|
|
935
969
|
console.warn(chalk.red('Warning: ') + 'Could not connect to LINCD registry');
|
|
@@ -1183,8 +1217,11 @@ var buildUpdated = function (back, target, target2, test) {
|
|
|
1183
1217
|
});
|
|
1184
1218
|
// });
|
|
1185
1219
|
};
|
|
1186
|
-
var
|
|
1187
|
-
log('
|
|
1220
|
+
var printBuildResults = function (failed, done) {
|
|
1221
|
+
log('Build results: '
|
|
1222
|
+
+ chalk.green(__spreadArray([], __read(done), false).map(function (m) { return m.moduleName; }).join(', '))
|
|
1223
|
+
+ (failed.length > 0 ? (', ' + chalk.red(failed.join(', '))) : '')
|
|
1224
|
+
+ '\n');
|
|
1188
1225
|
};
|
|
1189
1226
|
var executeCommandForEachModule = function (modules, command, includedSpaces, excludedSpaces) {
|
|
1190
1227
|
//if a specific set of modules is given
|
package/lib/config-grunt.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
19
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
20
|
if (ar || !(i in from)) {
|
|
@@ -56,7 +72,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
56
72
|
grunt.registerTask('dev', targetES6 ? ['prepare-build', 'dev-es6'] : ['prepare-build', 'dev-es5']);
|
|
57
73
|
grunt.registerTask('build', targets.map(function (target) { return 'build-' + target; }));
|
|
58
74
|
if (buildFrontend) {
|
|
59
|
-
grunt.registerTask('build-frontend', __spreadArray(['prepare-build'], targets.map(function (target) { return 'webpack:build-' + target; }),
|
|
75
|
+
grunt.registerTask('build-frontend', __spreadArray(['prepare-build'], __read(targets.map(function (target) { return 'webpack:build-' + target; })), false));
|
|
60
76
|
}
|
|
61
77
|
grunt.registerTask('build-production', (0, utils_1.flatten)([
|
|
62
78
|
'clean:lib',
|
package/lib/config-webpack.js
CHANGED
|
@@ -110,7 +110,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
110
110
|
if (config.analyse) {
|
|
111
111
|
plugins.push(new BundleAnalyzerPlugin());
|
|
112
112
|
}
|
|
113
|
-
if (es6 || config.declarations === true) {
|
|
113
|
+
if ((es6 || config.declarations === true) && !config.declarations === false) {
|
|
114
114
|
plugins.push(new declaration_plugin_1["default"]({
|
|
115
115
|
out: (config.filename ? config.filename : cleanModuleName) + '.d.ts',
|
|
116
116
|
root: config.outputPath ? config.outputPath : './lib/',
|
|
@@ -60,13 +60,16 @@ var DeclarationPlugin = /** @class */ (function () {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
if (Object.keys(_this.declarationFiles).length == 0) {
|
|
63
|
-
_this.
|
|
64
|
-
_this.
|
|
65
|
-
_this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
_this.debug('Didn\'t build .d.ts file because no declaration assets were emitted during build process.'.yellow);
|
|
64
|
+
_this.debug('This is likely because webpack is using cache.'.yellow);
|
|
65
|
+
_this.debug('In watch mode, declaration assets will be emitted once you change a ts(x) source file'.yellow);
|
|
66
|
+
// this.log('Make sure to run '.yellow + 'tsc'.blue + ' before running webpack'.yellow);
|
|
67
|
+
// this.log(
|
|
68
|
+
// 'Make sure to test for '.yellow +
|
|
69
|
+
// '/(?!.*.d.ts).ts(x?)$/'.blue.bold['underline'] +
|
|
70
|
+
// ' in the ts-loader in webpack.config.json'.yellow,
|
|
71
|
+
// );
|
|
72
|
+
// this.log(('Assets: ' + Object.keys(compilation.assets).toString()).yellow);
|
|
70
73
|
// callback();
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
exports.__esModule = true;
|
|
3
19
|
/// <reference path="colors.d.ts" />
|
|
4
20
|
var colors = require("colors");
|
|
@@ -94,7 +110,7 @@ var externaliseModules = function (config, es5) {
|
|
|
94
110
|
// --> match[0] = @dacore/some-mod
|
|
95
111
|
// --> match[1] = @dacore
|
|
96
112
|
// --> match[2] = some-mod
|
|
97
|
-
var _b = request.match(/(@[\w\-]+\/)?([\w\-]+)/), packageName = _b[0], scope = _b[1], cleanPackageName = _b[2];
|
|
113
|
+
var _b = __read(request.match(/(@[\w\-]+\/)?([\w\-]+)/), 3), packageName = _b[0], scope = _b[1], cleanPackageName = _b[2];
|
|
98
114
|
//if this module is listed as internal module in the config (or if we internalize all modules with '*')
|
|
99
115
|
if (config && config.internals && (config.internals.indexOf(packageName) !== -1 || config.internals === '*')) {
|
|
100
116
|
//then don't exclude and don't continue this function
|
package/lib/utils.js
CHANGED
|
@@ -22,16 +22,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
+
if (!m) return o;
|
|
28
|
+
var i = m.call(o), r, ar = [], e;
|
|
29
|
+
try {
|
|
30
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
+
}
|
|
32
|
+
catch (error) { e = { error: error }; }
|
|
33
|
+
finally {
|
|
34
|
+
try {
|
|
35
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
+
}
|
|
37
|
+
finally { if (e) throw e.error; }
|
|
38
|
+
}
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
42
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43
|
+
if (ar || !(i in from)) {
|
|
44
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
45
|
+
ar[i] = from[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
49
|
+
};
|
|
25
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
52
|
};
|
|
28
53
|
exports.__esModule = true;
|
|
29
|
-
exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.
|
|
54
|
+
exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.getPackageJSON = void 0;
|
|
30
55
|
var fs = __importStar(require("fs"));
|
|
31
56
|
var path = __importStar(require("path"));
|
|
32
|
-
var SHACL_1 = require("lincd/lib/shapes/SHACL");
|
|
33
|
-
var CoreSet_1 = require("lincd/lib/collections/CoreSet");
|
|
34
|
-
var JSONLDWriter_1 = require("lincd-jsonld/lib/utils/JSONLDWriter");
|
|
35
57
|
var chalk_1 = __importDefault(require("chalk"));
|
|
36
58
|
var getPackageJSON = function (root, error) {
|
|
37
59
|
if (root === void 0) { root = process.cwd(); }
|
|
@@ -48,25 +70,24 @@ var getPackageJSON = function (root, error) {
|
|
|
48
70
|
}
|
|
49
71
|
};
|
|
50
72
|
exports.getPackageJSON = getPackageJSON;
|
|
51
|
-
function getShapesJSONLD(
|
|
52
|
-
|
|
73
|
+
/*export function getShapesJSONLD(packageExports): Promise<string> {
|
|
74
|
+
// return JSONLDWriter.stringify(getShapes(packageExports));
|
|
53
75
|
}
|
|
54
|
-
|
|
55
|
-
function getShapes(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
76
|
+
|
|
77
|
+
export function getShapes(packageExports): CoreSet<SHACL_Shape> {
|
|
78
|
+
let shapes = new CoreSet<SHACL_Shape>();
|
|
79
|
+
for (var key in packageExports) {
|
|
80
|
+
let moduleExport = packageExports[key];
|
|
81
|
+
// console.log(key, Object.keys(packageExports[key]));
|
|
82
|
+
if (moduleExport.shape) {
|
|
83
|
+
// console.log(Object.keys(moduleExport.shape));
|
|
84
|
+
if (moduleExport.shape && moduleExport.shape instanceof SHACL_Shape) {
|
|
85
|
+
shapes.add(moduleExport.shape);
|
|
86
|
+
}
|
|
66
87
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
88
|
+
}
|
|
89
|
+
return shapes;
|
|
90
|
+
}*/
|
|
70
91
|
function generateScopedName(name, filename, css) {
|
|
71
92
|
var path = require('path');
|
|
72
93
|
var file = path.basename(filename, '.scss');
|
|
@@ -112,7 +133,7 @@ function debug(config) {
|
|
|
112
133
|
messages[_i - 1] = arguments[_i];
|
|
113
134
|
}
|
|
114
135
|
if (config.debug) {
|
|
115
|
-
log.apply(void 0, messages);
|
|
136
|
+
log.apply(void 0, __spreadArray([], __read(messages), false));
|
|
116
137
|
}
|
|
117
138
|
}
|
|
118
139
|
exports.debug = debug;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lincd-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Command line tools for the lincd.js library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"lincd": "lib/cli.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@babel/core": "^7.19.3",
|
|
28
29
|
"@babel/plugin-proposal-decorators": "^7.19.3",
|
|
29
30
|
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
30
31
|
"@babel/preset-env": "^7.19.3",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"grunt-ts": "^6.0.0-beta.22",
|
|
51
52
|
"grunt-webpack": "^5.0.0",
|
|
52
53
|
"license-info-webpack-plugin": "^3.0.0",
|
|
53
|
-
"lincd": "^0.3",
|
|
54
|
+
"lincd": "^0.3.6",
|
|
54
55
|
"lincd-jsonld": "^0.1.4",
|
|
55
56
|
"load-grunt-tasks": "^5.1.0",
|
|
56
57
|
"mini-css-extract-plugin": "^2.6.1",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"ts-node": "10.7",
|
|
72
73
|
"tsc-hooks": "^1.1.1",
|
|
73
74
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
74
|
-
"typescript": "4.
|
|
75
|
+
"typescript": "4.8.4",
|
|
75
76
|
"webpack": "^5.74.0",
|
|
76
77
|
"webpack-bundle-analyzer": "^4.6.1",
|
|
77
78
|
"webpack-license-plugin": "^4.2.2"
|