lucid-package 0.0.6 → 0.0.9

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.6",
3
+ "version": "0.0.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -7,6 +7,7 @@ const package_1 = require("./package");
7
7
  const express = require("express");
8
8
  const child_process = require("child_process");
9
9
  const shapelibrary_1 = require("./shapelibrary");
10
+ const packagemanifest_1 = require("./packagemanifest");
10
11
  const WebPackCLI = require('webpack-cli');
11
12
  async function createEditorExtension(name, isInternalTesting) {
12
13
  console.log('Creating empty editor extension in editorextensions/' + name);
@@ -16,7 +17,7 @@ async function createEditorExtension(name, isInternalTesting) {
16
17
  'name': name,
17
18
  'title': name,
18
19
  'codePath': `editorextensions/${name}/bin/extension.js`,
19
- 'scopes': ['READ', 'DOWNLOAD'],
20
+ 'scopes': ['READ', 'WRITE', 'DOWNLOAD', 'SHOW_MODAL', 'NETWORK'],
20
21
  });
21
22
  });
22
23
  console.log(`Installing dependencies`);
@@ -59,6 +60,31 @@ async function debugEditorExtension(name) {
59
60
  app.get('/extension.js', async (req, res) => {
60
61
  res.send((await fs.readFile('bin/extension.js')).toString());
61
62
  });
63
+ app.get('/scopes', async (req, res) => {
64
+ var _a;
65
+ const manifest = await (0, packagemanifest_1.readManifest)('../../');
66
+ res.send(JSON.stringify((_a = manifest['extensions'].find((extension) => extension['name'] === name)) === null || _a === void 0 ? void 0 : _a.scopes));
67
+ });
68
+ app.get('/packageId', async (req, res) => {
69
+ var _a;
70
+ const manifest = await (0, packagemanifest_1.readManifest)('../../');
71
+ res.send((_a = manifest['id']) !== null && _a !== void 0 ? _a : '__local__');
72
+ });
73
+ app.get('/editorextension', async (req, res) => {
74
+ var _a, _b;
75
+ const manifest = await (0, packagemanifest_1.readManifest)('../../');
76
+ const extensionManifest = manifest['extensions'].find((one) => one['name'] === name);
77
+ res.send({
78
+ id: '__local__',
79
+ packageId: (_a = manifest['id']) !== null && _a !== void 0 ? _a : '__local__',
80
+ packageVersionId: '__local__',
81
+ version: manifest['version'],
82
+ name: name,
83
+ title: (_b = extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest['title']) !== null && _b !== void 0 ? _b : 'Local dev extension',
84
+ scopes: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest['scopes'],
85
+ codeUrl: 'http://localhost:9900/extension.js',
86
+ });
87
+ });
62
88
  app.listen(9900, () => {
63
89
  console.log('Listening at http://localhost:9900/extension.js');
64
90
  });
package/src/index.js CHANGED
@@ -7,7 +7,7 @@ const shapelibrary_1 = require("./shapelibrary");
7
7
  class LucidSuiteExtensionCLI {
8
8
  run(args) {
9
9
  const parser = new argparse_1.ArgumentParser({
10
- description: 'Create and manage Lucid extensibility packages',
10
+ description: 'Create and manage Lucid extension packages',
11
11
  });
12
12
  //When running with `bazel run //extensibility/lucid-package:dev`, this gives the root directory to create projects in.
13
13
  parser.add_argument('--chdir', { type: 'str', help: argparse_1.SUPPRESS });
@@ -18,10 +18,10 @@ class LucidSuiteExtensionCLI {
18
18
  });
19
19
  const subparsers = parser.add_subparsers({ dest: 'command' });
20
20
  const createParser = subparsers.add_parser('create', {
21
- help: 'Create a new Lucid extensibility package in a new directory',
21
+ help: 'Create a new Lucid extension package in a new directory',
22
22
  });
23
23
  createParser.add_argument('name', { type: 'str' });
24
- const packageParser = subparsers.add_parser('package', {
24
+ const packageParser = subparsers.add_parser('bundle', {
25
25
  help: 'Prepare the current package for upload to the developer dashboard',
26
26
  });
27
27
  const updateSDKParser = subparsers.add_parser('update-sdk', {
@@ -64,12 +64,12 @@ class LucidSuiteExtensionCLI {
64
64
  case 'create':
65
65
  (0, package_1.createEmptyPackage)(parsed['name']);
66
66
  break;
67
- case 'package':
67
+ case 'bundle':
68
68
  if ((0, package_1.currentlyInPackage)()) {
69
69
  (0, package_1.writePackage)();
70
70
  }
71
71
  else {
72
- console.error('Not currently in a Lucid extensibility package folder');
72
+ console.error('Not currently in a Lucid extension package folder');
73
73
  }
74
74
  break;
75
75
  case 'update-sdk':
@@ -77,7 +77,7 @@ class LucidSuiteExtensionCLI {
77
77
  (0, package_1.updateAllExtensionSDK)();
78
78
  }
79
79
  else {
80
- console.error('Not currently in a Lucid extensibility package folder');
80
+ console.error('Not currently in a Lucid extension package folder');
81
81
  }
82
82
  break;
83
83
  case 'create-editor-extension':
@@ -85,7 +85,7 @@ class LucidSuiteExtensionCLI {
85
85
  (0, editorextension_1.createEditorExtension)(parsed['name'], isInternalTesting);
86
86
  }
87
87
  else {
88
- console.error('Not currently in a Lucid extensibility package folder');
88
+ console.error('Not currently in a Lucid extension package folder');
89
89
  }
90
90
  break;
91
91
  case 'build-editor-extension':
@@ -93,7 +93,7 @@ class LucidSuiteExtensionCLI {
93
93
  (0, editorextension_1.buildEditorExtension)(parsed['name']);
94
94
  }
95
95
  else {
96
- console.error('Not currently in a Lucid extensibility package folder');
96
+ console.error('Not currently in a Lucid extension package folder');
97
97
  }
98
98
  break;
99
99
  case 'create-shape-library':
@@ -101,7 +101,7 @@ class LucidSuiteExtensionCLI {
101
101
  (0, shapelibrary_1.createEmptyShapeLibrary)(parsed['name']);
102
102
  }
103
103
  else {
104
- console.error('Not currently in a Lucid extensibility package folder');
104
+ console.error('Not currently in a Lucid extension package folder');
105
105
  }
106
106
  break;
107
107
  case 'test-shape-libraries':
@@ -109,7 +109,7 @@ class LucidSuiteExtensionCLI {
109
109
  (0, shapelibrary_1.debugShapeLibraries)();
110
110
  }
111
111
  else {
112
- console.error('Not currently in a Lucid extensibility package folder');
112
+ console.error('Not currently in a Lucid extension package folder');
113
113
  }
114
114
  break;
115
115
  case 'test-editor-extension':
@@ -117,7 +117,7 @@ class LucidSuiteExtensionCLI {
117
117
  (0, editorextension_1.debugEditorExtension)(parsed['name']);
118
118
  }
119
119
  else {
120
- console.error('Not currently in a Lucid extensibility package folder');
120
+ console.error('Not currently in a Lucid extension package folder');
121
121
  }
122
122
  break;
123
123
  default:
@@ -1,4 +1,5 @@
1
1
  export declare type PackageManifest = {
2
+ 'id'?: string;
2
3
  'version': string;
3
4
  'extensions': {
4
5
  'name': string;
@@ -8,7 +9,7 @@ export declare type PackageManifest = {
8
9
  }[];
9
10
  'shapeLibraries': {
10
11
  'name': string;
11
- 'title': string;
12
+ 'product': 'chart' | 'spark';
12
13
  'lcszPath': string;
13
14
  }[];
14
15
  };
@@ -18,7 +18,7 @@ async function createEmptyShapeLibrary(name) {
18
18
  await (0, package_1.modifyManifest)((manifest) => {
19
19
  manifest['shapeLibraries'].push({
20
20
  'name': name,
21
- 'title': name,
21
+ 'product': 'chart',
22
22
  'lcszPath': `shapelibraries/${name}.lcsz`,
23
23
  });
24
24
  });
@@ -147,7 +147,9 @@ async function debugShapeLibraries(packagePath = '.') {
147
147
  var _a;
148
148
  const manifest = await (0, packagemanifest_1.readManifest)(packagePath + '/');
149
149
  const libraries = (_a = manifest['shapeLibraries']) !== null && _a !== void 0 ? _a : [];
150
- res.send(JSON.stringify(libraries.map((libraryManifest) => {
150
+ const output = await Promise.all(libraries.map(async (libraryManifest) => {
151
+ const libraryDefinitionContent = await fs.readFile(packagePath + '/shapelibraries/' + libraryManifest['name'] + '/library.manifest');
152
+ const libraryDefinition = JSON.parse(libraryDefinitionContent.toString());
151
153
  return {
152
154
  'uri': 'http://localhost:9901/shapeLibraries/' +
153
155
  encodeURIComponent(libraryManifest['name']) +
@@ -155,7 +157,7 @@ async function debugShapeLibraries(packagePath = '.') {
155
157
  shapeLibraryVersion,
156
158
  'user': '',
157
159
  'created': new Date().toISOString(),
158
- 'name': libraryManifest['title'],
160
+ 'name': libraryDefinition['name'],
159
161
  'size': 0,
160
162
  'shapes': 'http://localhost:9901/shapeLibraries/' +
161
163
  encodeURIComponent(libraryManifest['name']) +
@@ -164,7 +166,8 @@ async function debugShapeLibraries(packagePath = '.') {
164
166
  'team-edit': false,
165
167
  'encryption': '',
166
168
  };
167
- })));
169
+ }));
170
+ res.send(JSON.stringify(output));
168
171
  });
169
172
  app.get('/shapeLibraries/:libraryName/shapes', async (req, res) => {
170
173
  //Find all the shapes in the given shape library, and produce JSON for the client
@@ -1,5 +1,7 @@
1
1
  {
2
- "version": "1.0.0",
3
- "extensions": [],
4
- "shapeLibraries":[]
2
+ "id": "",
3
+ "version": "1.0.0",
4
+ "extensions": [],
5
+ "shapeLibraries": [],
6
+ "oauthProviders": []
5
7
  }