lincd-cli 0.2.9 → 0.2.10
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-with-backend/backend/server.js +2 -1
- package/defaults/app-with-backend/frontend/src/App.scss +0 -3
- package/defaults/app-with-backend/frontend/src/App.tsx +12 -8
- package/defaults/app-with-backend/frontend/src/package.ts +3 -0
- package/defaults/app-with-backend/lincd.config.js +4 -0
- package/defaults/app-with-backend/package.json +1 -0
- package/lib/cli.js +3 -3
- package/lib/config-webpack.js +121 -34
- package/package.json +1 -1
- package/yarn-error.log +0 -12933
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
require('@babel/register')({extensions: ['.ts', '.tsx']});
|
|
3
3
|
const LincdServer = require('lincd-server/lib/shapes/LincdServer');
|
|
4
|
-
let
|
|
4
|
+
let lincdConfig = require("../lincd.config");
|
|
5
|
+
let server = new LincdServer.LincdServer({loadAppComponent: () => require('../frontend/src/App').default,...lincdConfig});
|
|
5
6
|
server.start();
|
|
@@ -94,14 +94,18 @@ function Header() {
|
|
|
94
94
|
function Html({assets, children, title}) {
|
|
95
95
|
return (
|
|
96
96
|
<html lang="en">
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
{globalThis.document?.head ? (
|
|
98
|
+
<head dangerouslySetInnerHTML={{__html: document.head.innerHTML}} />
|
|
99
|
+
) : (
|
|
100
|
+
<head>
|
|
101
|
+
<meta charSet="utf-8" />
|
|
102
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
103
|
+
<link rel="shortcut icon" href="/static/favicon.ico" />
|
|
104
|
+
<link rel="stylesheet" href={assets['main.css']} />
|
|
105
|
+
{assets['tailwind-cdn'] && <script src={assets['tailwind-cdn']}></script>}
|
|
106
|
+
<title>{title}</title>
|
|
107
|
+
</head>
|
|
108
|
+
)}
|
|
105
109
|
<body>
|
|
106
110
|
<noscript
|
|
107
111
|
dangerouslySetInnerHTML={{
|
package/lib/cli.js
CHANGED
|
@@ -699,7 +699,7 @@ var createOntology = function (prefix, uriBase, basePath) {
|
|
|
699
699
|
}
|
|
700
700
|
targetFolder = ensureFolderExists(basePath, 'src', 'ontologies');
|
|
701
701
|
if (!uriBase) {
|
|
702
|
-
uriBase = 'http://lincd.org/ont/' + prefix;
|
|
702
|
+
uriBase = 'http://lincd.org/ont/' + prefix + '/';
|
|
703
703
|
}
|
|
704
704
|
setVariable('uri_base', uriBase);
|
|
705
705
|
_a = setNameVariables(prefix), hyphenName = _a.hyphenName, camelCaseName = _a.camelCaseName, underscoreName = _a.underscoreName;
|
|
@@ -918,7 +918,7 @@ var createPackage = function (name, uriBase, basePath) {
|
|
|
918
918
|
if (!uriBase) {
|
|
919
919
|
uriBase = 'http://lincd.org/ont/' + name;
|
|
920
920
|
}
|
|
921
|
-
setVariable('uri_base', uriBase);
|
|
921
|
+
setVariable('uri_base', uriBase + '/');
|
|
922
922
|
//find @scope and the next part between 2 slashes after
|
|
923
923
|
//so @dacore/some-mod/lib/file.js
|
|
924
924
|
// --> match[0] = @dacore/some-mod
|
|
@@ -999,7 +999,7 @@ var createApp = function (name, basePath) {
|
|
|
999
999
|
// fs.copySync(path.join(__dirname, '..', 'defaults', 'app'), targetFolder);
|
|
1000
1000
|
log("Creating new LINCD application '" + name + "'");
|
|
1001
1001
|
//replace variables in some copied files
|
|
1002
|
-
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/App.scss.json', 'frontend/src/components/Spinner.scss.json');
|
|
1002
|
+
replaceVariablesInFilesWithRoot(targetFolder, 'package.json', 'frontend/src/App.tsx', 'frontend/src/package.ts', 'frontend/src/App.scss.json', 'frontend/src/components/Spinner.scss.json');
|
|
1003
1003
|
return [4 /*yield*/, hasYarnInstalled()];
|
|
1004
1004
|
case 1:
|
|
1005
1005
|
hasYarn = _b.sent();
|
package/lib/config-webpack.js
CHANGED
|
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42
|
+
if (ar || !(i in from)) {
|
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
44
|
+
ar[i] = from[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
|
+
};
|
|
13
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
51
|
};
|
|
@@ -37,6 +73,37 @@ var NODE_ENV = process.env.NODE_ENV;
|
|
|
37
73
|
var nodeProduction = NODE_ENV == 'production';
|
|
38
74
|
// const libraryName = 'lincd';
|
|
39
75
|
process.traceDeprecation = true;
|
|
76
|
+
function getLincdPackagePaths(packages) {
|
|
77
|
+
var e_1, _a;
|
|
78
|
+
if (!packages) {
|
|
79
|
+
var pkgJson = (0, utils_1.getPackageJSON)();
|
|
80
|
+
packages = __assign(__assign({}, pkgJson.dependencies), pkgJson.devDependencies);
|
|
81
|
+
}
|
|
82
|
+
var lincdPackagePaths = [];
|
|
83
|
+
try {
|
|
84
|
+
for (var _b = __values(Object.keys(packages)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
85
|
+
var dependency = _c.value;
|
|
86
|
+
try {
|
|
87
|
+
var pkgJson = require(dependency + '/package.json');
|
|
88
|
+
if (pkgJson.lincd) {
|
|
89
|
+
var pkgPath = require.resolve(dependency + '/package.json');
|
|
90
|
+
lincdPackagePaths.push(pkgPath.substring(0, pkgPath.length - 13));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
// console.log("could not find "+dependency);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
99
|
+
finally {
|
|
100
|
+
try {
|
|
101
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
102
|
+
}
|
|
103
|
+
finally { if (e_1) throw e_1.error; }
|
|
104
|
+
}
|
|
105
|
+
return lincdPackagePaths;
|
|
106
|
+
}
|
|
40
107
|
function generateWebpackConfig(buildName, moduleName, config) {
|
|
41
108
|
if (config === void 0) { config = {}; }
|
|
42
109
|
if (!config.externals)
|
|
@@ -143,6 +210,52 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
143
210
|
// }),
|
|
144
211
|
// ];
|
|
145
212
|
var aliases = config.alias || {};
|
|
213
|
+
var postcssPlugins = [];
|
|
214
|
+
if (!config.cssMode) {
|
|
215
|
+
config.cssMode = 'mixed';
|
|
216
|
+
}
|
|
217
|
+
if (config.cssMode === 'scss-modules' || config.cssMode === 'scss' || config.cssMode === 'mixed') {
|
|
218
|
+
postcssPlugins = postcssPlugins.concat(['postcss-preset-env', productionMode && 'cssnano']);
|
|
219
|
+
//we once had:
|
|
220
|
+
// 'postcss-import': {},
|
|
221
|
+
// // 'postcss-cssnext': {},
|
|
222
|
+
// 'postcss-nested': {},
|
|
223
|
+
// // "postcss-scss": {}, //<-- only add this back if the build gets stuck on //comments in scss files, but I dont think that will be the case anymore
|
|
224
|
+
if (config.cssMode === 'scss-modules' || config.cssMode === 'mixed') {
|
|
225
|
+
postcssPlugins.push([
|
|
226
|
+
'postcss-modules',
|
|
227
|
+
{
|
|
228
|
+
generateScopedName: utils_1.generateScopedName.bind(null, moduleName),
|
|
229
|
+
globalModulePaths: [/tailwind/, /tailwindcss/, config.cssGlobalModulePaths].filter(Boolean)
|
|
230
|
+
},
|
|
231
|
+
]);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (config.cssMode === 'tailwind' || config.cssMode === 'mixed') {
|
|
235
|
+
var lincdPackagePaths = void 0;
|
|
236
|
+
//IF this package is including sources from another lincd package in its bundle (usually not the case)
|
|
237
|
+
if (config.internals) {
|
|
238
|
+
//THEN make sure that we also look for tailwind classes in those packages
|
|
239
|
+
//pass the list of internal packages, or if all, pass null because it will look up all the package.json:dependencies
|
|
240
|
+
lincdPackagePaths = getLincdPackagePaths(config.internals !== '*' ? config.internals : null).map(function (path) {
|
|
241
|
+
return path + '/lib/**/*.{js,mjs}';
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// console.log(chalk.blueBright('tailwind content: ')+chalk.magenta(['./frontend/src/**/*.{tsx,ts}',...lincdPackagePaths]));
|
|
245
|
+
postcssPlugins.push([
|
|
246
|
+
'tailwindcss',
|
|
247
|
+
{
|
|
248
|
+
safelist: productionMode
|
|
249
|
+
? {}
|
|
250
|
+
: {
|
|
251
|
+
//in development mode we allow all classes here, so that you can easily develop
|
|
252
|
+
pattern: /./,
|
|
253
|
+
variants: ['sm', 'md', 'lg', 'xl', '2xl']
|
|
254
|
+
},
|
|
255
|
+
content: __spreadArray(['./src/**/*.{tsx,ts}'], __read(lincdPackagePaths), false)
|
|
256
|
+
},
|
|
257
|
+
]);
|
|
258
|
+
}
|
|
146
259
|
var rules = [
|
|
147
260
|
{
|
|
148
261
|
test: /\.(scss|css)$/,
|
|
@@ -158,39 +271,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
158
271
|
loader: 'postcss-loader',
|
|
159
272
|
options: {
|
|
160
273
|
postcssOptions: {
|
|
161
|
-
plugins:
|
|
162
|
-
'postcss-import': {},
|
|
163
|
-
// 'postcss-cssnext': {},
|
|
164
|
-
'postcss-nested': {},
|
|
165
|
-
// "postcss-scss": {}, //<-- only add this back if the build gets stuck on //comments in scss files, but I dont think that will be the case anymore
|
|
166
|
-
'postcss-modules': {
|
|
167
|
-
// //by default postcss-modules will put out a json file right next to the original css / scss file, this method defines what classnames to use
|
|
168
|
-
// generateScopedName:generateScopedName.bind(null,moduleName),
|
|
169
|
-
generateScopedName: utils_1.generateScopedName.bind(null, moduleName),
|
|
170
|
-
globalModulePaths: [/tailwind/]
|
|
171
|
-
},
|
|
172
|
-
tailwindcss: {
|
|
173
|
-
safelist: productionMode
|
|
174
|
-
? {}
|
|
175
|
-
: {
|
|
176
|
-
//in development mode we allow all classes here, so that you can easily develop
|
|
177
|
-
pattern: /./,
|
|
178
|
-
variants: ['sm', 'md', 'lg', 'xl', '2xl']
|
|
179
|
-
},
|
|
180
|
-
// purge: {
|
|
181
|
-
// enabled: productionMode,
|
|
182
|
-
content: [
|
|
183
|
-
'./src/**/*.tsx',
|
|
184
|
-
'./src/**/*.ts',
|
|
185
|
-
//also include @dacore modules which are internalized with the "internal" config option
|
|
186
|
-
//imports like ... from '@dacore/module/lib/views/SomeView' will
|
|
187
|
-
//these modules should live in the node_modules folder of the root of the site
|
|
188
|
-
//TODO: remake this with multiple lincd modules
|
|
189
|
-
// '../../node_modules/@dacore/*/lib/**/*.js',
|
|
190
|
-
// './node_modules/@dacore/*/lib/**/*.js',
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
}
|
|
274
|
+
plugins: postcssPlugins
|
|
194
275
|
}
|
|
195
276
|
}
|
|
196
277
|
},
|
|
@@ -285,7 +366,9 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
285
366
|
// },
|
|
286
367
|
resolve: {
|
|
287
368
|
extensions: ['.webpack.js', '.js', '.ts', '.tsx', '.json'],
|
|
288
|
-
alias: aliases
|
|
369
|
+
alias: aliases,
|
|
370
|
+
// plugins: resolvePlugins,
|
|
371
|
+
fallback: { crypto: false }
|
|
289
372
|
},
|
|
290
373
|
resolveLoader: {
|
|
291
374
|
modules: [
|
|
@@ -308,6 +391,10 @@ function generateWebpackConfig(buildName, moduleName, config) {
|
|
|
308
391
|
]
|
|
309
392
|
},
|
|
310
393
|
watch: watch,
|
|
394
|
+
watchOptions: {
|
|
395
|
+
ignored: ['**/*.d.ts', '**/*.js.map', '**/*.scss.json'],
|
|
396
|
+
aggregateTimeout: 500
|
|
397
|
+
},
|
|
311
398
|
module: {
|
|
312
399
|
rules: rules
|
|
313
400
|
},
|