lincd-cli 0.1.11 → 0.1.13
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/Gruntfile.js +2 -10
- package/defaults/app/package.json +1 -1
- package/defaults/app2/frontend/scripts/build.js +100 -0
- package/defaults/app2/frontend/web/favicon.ico +0 -0
- package/defaults/app2/package.json +71 -0
- package/defaults/app2/tailwind.config.js +3 -0
- package/defaults/app3/.env-cmdrc +12 -0
- package/defaults/app3/backend/server.js +5 -0
- package/defaults/app3/frontend/scripts/build.js +34 -0
- package/defaults/app3/frontend/scripts/webpack-config.js +121 -0
- package/defaults/app3/frontend/web/favicon.ico +0 -0
- package/defaults/app3/package.json +77 -0
- package/defaults/app3/tailwind.config.js +3 -0
- package/defaults/module/package.json +1 -1
- package/lib/cli.js +21 -25
- package/lib/config-grunt.js +2 -2
- package/lib/config-webpack.js +19 -7
- package/lib/utils.js +1 -1
- package/package.json +4 -3
- package/cli.js +0 -1209
- package/config-generator.js +0 -568
- package/defaults/app/src/App.tsx +0 -5
- package/defaults/app/src/index.tsx +0 -10
- package/defaults/app/tsconfig.json +0 -18
- package/defaults/module/Gruntfile.js +0 -16
- package/defaults/module/src/components/ExampleComponent.tsx +0 -20
- package/defaults/module/src/data/example-ontology.json +0 -20
- package/defaults/module/src/data/example-ontology.json.d.ts +0 -1
- package/defaults/module/src/index.ts +0 -7
- package/defaults/module/src/module.ts +0 -4
- package/defaults/module/src/ontologies/example-ontology.ts +0 -36
- package/defaults/module/src/shapes/ExampleShapeClass.ts +0 -29
- package/defaults/module/tsconfig-es5.json +0 -18
- package/defaults/module/tsconfig.json +0 -18
- package/index.js +0 -26
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
var buildTools = require('lincd-cli');
|
|
2
2
|
module.exports = buildTools.generateGruntConfig('${hyphen_name}', {
|
|
3
|
-
internals: '*', //for applications we tell the bundler to bundle everything
|
|
4
|
-
|
|
5
|
-
//alias:{},//webpack alias -> maps on type of npm path to another
|
|
6
|
-
//target:"es5"|"es6",
|
|
7
|
-
//environment:"server"|"frontend",
|
|
8
|
-
//outputPath:string,
|
|
9
|
-
//es5Server:boolean
|
|
10
|
-
//es5:{},//es5 specific config, use same properties as above
|
|
11
|
-
//es6:{},//es6 specific config, use same properties as above
|
|
12
|
-
//debug:false,//debug the build process
|
|
3
|
+
internals: '*', //for applications, we tell the bundler to bundle everything
|
|
4
|
+
afterFirstBuildCommand:'open index.html'
|
|
13
5
|
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const webpack = require('webpack');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
7
|
+
|
|
8
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
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(
|
|
15
|
+
{
|
|
16
|
+
mode: isProduction ? 'production' : 'development',
|
|
17
|
+
devtool: isProduction ? 'source-map' : 'cheap-module-source-map',
|
|
18
|
+
entry: [path.resolve(__dirname, '../src/index.tsx')],
|
|
19
|
+
watch: isProduction ? false : true,
|
|
20
|
+
output: {
|
|
21
|
+
path: path.resolve(__dirname, '../build'),
|
|
22
|
+
filename: 'main.js',
|
|
23
|
+
publicPath: ASSET_PATH,
|
|
24
|
+
},
|
|
25
|
+
plugins: [
|
|
26
|
+
new webpack.WatchIgnorePlugin([/\.d\.ts$/]),
|
|
27
|
+
new MiniCssExtractPlugin(),
|
|
28
|
+
new webpack.EnvironmentPlugin(Object.keys(process.env)),
|
|
29
|
+
],
|
|
30
|
+
module: {
|
|
31
|
+
rules: [
|
|
32
|
+
{
|
|
33
|
+
test: /\.(scss|css)$/,
|
|
34
|
+
use: [
|
|
35
|
+
MiniCssExtractPlugin.loader,
|
|
36
|
+
{
|
|
37
|
+
loader: 'css-loader',
|
|
38
|
+
options: {
|
|
39
|
+
url: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
loader: 'postcss-loader',
|
|
44
|
+
options: {
|
|
45
|
+
postcssOptions: {
|
|
46
|
+
plugins: {
|
|
47
|
+
'postcss-import': {},
|
|
48
|
+
'postcss-nested': {},
|
|
49
|
+
tailwindcss: {
|
|
50
|
+
content: ['./frontend/src/**/*.{tsx,ts}'],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
loader: 'sass-loader',
|
|
58
|
+
options: {sourceMap: true},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
test: /\.tsx?$/,
|
|
64
|
+
use:
|
|
65
|
+
'ts-loader?' +
|
|
66
|
+
JSON.stringify({
|
|
67
|
+
compilerOptions: {
|
|
68
|
+
module: 'esnext',
|
|
69
|
+
moduleResolution: 'node',
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
exclude: /node_modules/,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
resolve: {
|
|
77
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
(err, stats) => {
|
|
81
|
+
if (err) {
|
|
82
|
+
console.error(err.stack || err);
|
|
83
|
+
if (err.details) {
|
|
84
|
+
console.error(err.details);
|
|
85
|
+
}
|
|
86
|
+
process.exit(1);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const info = stats.toJson();
|
|
90
|
+
if (stats.hasErrors()) {
|
|
91
|
+
console.log('Finished running webpack with errors.');
|
|
92
|
+
info.errors.forEach((e) => console.error(e));
|
|
93
|
+
} else {
|
|
94
|
+
console.log(chalk.green('Finished running webpack.'));
|
|
95
|
+
// console.log(
|
|
96
|
+
// chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
|
|
97
|
+
// );
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
);
|
|
Binary file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "${hyphen_name}",
|
|
3
|
+
"displayName": "${name}",
|
|
4
|
+
"description": "",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"private": true,
|
|
7
|
+
"author": "",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=14.9.0"
|
|
10
|
+
},
|
|
11
|
+
"main": "backend/src/server.js",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "concurrently --names \"WEBP,_TSC,SERV\" \"yarn run bundler:dev\" \"npm run tsc\" \"npm run server:dev\"",
|
|
15
|
+
"build:prod": "yarn bundler:prod && yarn tsc:prod",
|
|
16
|
+
"server:dev": "cross-env NODE_ENV=development nodemon --ignore frontend/build -e js,json --delay 1 ./backend/src/server.js",
|
|
17
|
+
"server:prod": "cross-env NODE_ENV=production nodemon -e js,json --delay 1 ./backend/src/server.js",
|
|
18
|
+
"tsc": "cross-env NODE_ENV=development tsc --watch --project ./tsconfig.json",
|
|
19
|
+
"tsc:prod": "cross-env NODE_ENV=production tsc --project ./tsconfig.json",
|
|
20
|
+
"bundler:dev": "cross-env NODE_ENV=development nodemon --watch frontend/scripts frontend/scripts/build.js",
|
|
21
|
+
"bundler:prod": "cross-env NODE_ENV=production node frontend/scripts/build.js"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"lincd",
|
|
25
|
+
"linked data",
|
|
26
|
+
"interoperable",
|
|
27
|
+
"semantic web",
|
|
28
|
+
"web3"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"lincd": "^0.3",
|
|
32
|
+
"lincd-jsonld": "^0.1",
|
|
33
|
+
"node-fetch": "^2.6.7",
|
|
34
|
+
"prism-react-renderer": "^1.3.5",
|
|
35
|
+
"react": "^18.2",
|
|
36
|
+
"react-dom": "^18.2",
|
|
37
|
+
"react-error-boundary": "^3.1.3",
|
|
38
|
+
"react-router-dom": "^6.3.0",
|
|
39
|
+
"react-select": "^5.4.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^17.0.30",
|
|
43
|
+
"@types/react": "^18.0.17",
|
|
44
|
+
"@types/react-dom": "^18.0.6",
|
|
45
|
+
"chalk": "4.1.2",
|
|
46
|
+
"classnames": "^2.3.1",
|
|
47
|
+
"compression": "^1.7.4",
|
|
48
|
+
"concurrently": "^5.3.0",
|
|
49
|
+
"cors": "^2.8.5",
|
|
50
|
+
"express": "^4.17.1",
|
|
51
|
+
"lincd-cli": "^0.1",
|
|
52
|
+
"ignore-styles": "^5.0.1",
|
|
53
|
+
"mini-css-extract-plugin": "^1.3.3",
|
|
54
|
+
"nodemon": "^2.0.6",
|
|
55
|
+
"css-loader": "^5.2.7",
|
|
56
|
+
"postcss": "^8.4.14",
|
|
57
|
+
"postcss-import": "^14.1.0",
|
|
58
|
+
"postcss-modules": "",
|
|
59
|
+
"postcss-nested": "^5.0.6",
|
|
60
|
+
"resolve": "1.12.0",
|
|
61
|
+
"rimraf": "^3.0.2",
|
|
62
|
+
"sass-loader": "^10.0",
|
|
63
|
+
"tailwindcss": "^3.0.24",
|
|
64
|
+
"ts-loader": "^8.0.12",
|
|
65
|
+
"typescript": "4.6.4",
|
|
66
|
+
"webpack": "4.44.2",
|
|
67
|
+
"webpack-cli": "^4.2.0",
|
|
68
|
+
"cross-env": "^7.0.3",
|
|
69
|
+
"prettier": "1.19.1"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
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]",
|
|
10
|
+
"DATA_ROOT": "http://localhost:4000/data"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const webpack = require('webpack');
|
|
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) => {
|
|
15
|
+
if (err) {
|
|
16
|
+
console.error(err.stack || err);
|
|
17
|
+
if (err.details) {
|
|
18
|
+
console.error(err.details);
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const info = stats.toJson();
|
|
24
|
+
if (stats.hasErrors()) {
|
|
25
|
+
console.log('Finished running webpack with errors.');
|
|
26
|
+
info.errors.forEach((e) => console.error(e));
|
|
27
|
+
} else {
|
|
28
|
+
console.log(chalk.green('Finished running webpack.'));
|
|
29
|
+
// console.log(
|
|
30
|
+
// chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
|
|
31
|
+
// );
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
|
+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
4
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
5
|
+
const ReactRefreshTypeScript = require('react-refresh-typescript');
|
|
6
|
+
const webpack = require('webpack');
|
|
7
|
+
|
|
8
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
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
|
+
|
|
15
|
+
// console.log(chalk.blueBright("Starting webpack"));
|
|
16
|
+
class WatchRunPlugin {
|
|
17
|
+
apply(compiler) {
|
|
18
|
+
compiler.hooks.watchRun.tap('WatchRun', (comp) => {
|
|
19
|
+
// const changedTimes = comp.watchFileSystem.watcher?.mtimes;
|
|
20
|
+
[comp.watchFileSystem.watcher,comp.watchFileSystem.wfs?.watcher].forEach(watcher => {
|
|
21
|
+
if(!watcher) return;
|
|
22
|
+
const changedTimes = watcher.mtimes;
|
|
23
|
+
const changedFiles = Object.keys(changedTimes)
|
|
24
|
+
.map(file => `\n ${file}`)
|
|
25
|
+
.join('');
|
|
26
|
+
if (changedFiles.length) {
|
|
27
|
+
console.log('Changed files:', changedFiles);
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = function getWebpackConfig()
|
|
35
|
+
{
|
|
36
|
+
return {
|
|
37
|
+
mode: isProduction ? 'production' : 'development',
|
|
38
|
+
devtool: isProduction ? 'source-map' : 'cheap-module-source-map',
|
|
39
|
+
entry: ['webpack-hot-middleware/client', path.resolve(__dirname, '../src/index.tsx')],
|
|
40
|
+
watch: isProduction ? false : true,
|
|
41
|
+
output: {
|
|
42
|
+
path: path.resolve(__dirname, '../build'),
|
|
43
|
+
filename: 'main.js',
|
|
44
|
+
publicPath: ASSET_PATH,
|
|
45
|
+
},
|
|
46
|
+
watchOptions: {
|
|
47
|
+
ignored: [/\.d\.ts$/, /\.scss\.json$/, /\.js\.map$/],
|
|
48
|
+
aggregateTimeout: 500
|
|
49
|
+
},
|
|
50
|
+
plugins: [
|
|
51
|
+
// new WatchRunPlugin(),
|
|
52
|
+
//for some reason we currently need both watchOptions.ignore + this WatchIgnorePlugin. They both ignore different files... Both only part of what we want to ignore
|
|
53
|
+
new webpack.WatchIgnorePlugin([/\.d\.ts$/, /\.scss\.json/]),
|
|
54
|
+
new MiniCssExtractPlugin(),
|
|
55
|
+
new webpack.EnvironmentPlugin(Object.keys(process.env)),
|
|
56
|
+
new ForkTsCheckerWebpackPlugin(),
|
|
57
|
+
!isProduction && new ReactRefreshWebpackPlugin(),
|
|
58
|
+
!isProduction && new webpack.HotModuleReplacementPlugin(),
|
|
59
|
+
].filter(Boolean),
|
|
60
|
+
module: {
|
|
61
|
+
rules: [
|
|
62
|
+
{
|
|
63
|
+
test: /\.(scss|css)$/,
|
|
64
|
+
use: [
|
|
65
|
+
MiniCssExtractPlugin.loader,
|
|
66
|
+
{
|
|
67
|
+
loader: 'css-loader',
|
|
68
|
+
options: {
|
|
69
|
+
url: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
loader: 'postcss-loader',
|
|
74
|
+
options: {
|
|
75
|
+
postcssOptions: {
|
|
76
|
+
plugins: {
|
|
77
|
+
'postcss-import': {},
|
|
78
|
+
'postcss-modules': {
|
|
79
|
+
globalModulePaths: [/tailwind/],
|
|
80
|
+
},
|
|
81
|
+
'postcss-nested': {},
|
|
82
|
+
tailwindcss: {
|
|
83
|
+
content: ['./frontend/src/**/*.{tsx,ts}'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
loader: 'sass-loader',
|
|
91
|
+
options: {sourceMap: true},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
test: /\.tsx?$/,
|
|
97
|
+
use: [{
|
|
98
|
+
loader: 'ts-loader?' +
|
|
99
|
+
JSON.stringify({
|
|
100
|
+
compilerOptions: {
|
|
101
|
+
module: 'esnext',
|
|
102
|
+
moduleResolution: 'node',
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
options: {
|
|
106
|
+
getCustomTransformers: () => ({
|
|
107
|
+
before: [!isProduction && ReactRefreshTypeScript()]
|
|
108
|
+
}),
|
|
109
|
+
transpileOnly: !isProduction,
|
|
110
|
+
}
|
|
111
|
+
}],
|
|
112
|
+
exclude: /node_modules/,
|
|
113
|
+
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
resolve: {
|
|
118
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "${hyphen_name}",
|
|
3
|
+
"displayName": "${name}",
|
|
4
|
+
"description": "",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"private": true,
|
|
7
|
+
"author": "",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16.0.0"
|
|
10
|
+
},
|
|
11
|
+
"main": "backend/src/server.js",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "npm run server:dev",
|
|
15
|
+
"start-full": "concurrently --names \"_TSC,SERV\" \"npm run tsc\" \"npm run server:dev\"",
|
|
16
|
+
"build:prod": "npm run bundler:prod && npm run tsc:prod",
|
|
17
|
+
"server:dev": "env-cmd -e dev nodemon --watch ../../modules/lincd-server/lib --delay 0.5 ./backend/server.js",
|
|
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"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"lincd",
|
|
27
|
+
"linked code",
|
|
28
|
+
"linked data",
|
|
29
|
+
"semantic web",
|
|
30
|
+
"web3"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
34
|
+
"fork-ts-checker-webpack-plugin": "6.2.6",
|
|
35
|
+
"is-object": "^1.0.2",
|
|
36
|
+
"lincd": "^0.3",
|
|
37
|
+
"lincd-jsonld": "^0.1.5",
|
|
38
|
+
"lincd-server": "^0.1",
|
|
39
|
+
"react": "^18.2",
|
|
40
|
+
"react-dom": "^18.2",
|
|
41
|
+
"react-error-boundary": "^3.1.3",
|
|
42
|
+
"react-refresh": "^0.14.0",
|
|
43
|
+
"react-refresh-typescript": "^2.0.7",
|
|
44
|
+
"react-router-dom": "^6.3.0",
|
|
45
|
+
"webpack-dev-middleware": "^5.3.3",
|
|
46
|
+
"webpack-hot-middleware": "^2.25.2"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^17.0.30",
|
|
50
|
+
"@types/react": "^18.0.17",
|
|
51
|
+
"@types/react-dom": "^18.0.6",
|
|
52
|
+
"chalk": "4.1.2",
|
|
53
|
+
"classnames": "^2.3.1",
|
|
54
|
+
"compression": "^1.7.4",
|
|
55
|
+
"concurrently": "^5.3.0",
|
|
56
|
+
"cors": "^2.8.5",
|
|
57
|
+
"cross-env": "^7.0.3",
|
|
58
|
+
"env-cmd": "^10.1.0",
|
|
59
|
+
"css-loader": "^5.2.7",
|
|
60
|
+
"express": "^4.17.1",
|
|
61
|
+
"lincd-cli": "^0.1",
|
|
62
|
+
"mini-css-extract-plugin": "^1.3.3",
|
|
63
|
+
"nodemon": "^2.0.6",
|
|
64
|
+
"postcss": "^8.4.14",
|
|
65
|
+
"postcss-import": "^14.1.0",
|
|
66
|
+
"postcss-modules": "",
|
|
67
|
+
"postcss-nested": "^5.0.6",
|
|
68
|
+
"prettier": "1.19.1",
|
|
69
|
+
"resolve": "1.12.0",
|
|
70
|
+
"sass-loader": "^10.0",
|
|
71
|
+
"tailwindcss": "^3.0.24",
|
|
72
|
+
"ts-loader": "^8.0.12",
|
|
73
|
+
"typescript": "4.6.4",
|
|
74
|
+
"webpack": "4.44.2",
|
|
75
|
+
"webpack-cli": "^4.2.0"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/lib/cli.js
CHANGED
|
@@ -62,7 +62,7 @@ program
|
|
|
62
62
|
return createApp(name);
|
|
63
63
|
})
|
|
64
64
|
.description('Creates a new folder with all the required files for a LINCD app')
|
|
65
|
-
.argument('<name>', 'the name of your LINCD app');
|
|
65
|
+
.argument('<name>', 'the name of your LINCD app. To use spaces, wrap the name in double quotes.');
|
|
66
66
|
program
|
|
67
67
|
.command('create-module')
|
|
68
68
|
.action(function (name, uriBase) {
|
|
@@ -138,12 +138,15 @@ program.command('dev [target] [mode]').action(function (target, mode) {
|
|
|
138
138
|
program
|
|
139
139
|
.command('module|m')
|
|
140
140
|
.action(function (name, command, args) {
|
|
141
|
-
var fullCommand =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
var fullCommand = command
|
|
142
|
+
? command +
|
|
143
|
+
' ' +
|
|
144
|
+
' ' +
|
|
145
|
+
args
|
|
146
|
+
.slice(0, 3)
|
|
147
|
+
.filter(function (a) { return a && true; })
|
|
148
|
+
.join(' ')
|
|
149
|
+
: null;
|
|
147
150
|
executeCommandForModule(name, fullCommand);
|
|
148
151
|
})
|
|
149
152
|
.alias('m')
|
|
@@ -819,7 +822,7 @@ var createModule = function (name, uriBase, basePath) {
|
|
|
819
822
|
var createApp = function (name, basePath) {
|
|
820
823
|
if (basePath === void 0) { basePath = process.cwd(); }
|
|
821
824
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
822
|
-
var _a, hyphenName, camelCaseName, underscoreName, targetFolder, hasYarn, installCommand,
|
|
825
|
+
var _a, hyphenName, camelCaseName, underscoreName, targetFolder, hasYarn, installCommand, runCommand;
|
|
823
826
|
return __generator(this, function (_b) {
|
|
824
827
|
switch (_b.label) {
|
|
825
828
|
case 0:
|
|
@@ -831,30 +834,22 @@ var createApp = function (name, basePath) {
|
|
|
831
834
|
if (!fs.existsSync(targetFolder)) {
|
|
832
835
|
fs.mkdirSync(targetFolder);
|
|
833
836
|
}
|
|
834
|
-
fs.copySync(path.join(__dirname, '..', 'defaults', '
|
|
835
|
-
//
|
|
836
|
-
// let cameCaseName = camelCase(name); //some-module --> someModule
|
|
837
|
-
// let underscoreName = name.replace(/[-\s]+/g, '_');
|
|
838
|
-
// setVariable('uri_base', uriBase);
|
|
839
|
-
//longer similar variables names should come before the shorter ones
|
|
840
|
-
// setVariable('camelcase_name', cameCaseName);
|
|
841
|
-
// setVariable('underscore_name', underscoreName);
|
|
842
|
-
// setVariable('app_name', name);
|
|
837
|
+
fs.copySync(path.join(__dirname, '..', 'defaults', 'app3'), targetFolder);
|
|
838
|
+
// fs.copySync(path.join(__dirname, '..', 'defaults', 'app'), targetFolder);
|
|
843
839
|
log("Creating new LINCD application '" + name + "'");
|
|
844
840
|
//replace variables in some of the copied files
|
|
845
|
-
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', '
|
|
841
|
+
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/Header.tsx', 'frontend/src/pages/Home.tsx');
|
|
846
842
|
return [4 /*yield*/, hasYarnInstalled()];
|
|
847
843
|
case 1:
|
|
848
844
|
hasYarn = _b.sent();
|
|
849
845
|
installCommand = hasYarn ? 'yarn install' : 'npm install';
|
|
850
|
-
|
|
851
|
-
return [4 /*yield*/, execp("cd ".concat(hyphenName, " && ").concat(installCommand, " && ").concat(
|
|
852
|
-
console.warn('Could not install dependencies');
|
|
846
|
+
runCommand = hasYarn ? 'yarn' : 'npm run';
|
|
847
|
+
return [4 /*yield*/, execp("cd ".concat(hyphenName, " && ").concat(installCommand, " && ").concat(runCommand, " setup"), true)["catch"](function (err) {
|
|
848
|
+
console.warn('Could not install dependencies or start application');
|
|
853
849
|
})];
|
|
854
850
|
case 2:
|
|
855
851
|
_b.sent();
|
|
856
|
-
|
|
857
|
-
log("Your LINCD App starting setup is ready.", "Run ".concat(chalk.blueBright('cd ' + hyphenName), " and then \n - ").concat(chalk.blueBright(lincdCommand + ' build'), " to build once or \n - ").concat(chalk.blueBright(lincdCommand + ' dev'), " to continuously rebuild on file changes"));
|
|
852
|
+
log("Your LINCD App is ready at ".concat(chalk.blueBright(targetFolder)), "To start, run\n".concat(chalk.blueBright("cd ".concat(hyphenName)), " and then ").concat(chalk.blueBright((hasYarn ? 'yarn' : 'npm') + ' start')));
|
|
858
853
|
return [2 /*return*/];
|
|
859
854
|
}
|
|
860
855
|
});
|
|
@@ -918,6 +913,7 @@ var register = function (registryURL) {
|
|
|
918
913
|
var version = pack.version;
|
|
919
914
|
var moduleName = pack.name;
|
|
920
915
|
var author = pack.author;
|
|
916
|
+
var description = pack.description;
|
|
921
917
|
console.log(chalk.cyan('registering ' + author + "'s module, " + moduleName + ' ' + version + ' in the LINCD registry'));
|
|
922
918
|
return fetch(registryURL + '/register', {
|
|
923
919
|
method: 'POST',
|
|
@@ -925,7 +921,7 @@ var register = function (registryURL) {
|
|
|
925
921
|
Accept: 'application/json, text/plain, */*',
|
|
926
922
|
'Content-Type': 'application/json'
|
|
927
923
|
},
|
|
928
|
-
body: JSON.stringify({ package: moduleName, version: version })
|
|
924
|
+
body: JSON.stringify({ package: moduleName, version: version, description: description })
|
|
929
925
|
})
|
|
930
926
|
.then(function (res) { return res.json(); })
|
|
931
927
|
.then(function (json) {
|
|
@@ -1224,7 +1220,7 @@ var executeCommandForModule = function (moduleName, command) {
|
|
|
1224
1220
|
return execp('cd ' + moduleDetails.path + ' && yarn lincd' + (command ? ' ' + command : ''));
|
|
1225
1221
|
}
|
|
1226
1222
|
else {
|
|
1227
|
-
warn("Could not find a module who
|
|
1223
|
+
warn("Could not find a module who's name (partially) matched " + chalk.cyan(moduleName));
|
|
1228
1224
|
}
|
|
1229
1225
|
};
|
|
1230
1226
|
program.parse(process.argv);
|
package/lib/config-grunt.js
CHANGED
|
@@ -22,8 +22,8 @@ function generateGruntConfig(moduleName, config) {
|
|
|
22
22
|
}
|
|
23
23
|
exports["default"] = generateGruntConfig;
|
|
24
24
|
function setupGrunt(grunt, moduleName, config) {
|
|
25
|
-
var buildServer = !config.environment || config.environment == '
|
|
26
|
-
var buildFrontend = !config.environment || config.environment == '
|
|
25
|
+
var buildServer = !config.environment || config.environment == 'nodejs' || config.environment == 'polymorphic';
|
|
26
|
+
var buildFrontend = !config.environment || config.environment == 'browser' || config.environment == 'polymorphic';
|
|
27
27
|
//when not specified and we ARe building frontend OR we are compiling the server for es5.. or if simply specified, then es5 is targeted
|
|
28
28
|
var targetES5 = (!config.target && (buildFrontend || config.es5Server)) || config.target == 'es5';
|
|
29
29
|
var targetES6 = !config.target || config.target == 'es6';
|
package/lib/config-webpack.js
CHANGED
|
@@ -78,16 +78,28 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
78
78
|
if (config.debug) {
|
|
79
79
|
plugins.push(new watch_run_1["default"]());
|
|
80
80
|
}
|
|
81
|
-
if (config.afterBuildCommand) {
|
|
81
|
+
if (config.afterBuildCommand || config.afterFirstBuildCommand) {
|
|
82
|
+
var executedFirstCommand_1 = false;
|
|
82
83
|
plugins.push({
|
|
83
84
|
apply: function (compiler) {
|
|
84
85
|
compiler.hooks.afterEmit.tap('AfterEmitPlugin', function (compilation) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
if (config.afterBuildCommand) {
|
|
87
|
+
exec(config.afterBuildCommand, function (err, stdout, stderr) {
|
|
88
|
+
if (stdout)
|
|
89
|
+
process.stdout.write(stdout);
|
|
90
|
+
if (stderr)
|
|
91
|
+
process.stderr.write(stderr);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (config.afterFirstBuildCommand && !executedFirstCommand_1) {
|
|
95
|
+
executedFirstCommand_1 = true;
|
|
96
|
+
exec(config.afterFirstBuildCommand, function (err, stdout, stderr) {
|
|
97
|
+
if (stdout)
|
|
98
|
+
process.stdout.write(stdout);
|
|
99
|
+
if (stderr)
|
|
100
|
+
process.stderr.write(stderr);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
91
103
|
});
|
|
92
104
|
}
|
|
93
105
|
});
|
package/lib/utils.js
CHANGED
|
@@ -31,7 +31,7 @@ var fs = __importStar(require("fs"));
|
|
|
31
31
|
var path = __importStar(require("path"));
|
|
32
32
|
var SHACL_1 = require("lincd/lib/shapes/SHACL");
|
|
33
33
|
var CoreSet_1 = require("lincd/lib/collections/CoreSet");
|
|
34
|
-
var JSONLDWriter_1 = require("lincd-jsonld/lib/JSONLDWriter");
|
|
34
|
+
var JSONLDWriter_1 = require("lincd-jsonld/lib/utils/JSONLDWriter");
|
|
35
35
|
var chalk_1 = __importDefault(require("chalk"));
|
|
36
36
|
var getPackageJSON = function (root, error) {
|
|
37
37
|
if (root === void 0) { root = process.cwd(); }
|