@hubspot/ui-extensions-dev-server 0.6.0 → 0.7.0
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/cli/run.js +1 -2
- package/cli/utils.js +0 -5
- package/lib/DevModeInterface.js +0 -7
- package/lib/dev.js +4 -1
- package/lib/plugins/devBuildPlugin.js +13 -6
- package/lib/server.js +7 -11
- package/package.json +3 -3
package/cli/run.js
CHANGED
|
@@ -15,7 +15,7 @@ const { loadConfigByPath, loadExtensionConfig } = require('./config');
|
|
|
15
15
|
|
|
16
16
|
// eslint-disable-next-line no-floating-promise/no-floating-promise
|
|
17
17
|
(async () => {
|
|
18
|
-
const { DEV_MODE, BUILD_MODE, extension, help
|
|
18
|
+
const { DEV_MODE, BUILD_MODE, extension, help } = parseArgs();
|
|
19
19
|
|
|
20
20
|
if (help || !(DEV_MODE || BUILD_MODE)) {
|
|
21
21
|
showHelp(OUTPUT_DIR);
|
|
@@ -31,7 +31,6 @@ const { loadConfigByPath, loadExtensionConfig } = require('./config');
|
|
|
31
31
|
allExtensionsConfig[path.join(extensionPath, extension)];
|
|
32
32
|
}
|
|
33
33
|
await DevModeInterface.setup({
|
|
34
|
-
alpha,
|
|
35
34
|
promptUser: inquirer.createPromptModule(),
|
|
36
35
|
components: {
|
|
37
36
|
[appConfig.name]: {
|
package/cli/utils.js
CHANGED
|
@@ -14,7 +14,6 @@ function parseArgs() {
|
|
|
14
14
|
const optionDefinitions = [
|
|
15
15
|
{ name: 'port', alias: 'p', type: Number },
|
|
16
16
|
{ name: 'extension', alias: 'e', type: String },
|
|
17
|
-
{ name: 'alpha', type: Boolean },
|
|
18
17
|
{ name: 'help', alias: 'h', type: Boolean },
|
|
19
18
|
];
|
|
20
19
|
|
|
@@ -49,10 +48,6 @@ function showHelp(OUTPUT_DIR) {
|
|
|
49
48
|
description:
|
|
50
49
|
'The extension entrypoint file to build or start local development for',
|
|
51
50
|
},
|
|
52
|
-
{
|
|
53
|
-
name: 'alpha',
|
|
54
|
-
description: 'Run app functions locally.',
|
|
55
|
-
},
|
|
56
51
|
{
|
|
57
52
|
name: 'help',
|
|
58
53
|
alias: 'h',
|
package/lib/DevModeInterface.js
CHANGED
|
@@ -55,11 +55,6 @@ class DevModeInterface {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async setup({
|
|
58
|
-
// This flag is used for whether to enable local serverless on the dev server pre-INBOUND.
|
|
59
|
-
// If the user runs `hs project dev --local-all`, the flag is set to true.
|
|
60
|
-
// By INBOUND, we will remove the flag and make the dev server handle both extensions
|
|
61
|
-
// and app functions locally.
|
|
62
|
-
alpha = false,
|
|
63
58
|
debug = false,
|
|
64
59
|
accountId,
|
|
65
60
|
httpClient,
|
|
@@ -68,7 +63,6 @@ class DevModeInterface {
|
|
|
68
63
|
extensionConfig,
|
|
69
64
|
logger,
|
|
70
65
|
}) {
|
|
71
|
-
this.alpha = alpha;
|
|
72
66
|
this.debug = debug;
|
|
73
67
|
this.accountId = accountId;
|
|
74
68
|
this.httpClient = httpClient;
|
|
@@ -111,7 +105,6 @@ class DevModeInterface {
|
|
|
111
105
|
app: { path: appPath },
|
|
112
106
|
accountId: this.accountId,
|
|
113
107
|
httpClient: this.httpClient,
|
|
114
|
-
enabled: !!this.alpha,
|
|
115
108
|
};
|
|
116
109
|
|
|
117
110
|
this.shutdown = await startDevMode({
|
package/lib/dev.js
CHANGED
|
@@ -2,7 +2,6 @@ const { ROLLUP_OPTIONS, WEBSOCKET_MESSAGE_VERSION } = require('../constants');
|
|
|
2
2
|
const { build } = require('vite');
|
|
3
3
|
const manifestPlugin = require('./manifestPlugin');
|
|
4
4
|
const { stripAnsiColorCodes } = require('../utils');
|
|
5
|
-
const codeInjectionPlugin = require('./codeInjectionPlugin');
|
|
6
5
|
|
|
7
6
|
function devBuildPlugin(options = {}) {
|
|
8
7
|
const { extensionConfig, outputDir, baseMessage, logger } = options;
|
|
@@ -44,6 +43,13 @@ function devBuildPlugin(options = {}) {
|
|
|
44
43
|
process.env.NODE_ENV || 'development'
|
|
45
44
|
),
|
|
46
45
|
},
|
|
46
|
+
esbuild: {
|
|
47
|
+
tsconfigRaw: {
|
|
48
|
+
compilerOptions: {
|
|
49
|
+
preserveValueImports: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
47
53
|
build: {
|
|
48
54
|
lib: {
|
|
49
55
|
entry: extensionConfig.data.module.file,
|
|
@@ -59,7 +65,6 @@ function devBuildPlugin(options = {}) {
|
|
|
59
65
|
output: extensionConfig.output,
|
|
60
66
|
logger,
|
|
61
67
|
}),
|
|
62
|
-
codeInjectionPlugin({ file: extensionConfig.data.module.file }),
|
|
63
68
|
],
|
|
64
69
|
output: {
|
|
65
70
|
...ROLLUP_OPTIONS.output,
|
|
@@ -96,7 +101,7 @@ function devBuildPlugin(options = {}) {
|
|
|
96
101
|
});
|
|
97
102
|
});
|
|
98
103
|
localServer.ws.on('build', async () => {
|
|
99
|
-
logger.
|
|
104
|
+
logger.debug('Browser has requested a build, rebuilding');
|
|
100
105
|
const successful = await devBuild(localServer);
|
|
101
106
|
if (successful) {
|
|
102
107
|
server.ws.send({
|
|
@@ -114,12 +119,14 @@ function devBuildPlugin(options = {}) {
|
|
|
114
119
|
return [];
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
logger.info(`Extension ${extensionConfig.data.title} updated, compiled`);
|
|
123
|
+
|
|
117
124
|
if (server.ws.clients.size === 0) {
|
|
118
|
-
logger.
|
|
125
|
+
logger.debug('Bundle updated, no browsers connected to notify');
|
|
119
126
|
return [];
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
logger.
|
|
129
|
+
logger.debug('Bundle updated, notifying connected browsers');
|
|
123
130
|
server.ws.send({
|
|
124
131
|
...versionedBaseMessage,
|
|
125
132
|
event: 'update',
|
|
@@ -130,7 +137,7 @@ function devBuildPlugin(options = {}) {
|
|
|
130
137
|
if (error) {
|
|
131
138
|
logger.error(error);
|
|
132
139
|
}
|
|
133
|
-
logger.
|
|
140
|
+
logger.debug('Sending shutdown message to connected browsers');
|
|
134
141
|
if (localServer && localServer.ws) {
|
|
135
142
|
localServer.ws.send({
|
|
136
143
|
...versionedBaseMessage,
|
package/lib/server.js
CHANGED
|
@@ -21,22 +21,18 @@ function startDevServer({
|
|
|
21
21
|
app.use(cors());
|
|
22
22
|
app.use(express.static(outputDir));
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
AppFunctionExecutionService({ ...functionsConfig, logger })
|
|
30
|
-
);
|
|
31
|
-
logger.info('Serving app functions locally');
|
|
32
|
-
}
|
|
24
|
+
app.use(
|
|
25
|
+
'/api/crm-extensibility/execution/internal/v3',
|
|
26
|
+
AppFunctionExecutionService({ ...functionsConfig, logger })
|
|
27
|
+
);
|
|
28
|
+
logger.info('Serving app functions locally');
|
|
33
29
|
|
|
34
30
|
const endpointsAdded = extensionsService.add(
|
|
35
31
|
app,
|
|
36
32
|
webSocketPort,
|
|
37
33
|
outputDir,
|
|
38
34
|
baseMessage,
|
|
39
|
-
|
|
35
|
+
SERVER_CAPABILITIES
|
|
40
36
|
);
|
|
41
37
|
|
|
42
38
|
endpointsAdded.forEach(endpoint => {
|
|
@@ -54,7 +50,7 @@ function startDevServer({
|
|
|
54
50
|
await viteDevServer.pluginContainer.close();
|
|
55
51
|
// Stop new connections to express server
|
|
56
52
|
server.close(() => {});
|
|
57
|
-
logger.info('
|
|
53
|
+
logger.info('Extension dev server done cleaning up');
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@hubspot/app-functions-dev-server": "^0.
|
|
36
|
+
"@hubspot/app-functions-dev-server": "^0.7.0",
|
|
37
37
|
"command-line-args": "^5.2.1",
|
|
38
38
|
"command-line-usage": "^7.0.1",
|
|
39
39
|
"console-log-colors": "^0.4.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"optional": true
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "60f780b26b92ab097b24f162bf485fde5fd26528"
|
|
71
71
|
}
|