@hubspot/ui-extensions-dev-server 0.0.1-prealpha.5 → 0.0.1-prealpha.6
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/build.js +7 -0
- package/dev.js +5 -0
- package/index.js +33 -0
- package/package.json +5 -6
- package/remoteBuild.js +0 -30
package/build.js
CHANGED
|
@@ -22,8 +22,15 @@ async function buildSingleExtension({
|
|
|
22
22
|
emptyOutDir = true,
|
|
23
23
|
plugins = { rollup: [], vite: [] },
|
|
24
24
|
minify = false,
|
|
25
|
+
root = process.cwd(), // This is the vite default, so using that as our default
|
|
25
26
|
}) {
|
|
26
27
|
await build({
|
|
28
|
+
root,
|
|
29
|
+
define: {
|
|
30
|
+
'process.env.NODE_ENV': JSON.stringify(
|
|
31
|
+
process.env.NODE_ENV || 'production'
|
|
32
|
+
),
|
|
33
|
+
},
|
|
27
34
|
build: {
|
|
28
35
|
lib: {
|
|
29
36
|
entry: file,
|
package/dev.js
CHANGED
|
@@ -12,6 +12,11 @@ const { ROLLUP_OPTIONS } = require('./constants');
|
|
|
12
12
|
async function _devBuild(config, outputDir, extension) {
|
|
13
13
|
const extensionConfig = await getExtensionConfig(config, extension);
|
|
14
14
|
build({
|
|
15
|
+
define: {
|
|
16
|
+
'process.env.NODE_ENV': JSON.stringify(
|
|
17
|
+
process.env.NODE_ENV || 'development'
|
|
18
|
+
),
|
|
19
|
+
},
|
|
15
20
|
build: {
|
|
16
21
|
watch: {
|
|
17
22
|
clearScreen: false,
|
package/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { OUTPUT_DIR } = require('./constants');
|
|
2
|
+
const { getUrlSafeFileName } = require('./utils');
|
|
3
|
+
const { buildSingleExtension } = require('./build');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const manifestPlugin = require('./plugins/manifestPlugin');
|
|
6
|
+
|
|
7
|
+
function remoteBuild(root, entryPoint, outputDir) {
|
|
8
|
+
const allowedExtensions = ['.js', '.ts', '.tsx', '.jsx'];
|
|
9
|
+
const fileInfo = path.parse(entryPoint);
|
|
10
|
+
|
|
11
|
+
if (!allowedExtensions.includes(fileInfo.ext)) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`The last argument should be the filename you wish to build. Supported file extensions are [${allowedExtensions.join(
|
|
14
|
+
', '
|
|
15
|
+
)}]`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
buildSingleExtension({
|
|
20
|
+
file: entryPoint,
|
|
21
|
+
outputFileName: getUrlSafeFileName(entryPoint),
|
|
22
|
+
outputDir: outputDir || OUTPUT_DIR,
|
|
23
|
+
plugins: {
|
|
24
|
+
rollup: [manifestPlugin({ minify: true })],
|
|
25
|
+
},
|
|
26
|
+
minify: true,
|
|
27
|
+
root,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
remoteBuild,
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions-dev-server",
|
|
3
|
-
"version": "0.0.1-prealpha.
|
|
3
|
+
"version": "0.0.1-prealpha.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"constants.js",
|
|
18
18
|
"dev.js",
|
|
19
19
|
"logger.js",
|
|
20
|
-
"remoteBuild.js",
|
|
21
20
|
"run.js",
|
|
22
21
|
"utils.js",
|
|
23
22
|
"tests/runTests.js",
|
|
24
23
|
"tests/testBuild.js",
|
|
25
24
|
"tests/testDevServer.js",
|
|
26
|
-
"plugins/manifestPlugin.js"
|
|
25
|
+
"plugins/manifestPlugin.js",
|
|
26
|
+
"index.js"
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"ws": "^8.12.1"
|
|
39
39
|
},
|
|
40
40
|
"bin": {
|
|
41
|
-
"hs-ui-extensions-dev-server": "run.js"
|
|
42
|
-
"hs-ui-extensions-remote-build": "remoteBuild.js"
|
|
41
|
+
"hs-ui-extensions-dev-server": "run.js"
|
|
43
42
|
},
|
|
44
43
|
"eslintConfig": {
|
|
45
44
|
"env": {
|
|
@@ -57,5 +56,5 @@
|
|
|
57
56
|
"optional": true
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "1dfa4048c08a39c6f50a5f87e92eddf1b19dde5c"
|
|
61
60
|
}
|
package/remoteBuild.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { OUTPUT_DIR } = require('./constants');
|
|
3
|
-
const { getUrlSafeFileName } = require('./utils');
|
|
4
|
-
const { buildSingleExtension } = require('./build');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const manifestPlugin = require('./plugins/manifestPlugin');
|
|
7
|
-
|
|
8
|
-
const entryPoint = process.argv[process.argv.length - 1];
|
|
9
|
-
|
|
10
|
-
const allowedExtensions = ['.js', '.ts', '.tsx', '.jsx'];
|
|
11
|
-
|
|
12
|
-
const fileInfo = path.parse(entryPoint);
|
|
13
|
-
|
|
14
|
-
if (!allowedExtensions.includes(fileInfo.ext)) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`The last argument should be the filename you wish to build. Supported file extensions are [${allowedExtensions.join(
|
|
17
|
-
', '
|
|
18
|
-
)}]`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
buildSingleExtension({
|
|
23
|
-
file: entryPoint,
|
|
24
|
-
outputFileName: getUrlSafeFileName(entryPoint),
|
|
25
|
-
outputDir: OUTPUT_DIR,
|
|
26
|
-
plugins: {
|
|
27
|
-
rollup: [manifestPlugin({ minify: true })],
|
|
28
|
-
},
|
|
29
|
-
minify: true,
|
|
30
|
-
});
|