lincd-cli 0.1.13 → 0.1.15
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/src/App.scss +3 -0
- package/defaults/app/src/App.tsx +5 -0
- package/defaults/app/src/index.tsx +10 -0
- package/defaults/app/tsconfig.json +18 -0
- package/defaults/{app3/.env-cmdrc → app-with-backend/.env-cmdrc.json} +1 -1
- package/defaults/app-with-backend/babel.config.js +10 -0
- package/defaults/app-with-backend/backend/server.js +5 -0
- package/defaults/{app3 → app-with-backend}/frontend/scripts/build.js +15 -15
- package/defaults/app-with-backend/frontend/src/App.scss +45 -0
- package/defaults/app-with-backend/frontend/src/App.scss.json +1 -0
- package/defaults/app-with-backend/frontend/src/App.tsx +123 -0
- package/defaults/app-with-backend/frontend/src/components/Spinner.scss +16 -0
- package/defaults/app-with-backend/frontend/src/components/Spinner.scss.json +1 -0
- package/defaults/app-with-backend/frontend/src/components/Spinner.tsx +10 -0
- package/defaults/app-with-backend/frontend/src/index.tsx +16 -0
- package/defaults/app-with-backend/frontend/src/pages/Home.tsx +14 -0
- package/defaults/app-with-backend/frontend/src/pages/Page1.tsx +7 -0
- package/defaults/{app2 → app-with-backend}/frontend/web/favicon.ico +0 -0
- package/defaults/{app3 → app-with-backend}/package.json +12 -11
- package/defaults/app-with-backend/tsconfig.json +17 -0
- package/defaults/module/Gruntfile.js +16 -0
- package/defaults/module/src/components/ExampleComponent.tsx +20 -0
- package/defaults/module/src/data/example-ontology.json +20 -0
- package/defaults/module/src/data/example-ontology.json.d.ts +1 -0
- package/defaults/module/src/index.ts +7 -0
- package/defaults/module/src/module.ts +4 -0
- package/defaults/module/src/ontologies/example-ontology.ts +36 -0
- package/defaults/module/src/shapes/ExampleShapeClass.ts +29 -0
- package/defaults/module/tsconfig-es5.json +18 -0
- package/defaults/module/tsconfig.json +18 -0
- package/lib/cli.js +3 -3
- package/lib/config-grunt.js +1 -4
- package/lib/config-webpack.js +74 -40
- package/lib/plugins/declaration-plugin.js +75 -69
- package/lib/plugins/externalise-modules.js +30 -14
- package/package.json +24 -18
- package/defaults/app2/frontend/scripts/build.js +0 -100
- package/defaults/app2/package.json +0 -71
- package/defaults/app2/tailwind.config.js +0 -3
- package/defaults/app3/backend/server.js +0 -5
- package/defaults/app3/frontend/scripts/webpack-config.js +0 -121
- package/defaults/app3/frontend/web/favicon.ico +0 -0
- package/defaults/app3/tailwind.config.js +0 -3
- package/plugins/declaration-plugin.js +0 -248
- package/plugins/externalise-modules.js +0 -161
- package/plugins/watch-run.js +0 -47
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {createRoot} from 'react-dom/client';
|
|
3
|
+
import {App} from './App';
|
|
4
|
+
|
|
5
|
+
declare var document;
|
|
6
|
+
if (typeof document !== 'undefined') {
|
|
7
|
+
const container = document.getElementById('root');
|
|
8
|
+
const root = createRoot(container!);
|
|
9
|
+
root.render(<App></App>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"outDir": "lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"downlevelIteration": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"jsx": "react",
|
|
14
|
+
"baseUrl": "./",
|
|
15
|
+
"rootDir": "src"
|
|
16
|
+
},
|
|
17
|
+
"files": ["./src/index.tsx"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
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,17 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
const webpack = require("webpack");
|
|
3
|
+
const config = require("lincd-server/site.webpack.config");
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
|
|
6
|
-
const isProduction = process.env.NODE_ENV === 'production';
|
|
7
|
-
|
|
8
|
-
let webpackConfig = require("./webpack-config");
|
|
9
|
-
|
|
10
|
-
// Can be overwritten by environment variables
|
|
11
|
-
// Should relate to express.static in server.ts, which makes the build files available through a URL
|
|
12
|
-
const ASSET_PATH = process.env.ASSET_PATH || '/js/';
|
|
13
|
-
|
|
14
|
-
webpack(webpackConfig(),(err, stats) => {
|
|
5
|
+
webpack(config, (err, stats) => { // [Stats Object](#stats-object)
|
|
15
6
|
if (err) {
|
|
16
7
|
console.error(err.stack || err);
|
|
17
8
|
if (err.details) {
|
|
@@ -25,10 +16,19 @@ webpack(webpackConfig(),(err, stats) => {
|
|
|
25
16
|
console.log('Finished running webpack with errors.');
|
|
26
17
|
info.errors.forEach((e) => console.error(e));
|
|
27
18
|
} else {
|
|
28
|
-
console.log(chalk.green('Finished running webpack.'));
|
|
19
|
+
// console.log(chalk.green('Finished running webpack.'));
|
|
20
|
+
console.log(stats.toString({
|
|
21
|
+
chunks:false,
|
|
22
|
+
assets:true,
|
|
23
|
+
entryPoints:false,
|
|
24
|
+
modules:false,
|
|
25
|
+
moduleAssets:false,
|
|
26
|
+
moduleChunks:false,
|
|
27
|
+
colors: true,
|
|
28
|
+
}));
|
|
29
29
|
// console.log(
|
|
30
30
|
// chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
|
|
31
31
|
// );
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
process.exit();
|
|
34
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.error {
|
|
2
|
+
color: white;
|
|
3
|
+
margin: 2rem;
|
|
4
|
+
|
|
5
|
+
pre {
|
|
6
|
+
white-space: pre-wrap;
|
|
7
|
+
padding: 1rem;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.content {
|
|
12
|
+
display: block;
|
|
13
|
+
background-color: #f3f3f3;
|
|
14
|
+
box-shadow: 2px 2px 2px rgba(68, 68, 68, 0.3);
|
|
15
|
+
padding: 1rem;
|
|
16
|
+
margin: 1rem 0;
|
|
17
|
+
|
|
18
|
+
code {
|
|
19
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
|
20
|
+
margin: 0.5rem 0;
|
|
21
|
+
|
|
22
|
+
pre {
|
|
23
|
+
padding: 1rem;
|
|
24
|
+
background-color: #bfe7fc;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.main {
|
|
30
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans',
|
|
31
|
+
'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
32
|
+
width: 66.6%;
|
|
33
|
+
margin: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.header {
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.menu {
|
|
41
|
+
margin: 1rem 0;
|
|
42
|
+
display: grid;
|
|
43
|
+
grid-template-columns: repeat(6, 1fr);
|
|
44
|
+
grid-gap: 1rem;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"error":"${name}_App_error","content":"${name}_App_content","main":"${name}_App_main","header":"${name}_App_header","menu":"${name}_App_menu"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {Link} from 'react-router-dom';
|
|
2
|
+
import {lazy, Suspense} from 'react';
|
|
3
|
+
import {ErrorBoundary} from 'react-error-boundary';
|
|
4
|
+
import Spinner from './components/Spinner';
|
|
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
|
+
|
|
9
|
+
//Note that by default LINCD apps are set up with support for SCSS (sass) and CSS Modules
|
|
10
|
+
//So any .scss file needs to be imported by itself
|
|
11
|
+
import "./App.scss";
|
|
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 "./App.scss.json";
|
|
14
|
+
|
|
15
|
+
//In React 18 you can use 'lazy' to import pages only when you need them.
|
|
16
|
+
//This will cause webpack to create multiple bundles, and the right one is automatically loaded
|
|
17
|
+
const Home = lazy(() => import('./pages/Home' /* webpackPrefetch: true */));
|
|
18
|
+
const Page1 = lazy(() => import('./pages/Page1' /* webpackPrefetch: true */));
|
|
19
|
+
|
|
20
|
+
//store all quads in a file on the backend named 'main'
|
|
21
|
+
let store = new FrontendFileStore('main');
|
|
22
|
+
Storage.setDefaultStore(store);
|
|
23
|
+
|
|
24
|
+
declare var window;
|
|
25
|
+
export default function App({assets = typeof window !== 'undefined' ? window['assetManifest'] : {}}) {
|
|
26
|
+
return (
|
|
27
|
+
<Html assets={assets} title="${name} - LINCD App">
|
|
28
|
+
<Suspense fallback={<Spinner />}>
|
|
29
|
+
<ErrorBoundary FallbackComponent={Error}>
|
|
30
|
+
<Content />
|
|
31
|
+
</ErrorBoundary>
|
|
32
|
+
</Suspense>
|
|
33
|
+
</Html>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function Content() {
|
|
38
|
+
return (
|
|
39
|
+
<Layout>
|
|
40
|
+
<div className={style.content}>
|
|
41
|
+
<Routes>
|
|
42
|
+
<Route
|
|
43
|
+
path="/"
|
|
44
|
+
element={
|
|
45
|
+
<Suspense fallback={<Spinner />}>
|
|
46
|
+
<Home />
|
|
47
|
+
</Suspense>
|
|
48
|
+
}
|
|
49
|
+
/>
|
|
50
|
+
<Route
|
|
51
|
+
path="/page1"
|
|
52
|
+
element={
|
|
53
|
+
<Suspense fallback={<Spinner />}>
|
|
54
|
+
<Page1 />
|
|
55
|
+
</Suspense>
|
|
56
|
+
}
|
|
57
|
+
/>
|
|
58
|
+
</Routes>
|
|
59
|
+
</div>
|
|
60
|
+
</Layout>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function Error({error}) {
|
|
65
|
+
return (
|
|
66
|
+
<div className={style.error}>
|
|
67
|
+
<h1>Application Error</h1>
|
|
68
|
+
<pre>{error.stack}</pre>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function Layout({children}) {
|
|
74
|
+
return (
|
|
75
|
+
<main className={style.main}>
|
|
76
|
+
<Header />
|
|
77
|
+
{children}
|
|
78
|
+
</main>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function Header()
|
|
83
|
+
{
|
|
84
|
+
return (
|
|
85
|
+
<header className={style.header}>
|
|
86
|
+
<h1>${name}</h1>
|
|
87
|
+
<nav className={style.menu}>
|
|
88
|
+
<Link to="/">Home</Link>
|
|
89
|
+
<Link to="/page1">Page 1</Link>
|
|
90
|
+
</nav>
|
|
91
|
+
</header>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Html({assets, children, title}) {
|
|
96
|
+
return (
|
|
97
|
+
<html lang="en">
|
|
98
|
+
<head>
|
|
99
|
+
<meta charSet="utf-8" />
|
|
100
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
101
|
+
<link rel="shortcut icon" href="/static/favicon.ico" />
|
|
102
|
+
<link rel="stylesheet" href={assets['main.css']} />
|
|
103
|
+
{assets['tailwind-cdn'] && (
|
|
104
|
+
<script src={assets['tailwind-cdn']}></script>
|
|
105
|
+
)}
|
|
106
|
+
<title>{title}</title>
|
|
107
|
+
</head>
|
|
108
|
+
<body>
|
|
109
|
+
<noscript
|
|
110
|
+
dangerouslySetInnerHTML={{
|
|
111
|
+
__html: `<b>Enable JavaScript to run this app.</b>`,
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
{children}
|
|
115
|
+
<script
|
|
116
|
+
dangerouslySetInnerHTML={{
|
|
117
|
+
__html: `assetManifest = ${JSON.stringify(assets)};`,
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
</body>
|
|
121
|
+
</html>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.spinner.active {
|
|
2
|
+
border: 4px solid #474545;
|
|
3
|
+
border-top: 4px solid lightblue;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
width: 24px;
|
|
6
|
+
height: 24px;
|
|
7
|
+
animation: spin 1s linear infinite;
|
|
8
|
+
}
|
|
9
|
+
@keyframes spin {
|
|
10
|
+
0% {
|
|
11
|
+
transform: rotate(0deg);
|
|
12
|
+
}
|
|
13
|
+
100% {
|
|
14
|
+
transform: rotate(360deg);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"spinner":"${name}_Spinner_spinner","active":"${name}_Spinner_active","spin":"${name}_Spinner_spin"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
window['$RefreshReg$'] = () => {};
|
|
2
|
+
window['$RefreshSig$'] = () => () => {};
|
|
3
|
+
|
|
4
|
+
import {hydrateRoot} from 'react-dom/client';
|
|
5
|
+
import {BrowserRouter} from 'react-router-dom';
|
|
6
|
+
import App from './App';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
hydrateRoot(
|
|
10
|
+
document,
|
|
11
|
+
<React.StrictMode>
|
|
12
|
+
<BrowserRouter>
|
|
13
|
+
<App assets={window['assetManifest']} />
|
|
14
|
+
</BrowserRouter>
|
|
15
|
+
</React.StrictMode>,
|
|
16
|
+
);
|
|
File without changes
|
|
@@ -12,15 +12,9 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "npm run server:dev",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"server:
|
|
18
|
-
"server:prod": "env-cmd -e prod nodemon -e js,json --delay 1 ./backend/server.js",
|
|
19
|
-
"tsc": "cross-env NODE_ENV=development tsc --watch --project ./tsconfig.json",
|
|
20
|
-
"tsc:prod": "cross-env NODE_ENV=production tsc --project ./tsconfig.json",
|
|
21
|
-
"bundler:dev": "cross-env NODE_ENV=development nodemon --watch frontend/scripts frontend/scripts/build.js",
|
|
22
|
-
"bundler:prod": "cross-env NODE_ENV=production node frontend/scripts/build.js",
|
|
23
|
-
"setup": "cross-env NODE_ENV=development tsc --project ./tsconfig.json"
|
|
15
|
+
"build": "env-cmd -e prod node frontend/scripts/build.js",
|
|
16
|
+
"server:dev": "env-cmd -e dev nodemon --watch ../../modules/lincd-server/lib --watch ../../modules/lincd-server/site.webpack.config.js ./backend/server.js",
|
|
17
|
+
"server:prod": "env-cmd -e prod nodemon -e js,json s ./backend/server.js"
|
|
24
18
|
},
|
|
25
19
|
"keywords": [
|
|
26
20
|
"lincd",
|
|
@@ -30,7 +24,15 @@
|
|
|
30
24
|
"web3"
|
|
31
25
|
],
|
|
32
26
|
"dependencies": {
|
|
27
|
+
"@babel/cli": "^7.18.10",
|
|
28
|
+
"@babel/core": "^7.19.1",
|
|
29
|
+
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
30
|
+
"@babel/preset-env": "^7.19.1",
|
|
31
|
+
"@babel/preset-react": "^7.18.6",
|
|
32
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
33
|
+
"@babel/register": "^7.18.9",
|
|
33
34
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
35
|
+
"babel-loader": "^8.2.5",
|
|
34
36
|
"fork-ts-checker-webpack-plugin": "6.2.6",
|
|
35
37
|
"is-object": "^1.0.2",
|
|
36
38
|
"lincd": "^0.3",
|
|
@@ -69,9 +71,8 @@
|
|
|
69
71
|
"resolve": "1.12.0",
|
|
70
72
|
"sass-loader": "^10.0",
|
|
71
73
|
"tailwindcss": "^3.0.24",
|
|
72
|
-
"ts-loader": "^8.0.12",
|
|
73
74
|
"typescript": "4.6.4",
|
|
74
|
-
"webpack": "
|
|
75
|
+
"webpack": "^5.74.0",
|
|
75
76
|
"webpack-cli": "^4.2.0"
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"sourceMap": true,
|
|
6
|
+
"target": "es2019",
|
|
7
|
+
"declaration": false,
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"emitDecoratorMetadata": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"types": ["node", "react", "react-dom"],
|
|
14
|
+
"pretty": true
|
|
15
|
+
},
|
|
16
|
+
"files": ["./frontend/src/index.tsx"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var buildTools = require('lincd-cli');
|
|
2
|
+
module.exports = buildTools.generateGruntConfig('${module_name}', {
|
|
3
|
+
externals: {
|
|
4
|
+
react: 'React',
|
|
5
|
+
'react-dom': 'ReactDOM',
|
|
6
|
+
}, //list of non lincd modules that are already loaded and made globally available by one of the dependencies of this module
|
|
7
|
+
//internals: [],//list of lincd modules that you want to INCLUDE in the bundle (as opposed to the module its own bundle being a dependency)
|
|
8
|
+
//alias:{},//webpack alias -> maps on type of npm path to another
|
|
9
|
+
//target:"es5"|"es6",
|
|
10
|
+
//environment:"server"|"frontend",
|
|
11
|
+
//outputPath:string,
|
|
12
|
+
//es5Server:boolean
|
|
13
|
+
//es5:{},//es5 specific config, use same properties as above
|
|
14
|
+
//es6:{},//es6 specific config, use same properties as above
|
|
15
|
+
//debug:false,//debug the build process
|
|
16
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {ExampleShapeClass} from "../shapes/ExampleShapeClass";
|
|
3
|
+
import {linkedComponentClass,linkedComponent} from '../module';
|
|
4
|
+
import {LinkedComponentClass} from 'lincd/lib/utils/LinkedComponentClass';
|
|
5
|
+
|
|
6
|
+
export const ExampleComponent = linkedComponent<ExampleShapeClass>(ExampleShapeClass, ({source, sourceShape}) => {
|
|
7
|
+
//note that typescript knows that person has the type of the Shape you provided
|
|
8
|
+
return <div></div>;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
//alternatively, use a Class component if you prefer:
|
|
12
|
+
/*@linkedComponentClass(ExampleShapeClass)
|
|
13
|
+
export class ExampleComponent extends LinkedComponentClass<ExampleShapeClass> {
|
|
14
|
+
render() {
|
|
15
|
+
let exampleInstance = this.sourceShape;
|
|
16
|
+
|
|
17
|
+
//get the name of this item from the graph
|
|
18
|
+
return <h1>Hello {exampleInstance.name}!</h1>;
|
|
19
|
+
}
|
|
20
|
+
}*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"dc": "http://purl.org/dc/elements/1.1/",
|
|
4
|
+
"owl": "http://www.w3.org/2002/07/owl#",
|
|
5
|
+
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
6
|
+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
|
7
|
+
"${hyphen_name}": "${uri_base}"
|
|
8
|
+
},
|
|
9
|
+
"@graph": [
|
|
10
|
+
{
|
|
11
|
+
"@id": "${hyphen_name}:ExampleClass",
|
|
12
|
+
"@type": "rdfs:Class",
|
|
13
|
+
"rdfs:comment": "This is an example class. You can remove or rename it",
|
|
14
|
+
"rdfs:isDefinedBy": {
|
|
15
|
+
"@id": "${hyphen_name}:"
|
|
16
|
+
},
|
|
17
|
+
"rdfs:label": "Example Class"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var json: string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {NamedNode} from 'lincd/lib/models';
|
|
2
|
+
import {JSONLD} from 'lincd-jsonld/lib/utils/JSONLD';
|
|
3
|
+
import {createNameSpace} from 'lincd/lib/utils/NameSpace';
|
|
4
|
+
import {linkedOntology} from '../module';
|
|
5
|
+
//import all the exports of this file as one variable called _this (we need this at the end)
|
|
6
|
+
import * as _this from './${hyphen_name}';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Load the data of this ontology into memory, thus adding the properties of the entities of this ontology to the local graph.
|
|
10
|
+
*/
|
|
11
|
+
export var loadData = () => {
|
|
12
|
+
return import('../data/${hyphen_name}.json').then((data) => JSONLD.parse(data));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The namespace of this ontology, which can be used to create NamedNodes with URI's not listed in this file
|
|
17
|
+
*/
|
|
18
|
+
export var ns = createNameSpace('${uri_base}');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The NamedNode of the ontology itself
|
|
22
|
+
*/
|
|
23
|
+
export var _self: NamedNode = ns('');
|
|
24
|
+
|
|
25
|
+
//A list of all the entities (Classes & Properties) of this ontology, each exported as a NamedNode
|
|
26
|
+
export var ExampleClass: NamedNode = ns('ExampleClass');
|
|
27
|
+
export var exampleProperty: NamedNode = ns('exampleProperty');
|
|
28
|
+
|
|
29
|
+
//An extra grouping object so all the entities can be accessed from the prefix/name
|
|
30
|
+
export const ${camel_name} = {
|
|
31
|
+
ExampleClass,
|
|
32
|
+
exampleProperty,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//Registers this ontology to LINCD.JS, so that data loading can be automated amongst other things
|
|
36
|
+
linkedOntology(_this, ns, '${hyphen_name}', loadData, '../data/${hyphen_name}.json');
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {Shape} from 'lincd/lib/shapes/Shape';
|
|
2
|
+
import {Literal, NamedNode} from 'lincd/lib/models';
|
|
3
|
+
import {linkedShape} from '../module';
|
|
4
|
+
import {literalProperty} from 'lincd/lib/utils/ShapeDecorators';
|
|
5
|
+
import {${camel_name}} from '../ontologies/${hyphen_name}';
|
|
6
|
+
|
|
7
|
+
@linkedShape
|
|
8
|
+
export class ExampleShapeClass extends Shape {
|
|
9
|
+
/**
|
|
10
|
+
* indicates that instances of this shape need to have this rdf.type
|
|
11
|
+
*/
|
|
12
|
+
static targetClass: NamedNode = ${camel_name}.ExampleClass;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* instances of this shape need to have exactly one value defined for the given property
|
|
16
|
+
*/
|
|
17
|
+
@literalProperty({
|
|
18
|
+
path: ${camel_name}.exampleProperty,
|
|
19
|
+
required: true,
|
|
20
|
+
maxCount: 1,
|
|
21
|
+
})
|
|
22
|
+
get name() {
|
|
23
|
+
return this.getValue(${camel_name}.exampleProperty);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
set name(val: string) {
|
|
27
|
+
this.overwrite(${camel_name}.exampleProperty, new Literal(val));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "lib",
|
|
7
|
+
"declaration": false,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"downlevelIteration": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"jsx": "react",
|
|
14
|
+
"baseUrl": "./",
|
|
15
|
+
"rootDir": "src"
|
|
16
|
+
},
|
|
17
|
+
"files": ["./src/index.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"outDir": "lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"downlevelIteration": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"jsx": "react",
|
|
14
|
+
"baseUrl": "./",
|
|
15
|
+
"rootDir": "src"
|
|
16
|
+
},
|
|
17
|
+
"files": ["./src/index.ts"]
|
|
18
|
+
}
|
package/lib/cli.js
CHANGED
|
@@ -834,17 +834,17 @@ var createApp = function (name, basePath) {
|
|
|
834
834
|
if (!fs.existsSync(targetFolder)) {
|
|
835
835
|
fs.mkdirSync(targetFolder);
|
|
836
836
|
}
|
|
837
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
837
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'app-with-backend'), targetFolder);
|
|
838
838
|
// fs.copySync(path.join(__dirname, '..', 'defaults', 'app'), targetFolder);
|
|
839
839
|
log("Creating new LINCD application '" + name + "'");
|
|
840
840
|
//replace variables in some of the copied files
|
|
841
|
-
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/
|
|
841
|
+
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/App.scss.json', 'frontend/src/components/Spinner.scss.json');
|
|
842
842
|
return [4 /*yield*/, hasYarnInstalled()];
|
|
843
843
|
case 1:
|
|
844
844
|
hasYarn = _b.sent();
|
|
845
845
|
installCommand = hasYarn ? 'yarn install' : 'npm install';
|
|
846
846
|
runCommand = hasYarn ? 'yarn' : 'npm run';
|
|
847
|
-
return [4 /*yield*/, execp("cd ".concat(hyphenName, " && ").concat(installCommand
|
|
847
|
+
return [4 /*yield*/, execp("cd ".concat(hyphenName, " && ").concat(installCommand), true)["catch"](function (err) {
|
|
848
848
|
console.warn('Could not install dependencies or start application');
|
|
849
849
|
})];
|
|
850
850
|
case 2:
|
package/lib/config-grunt.js
CHANGED
|
@@ -168,10 +168,7 @@ function setupGrunt(grunt, moduleName, config) {
|
|
|
168
168
|
options: {
|
|
169
169
|
stats: {
|
|
170
170
|
chunks: false,
|
|
171
|
-
version: false
|
|
172
|
-
warningsFilter: function (warning) {
|
|
173
|
-
return warning.indexOf('There are multiple modules') !== -1;
|
|
174
|
-
}
|
|
171
|
+
version: false
|
|
175
172
|
}
|
|
176
173
|
},
|
|
177
174
|
dev: (0, config_webpack_1.generateWebpackConfig)('dev', moduleName, Object.assign({
|