lincd-cli 0.1.2 → 0.1.4
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/README.md +24 -23
- package/defaults/defaultModule/Index.tsx +24 -24
- package/defaults/defaultModule/index.ts +1 -1
- package/defaults/defaultModule/ontology.ts +1 -1
- package/defaults/index.ts +1 -1
- package/defaults/module/Gruntfile.js +16 -0
- package/defaults/module/package.json +29 -0
- package/defaults/module/src/components/ExampleComponent.tsx +22 -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 +9 -0
- package/defaults/module/src/ontologies/example-ontology.ts +33 -0
- package/defaults/module/src/shapes/ExampleShapeClass.ts +30 -0
- package/defaults/module/tsconfig-es5.json +19 -0
- package/defaults/module/tsconfig.json +19 -0
- package/defaults/ontology.ts +1 -1
- package/defaults/package.json +28 -24
- package/defaults/site/.gitignore +8 -0
- package/defaults/site/.npmignore +10 -0
- package/defaults/site/lib/start-server.js +22 -0
- package/defaults/site/lib/test-server.js +10 -0
- package/defaults/site/package.json +40 -0
- package/defaults/site/storage/filestores/settings-development.jsonld +117 -0
- package/defaults/site/storage/filestores/settings-production-template.jsonld +129 -0
- package/defaults/site/web/.htaccess +19 -0
- package/defaults/site/web/favicon.png +0 -0
- package/defaults/site/web/img/placeholder.jpg +0 -0
- package/defaults/tsconfig-es5.json +18 -19
- package/defaults/tsconfig.json +20 -21
- package/lib/cli.js +1074 -0
- package/lib/config-grunt.js +254 -0
- package/lib/config-webpack.js +273 -0
- package/{index.js → lib/index.js} +8 -4
- package/lib/interfaces.js +2 -0
- package/{plugins → lib/plugins}/declaration-plugin.js +3 -3
- package/lib/plugins/externalise-modules.js +165 -0
- package/{plugins → lib/plugins}/watch-run.js +0 -0
- package/lib/utils.js +127 -0
- package/package.json +71 -68
- package/{cli.js → src/cli.js} +54 -93
- package/src/config-grunt.js +263 -0
- package/src/config-webpack.js +281 -0
- package/src/index.js +22 -0
- package/src/interfaces.js +2 -0
- package/src/plugins/declaration-plugin.js +248 -0
- package/{plugins → src/plugins}/externalise-modules.js +8 -6
- package/src/plugins/shapes-plugin.js +69 -0
- package/src/plugins/watch-run.js +47 -0
- package/src/utils.js +127 -0
- package/config-generator.js +0 -545
- package/utils.js +0 -17
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// WebpackWatchRunPlugin.js
|
|
2
|
+
/*
|
|
3
|
+
* This simple webpack plugin helps to identify the list of file changes, that
|
|
4
|
+
* triggered webpack re-compilation/re-build
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
var WatchRunPlugin = /** @class */ (function () {
|
|
9
|
+
function WatchRunPlugin() {
|
|
10
|
+
}
|
|
11
|
+
WatchRunPlugin.prototype.apply = function (compiler) {
|
|
12
|
+
compiler.hooks.watchRun.tap('WatchRun', function (comp) {
|
|
13
|
+
var changedTimes = comp.watchFileSystem.watcher.mtimes;
|
|
14
|
+
var changedFiles = Object.keys(changedTimes)
|
|
15
|
+
.map(function (file) { return "\n ".concat(file); })
|
|
16
|
+
.join('');
|
|
17
|
+
if (changedFiles.length) {
|
|
18
|
+
console.log('====================================');
|
|
19
|
+
console.log('NEW BUILD FILES CHANGED:', changedFiles);
|
|
20
|
+
console.log('====================================');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return WatchRunPlugin;
|
|
25
|
+
}());
|
|
26
|
+
/*class WebpackWatchRunPlugin {
|
|
27
|
+
constructor(options?) {
|
|
28
|
+
if (typeof options !== "object") options = {};
|
|
29
|
+
this['options'] = options;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
apply(compiler) {
|
|
33
|
+
const options = this['options'];
|
|
34
|
+
compiler.plugin("watch-run",
|
|
35
|
+
function (watching, done) {
|
|
36
|
+
const changedTimes = watching.compiler.watchFileSystem.watcher.mtimes;
|
|
37
|
+
const changedFiles = Object.keys(changedTimes)
|
|
38
|
+
.map(file => `\n ${file}`)
|
|
39
|
+
.join("");
|
|
40
|
+
if (changedFiles.length) {
|
|
41
|
+
console.log("Files modified:", changedFiles);
|
|
42
|
+
}
|
|
43
|
+
done();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}*/
|
|
47
|
+
exports["default"] = WatchRunPlugin;
|
package/src/utils.js
ADDED
|
@@ -0,0 +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;
|