lincd-cli 0.2.13 → 0.2.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.
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
2
  presets: ['@babel/preset-env', ['@babel/preset-react', {runtime: 'automatic'}], '@babel/preset-typescript'],
3
- plugins: ['@babel/plugin-transform-runtime'],
3
+ plugins: ['@babel/plugin-transform-runtime',['@babel/plugin-proposal-decorators',{legacy:true}]],
4
4
  };
@@ -0,0 +1 @@
1
+ //import all ShapeProviders here or define a generic BackendProvider, see documentation on https://docs.lincd.org
@@ -6,10 +6,10 @@ import {BrowserRouter} from 'react-router-dom';
6
6
  import App from './App';
7
7
  import React from 'react';
8
8
  import {Storage} from 'lincd/lib/utils/Storage';
9
- import {FrontendFileStore} from 'lincd-server/lib/shapes/FrontendFileStore';
9
+ import {BackendFileStore} from 'lincd-server/lib/shapes/BackendFileStore';
10
10
 
11
11
  //store all quads in a file on the backend named 'main'
12
- export const store = new FrontendFileStore('main');
12
+ export const store = new BackendFileStore('main');
13
13
  Storage.setDefaultStore(store);
14
14
 
15
15
  hydrateRoot(
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
- cssMode: 'scss-modules',
2
+ cssMode: 'mixed',
3
3
  cacheWebpack:true,
4
4
  };
@@ -36,6 +36,7 @@
36
36
  "dependencies": {
37
37
  "@babel/cli": "^7.18.10",
38
38
  "@babel/core": "^7.19.1",
39
+ "@babel/plugin-proposal-decorators": "^7.21.0",
39
40
  "@babel/plugin-transform-runtime": "^7.19.1",
40
41
  "@babel/preset-env": "^7.19.1",
41
42
  "@babel/preset-react": "^7.18.6",
@@ -16,5 +16,6 @@
16
16
  },
17
17
  "pretty": true
18
18
  },
19
- "files": ["./frontend/src/index.tsx"]
19
+ "files": ["./frontend/src/index.tsx"],
20
+ "include": ["./frontend/src/backend.ts"]
20
21
  }
package/lib/utils.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,6 +33,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
33
  __setModuleDefault(result, mod);
23
34
  return result;
24
35
  };
36
+ var __values = (this && this.__values) || function(o) {
37
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
38
+ if (m) return m.call(o);
39
+ if (o && typeof o.length === "number") return {
40
+ next: function () {
41
+ if (o && i >= o.length) o = void 0;
42
+ return { value: o && o[i++], done: !o };
43
+ }
44
+ };
45
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
46
+ };
25
47
  var __read = (this && this.__read) || function (o, n) {
26
48
  var m = typeof Symbol === "function" && o[Symbol.iterator];
27
49
  if (!m) return o;
@@ -51,7 +73,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
51
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
52
74
  };
53
75
  exports.__esModule = true;
54
- exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.execPromise = exports.execp = exports.getGruntConfig = exports.getPackageJSON = void 0;
76
+ exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.execPromise = exports.execp = exports.getGruntConfig = exports.getModulePackageJSON = exports.getLINCDDependencies = exports.getPackageJSON = void 0;
55
77
  var fs = __importStar(require("fs"));
56
78
  var path = __importStar(require("path"));
57
79
  var chalk_1 = __importDefault(require("chalk"));
@@ -72,6 +94,75 @@ var getPackageJSON = function (root, error) {
72
94
  }
73
95
  };
74
96
  exports.getPackageJSON = getPackageJSON;
97
+ /**
98
+ * Scans package.json for dependencies that are LINCD packages
99
+ * Also looks into dependencies of dependencies
100
+ * If no packageJson is given, it will attempt to obtain it from the current working directory
101
+ * Returns an array of lincd packages, with each entry containing an array with the package name and the local path to the package
102
+ * @param packageJson
103
+ */
104
+ var getLINCDDependencies = function (packageJson, checkedPackages) {
105
+ var e_1, _a;
106
+ if (checkedPackages === void 0) { checkedPackages = new Set(); }
107
+ if (!packageJson) {
108
+ packageJson = (0, exports.getPackageJSON)();
109
+ }
110
+ var dependencies = __assign(__assign({}, packageJson.dependencies), packageJson.devDependencies);
111
+ var lincdPackagePaths = [];
112
+ try {
113
+ for (var _b = __values(Object.keys(dependencies)), _c = _b.next(); !_c.done; _c = _b.next()) {
114
+ var dependency = _c.value;
115
+ try {
116
+ if (!checkedPackages.has(dependency)) {
117
+ checkedPackages.add(dependency);
118
+ var _d = __read((0, exports.getModulePackageJSON)(dependency), 2), modulePackageJson = _d[0], modulePath = _d[1];
119
+ if (modulePackageJson === null || modulePackageJson === void 0 ? void 0 : modulePackageJson.lincd) {
120
+ lincdPackagePaths.push([modulePackageJson.name, modulePath]);
121
+ //also check if this package has any dependencies that are lincd packages
122
+ lincdPackagePaths = lincdPackagePaths.concat((0, exports.getLINCDDependencies)(modulePackageJson, checkedPackages));
123
+ }
124
+ if (!modulePackageJson) {
125
+ //this seems to only happen with yarn workspaces for some grunt related dependencies of lincd-cli
126
+ // console.log(`could not find package.json of ${dependency}`);
127
+ }
128
+ }
129
+ }
130
+ catch (err) {
131
+ console.log("could not check if ".concat(dependency, " is a lincd package: ").concat(err));
132
+ }
133
+ }
134
+ }
135
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
136
+ finally {
137
+ try {
138
+ if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
139
+ }
140
+ finally { if (e_1) throw e_1.error; }
141
+ }
142
+ return lincdPackagePaths;
143
+ };
144
+ exports.getLINCDDependencies = getLINCDDependencies;
145
+ //from https://github.com/haalcala/node-packagejson/blob/master/index.js
146
+ var getModulePackageJSON = function (module_name, work_dir) {
147
+ if (!work_dir) {
148
+ work_dir = process.cwd();
149
+ }
150
+ else {
151
+ work_dir = path.resolve(work_dir);
152
+ }
153
+ var package_json;
154
+ if (fs.existsSync(path.resolve(work_dir, "./node_modules"))) {
155
+ var module_dir = path.resolve(work_dir, "./node_modules/" + module_name);
156
+ if (fs.existsSync(module_dir) && fs.existsSync(module_dir + "/package.json")) {
157
+ package_json = JSON.parse(fs.readFileSync((module_dir + "/package.json"), 'utf-8'));
158
+ }
159
+ }
160
+ if (!package_json && work_dir != "/") {
161
+ return (0, exports.getModulePackageJSON)(module_name, path.resolve(work_dir, ".."));
162
+ }
163
+ return [package_json, module_dir];
164
+ };
165
+ exports.getModulePackageJSON = getModulePackageJSON;
75
166
  var getGruntConfig = function (root, error) {
76
167
  if (root === void 0) { root = process.cwd(); }
77
168
  if (error === void 0) { error = true; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lincd-cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Command line tools for the lincd.js library",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {