@hubspot/cms-dev-server 0.9.0 → 0.10.1

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/dist/run.js CHANGED
@@ -2,11 +2,55 @@
2
2
 
3
3
  // src/lib/cli.ts
4
4
  import { resolve } from "path";
5
+
6
+ // src/lib/logColors.ts
7
+ var CONTROL_CHARACTER = "\x1B";
8
+ var DEFAULT_SCHEME = "[0m";
9
+ var ForeGroudANSIColorMap = {
10
+ black: 30,
11
+ red: 31,
12
+ green: 32,
13
+ yellow: 33,
14
+ blue: 34,
15
+ magenta: 35,
16
+ cyan: 36,
17
+ white: 37
18
+ };
19
+ function wrapMessageInColor(color, message) {
20
+ return `${CONTROL_CHARACTER}[${ForeGroudANSIColorMap[color]}m${message}${CONTROL_CHARACTER}${DEFAULT_SCHEME}`;
21
+ }
22
+
23
+ // src/lib/cli.ts
24
+ function printHelpMessage() {
25
+ console.log(`
26
+ HubSpot CMS Dev Server
27
+
28
+ Usage: hs-cms-dev-server <path> [options]
29
+
30
+ Mandatory:
31
+ <path> Path to the directory containing your assets.
32
+
33
+ Options:
34
+ -c, --config Path to alternate hubspot.config.yaml configuration.
35
+ -a, --account The account name or id to use for the dev server.
36
+ --ssl Enables SSL for the dev server, serving it over an https:// URL.
37
+ --storybook Launches a Storybook dev server.
38
+
39
+ For more information on HubSpot CMS JS Rendering, visit:
40
+ ${wrapMessageInColor(
41
+ "cyan",
42
+ "https://github.hubspot.com/cms-js-building-block-examples/"
43
+ )}`);
44
+ }
5
45
  function getDevServerCommandLineOptions(argv) {
6
46
  const args = [...argv];
7
47
  const webRoot2 = args[2];
8
48
  let hubspotCliConfigPathOption2;
9
49
  let hubspotCliAccountNameOption2;
50
+ if (args.length == 2 || args.includes("help") || args.includes("--help")) {
51
+ printHelpMessage();
52
+ process.exit(0);
53
+ }
10
54
  const configOptionIndex = args.findIndex(
11
55
  (arg) => arg === "-c" || arg === "--config"
12
56
  );
@@ -2384,23 +2428,6 @@ async function fetchWebsiteDomainNames(portalId) {
2384
2428
  return domainNames;
2385
2429
  }
2386
2430
 
2387
- // src/lib/logColors.ts
2388
- var CONTROL_CHARACTER = "\x1B";
2389
- var DEFAULT_SCHEME = "[0m";
2390
- var ForeGroudANSIColorMap = {
2391
- black: 30,
2392
- red: 31,
2393
- green: 32,
2394
- yellow: 33,
2395
- blue: 34,
2396
- megenta: 35,
2397
- cyan: 36,
2398
- white: 37
2399
- };
2400
- function wrapMessageInColor(color, message) {
2401
- return `${CONTROL_CHARACTER}[${ForeGroudANSIColorMap[color]}m${message}${CONTROL_CHARACTER}${DEFAULT_SCHEME}`;
2402
- }
2403
-
2404
2431
  // src/createDevServer.ts
2405
2432
  var BASE_PATH = "/";
2406
2433
  var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
@@ -2444,7 +2471,7 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
2444
2471
  );
2445
2472
  } catch (e) {
2446
2473
  console.warn(
2447
- `Unable to get gating information. gated features will not be availalbe in the local dev server`
2474
+ `Unable to get gating information. Gated features will not be available in the local dev server.`
2448
2475
  );
2449
2476
  }
2450
2477
  }
@@ -628,6 +628,8 @@ ${groupEnd}</script>
628
628
  // src/storybook-main/main.ts
629
629
  import path2 from "path";
630
630
  import { mergeConfig } from "vite";
631
+ import { withoutVitePlugins } from "@storybook/builder-vite";
632
+ import { default as react } from "@vitejs/plugin-react";
631
633
  var webRoot = process.env.WEB_ROOT;
632
634
  var storyPath = path2.resolve(process.cwd(), webRoot, "**/*.stories.*");
633
635
  var jsRenderingGates = process.env.GATES ? process.env.GATES.split(",") : [];
@@ -671,9 +673,30 @@ var main_default = {
671
673
  css: {
672
674
  postcss: webRoot
673
675
  },
674
- plugins: [resolveIslandPlugin2()]
676
+ plugins: [
677
+ resolveIslandPlugin2(),
678
+ react({
679
+ babel: {
680
+ plugins: [
681
+ "babel-plugin-styled-components",
682
+ "styled-jsx/babel",
683
+ "macros"
684
+ ]
685
+ }
686
+ })
687
+ ]
688
+ };
689
+ const configNoReact = {
690
+ ...config,
691
+ // replacing the default usage of `@vite/plugin-react` (it emits multiple
692
+ // sub-plugins listed here) to add our babel plugin configuration
693
+ plugins: await withoutVitePlugins(config.plugins, [
694
+ "vite:react-babel",
695
+ "vite:react-swc",
696
+ "vite:react-refresh"
697
+ ])
675
698
  };
676
- return mergeConfig(config, viteConfig);
699
+ return mergeConfig(configNoReact, viteConfig);
677
700
  }
678
701
  };
679
702
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@hubspot/cli-lib": "^3.0.12",
28
- "@hubspot/cms-components": "^0.9.0",
28
+ "@hubspot/cms-components": "^0.10.1",
29
29
  "@originjs/vite-plugin-commonjs": "^1.0.3",
30
30
  "@storybook/addon-actions": "7.0.7",
31
31
  "@storybook/addon-essentials": "7.0.7",
@@ -101,5 +101,5 @@
101
101
  "publishConfig": {
102
102
  "access": "public"
103
103
  },
104
- "gitHead": "f57bf5f6b7984a619c6e5c1b80d4e51fe636a9a7"
104
+ "gitHead": "8e70e43546d6e772b4664da02bcc9eab4bfe04d0"
105
105
  }