lucid-package 0.0.84 → 0.0.86

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-package",
3
- "version": "0.0.84",
3
+ "version": "0.0.86",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -15,6 +15,8 @@ const shapelibrary_1 = require("./shapelibrary");
15
15
  const shellutil_1 = require("./shellutil");
16
16
  const supportedproduct_1 = require("./supportedproduct");
17
17
  const WebPackCLI = require('webpack-cli');
18
+ const ws = require('ws');
19
+ const chokidar = require('chokidar');
18
20
  async function createEditorExtension(name, isInternalTesting, skipSDKDependency) {
19
21
  const editorExtensionSource = path.join(__dirname, '..', 'templates', 'editorextension');
20
22
  const editorExtensionTargetFolder = path.join('editorextensions', name);
@@ -184,8 +186,27 @@ async function debugEditorExtension(extensionNames, quiet = false, pickAnyPort =
184
186
  }
185
187
  app.use('/resources', express.static('public'));
186
188
  const listen = () => {
187
- app.listen(port, 'localhost', () => {
189
+ const server = app.listen(port, 'localhost', () => {
188
190
  console.log('Listening at http://localhost:' + port + '/extension.js');
191
+ // Watch for any editor extension changes, and inform watchers that they need to refresh them.
192
+ const wss = new ws.Server({ server, path: '/editorExtensions/changes' });
193
+ const sockets = [];
194
+ wss.on('connection', (ws) => {
195
+ sockets.push(ws);
196
+ });
197
+ // Changes to a file can trigger changes in other files. We debounce all changes so that
198
+ // we don't send multiple "refresh" messages.
199
+ let timeout = null;
200
+ chokidar.watch([['./']]).on('all', () => {
201
+ if (timeout) {
202
+ clearTimeout(timeout);
203
+ }
204
+ timeout = setTimeout(() => {
205
+ for (const socket of sockets) {
206
+ socket.send('refresh');
207
+ }
208
+ }, 100);
209
+ });
189
210
  (0, shapelibrary_1.debugShapeLibraries)(undefined, pickAnyPort);
190
211
  }).on('error', (err) => {
191
212
  if (err.code === 'EADDRINUSE') {
package/src/index.js CHANGED
@@ -144,6 +144,7 @@ class LucidSuiteExtensionCLI {
144
144
  switch (parsed['command']) {
145
145
  case 'bundle':
146
146
  await (0, package_1.writePackage)(parsed['quiet'], parsed['env']);
147
+ break;
147
148
  case 'update-sdk':
148
149
  await (0, package_1.updateAllExtensionSDK)();
149
150
  break;
@@ -8,25 +8,14 @@ function installDependenciesIfNeeded(isInternalTesting, skipSDKDependency = fals
8
8
  if (!oldFs.existsSync('node_modules')) {
9
9
  console.log((0, shellutil_1.execSyncLoggingOutputOnError)('npm install --silent').toString());
10
10
  }
11
- if (!oldFs.existsSync(path.join('node_modules', 'lucid-extension-sdk')) && !skipSDKDependency) {
12
- if (isInternalTesting) {
13
- linkInternalTestingSDK();
14
- }
15
- else {
16
- console.log('Adding dependency on SDK');
17
- console.log((0, shellutil_1.execSyncLoggingOutputOnError)('npm install --save lucid-extension-sdk').toString());
18
- }
11
+ const sdkDir = path.join('node_modules', 'lucid-extension-sdk');
12
+ if (isInternalTesting) {
13
+ //Delete any lucid-extension-sdk directory; let it come from //extensibility/packages/node_modules/lucid-extension-sdk
14
+ oldFs.rmSync(sdkDir, { recursive: true, force: true });
19
15
  }
20
- }
21
- exports.installDependenciesIfNeeded = installDependenciesIfNeeded;
22
- function linkInternalTestingSDK() {
23
- if (!oldFs.existsSync(path.join('node_modules', 'lucid-extension-sdk'))) {
24
- const cwd = process.cwd();
25
- const rootSearch = 'lucid/main/extensibility/';
26
- const pos = cwd.indexOf(rootSearch);
27
- const sdkPath = cwd.substr(0, pos + rootSearch.length) + 'lucid-extension-sdk';
28
- const relativePath = path.relative(cwd, sdkPath);
29
- console.log('Using symlink for dependency on SDK for internal testing');
30
- console.log((0, shellutil_1.execSyncLoggingOutputOnError)(`npm install --silent --save ${relativePath}`).toString());
16
+ else if (!oldFs.existsSync(sdkDir) && !skipSDKDependency) {
17
+ console.log('Adding dependency on SDK');
18
+ console.log((0, shellutil_1.execSyncLoggingOutputOnError)('npm install --save lucid-extension-sdk').toString());
31
19
  }
32
20
  }
21
+ exports.installDependenciesIfNeeded = installDependenciesIfNeeded;