lucid-package 0.0.103 → 0.0.107

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.103",
3
+ "version": "0.0.107",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  import { Compiler } from 'webpack';
2
2
  export declare function createEditorExtension(name: string, isInternal: boolean, skipSDKDependency: boolean, source?: string, deps?: string[]): Promise<void>;
3
- export declare function buildEditorExtension(name: string, isInternal: boolean, quiet?: boolean): Promise<void>;
3
+ export declare function buildEditorExtension(name: string, isInternal: boolean, quiet?: boolean, skipSdkDependency?: boolean): Promise<void>;
4
4
  export declare function updateExtensionSDK(name: string): Promise<void>;
5
5
  /**
6
6
  * Uses webpack to watch for changes in the editor extension
@@ -46,10 +46,10 @@ async function createEditorExtension(name, isInternal, skipSDKDependency, source
46
46
  (0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSDKDependency, deps);
47
47
  }
48
48
  exports.createEditorExtension = createEditorExtension;
49
- async function buildEditorExtension(name, isInternal, quiet = false) {
49
+ async function buildEditorExtension(name, isInternal, quiet = false, skipSdkDependency = false) {
50
50
  const extensionCodePath = path.join('editorextensions', await getExtensionCodeDirectoryName(name));
51
51
  process.chdir(extensionCodePath);
52
- (0, installationutil_1.installDependenciesIfNeeded)(isInternal);
52
+ (0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSdkDependency);
53
53
  const cli = new WebPackCLI();
54
54
  await cli.run(['node', 'webpack', '--mode', 'production', ...(quiet ? ['--stats', 'errors-only'] : [])]);
55
55
  }
@@ -292,7 +292,7 @@ async function getExtensionManifest(name) {
292
292
  async function getExtensionCodeDirectoryName(name) {
293
293
  const extensionManifest = (await getExtensionManifest(name)).extensionManifest;
294
294
  const codePath = extensionManifest?.['codePath'];
295
- return codePath ? (await getExtensionCodeDirectoryNameFromCodePath(codePath)) ?? name : name;
295
+ return codePath ? ((await getExtensionCodeDirectoryNameFromCodePath(codePath)) ?? name) : name;
296
296
  }
297
297
  /**
298
298
  * Our codePath has the form '/editorextensions/{extensionName}/bin/extension.js'. This function returns the
@@ -308,7 +308,7 @@ async function getExtensionCodeDirectoryNameFromCodePath(codePath) {
308
308
  async function getRawEditorExtension(name, port) {
309
309
  const { manifest, extensionManifest } = await getExtensionManifest(name);
310
310
  const codePath = extensionManifest?.['codePath'];
311
- const directory = codePath ? (await getExtensionCodeDirectoryNameFromCodePath(codePath)) ?? name : name;
311
+ const directory = codePath ? ((await getExtensionCodeDirectoryNameFromCodePath(codePath)) ?? name) : name;
312
312
  const products = extensionManifest
313
313
  ? getExtensionProducts(extensionManifest['product'], extensionManifest['products'])
314
314
  : [supportedproduct_1.SupportedProduct.Chart];
package/src/index.js CHANGED
@@ -44,6 +44,11 @@ class LucidSuiteExtensionCLI {
44
44
  packageParser.add_argument('--env', {
45
45
  help: 'Provide the environment to define which manifest.<env>.json is combined with manifest.json when bundling. If not provided, uses manifest.json only.',
46
46
  });
47
+ packageParser.add_argument('--skip-sdk', {
48
+ default: false,
49
+ action: 'store_true',
50
+ help: argparse_1.SUPPRESS,
51
+ });
47
52
  const updateSDKParser = subparsers.add_parser('update-sdk', {
48
53
  help: 'Update the editor extension SDK to the latest published version for all editor extensions in this package',
49
54
  });
@@ -65,6 +70,11 @@ class LucidSuiteExtensionCLI {
65
70
  action: 'store_true',
66
71
  help: argparse_1.SUPPRESS,
67
72
  });
73
+ buildExtensionParser.add_argument('--skip-sdk', {
74
+ default: false,
75
+ action: 'store_true',
76
+ help: argparse_1.SUPPRESS,
77
+ });
68
78
  const testExtensionParser = subparsers.add_parser('test-editor-extension', {
69
79
  help: 'Compile one or more editor extensions in debug mode, and serve them at localhost:9900, along with any shape libraries in this package at localhost:9901. Watch for changes to the code and recompile as needed',
70
80
  });
@@ -204,7 +214,7 @@ class LucidSuiteExtensionCLI {
204
214
  else {
205
215
  switch (parsed['command']) {
206
216
  case 'bundle':
207
- await (0, package_1.writePackage)(parsed['quiet'], parsed['env']);
217
+ await (0, package_1.writePackage)(parsed['quiet'], parsed['env'], parsed['skip_sdk']);
208
218
  break;
209
219
  case 'update-sdk':
210
220
  await (0, package_1.updateAllExtensionSDK)();
@@ -213,7 +223,7 @@ class LucidSuiteExtensionCLI {
213
223
  await (0, editorextension_1.createEditorExtension)(parsed['name'], isInternal, parsed['skip_sdk']);
214
224
  break;
215
225
  case 'build-editor-extension':
216
- await (0, editorextension_1.buildEditorExtension)(parsed['name'], isInternal, parsed['quiet']);
226
+ await (0, editorextension_1.buildEditorExtension)(parsed['name'], isInternal, parsed['quiet'], parsed['skip_sdk']);
217
227
  break;
218
228
  case 'create-shape-library':
219
229
  await (0, shapelibrary_1.createEmptyShapeLibrary)(parsed['name']);
@@ -15,6 +15,8 @@ function installDependenciesIfNeeded(isInternal, skipSDKDependency = false, addi
15
15
  (0, shellutil_1.execSyncLoggingOutputOnError)(`rm -rf ${sdkDir}`);
16
16
  }
17
17
  else if (!oldFs.existsSync(sdkDir) && !skipSDKDependency) {
18
+ // Otherwise, install the NPM version of the SDK directly. If you would like to opt out of this you can use the
19
+ // `--skip-sdk` CLI flag.
18
20
  console.log((0, theme_1.success)('Adding dependency on SDK'));
19
21
  console.log((0, shellutil_1.execSyncLoggingOutputOnError)('npm install --save lucid-extension-sdk').toString());
20
22
  }
package/src/package.d.ts CHANGED
@@ -8,4 +8,4 @@ export declare function updateAllExtensionSDK(): Promise<void>;
8
8
  *
9
9
  * @param manifestOverrideEnv The environment definine what manifest to read from. `manifest.env.json`
10
10
  */
11
- export declare function writePackage(quiet?: boolean, manifestOverrideEnv?: string): Promise<void>;
11
+ export declare function writePackage(quiet?: boolean, manifestOverrideEnv?: string, skipSdkDependency?: boolean): Promise<void>;
package/src/package.js CHANGED
@@ -58,7 +58,7 @@ exports.updateAllExtensionSDK = updateAllExtensionSDK;
58
58
  *
59
59
  * @param manifestOverrideEnv The environment definine what manifest to read from. `manifest.env.json`
60
60
  */
61
- async function writePackage(quiet = false, manifestOverrideEnv) {
61
+ async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependency = false) {
62
62
  const zip = new JSZip();
63
63
  const quietableConsoleLog = (...data) => {
64
64
  if (!quiet) {
@@ -95,11 +95,12 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
95
95
  process.argv[1] +
96
96
  '" build-editor-extension ' +
97
97
  (quiet ? '--quiet ' : '') +
98
+ (skipSdkDependency ? '--skip-sdk ' : '') +
98
99
  '"' +
99
100
  parts[1] +
100
101
  '"';
101
102
  quietableConsoleLog(cmd);
102
- quietableConsoleLog((0, shellutil_1.execSyncLoggingOutputOnError)(cmd, quiet = quiet).toString());
103
+ quietableConsoleLog((0, shellutil_1.execSyncLoggingOutputOnError)(cmd, (quiet = quiet)).toString());
103
104
  }
104
105
  zip.file(extension['codePath'], await fs.readFile(extension['codePath']));
105
106
  }
@@ -28,21 +28,27 @@ module.exports = {
28
28
  },
29
29
  plugins: [
30
30
  new WebpackShellPluginNext({
31
- //When doing a watch build, run "ng serve" and update the html file to prefix http://localhost:4200/ to all the resource URLs
31
+ // Run during execution of `npx lucid-package@latest test-editor-extension`.
32
+ // When doing a watch build, the user must manually first run "ng serve".
33
+ // Then, this script will update the html file to prefix http://localhost:4200/ to all the resource URLs
32
34
  onWatchRun: {
33
35
  scripts: angularTargets.map(
34
36
  (target) =>
35
- `mkdir -p ../../public/${target.name} &&` +
37
+ // Executed by WebpackShellPluginNext, from within the package's root level directory.
38
+ `mkdir -p public/${target.name} &&` +
36
39
  `curl http://localhost:${target.port} | ` +
37
40
  `sed -E "s/(src|href)=\\"/\\\\1=\\"http:\\/\\/localhost:${target.port}\\//gi" > ` +
38
- `../../public/${target.name}/index.html`,
41
+ `public/${target.name}/index.html`,
39
42
  ),
40
43
  blocking: true,
41
44
  },
42
- //When doing a full build, run "ng build" and then copy all the assets to the root level public folder
45
+ // Run during execution of `npx lucid-package@latest bundle`.
46
+ // When doing a full build, this script will automatically run "ng build"
47
+ // and then copy all the assets to the root level public folder
43
48
  onBeforeNormalRun: {
44
49
  scripts: angularTargets.map(
45
50
  (target) =>
51
+ // Executed by WebpackShellPluginNext from within each _extension's_ directory.
46
52
  `mkdir -p ../../public/${target.name} &&` +
47
53
  `cd ${target.name} && ` +
48
54
  // `npx ng build` usually works, but this is more reliable when used with build tools such as bazel
@@ -28,21 +28,27 @@ module.exports = {
28
28
  },
29
29
  plugins: [
30
30
  new WebpackShellPluginNext({
31
- //When doing a watch build, run "npm start" and update the html file to prefix http://localhost:3000/ to all the resource URLs
31
+ // Run during execution of `npx lucid-package@latest test-editor-extension`.
32
+ // When doing a watch build, the user must manually first run "npm start".
33
+ // Then, this script will update the html file to prefix http://localhost:3000/ to all the resource URLs
32
34
  onWatchRun: {
33
35
  scripts: reactTargets.map(
34
36
  (target) =>
35
- `mkdir -p ../../public/${target.name} &&` +
37
+ // Executed by WebpackShellPluginNext, from within the package's root level directory.
38
+ `mkdir -p public/${target.name} &&` +
36
39
  `curl http://localhost:${target.port} | ` +
37
40
  `sed -E "s/(src|href)=\\"/\\\\1=\\"http:\\/\\/localhost:${target.port}\/gi" > ` +
38
- `../../public/${target.name}/index.html`,
41
+ `public/${target.name}/index.html`,
39
42
  ),
40
43
  blocking: true,
41
44
  },
42
- // When doing a full build, run "npm run build" and then copy all the assets to the root level public folder
45
+ // Run during execution of `npx lucid-package@latest bundle`.
46
+ // When doing a full build, this script will automatically run "npm run build"
47
+ // and then copy all the assets to the root level public folder
43
48
  onBeforeNormalRun: {
44
49
  scripts: reactTargets.map(
45
50
  (target) =>
51
+ // Executed by WebpackShellPluginNext from within each _extension's_ directory.
46
52
  `mkdir -p ../../public/${target.name} &&` +
47
53
  `cd ${target.name} && ` +
48
54
  `npm run build && ` +