lucid-package 0.0.96 → 0.0.98
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 +1 -1
- package/src/angularframeworkutils.d.ts +1 -1
- package/src/angularframeworkutils.js +3 -3
- package/src/dataconnector.d.ts +1 -1
- package/src/dataconnector.js +2 -2
- package/src/editorextension.d.ts +4 -4
- package/src/editorextension.js +8 -8
- package/src/index.js +25 -19
- package/src/installationutil.d.ts +1 -1
- package/src/installationutil.js +2 -2
- package/src/reactframeworkutils.d.ts +1 -1
- package/src/reactframeworkutils.js +3 -3
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function createAngularEditorExtension(name: string,
|
|
1
|
+
export declare function createAngularEditorExtension(name: string, isInternal: boolean, skipSDKDependency: boolean): Promise<void>;
|
|
@@ -7,8 +7,8 @@ const editorextension_1 = require("./editorextension");
|
|
|
7
7
|
const installationutil_1 = require("./installationutil");
|
|
8
8
|
const package_1 = require("./package");
|
|
9
9
|
const theme_1 = require("./theme");
|
|
10
|
-
async function createAngularEditorExtension(name,
|
|
11
|
-
await (0, editorextension_1.createEditorExtension)(name,
|
|
10
|
+
async function createAngularEditorExtension(name, isInternal, skipSDKDependency) {
|
|
11
|
+
await (0, editorextension_1.createEditorExtension)(name, isInternal, skipSDKDependency, path.join('angular', 'skeleton'), [
|
|
12
12
|
'webpack-shell-plugin-next',
|
|
13
13
|
]);
|
|
14
14
|
const angularProjectName = name;
|
|
@@ -24,6 +24,6 @@ async function createAngularEditorExtension(name, isInternalTesting, skipSDKDepe
|
|
|
24
24
|
packageJson.name = angularProjectName;
|
|
25
25
|
await fs.writeFile('package.json', JSON.stringify(packageJson, null, 4));
|
|
26
26
|
console.log('Installing Angular dependencies');
|
|
27
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
27
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSDKDependency);
|
|
28
28
|
}
|
|
29
29
|
exports.createAngularEditorExtension = createAngularEditorExtension;
|
package/src/dataconnector.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function createDataConnector(name: string,
|
|
1
|
+
export declare function createDataConnector(name: string, isInternal: boolean, skipSDKDependency: boolean): Promise<void>;
|
package/src/dataconnector.js
CHANGED
|
@@ -6,7 +6,7 @@ const filesystemutil_1 = require("./filesystemutil");
|
|
|
6
6
|
const installationutil_1 = require("./installationutil");
|
|
7
7
|
const package_1 = require("./package");
|
|
8
8
|
const theme_1 = require("./theme");
|
|
9
|
-
async function createDataConnector(name,
|
|
9
|
+
async function createDataConnector(name, isInternal, skipSDKDependency) {
|
|
10
10
|
console.log((0, theme_1.success)('Creating data connector in dataconnectors/' + name));
|
|
11
11
|
const source = path.join(__dirname, '..', 'templates', 'dataconnector');
|
|
12
12
|
const targetFolder = path.join('dataconnectors', name);
|
|
@@ -24,6 +24,6 @@ async function createDataConnector(name, isInternalTesting, skipSDKDependency) {
|
|
|
24
24
|
});
|
|
25
25
|
console.log(`Installing dependencies`);
|
|
26
26
|
process.chdir(targetFolder);
|
|
27
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
27
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSDKDependency);
|
|
28
28
|
}
|
|
29
29
|
exports.createDataConnector = createDataConnector;
|
package/src/editorextension.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Compiler } from 'webpack';
|
|
2
|
-
export declare function createEditorExtension(name: string,
|
|
3
|
-
export declare function buildEditorExtension(name: string,
|
|
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>;
|
|
4
4
|
export declare function updateExtensionSDK(name: string): Promise<void>;
|
|
5
5
|
/**
|
|
6
6
|
* Uses webpack to watch for changes in the editor extension
|
|
7
7
|
* @param name The editor extension name
|
|
8
8
|
* @param quiet If true, will only show errors in output
|
|
9
9
|
*/
|
|
10
|
-
export declare function watchEditorExtension(name: string,
|
|
10
|
+
export declare function watchEditorExtension(name: string, isInternal: boolean, quiet?: boolean): Promise<{
|
|
11
11
|
name: string;
|
|
12
12
|
compiler: Compiler;
|
|
13
13
|
}>;
|
|
@@ -16,5 +16,5 @@ export declare function watchEditorExtension(name: string, isInternalTesting: bo
|
|
|
16
16
|
* @param extensionNames The names of the editor extensions
|
|
17
17
|
* @param quiet If true, will only show errors in output
|
|
18
18
|
*/
|
|
19
|
-
export declare function debugEditorExtension(extensionNames: string[],
|
|
19
|
+
export declare function debugEditorExtension(extensionNames: string[], isInternal: boolean, quiet?: boolean, pickAnyPort?: boolean): Promise<void>;
|
|
20
20
|
export declare function getAllExtensionNames(): Promise<string[]>;
|
package/src/editorextension.js
CHANGED
|
@@ -19,7 +19,7 @@ const webpack = require('webpack');
|
|
|
19
19
|
const WebPackCLI = require('webpack-cli');
|
|
20
20
|
const ws = require('ws');
|
|
21
21
|
const chokidar = require('chokidar');
|
|
22
|
-
async function createEditorExtension(name,
|
|
22
|
+
async function createEditorExtension(name, isInternal, skipSDKDependency, source = 'vanilla', deps = []) {
|
|
23
23
|
const editorExtensionSource = path.join(__dirname, '..', 'templates', 'editorextension', source);
|
|
24
24
|
const editorExtensionTargetFolder = path.join('editorextensions', name);
|
|
25
25
|
const publicSource = path.join(__dirname, '..', 'templates', 'public');
|
|
@@ -42,13 +42,13 @@ async function createEditorExtension(name, isInternalTesting, skipSDKDependency,
|
|
|
42
42
|
});
|
|
43
43
|
console.log(`Installing dependencies`);
|
|
44
44
|
process.chdir(editorExtensionTargetFolder);
|
|
45
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
45
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSDKDependency, deps);
|
|
46
46
|
}
|
|
47
47
|
exports.createEditorExtension = createEditorExtension;
|
|
48
|
-
async function buildEditorExtension(name,
|
|
48
|
+
async function buildEditorExtension(name, isInternal, quiet = false) {
|
|
49
49
|
const extensionCodePath = path.join('editorextensions', await getExtensionCodeDirectoryName(name));
|
|
50
50
|
process.chdir(extensionCodePath);
|
|
51
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
51
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal);
|
|
52
52
|
const cli = new WebPackCLI();
|
|
53
53
|
await cli.run(['node', 'webpack', '--mode', 'production', ...(quiet ? ['--stats', 'errors-only'] : [])]);
|
|
54
54
|
}
|
|
@@ -65,11 +65,11 @@ exports.updateExtensionSDK = updateExtensionSDK;
|
|
|
65
65
|
* @param name The editor extension name
|
|
66
66
|
* @param quiet If true, will only show errors in output
|
|
67
67
|
*/
|
|
68
|
-
async function watchEditorExtension(name,
|
|
68
|
+
async function watchEditorExtension(name, isInternal, quiet = false) {
|
|
69
69
|
const originalDirectory = process.cwd();
|
|
70
70
|
const extensionCodePath = path.join('editorextensions', await getExtensionCodeDirectoryName(name));
|
|
71
71
|
process.chdir(extensionCodePath);
|
|
72
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
72
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal);
|
|
73
73
|
const webpackConfigExport = require(path.resolve('webpack.config.js'));
|
|
74
74
|
// For backwards compatibility, we need to support extensions where the webpack config is a fuction or an object
|
|
75
75
|
const webpackConfig = typeof webpackConfigExport == 'function' ? webpackConfigExport({ environment: 'dev' }) : webpackConfigExport;
|
|
@@ -90,9 +90,9 @@ exports.watchEditorExtension = watchEditorExtension;
|
|
|
90
90
|
* @param extensionNames The names of the editor extensions
|
|
91
91
|
* @param quiet If true, will only show errors in output
|
|
92
92
|
*/
|
|
93
|
-
async function debugEditorExtension(extensionNames,
|
|
93
|
+
async function debugEditorExtension(extensionNames, isInternal, quiet = false, pickAnyPort = false) {
|
|
94
94
|
const port = 9900;
|
|
95
|
-
const watchers = await Promise.all(extensionNames.map(async (name) => watchEditorExtension(name,
|
|
95
|
+
const watchers = await Promise.all(extensionNames.map(async (name) => watchEditorExtension(name, isInternal, quiet)));
|
|
96
96
|
startCustomUIServers(extensionNames);
|
|
97
97
|
const app = express();
|
|
98
98
|
const server = listen(app, port, pickAnyPort);
|
package/src/index.js
CHANGED
|
@@ -14,9 +14,16 @@ class LucidSuiteExtensionCLI {
|
|
|
14
14
|
const parser = new argparse_1.ArgumentParser({
|
|
15
15
|
description: 'Create and manage Lucid extension packages',
|
|
16
16
|
});
|
|
17
|
-
//
|
|
17
|
+
// For internal development, creating and operating on a package via bazel
|
|
18
|
+
parser.add_argument('--is-internal', {
|
|
19
|
+
default: false,
|
|
20
|
+
action: 'store_true',
|
|
21
|
+
help: argparse_1.SUPPRESS,
|
|
22
|
+
});
|
|
23
|
+
// Gives the root directory to create projects in.
|
|
18
24
|
parser.add_argument('--chdir', { type: 'str', help: argparse_1.SUPPRESS });
|
|
19
|
-
//
|
|
25
|
+
// If running with the chdir argument, specifies a project name inside the chdir.
|
|
26
|
+
// Otherwise (if not running with the chdir argument), directly specifies a directory to chdir to.
|
|
20
27
|
parser.add_argument('--project', '-p', {
|
|
21
28
|
type: 'str',
|
|
22
29
|
help: argparse_1.SUPPRESS,
|
|
@@ -116,9 +123,13 @@ class LucidSuiteExtensionCLI {
|
|
|
116
123
|
help: argparse_1.SUPPRESS,
|
|
117
124
|
});
|
|
118
125
|
const parsed = parser.parse_args(args);
|
|
119
|
-
//For internal development, creating and operating on a
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
//For internal development, creating and operating on a package via bazel
|
|
127
|
+
const isInternal = parsed['is_internal'] ||
|
|
128
|
+
// If we've spawned a child process recursively calling a new lucid-package target,
|
|
129
|
+
// as long as it's originally triggered by Bazel then we're still using Bazel flows.
|
|
130
|
+
process.env['BAZEL_TARGET'];
|
|
131
|
+
let isChdir = !!parsed['chdir'];
|
|
132
|
+
if (isChdir) {
|
|
122
133
|
if (parsed['project']) {
|
|
123
134
|
process.chdir(path.join(parsed['chdir'], parsed['project']));
|
|
124
135
|
}
|
|
@@ -129,11 +140,6 @@ class LucidSuiteExtensionCLI {
|
|
|
129
140
|
else if (parsed['project']) {
|
|
130
141
|
process.chdir(parsed['project']);
|
|
131
142
|
}
|
|
132
|
-
//If we've spawned a child process recursively calling a new lucid-package target,
|
|
133
|
-
//then we're still testing as long as it's originally triggered by Bazel.
|
|
134
|
-
if (process.env['BAZEL_TARGET']) {
|
|
135
|
-
isInternalTesting = true;
|
|
136
|
-
}
|
|
137
143
|
switch (parsed['command']) {
|
|
138
144
|
case 'create':
|
|
139
145
|
if (parsed['name'] == null) {
|
|
@@ -154,17 +160,17 @@ class LucidSuiteExtensionCLI {
|
|
|
154
160
|
const choice = await interactive.selectPrompt('Please select a framework', options);
|
|
155
161
|
switch (choice) {
|
|
156
162
|
case 0:
|
|
157
|
-
await (0, angularframeworkutils_1.createAngularEditorExtension)(editorExtensionName,
|
|
163
|
+
await (0, angularframeworkutils_1.createAngularEditorExtension)(editorExtensionName, isInternal, false);
|
|
158
164
|
break;
|
|
159
165
|
case 1:
|
|
160
166
|
const options = ['Javascript', 'Typescript'];
|
|
161
167
|
const choice = await interactive.selectPrompt('Please select flavor', options);
|
|
162
|
-
await (0, reactframeworkutils_1.createReactEditorExtension)(editorExtensionName, options[choice],
|
|
168
|
+
await (0, reactframeworkutils_1.createReactEditorExtension)(editorExtensionName, options[choice], isInternal, false);
|
|
163
169
|
break;
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
else {
|
|
167
|
-
await (0, editorextension_1.createEditorExtension)(editorExtensionName,
|
|
173
|
+
await (0, editorextension_1.createEditorExtension)(editorExtensionName, isInternal, false);
|
|
168
174
|
}
|
|
169
175
|
break;
|
|
170
176
|
case 1:
|
|
@@ -175,7 +181,7 @@ class LucidSuiteExtensionCLI {
|
|
|
175
181
|
case 2:
|
|
176
182
|
process.chdir(packagePath);
|
|
177
183
|
const dataConnectorName = await interactive.inputPrompt('Please enter the name of the data connector');
|
|
178
|
-
await (0, dataconnector_1.createDataConnector)(dataConnectorName,
|
|
184
|
+
await (0, dataconnector_1.createDataConnector)(dataConnectorName, isInternal, false);
|
|
179
185
|
break;
|
|
180
186
|
}
|
|
181
187
|
}
|
|
@@ -194,10 +200,10 @@ class LucidSuiteExtensionCLI {
|
|
|
194
200
|
await (0, package_1.updateAllExtensionSDK)();
|
|
195
201
|
break;
|
|
196
202
|
case 'create-editor-extension':
|
|
197
|
-
await (0, editorextension_1.createEditorExtension)(parsed['name'],
|
|
203
|
+
await (0, editorextension_1.createEditorExtension)(parsed['name'], isInternal, parsed['skip_sdk']);
|
|
198
204
|
break;
|
|
199
205
|
case 'build-editor-extension':
|
|
200
|
-
await (0, editorextension_1.buildEditorExtension)(parsed['name'],
|
|
206
|
+
await (0, editorextension_1.buildEditorExtension)(parsed['name'], isInternal, parsed['quiet']);
|
|
201
207
|
break;
|
|
202
208
|
case 'create-shape-library':
|
|
203
209
|
await (0, shapelibrary_1.createEmptyShapeLibrary)(parsed['name']);
|
|
@@ -213,7 +219,7 @@ class LucidSuiteExtensionCLI {
|
|
|
213
219
|
await (0, shapelibrary_1.createImageShapeLibrary)(parsed['name'], parsed['path'], config);
|
|
214
220
|
break;
|
|
215
221
|
case 'create-data-connector':
|
|
216
|
-
await (0, dataconnector_1.createDataConnector)(parsed['name'],
|
|
222
|
+
await (0, dataconnector_1.createDataConnector)(parsed['name'], isInternal, parsed['skip_sdk']);
|
|
217
223
|
break;
|
|
218
224
|
case 'test-shape-libraries':
|
|
219
225
|
await (0, shapelibrary_1.debugShapeLibraries)();
|
|
@@ -222,10 +228,10 @@ class LucidSuiteExtensionCLI {
|
|
|
222
228
|
if (parsed['name'].length === 0) {
|
|
223
229
|
parsed['name'] = await (0, editorextension_1.getAllExtensionNames)();
|
|
224
230
|
}
|
|
225
|
-
await (0, editorextension_1.debugEditorExtension)(parsed['name'],
|
|
231
|
+
await (0, editorextension_1.debugEditorExtension)(parsed['name'], isInternal, parsed['quiet'], parsed['anyport']);
|
|
226
232
|
break;
|
|
227
233
|
case 'watch-editor-extension':
|
|
228
|
-
await (0, editorextension_1.watchEditorExtension)(parsed['name'],
|
|
234
|
+
await (0, editorextension_1.watchEditorExtension)(parsed['name'], isInternal, parsed['quiet']);
|
|
229
235
|
break;
|
|
230
236
|
default:
|
|
231
237
|
parser.print_help();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function installDependenciesIfNeeded(
|
|
1
|
+
export declare function installDependenciesIfNeeded(isInternal: boolean, skipSDKDependency?: boolean, additionalDependencies?: string[]): void;
|
|
2
2
|
export declare function installReactProject(reactProjectName: string, typescript: boolean): void;
|
|
3
3
|
export declare function installAngularProject(angularProjectName: string): void;
|
package/src/installationutil.js
CHANGED
|
@@ -5,12 +5,12 @@ const oldFs = require("fs");
|
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const shellutil_1 = require("./shellutil");
|
|
7
7
|
const theme_1 = require("./theme");
|
|
8
|
-
function installDependenciesIfNeeded(
|
|
8
|
+
function installDependenciesIfNeeded(isInternal, skipSDKDependency = false, additionalDependencies = []) {
|
|
9
9
|
if (!oldFs.existsSync('node_modules')) {
|
|
10
10
|
console.log((0, shellutil_1.execSyncLoggingOutputOnError)('npm install --silent').toString());
|
|
11
11
|
}
|
|
12
12
|
const sdkDir = path.join('node_modules', 'lucid-extension-sdk');
|
|
13
|
-
if (
|
|
13
|
+
if (isInternal) {
|
|
14
14
|
//Delete any lucid-extension-sdk directory; let it come from //extensibility/packages/node_modules/lucid-extension-sdk
|
|
15
15
|
oldFs.rmSync(sdkDir, { recursive: true, force: true });
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function createReactEditorExtension(name: string, flavor: string,
|
|
1
|
+
export declare function createReactEditorExtension(name: string, flavor: string, isInternal: boolean, skipSDKDependency: boolean): Promise<void>;
|
|
@@ -7,8 +7,8 @@ const editorextension_1 = require("./editorextension");
|
|
|
7
7
|
const installationutil_1 = require("./installationutil");
|
|
8
8
|
const package_1 = require("./package");
|
|
9
9
|
const theme_1 = require("./theme");
|
|
10
|
-
async function createReactEditorExtension(name, flavor,
|
|
11
|
-
await (0, editorextension_1.createEditorExtension)(name,
|
|
10
|
+
async function createReactEditorExtension(name, flavor, isInternal, skipSDKDependency) {
|
|
11
|
+
await (0, editorextension_1.createEditorExtension)(name, isInternal, skipSDKDependency, path.join('react', 'skeleton'), [
|
|
12
12
|
'webpack-shell-plugin-next',
|
|
13
13
|
]);
|
|
14
14
|
let typescript = false;
|
|
@@ -56,7 +56,7 @@ async function createReactEditorExtension(name, flavor, isInternalTesting, skipS
|
|
|
56
56
|
const apptsx = (await fs.readFile(path.join('src', appName), 'utf8')).replace('{logo}', '"logo.svg"');
|
|
57
57
|
await fs.writeFile(path.join('src', appName), apptsx);
|
|
58
58
|
console.log('Installing React dependencies');
|
|
59
|
-
(0, installationutil_1.installDependenciesIfNeeded)(
|
|
59
|
+
(0, installationutil_1.installDependenciesIfNeeded)(isInternal, skipSDKDependency);
|
|
60
60
|
}
|
|
61
61
|
exports.createReactEditorExtension = createReactEditorExtension;
|
|
62
62
|
async function copyFilesTo(sourceFolder, destFolder, endingWith) {
|