lincd-cli 0.1.5 → 0.1.6

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.
Files changed (50) hide show
  1. package/LICENSE +373 -373
  2. package/README.md +24 -24
  3. package/defaults/defaultModule/Index.js +30 -30
  4. package/defaults/defaultModule/Index.tsx +24 -24
  5. package/defaults/defaultModule/index.ts +11 -11
  6. package/defaults/defaultModule/ontology.js +21 -21
  7. package/defaults/defaultModule/ontology.ts +15 -15
  8. package/defaults/gitignorefile +3 -3
  9. package/defaults/index.ts +12 -12
  10. package/defaults/module/package.json +30 -30
  11. package/defaults/module/src/components/ExampleComponent.tsx +22 -22
  12. package/defaults/module/src/data/example-ontology.json +20 -20
  13. package/defaults/module/src/data/example-ontology.json.d.ts +1 -1
  14. package/defaults/module/src/index.ts +7 -7
  15. package/defaults/module/src/module.ts +9 -9
  16. package/defaults/module/src/ontologies/example-ontology.ts +33 -33
  17. package/defaults/module/src/shapes/ExampleShapeClass.ts +30 -30
  18. package/defaults/ontology.ts +15 -15
  19. package/defaults/package.json +28 -28
  20. package/defaults/site/package.json +40 -40
  21. package/defaults/site/storage/filestores/settings-production-template.jsonld +128 -128
  22. package/defaults/site/web/.htaccess +19 -19
  23. package/lib/cli.js +70 -116
  24. package/lib/config-grunt.js +4 -14
  25. package/lib/config-webpack.js +23 -23
  26. package/lib/plugins/declaration-plugin.js +26 -68
  27. package/lib/plugins/externalise-modules.js +4 -10
  28. package/package.json +75 -73
  29. package/src/cli.js +1209 -1209
  30. package/src/config-grunt.js +263 -263
  31. package/src/config-webpack.js +281 -281
  32. package/src/index.js +22 -22
  33. package/src/interfaces.js +2 -2
  34. package/src/plugins/declaration-plugin.js +248 -248
  35. package/src/plugins/externalise-modules.js +161 -161
  36. package/src/plugins/shapes-plugin.js +69 -69
  37. package/src/plugins/watch-run.js +47 -47
  38. package/src/utils.js +127 -127
  39. package/defaults/.npmignore +0 -11
  40. package/defaults/Gruntfile.js +0 -16
  41. package/defaults/module/Gruntfile.js +0 -16
  42. package/defaults/module/tsconfig-es5.json +0 -21
  43. package/defaults/module/tsconfig.json +0 -21
  44. package/defaults/site/.gitignore +0 -8
  45. package/defaults/site/.npmignore +0 -10
  46. package/defaults/site/lib/start-server.js +0 -22
  47. package/defaults/site/lib/test-server.js +0 -10
  48. package/defaults/site/storage/filestores/settings-development.jsonld +0 -117
  49. package/defaults/tsconfig-es5.json +0 -18
  50. package/defaults/tsconfig.json +0 -20
package/src/utils.js CHANGED
@@ -1,127 +1,127 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- exports.__esModule = true;
25
- exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.getShapes = exports.getShapesJSONLD = exports.getPackageJSON = void 0;
26
- var fs = __importStar(require("fs"));
27
- var path = __importStar(require("path"));
28
- var SHACL_Shape_1 = require("lincd/lib/shapes/SHACL_Shape");
29
- var CoreSet_1 = require("lincd/lib/collections/CoreSet");
30
- var JSONLDWriter_1 = require("lincd-jsonld/lib/JSONLDWriter");
31
- var index_1 = __importDefault(require("chalk/index"));
32
- var getPackageJSON = function (root) {
33
- if (root === void 0) { root = process.cwd(); }
34
- var packagePath = path.join(root, 'package.json');
35
- if (fs.existsSync(packagePath)) {
36
- return JSON.parse(fs.readFileSync(packagePath, 'utf8'));
37
- }
38
- else if (root === process.cwd()) {
39
- 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');
40
- process.exit();
41
- }
42
- };
43
- exports.getPackageJSON = getPackageJSON;
44
- function getShapesJSONLD(moduleExports) {
45
- return JSONLDWriter_1.JSONLDWriter.stringify(getShapes(moduleExports));
46
- }
47
- exports.getShapesJSONLD = getShapesJSONLD;
48
- function getShapes(moduleExports) {
49
- var shapes = new CoreSet_1.CoreSet();
50
- for (var key in moduleExports) {
51
- var moduleExport = moduleExports[key];
52
- // console.log(key, Object.keys(moduleExports[key]));
53
- if (moduleExport.shape) {
54
- // console.log(Object.keys(moduleExport.shape));
55
- if (moduleExport.shape && moduleExport.shape instanceof SHACL_Shape_1.SHACL_Shape) {
56
- shapes.add(moduleExport.shape);
57
- }
58
- }
59
- }
60
- return shapes;
61
- }
62
- exports.getShapes = getShapes;
63
- function generateScopedName(name, filename, css) {
64
- var path = require('path');
65
- var file = path.basename(filename, '.scss');
66
- var module = filename.match(/[\\\/]modules[\\\/]([\w\-_]+)/);
67
- var moduleName;
68
- if (module) {
69
- moduleName = module[1];
70
- }
71
- else {
72
- //if we cant find module name from path, we'll use a hash
73
- //https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
74
- var hash = 0;
75
- if (filename.length == 0) {
76
- moduleName = '_unknown';
77
- }
78
- else {
79
- for (var i = 0; i < filename.length; i++) {
80
- var char = filename.charCodeAt(i);
81
- hash = (hash << 5) - hash + char;
82
- hash = hash & hash; // Convert to 32bit integer
83
- }
84
- moduleName = hash;
85
- }
86
- }
87
- // console.log("Module name: "+moduleName);
88
- // console.log("Returning: " + moduleName + "_" + file + "_" + name);
89
- return moduleName + '_' + file + '_' + name;
90
- }
91
- exports.generateScopedName = generateScopedName;
92
- function log() {
93
- var messages = [];
94
- for (var _i = 0; _i < arguments.length; _i++) {
95
- messages[_i] = arguments[_i];
96
- }
97
- messages.forEach(function (message) {
98
- console.log(index_1["default"].cyan(message));
99
- });
100
- }
101
- exports.log = log;
102
- function debug(config) {
103
- var messages = [];
104
- for (var _i = 1; _i < arguments.length; _i++) {
105
- messages[_i - 1] = arguments[_i];
106
- }
107
- if (config.debug) {
108
- log.apply(void 0, messages);
109
- }
110
- }
111
- exports.debug = debug;
112
- function warn() {
113
- var messages = [];
114
- for (var _i = 0; _i < arguments.length; _i++) {
115
- messages[_i] = arguments[_i];
116
- }
117
- messages.forEach(function (message) {
118
- console.log(index_1["default"].red(message));
119
- });
120
- }
121
- exports.warn = warn;
122
- function flatten(arr) {
123
- return arr.reduce(function (a, b) {
124
- return b ? a.concat(b) : a;
125
- }, []);
126
- }
127
- exports.flatten = flatten;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ exports.__esModule = true;
25
+ exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.getShapes = exports.getShapesJSONLD = exports.getPackageJSON = void 0;
26
+ var fs = __importStar(require("fs"));
27
+ var path = __importStar(require("path"));
28
+ var SHACL_Shape_1 = require("lincd/lib/shapes/SHACL_Shape");
29
+ var CoreSet_1 = require("lincd/lib/collections/CoreSet");
30
+ var JSONLDWriter_1 = require("lincd-jsonld/lib/JSONLDWriter");
31
+ var index_1 = __importDefault(require("chalk/index"));
32
+ var getPackageJSON = function (root) {
33
+ if (root === void 0) { root = process.cwd(); }
34
+ var packagePath = path.join(root, 'package.json');
35
+ if (fs.existsSync(packagePath)) {
36
+ return JSON.parse(fs.readFileSync(packagePath, 'utf8'));
37
+ }
38
+ else if (root === process.cwd()) {
39
+ 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');
40
+ process.exit();
41
+ }
42
+ };
43
+ exports.getPackageJSON = getPackageJSON;
44
+ function getShapesJSONLD(moduleExports) {
45
+ return JSONLDWriter_1.JSONLDWriter.stringify(getShapes(moduleExports));
46
+ }
47
+ exports.getShapesJSONLD = getShapesJSONLD;
48
+ function getShapes(moduleExports) {
49
+ var shapes = new CoreSet_1.CoreSet();
50
+ for (var key in moduleExports) {
51
+ var moduleExport = moduleExports[key];
52
+ // console.log(key, Object.keys(moduleExports[key]));
53
+ if (moduleExport.shape) {
54
+ // console.log(Object.keys(moduleExport.shape));
55
+ if (moduleExport.shape && moduleExport.shape instanceof SHACL_Shape_1.SHACL_Shape) {
56
+ shapes.add(moduleExport.shape);
57
+ }
58
+ }
59
+ }
60
+ return shapes;
61
+ }
62
+ exports.getShapes = getShapes;
63
+ function generateScopedName(name, filename, css) {
64
+ var path = require('path');
65
+ var file = path.basename(filename, '.scss');
66
+ var module = filename.match(/[\\\/]modules[\\\/]([\w\-_]+)/);
67
+ var moduleName;
68
+ if (module) {
69
+ moduleName = module[1];
70
+ }
71
+ else {
72
+ //if we cant find module name from path, we'll use a hash
73
+ //https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
74
+ var hash = 0;
75
+ if (filename.length == 0) {
76
+ moduleName = '_unknown';
77
+ }
78
+ else {
79
+ for (var i = 0; i < filename.length; i++) {
80
+ var char = filename.charCodeAt(i);
81
+ hash = (hash << 5) - hash + char;
82
+ hash = hash & hash; // Convert to 32bit integer
83
+ }
84
+ moduleName = hash;
85
+ }
86
+ }
87
+ // console.log("Module name: "+moduleName);
88
+ // console.log("Returning: " + moduleName + "_" + file + "_" + name);
89
+ return moduleName + '_' + file + '_' + name;
90
+ }
91
+ exports.generateScopedName = generateScopedName;
92
+ function log() {
93
+ var messages = [];
94
+ for (var _i = 0; _i < arguments.length; _i++) {
95
+ messages[_i] = arguments[_i];
96
+ }
97
+ messages.forEach(function (message) {
98
+ console.log(index_1["default"].cyan(message));
99
+ });
100
+ }
101
+ exports.log = log;
102
+ function debug(config) {
103
+ var messages = [];
104
+ for (var _i = 1; _i < arguments.length; _i++) {
105
+ messages[_i - 1] = arguments[_i];
106
+ }
107
+ if (config.debug) {
108
+ log.apply(void 0, messages);
109
+ }
110
+ }
111
+ exports.debug = debug;
112
+ function warn() {
113
+ var messages = [];
114
+ for (var _i = 0; _i < arguments.length; _i++) {
115
+ messages[_i] = arguments[_i];
116
+ }
117
+ messages.forEach(function (message) {
118
+ console.log(index_1["default"].red(message));
119
+ });
120
+ }
121
+ exports.warn = warn;
122
+ function flatten(arr) {
123
+ return arr.reduce(function (a, b) {
124
+ return b ? a.concat(b) : a;
125
+ }, []);
126
+ }
127
+ exports.flatten = flatten;
@@ -1,11 +0,0 @@
1
- **/node_modules
2
- src
3
- .idea
4
- Gruntfile.js
5
- tsconfig.json
6
- tsconfig-es5.json
7
- modules/*/src
8
- modules/*/node_modules
9
- storage/cached
10
- storage/uploads
11
- storage/logs
@@ -1,16 +0,0 @@
1
- var buildTools = require('@dacore/build-tools');
2
- module.exports = buildTools.generateGruntConfig('${module_name}', {
3
- externals: {
4
- react: 'React',
5
- 'react-dom': 'ReactDOM',
6
- }, //externals: list of non-dacore modules that are already loaded and made globally available by one of the dependencies of this module
7
- //internals: [],//list of dacore modules (their package name, can be with or without '@dacore/') 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
- });
@@ -1,16 +0,0 @@
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
- });
@@ -1,21 +0,0 @@
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
- "plugins" : [{ "name": "typescript-plugin-css-modules" }]
17
- },
18
- "files": [
19
- "./src/index.ts"
20
- ]
21
- }
@@ -1,21 +0,0 @@
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
- "plugins" : [{ "name": "typescript-plugin-css-modules" }]
17
- },
18
- "files": [
19
- "./src/index.ts"
20
- ]
21
- }
@@ -1,8 +0,0 @@
1
- **/node_modules
2
- **/builds
3
- modules/**/lib
4
- storage/logs
5
- storage/uploads
6
- storage/cached
7
- storage/filestores/settings-development.jsonld
8
- .DS_Store
@@ -1,10 +0,0 @@
1
- **/node_modules
2
- src
3
- .idea
4
- Gruntfile.js
5
- tsconfig.json
6
- tsconfig-es5.json
7
- modules
8
- storage/cached
9
- storage/uploads
10
- storage/logs
@@ -1,22 +0,0 @@
1
- const serverCore = require('@dacore/server-core');
2
-
3
- serverCore.default
4
- .init()
5
- .then(() => {
6
- const args = process.argv.slice(2);
7
- let method;
8
- if (args.length > 0) {
9
- // console.log("Applying server method: "+args[0]);
10
- method = args[0];
11
- } else {
12
- method = 'startServer';
13
- }
14
- if (serverCore.default[method]) {
15
- serverCore.default[method]();
16
- } else {
17
- console.warn(`Method ${method} does not exist`);
18
- }
19
- })
20
- .catch((err) => {
21
- console.warn(`Could not start server: ${err.stack}`);
22
- });
@@ -1,10 +0,0 @@
1
- const serverCore = require('@dacore/server-core');
2
-
3
- serverCore.default
4
- .init()
5
- .then(() => {
6
- serverCore.default.runTests();
7
- })
8
- .catch((err) => {
9
- console.warn(`Could not start server: ${err.stack}`);
10
- });
@@ -1,117 +0,0 @@
1
- {
2
- "@context": {
3
- "owl": "http://www.w3.org/2002/07/owl#",
4
- "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
5
- "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
6
- "xsd": "http://www.w3.org/2001/XMLSchema#",
7
- "core": "http://data.dacore.org/ontologies/core/",
8
- "module": "http://data.dacore.org/ontologies/module/",
9
- "storage": "http://data.dacore.org/ontologies/storage/",
10
- "rdf4j": "http://data.dacore.org/ontologies/rdf4j/",
11
- "node-core": "http://data.dacore.org/ontologies/node-core/",
12
- "server-core": "http://data.dacore.org/ontologies/server-core/",
13
- "browser-core": "http://data.dacore.org/ontologies/browser-core/"
14
- },
15
- "@graph": [
16
- {
17
- "@id": "dacore://store/main",
18
- "@type": [
19
- "rdf4j:RDF4JStore"
20
- ],
21
- "storage:publicEndPoint": [
22
- {
23
- "@value": "http://127.0.0.1:7200/repositories/${repositoryName}"
24
- }
25
- ]
26
- },
27
- {
28
- "@id": "dacore://system",
29
- "@type": "server-core:ServerCore",
30
- "rdfs:label" : "${projectName}",
31
- "server-core:serves": {
32
- "@id": "${uriBase}"
33
- },
34
- "server-core:port": "${port}",
35
- "core:uriBase": "${uriBase}",
36
- "storage:defaultStore": {
37
- "@id": "dacore://store/main"
38
- },
39
- "node-core:includeAtStartup": [
40
- "@dacore/node-core",
41
- "@dacore/rdf4j"
42
- ],
43
- "core:adminEmail": "${email}",
44
- "core:deployment": "development",
45
- "core:requiresSetup": {
46
- "@type": "xsd:boolean",
47
- "@value": "true"
48
- },
49
- "core:defaultModule": {
50
- "@id": "${defaultModuleUri}"
51
- },
52
- "core:defaultOntology": {
53
- "@id": "${defaultOntologyUri}"
54
- },
55
- "module:maintainsModule": [
56
- {
57
- "@id": "${defaultModuleUri}"
58
- }
59
- ],
60
- "module:installedModule": [
61
- {
62
- "@id": "http://data.dacore.org/module/auth"
63
- },
64
- {
65
- "@id": "http://data.dacore.org/module/admin"
66
- },
67
- {
68
- "@id": "http://data.dacore.org/module/browser-core"
69
- },
70
- {
71
- "@id": "http://data.dacore.org/module/core-editors"
72
- },
73
- {
74
- "@id": "http://data.dacore.org/module/core-ui"
75
- },
76
- {
77
- "@id": "http://data.dacore.org/module/core"
78
- },
79
- {
80
- "@id": "http://data.dacore.org/module/coreviews"
81
- },
82
- {
83
- "@id": "http://data.dacore.org/module/dcterms"
84
- },
85
- {
86
- "@id": "http://data.dacore.org/module/forms"
87
- },
88
- {
89
- "@id": "http://data.dacore.org/module/html"
90
- },
91
- {
92
- "@id": "http://data.dacore.org/module/icons"
93
- },
94
- {
95
- "@id": "http://data.dacore.org/module/rdf4j"
96
- },
97
- {
98
- "@id": "http://data.dacore.org/module/server-core"
99
- },
100
- {
101
- "@id": "http://data.dacore.org/module/website"
102
- },
103
- {
104
- "@id": "http://data.dacore.org/module/website-editors"
105
- }
106
- ]
107
- },
108
- {
109
- "@id": "${uriBase}",
110
- "@type": "browser-core:BrowserCore",
111
- "core:uriBase": "${uriBase}",
112
- "core:deployment": "development",
113
- "browser-core:publicRoot": "${publicRoot}",
114
- "browser-core:browserTitle": "${projectName}"
115
- }
116
- ]
117
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "sourceMap": true,
5
- "target": "ES5",
6
- "jsx": "react",
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "downlevelIteration": true,
10
- "lib": ["es2017", "dom"],
11
- "baseUrl": "./",
12
- "rootDir": "src",
13
- "paths": {
14
- "*": ["node_modules/@types/*", "../../node_modules/@types/*", "*"]
15
- }
16
- },
17
- "files": ["./src/index.ts"]
18
- }
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "sourceMap": true,
5
- "target": "es6",
6
- "outDir": "lib",
7
- "declaration": true,
8
- "esModuleInterop": true,
9
- "downlevelIteration": true,
10
- "skipLibCheck": true,
11
- "jsx": "react",
12
- "baseUrl": "./",
13
- "rootDir": "src",
14
- "paths": {
15
- "*": ["node_modules/@types/*", "../../node_modules/@types/*", "*"]
16
- }
17
- },
18
- "include": ["./src/data/migrations/*"],
19
- "files": ["./src/index.ts", "./src/providers.ts"]
20
- }