@woodsportal/hubspot-kit 1.0.27 → 1.0.30
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/CHANGELOG.md +19 -0
- package/README.md +6 -6
- package/dist/{chunk-U4KFGTEW.js → chunk-S2YJDWZU.js} +5 -5
- package/dist/chunk-S2YJDWZU.js.map +1 -0
- package/dist/cli.js +486 -316
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/vite/index.js +1 -1
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/content/woodscli-guide-content.ts +4 -4
- package/examples/greenfield/module-monolith/src/features/starter/content/woodscli-guide-content.ts +4 -4
- package/examples/smoke/run-matrix.mjs +1 -1
- package/package.json +1 -1
- package/scripts/detect-layout.mjs +71 -4
- package/scripts/run-hubspot-module-postbuild.mjs +26 -3
- package/templates/module-hybrid-cdn/src/features/starter/content/woodscli-guide-content.ts +4 -4
- package/templates/module-monolith/src/features/starter/content/woodscli-guide-content.ts +4 -4
- package/templates/shared/.env.prod.example +1 -1
- package/dist/chunk-U4KFGTEW.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.30 — 2026-06-08
|
|
4
|
+
|
|
5
|
+
### CLI
|
|
6
|
+
- **Hybrid CDN setup prompts** on `wp init` and `wp setup` — public GitHub mirror (`org/repo`) and PAT saved to gitignored `.env.local` as `PORTAL_CDN_PUBLISH_TOKEN`
|
|
7
|
+
- `wp publish` loads `.env.local`; `wp init --cdn-github org/repo` for CI
|
|
8
|
+
|
|
9
|
+
## 1.0.29 — 2026-06-07
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
- **Removed `wp adopt`** — use `wp init` for new projects; add `woodscli.json` manually for legacy `<name>.module/` upload-only repos (see MODULES.md)
|
|
13
|
+
|
|
14
|
+
## 1.0.28 — 2026-06-07
|
|
15
|
+
|
|
16
|
+
### CLI
|
|
17
|
+
- **`wp adopt` dev scaffold** for preexisting `<name>.module/` repos — interactive track (monolith / hybrid CDN / upload-only) and optional template copy (`package.json`, `src/`, `public/`)
|
|
18
|
+
- CI flags: `--track monolith|hybrid-cdn`, `--scaffold-dev`, `--router hash|browser|none`
|
|
19
|
+
- Upload-only adopt: `module.outDir` stays at `.module/`; `wp doctor` skips dev checks with guidance
|
|
20
|
+
- Postbuild resolves `fields.json` / `module.html` from `dev.fieldsJson` when `public/` is absent
|
|
21
|
+
|
|
3
22
|
## 1.0.27 — 2026-06-07
|
|
4
23
|
|
|
5
24
|
### Docs
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**HubSpot CMS dev kit by WoodsPortal** — local preview, module field editing, Vite build pipelines, and HubSpot upload/watch for **custom modules** and **themes**.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm i -D @woodsportal/hubspot-kit@^1.0.
|
|
6
|
+
npm i -D @woodsportal/hubspot-kit@^1.0.29
|
|
7
7
|
npx wp --version
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -34,7 +34,7 @@ The `wp` CLI wraps [`@hubspot/cli`](https://developers.hubspot.com/docs/cms/deve
|
|
|
34
34
|
| **Node.js 20+** | Enforced by `wp doctor` |
|
|
35
35
|
| **HubSpot CLI** | `npm i -g @hubspot/cli` — required for upload/watch/deploy |
|
|
36
36
|
| **HubSpot CMS portal** | Design Manager access; PAT or OAuth via `wp auth` |
|
|
37
|
-
| **Project config** | `woodscli.json` at repo root (created by `wp init`
|
|
37
|
+
| **Project config** | `woodscli.json` at repo root (created by `wp init`) |
|
|
38
38
|
|
|
39
39
|
Local preview (`wp dev`) runs **without** HubSpot credentials. Upload, watch, and deploy need a valid project `hubspot.config.yml`.
|
|
40
40
|
|
|
@@ -52,7 +52,7 @@ cd my-portal-module && npm install
|
|
|
52
52
|
**Existing consumer** (add dev dependency):
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
npm i -D @woodsportal/hubspot-kit@^1.0.
|
|
55
|
+
npm i -D @woodsportal/hubspot-kit@^1.0.29
|
|
56
56
|
# or: yarn add -D @woodsportal/hubspot-kit@^1.0.26
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -93,12 +93,13 @@ wp dev # http://localhost:3000 — alias: wp local
|
|
|
93
93
|
## Existing repository
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
|
-
wp
|
|
97
|
-
wp setup
|
|
96
|
+
wp setup # hubspot.config.yml, .env.*, vite shims (after woodscli.json exists)
|
|
98
97
|
wp migrate --yes # if you still have legacy .dev/ or woodsportal.hs.json
|
|
99
98
|
wp doctor
|
|
100
99
|
```
|
|
101
100
|
|
|
101
|
+
For legacy **`<name>.module/`** artifact folders (plain JS, no `src/`), add `woodscli.json` manually (see [docs/MODULES.md](./docs/MODULES.md)) then `wp setup` and `wp upload`.
|
|
102
|
+
|
|
102
103
|
Legacy filename `woodsportal.hs.json` is **not** read — migrate to `woodscli.json` with `wp migrate --yes`.
|
|
103
104
|
|
|
104
105
|
---
|
|
@@ -158,7 +159,6 @@ Global flags (all commands): `--project <path>`, `--ci`, `--json`, `--verbose`,
|
|
|
158
159
|
| Command | Description |
|
|
159
160
|
|---------|-------------|
|
|
160
161
|
| `wp init [-t template] [-n name] [--router hash\|browser\|none]` | Scaffold `module-hybrid-cdn`, `module-monolith`, or `theme-starter` |
|
|
161
|
-
| `wp adopt` | Add WoodsCLI config to an existing module/theme repo |
|
|
162
162
|
| `wp migrate` | Move legacy `.dev/` / `woodsportal.hs.json` → `.wphs/` + `woodscli.json` |
|
|
163
163
|
| `wp setup [--tier dev\|stg\|prod]` | Copy missing config, env, CDN, and vite shim files |
|
|
164
164
|
| `wp doctor` | Prerequisite checks (interactive progress on TTY) |
|
|
@@ -95,14 +95,14 @@ function getKitRoot() {
|
|
|
95
95
|
return kitRoot;
|
|
96
96
|
}
|
|
97
97
|
function findProjectRoot2(from = process.cwd()) {
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
98
|
+
const resolved = findProjectRoot(from);
|
|
99
|
+
if (!resolved) {
|
|
100
100
|
throw new WpHsError("Could not find woodscli.json in this directory or any parent.", {
|
|
101
101
|
exitCode: ExitCode.USER_ERROR,
|
|
102
|
-
remediation: "Run wp init,
|
|
102
|
+
remediation: "Run wp init, or pass --project <path>. Legacy config: wp migrate --yes."
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
return
|
|
105
|
+
return resolved;
|
|
106
106
|
}
|
|
107
107
|
function kitPath(...segments) {
|
|
108
108
|
return resolve2(kitRoot, ...segments);
|
|
@@ -133,4 +133,4 @@ export {
|
|
|
133
133
|
getViteConfigPath,
|
|
134
134
|
createViteConfig
|
|
135
135
|
};
|
|
136
|
-
//# sourceMappingURL=chunk-
|
|
136
|
+
//# sourceMappingURL=chunk-S2YJDWZU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/paths.ts","../src/lib/config-files.ts","../src/lib/errors.ts","../src/vite/paths.ts","../src/vite/create-vite-config.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport { findProjectRoot as findConfigProjectRoot } from './config-files.js'\nimport { WpHsError, ExitCode } from './errors.js'\n\nconst KIT_PACKAGE_NAME = '@woodsportal/hubspot-kit'\n\nfunction resolveKitRoot(): string {\n let dir = dirname(fileURLToPath(import.meta.url))\n while (true) {\n const pkgPath = resolve(dir, 'package.json')\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { name?: string }\n if (pkg.name === KIT_PACKAGE_NAME) {\n return dir\n }\n } catch {\n // keep walking\n }\n }\n const parent = dirname(dir)\n if (parent === dir) {\n break\n }\n dir = parent\n }\n\n throw new WpHsError('Could not resolve @woodsportal/hubspot-kit package root.', {\n exitCode: ExitCode.INTERNAL,\n })\n}\n\nconst kitRoot = resolveKitRoot()\n\nexport function getKitRoot(): string {\n return kitRoot\n}\n\nexport function findProjectRoot(from = process.cwd()): string {\n const resolved = findConfigProjectRoot(from)\n\n if (!resolved) {\n throw new WpHsError('Could not find woodscli.json in this directory or any parent.', {\n exitCode: ExitCode.USER_ERROR,\n remediation: 'Run wp init, or pass --project <path>. Legacy config: wp migrate --yes.',\n })\n }\n return resolved\n}\n\nexport function kitPath(...segments: string[]): string {\n return resolve(kitRoot, ...segments)\n}\n\nexport { resolveProjectConfig, WOODSCLI_CONFIG_FILE, LEGACY_WOODSPORTAL_HS_FILE } from './config-files.js'\n","import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\n/** Canonical WoodsCLI project config — the only supported filename. */\nexport const WOODSCLI_CONFIG_FILE = 'woodscli.json'\n\n/** Removed in v1.0.2+ — detected only for migrate/doctor messaging. */\nexport const LEGACY_WOODSPORTAL_HS_FILE = 'woodsportal.hs.json'\n\nexport type ResolvedProjectConfig = {\n path: string\n fileName: typeof WOODSCLI_CONFIG_FILE\n}\n\nfunction envConfigPath(projectRoot: string): string | null {\n const fromEnv = process.env.WOODSCLI_CONFIG?.trim() || process.env.WP_HS_CONFIG?.trim() || null\n if (!fromEnv) return null\n return resolve(projectRoot, fromEnv)\n}\n\nexport function legacyConfigPath(projectRoot: string): string {\n return resolve(projectRoot, LEGACY_WOODSPORTAL_HS_FILE)\n}\n\nexport function woodscliConfigPath(projectRoot: string): string {\n return resolve(projectRoot, WOODSCLI_CONFIG_FILE)\n}\n\n/** @returns null | 'legacy-only' | 'duplicate' */\nexport function legacyConfigConflict(projectRoot: string): 'legacy-only' | 'duplicate' | null {\n const hasWoodscli = existsSync(woodscliConfigPath(projectRoot))\n const hasLegacy = existsSync(legacyConfigPath(projectRoot))\n if (hasLegacy && hasWoodscli) return 'duplicate'\n if (hasLegacy && !hasWoodscli) return 'legacy-only'\n return null\n}\n\n/**\n * Resolve the active project config file (`woodscli.json` only).\n */\nexport function resolveProjectConfig(projectRoot: string): ResolvedProjectConfig | null {\n const envPath = envConfigPath(projectRoot)\n if (envPath) {\n if (!existsSync(envPath)) return null\n return { path: envPath, fileName: WOODSCLI_CONFIG_FILE }\n }\n\n const path = woodscliConfigPath(projectRoot)\n if (existsSync(path)) {\n return { path, fileName: WOODSCLI_CONFIG_FILE }\n }\n\n return null\n}\n\nexport function findProjectRoot(from = process.cwd()): string | null {\n if (process.env.WP_HS_PROJECT_ROOT?.trim()) {\n return resolve(process.env.WP_HS_PROJECT_ROOT.trim())\n }\n\n let dir = resolve(from)\n while (true) {\n if (resolveProjectConfig(dir)) {\n return dir\n }\n const parent = resolve(dir, '..')\n if (parent === dir) {\n return null\n }\n dir = parent\n }\n}\n","export const ExitCode = {\n SUCCESS: 0,\n USER_ERROR: 1,\n PREREQUISITE: 2,\n BUILD_FAILED: 3,\n PUBLISH_FAILED: 4,\n AUDIT_FAILED: 5,\n INTERNAL: 10,\n} as const\n\nexport type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode]\n\nexport class WpHsError extends Error {\n readonly exitCode: ExitCodeValue\n readonly remediation?: string\n\n constructor(\n message: string,\n options: { exitCode?: ExitCodeValue; remediation?: string; cause?: unknown } = {},\n ) {\n super(message, { cause: options.cause })\n this.name = 'WpHsError'\n this.exitCode = options.exitCode ?? ExitCode.USER_ERROR\n this.remediation = options.remediation\n }\n}\n\nexport function isWpHsError(error: unknown): error is WpHsError {\n return error instanceof WpHsError\n}\n","import { kitPath } from '../lib/paths.js'\n\nexport type VitePreset = 'dev' | 'hubspot' | 'cdn-vendor' | 'cdn-app' | 'cdn-esm'\n\nexport function getViteConfigPath(preset: VitePreset): string {\n return kitPath('vite', `vite.config.${preset}.mjs`)\n}\n","import { getViteConfigPath, type VitePreset } from './paths.js'\n\nexport type CreateViteConfigOptions = {\n /** Vite preset shipped with @woodsportal/hubspot-kit */\n preset: VitePreset\n /** Consumer project root (sets WP_HS_PROJECT_ROOT for kit scripts) */\n projectRoot?: string\n}\n\n/**\n * Returns the absolute path to a kit Vite config preset.\n * Consumer repos typically re-export: `export { default } from '@woodsportal/hubspot-kit/vite/vite.config.hubspot.mjs'`\n * or use this helper in a thin wrapper config.\n */\nexport function createViteConfig(\n presetOrOptions: VitePreset | CreateViteConfigOptions,\n): string {\n const options: CreateViteConfigOptions =\n typeof presetOrOptions === 'string' ? { preset: presetOrOptions } : presetOrOptions\n\n if (options.projectRoot?.trim()) {\n process.env.WP_HS_PROJECT_ROOT = options.projectRoot.trim()\n }\n\n return getViteConfigPath(options.preset)\n}\n"],"mappings":";AAAA,SAAS,cAAAA,aAAY,oBAAoB;AACzC,SAAS,SAAS,WAAAC,gBAAe;AACjC,SAAS,qBAAqB;;;ACF9B,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AAGjB,IAAM,uBAAuB;AAUpC,SAAS,cAAc,aAAoC;AACzD,QAAM,UAAU,QAAQ,IAAI,iBAAiB,KAAK,KAAK,QAAQ,IAAI,cAAc,KAAK,KAAK;AAC3F,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,aAAa,OAAO;AACrC;AAMO,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,QAAQ,aAAa,oBAAoB;AAClD;AAcO,SAAS,qBAAqB,aAAmD;AACtF,QAAM,UAAU,cAAc,WAAW;AACzC,MAAI,SAAS;AACX,QAAI,CAAC,WAAW,OAAO,EAAG,QAAO;AACjC,WAAO,EAAE,MAAM,SAAS,UAAU,qBAAqB;AAAA,EACzD;AAEA,QAAM,OAAO,mBAAmB,WAAW;AAC3C,MAAI,WAAW,IAAI,GAAG;AACpB,WAAO,EAAE,MAAM,UAAU,qBAAqB;AAAA,EAChD;AAEA,SAAO;AACT;AAEO,SAAS,gBAAgB,OAAO,QAAQ,IAAI,GAAkB;AACnE,MAAI,QAAQ,IAAI,oBAAoB,KAAK,GAAG;AAC1C,WAAO,QAAQ,QAAQ,IAAI,mBAAmB,KAAK,CAAC;AAAA,EACtD;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