@jee-r/astro-decap-cms 0.6.1 → 1.0.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/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = tab
8
+ insert_final_newline = false
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.md]
12
+ indent_style = space
13
+ insert_final_newline = true
@@ -2,9 +2,9 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [latest]
5
+ branches: [main]
6
6
  pull_request:
7
- branches: [latest]
7
+ branches: [main]
8
8
 
9
9
  # Automatically cancel in-progress actions on the same branch
10
10
  concurrency:
@@ -16,22 +16,21 @@ jobs:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
18
  - name: Checkout
19
- uses: actions/checkout@v3
19
+ uses: actions/checkout@v4
20
20
 
21
- - name: Setup Node.js 16.x
22
- uses: actions/setup-node@v2
21
+ - name: Install pnpm
22
+ uses: pnpm/action-setup@v4
23
23
  with:
24
- node-version: 16.x
24
+ version: 10
25
25
 
26
- - name: Cache node_modules
27
- uses: actions/cache@v2
26
+ - name: Setup Node.js 20.x
27
+ uses: actions/setup-node@v4
28
28
  with:
29
- path: ~/.npm
30
- key: node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
31
- restore-keys: node-${{ matrix.node }}-
29
+ node-version: 20.x
30
+ cache: 'pnpm'
32
31
 
33
32
  - name: Install Dependencies
34
- run: npm ci
33
+ run: pnpm install --frozen-lockfile
35
34
 
36
35
  - name: Test
37
- run: npm t
36
+ run: pnpm test
@@ -2,41 +2,116 @@ name: Release
2
2
 
3
3
  on:
4
4
  push:
5
- branches:
6
- - main
5
+ tags:
6
+ - 'v*'
7
7
 
8
- concurrency: ${{ github.workflow }}-${{ github.ref }}
8
+ permissions:
9
+ contents: write
10
+ packages: write
9
11
 
10
12
  jobs:
11
13
  release:
12
- name: Release
14
+ name: Create Release
13
15
  runs-on: ubuntu-latest
14
16
  steps:
15
- - name: Checkout Repo
16
- uses: actions/checkout@v2
17
- with:
18
- # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
19
- fetch-depth: 0
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
20
19
 
21
- - name: Setup Node.js 16.x
22
- uses: actions/setup-node@v2
20
+ - name: Install pnpm
21
+ uses: pnpm/action-setup@v4
23
22
  with:
24
- node-version: 16.x
23
+ version: 10
25
24
 
26
- - name: Cache node_modules
27
- uses: actions/cache@v2
25
+ - name: Setup Node.js
26
+ uses: actions/setup-node@v4
28
27
  with:
29
- path: ~/.npm
30
- key: node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
31
- restore-keys: node-${{ matrix.node }}-
28
+ node-version: 20.x
29
+ cache: 'pnpm'
32
30
 
33
31
  - name: Install Dependencies
34
- run: npm ci
32
+ run: pnpm install --frozen-lockfile
33
+
34
+ - name: Build
35
+ run: pnpm run build
35
36
 
36
- - name: Create Release Pull Request
37
- uses: changesets/action@v1
37
+ - name: Generate Changelog
38
+ run: pnpm exec conventional-changelog --config ./changelog-config.mjs -r 2 > RELEASE_NOTES.md
39
+
40
+ - name: Create GitHub Release
41
+ uses: softprops/action-gh-release@v2
38
42
  with:
39
- publish: npx changeset publish
43
+ body_path: RELEASE_NOTES.md
44
+ draft: false
45
+ prerelease: false
40
46
  env:
41
47
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48
+
49
+ publish-npm:
50
+ name: Publish to npm
51
+ runs-on: ubuntu-latest
52
+ needs: release
53
+ permissions:
54
+ id-token: write
55
+ contents: read
56
+ steps:
57
+ - name: Checkout
58
+ uses: actions/checkout@v4
59
+
60
+ - name: Install pnpm
61
+ uses: pnpm/action-setup@v4
62
+ with:
63
+ version: 10
64
+
65
+ - name: Setup Node.js
66
+ uses: actions/setup-node@v4
67
+ with:
68
+ node-version: 20.x
69
+ cache: 'pnpm'
70
+ registry-url: 'https://registry.npmjs.org'
71
+
72
+ - name: Install Dependencies
73
+ run: pnpm install --frozen-lockfile
74
+
75
+ - name: Build
76
+ run: pnpm run build
77
+
78
+ - name: Update npm to latest for OIDC support
79
+ run: npm install -g npm@latest
80
+
81
+ - name: Publish to npm (Trusted Publishing)
82
+ run: npm publish --provenance
83
+
84
+ publish-gpr:
85
+ name: Publish to GitHub Packages
86
+ runs-on: ubuntu-latest
87
+ needs: release
88
+ permissions:
89
+ packages: write
90
+ contents: read
91
+ steps:
92
+ - name: Checkout
93
+ uses: actions/checkout@v4
94
+
95
+ - name: Install pnpm
96
+ uses: pnpm/action-setup@v4
97
+ with:
98
+ version: 10
99
+
100
+ - name: Setup Node.js
101
+ uses: actions/setup-node@v4
102
+ with:
103
+ node-version: 20.x
104
+ cache: 'pnpm'
105
+ registry-url: 'https://npm.pkg.github.com'
106
+ scope: '@jee-r'
107
+
108
+ - name: Install Dependencies
109
+ run: pnpm install --frozen-lockfile
110
+
111
+ - name: Build
112
+ run: pnpm run build
113
+
114
+ - name: Publish to GitHub Packages
115
+ run: pnpm publish --no-git-checks
116
+ env:
117
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,9 @@
1
+ {
2
+ "cSpell.words": [
3
+ "astro",
4
+ "astrojs",
5
+ "decap",
6
+ "NCMS",
7
+ "netlify"
8
+ ]
9
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,49 @@
1
+ ## [1.0.0](https://github.com/jee-r/astro-decap-cms/compare/v0.6.1...v1.0.0) (2026-01-18)
2
+
3
+ ### Features
4
+
5
+ * add editorconfig and VSCode settings ([b72176f](https://github.com/jee-r/astro-decap-cms/commit/b72176f925aa7df5091ac735079e59e8dfa74d14))
6
+ * add noindex robots metatag ([529d600](https://github.com/jee-r/astro-decap-cms/commit/529d600f4e52e4b0c4693ab37494d9f20cfc321c))
7
+ * add Renovate configuration for automated dependency updates ([e176295](https://github.com/jee-r/astro-decap-cms/commit/e17629539e190e61c0c785c1340e5acca5cbb8ec))
8
+
9
+ ### Bug Fixes
10
+
11
+ * resolve TypeScript compilation errors for Astro 5 ([43c6724](https://github.com/jee-r/astro-decap-cms/commit/43c6724e85d8a8bd7b615214c964ed0ea3e5636c))
12
+ * **vite-plugin:** update import for decap-cms-app 3.10.0 ([e2e3663](https://github.com/jee-r/astro-decap-cms/commit/e2e36636cb95328a6eca67d51d19866ee822f36f))
13
+
14
+ ### Documentation
15
+
16
+ * add credits section to README ([e4d577b](https://github.com/jee-r/astro-decap-cms/commit/e4d577b5615f897b7b33813d7e7b7eead7b811a2))
17
+ * add development section with build and testing instructions ([8c9f278](https://github.com/jee-r/astro-decap-cms/commit/8c9f2787e555b5f84038c4e7684454632e8fc834))
18
+ * add MIT license file ([c7295ca](https://github.com/jee-r/astro-decap-cms/commit/c7295ca7beca2ad30b14ffdb2dce6148c0c6d93c))
19
+ * **demo:** clean up documentation and references ([f002b8c](https://github.com/jee-r/astro-decap-cms/commit/f002b8c6e62f738521eafbd895206ea405443595))
20
+ * fix package name and broken links in README ([0035caa](https://github.com/jee-r/astro-decap-cms/commit/0035caa6a5357fd03b83d09410155439e2f30880))
21
+ * update examples to use DecapCMS ([e944508](https://github.com/jee-r/astro-decap-cms/commit/e944508e8b807cb5f9a34358bc95b1258c1a8509))
22
+
23
+ ### Chores
24
+
25
+ * add changelog configuration for all commit types ([73e5a29](https://github.com/jee-r/astro-decap-cms/commit/73e5a290facf092f0b7885fdf2b56b8357b0b2f8))
26
+ * add demo lockfile and update gitignore ([32da775](https://github.com/jee-r/astro-decap-cms/commit/32da775b7e098d79e58cd4cad6ce55e5a5517f6b))
27
+ * **build:** add dedicated build script and migrate to pnpm ([b129f62](https://github.com/jee-r/astro-decap-cms/commit/b129f62a6dad8e5e411667b1939908219a8be820))
28
+ * **ci:** update GitHub Actions workflows ([c7baf37](https://github.com/jee-r/astro-decap-cms/commit/c7baf37bab095ce8c9732400fe50ecebfffa0fe6))
29
+ * **ci:** update release workflow for tag-based releases ([2509bef](https://github.com/jee-r/astro-decap-cms/commit/2509befdba562b8a95d976b68bf7d592e8e0cc59))
30
+ * **demo:** add decap-server dependency ([cb3fbb9](https://github.com/jee-r/astro-decap-cms/commit/cb3fbb9d9008b41c362bfbacd8d2938a6145adf4))
31
+ * **demo:** migrate start script to pnpm ([b23f9e1](https://github.com/jee-r/astro-decap-cms/commit/b23f9e1e8e393cbc3ba5eec91c47fe497044972f))
32
+ * **demo:** update to Astro 5 ([7dc2bc8](https://github.com/jee-r/astro-decap-cms/commit/7dc2bc8cb80854ef1470706f89f1d06384803f5f))
33
+ * **deps:** configure pnpm build scripts allowlist ([be5e9f5](https://github.com/jee-r/astro-decap-cms/commit/be5e9f555c5fb7a7ff4ba06466f12e7233d3094f))
34
+ * **deps:** update dependencies to latest versions ([a7277c9](https://github.com/jee-r/astro-decap-cms/commit/a7277c97a827ad807b2ac16120aa592dba9a257d))
35
+ * **deps:** upgrade to React 19 and latest Decap CMS ([0877dae](https://github.com/jee-r/astro-decap-cms/commit/0877dae83d63e006298336f8e7ed44ac0074e01a))
36
+ * fix Changesets configuration ([4d4dd77](https://github.com/jee-r/astro-decap-cms/commit/4d4dd772212b8e2d31195b8d97bb0fb021aa6379))
37
+ * ignore demo build artifacts and lockfiles ([cea2987](https://github.com/jee-r/astro-decap-cms/commit/cea298748a3aabfa6b13edaa92ac98251a87e2b7))
38
+ * improve package.json keywords ([981390a](https://github.com/jee-r/astro-decap-cms/commit/981390a3bbc32e5f39c0f9ef54d7a7e6f5e393a8))
39
+ * migrate from Changesets to conventional-changelog ([bcdb89d](https://github.com/jee-r/astro-decap-cms/commit/bcdb89deb12bd2dde9293f675343a126d44a6d24))
40
+
41
+ ### Code Refactoring
42
+
43
+ * **core:** rename NetlifyCMS to DecapCMS ([ba3997d](https://github.com/jee-r/astro-decap-cms/commit/ba3997deccdb5d55ade848d928a0944faea795e7))
44
+ * **demo:** update to use DecapCMS and main branch ([427ad9f](https://github.com/jee-r/astro-decap-cms/commit/427ad9fb41db7ff9012fe48ef8fcb97df7f849a1))
45
+ * improve code quality in src/index.ts ([172f0dd](https://github.com/jee-r/astro-decap-cms/commit/172f0ddcba8da4966330db1ee329f0681980b086))
46
+ * move integration folder to src ([31e73ab](https://github.com/jee-r/astro-decap-cms/commit/31e73ab7c42ff5a4c88b22c84a8b564f1f3fd00c))
1
47
  # astro-netlify-cms
2
48
 
3
49
  ## 0.6.0
package/DecAp.svg ADDED
@@ -0,0 +1,67 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ width="481.47726mm"
6
+ height="179.94118mm"
7
+ viewBox="0 0 481.47727 179.94118"
8
+ version="1.1"
9
+ id="svg1"
10
+ xml:space="preserve"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ xmlns:svg="http://www.w3.org/2000/svg"><defs
13
+ id="defs1"><linearGradient
14
+ id="swatch9"><stop
15
+ style="stop-color:#000000;stop-opacity:1;"
16
+ offset="0"
17
+ id="stop9" /></linearGradient><style
18
+ id="style1">.cls-1{fill:#ff0082;}</style><linearGradient
19
+ id="paint0_linear_1_59"
20
+ x1="22.4702"
21
+ y1="107"
22
+ x2="69.145103"
23
+ y2="84.9468"
24
+ gradientUnits="userSpaceOnUse"><stop
25
+ stop-color="#D83333"
26
+ id="stop3" /><stop
27
+ offset="1"
28
+ stop-color="#F041FF"
29
+ id="stop4" /></linearGradient></defs><g
30
+ id="layer1"
31
+ transform="translate(-60.600167,-44.834473)"><g
32
+ id="g1"
33
+ transform="matrix(1.2846588,0,0,1.2846588,23.524914,28.312615)"><g
34
+ class="name"
35
+ id="g7"><path
36
+ d="m 168.38393,85.306005 7.9375,9.016802 c -4.78977,5.702023 -11.96693,8.712643 -21.24224,8.712643 -17.79016,0 -29.37677,-11.723288 -29.37677,-27.749786 0,-16.026484 11.67752,-27.749849 27.55193,-27.749849 14.53667,0 26.50302,10.020377 26.59442,27.248073 l -38.07422,7.709115 c 2.20458,5.306691 6.97943,8.013236 13.68485,8.013236 5.4587,0 9.38162,-1.70299 12.92453,-5.215448 z M 140.34528,73.689091 165.41902,68.58008 c -1.42926,-5.504343 -5.93019,-9.214464 -12.14921,-9.214464 -7.46584,0 -12.63573,5.215471 -12.92453,14.323475 z"
37
+ id="path4"
38
+ style="stroke-width:1.52062" /><path
39
+ d="m 183.34119,75.285664 c 0,-16.22418 11.96636,-27.749849 28.70749,-27.749849 10.81128,0 19.32623,4.911368 23.06687,13.715281 l -11.57161,6.507901 c -2.78264,-5.109008 -6.88795,-7.405022 -11.57133,-7.405022 -7.5568,0 -13.48697,5.504347 -13.48697,14.91648 0,9.412145 5.93018,14.916491 13.48697,14.916491 4.68338,0 8.80412,-2.204768 11.57133,-7.405018 l 11.57161,6.614357 c -3.72566,8.621424 -12.24061,13.624095 -23.06687,13.624095 -16.74113,0 -28.70749,-11.525782 -28.70749,-27.749925 z"
40
+ id="path5"
41
+ style="stroke-width:1.52062" /><g
42
+ style="fill:none"
43
+ id="g2"
44
+ transform="matrix(1.2435478,0,0,1.2435478,238.60797,19.870519)"><path
45
+ d="m 27.5894,91.1365 c -4.8339,-4.4187 -6.245,-13.703 -4.2311,-20.4293 3.492,4.2408 8.3305,5.5842 13.3422,6.3425 7.737,1.1702 15.3354,0.7325 22.5227,-2.8038 0.8222,-0.4049 1.582,-0.9432 2.4804,-1.4885 0.6744,1.9566 0.8499,3.9318 0.6144,5.9422 -0.5728,4.8961 -3.0094,8.6782 -6.8848,11.5452 -1.5497,1.1468 -3.1895,2.1719 -4.79,3.2531 -4.917,3.3234 -6.2473,7.2201 -4.3997,12.8881 0.0439,0.139 0.0832,0.277 0.1825,0.614 -2.5105,-1.124 -4.3443,-2.76 -5.7415,-4.911 -1.4758,-2.2697 -2.1779,-4.7809 -2.2149,-7.4981 -0.0185,-1.3223 -0.0185,-2.6564 -0.1963,-3.96 -0.4342,-3.1782 -1.9262,-4.6012 -4.7369,-4.6831 -2.8846,-0.0842 -5.1664,1.6991 -5.7715,4.5076 -0.0462,0.2153 -0.1132,0.4283 -0.1802,0.6787 z"
46
+ fill="url(#paint0_linear_1_59)"
47
+ id="path2-7"
48
+ style="fill:url(#paint0_linear_1_59)" /><path
49
+ d="m 0,69.5866 c 0,0 14.3139,-6.9729 28.6678,-6.9729 L 39.4901,29.1204 c 0.4052,-1.6197 1.5882,-2.7205 2.9238,-2.7205 1.3356,0 2.5186,1.1008 2.9238,2.7205 l 10.8224,33.4933 c 17,0 28.6677,6.9729 28.6677,6.9729 0,0 -24.3133,-66.23427 -24.3608,-66.36716 C 59.7692,1.2612 58.5911,0 57.0029,0 H 27.8274 C 26.2392,0 25.1087,1.2612 24.3634,3.21944 24.3108,3.34983 0,69.5866 0,69.5866 Z"
50
+ class="astro-logo"
51
+ id="path3-5" /></g><path
52
+ d="m 403.64999,73.654032 c 0,16.923602 -11.19105,27.749788 -25.63625,27.749788 -6.41671,0 -11.67766,-2.098272 -15.49422,-6.507879 v 25.134549 h -14.9317 V 46.710056 h 14.26274 v 6.203805 c 3.72517,-4.71367 9.27528,-7.009678 16.16318,-7.009678 14.4452,0 25.63625,10.811039 25.63625,27.749849 z m -15.11416,0 c 0,-9.320898 -5.64097,-14.916473 -13.1068,-14.916473 -7.46583,0 -13.10741,5.610788 -13.10741,14.916473 0,9.305694 5.64158,14.91649 13.10741,14.91649 7.46583,0 13.1068,-5.610796 13.1068,-14.91649 z"
53
+ id="path7"
54
+ style="stroke-width:1.52062" /><g
55
+ id="g9"><path
56
+ class="cls-1"
57
+ d="m 59.59,13.02 -30.73,2.8 3.67,40.21 20.03,-1.83 -1.99,-21.86 10.71,-0.98 c 10.61,-0.97 19.14,7.53 20.29,20.19 v 0 c 0,0 19.67,-1.79 19.67,-1.79 C 99.22,27.59 80.52,11.11 59.61,13.01 Z"
58
+ id="path1" /><path
59
+ class="cls-1"
60
+ d="m 102.46,62.38 c 0,12.72 -7.73,21.95 -18.37,21.95 H 73.34 V 62.34 H 53.23 v 40.42 h 30.86 c 21.02,0 38.12,-18.11 38.12,-40.38 0,-0.01 0,-0.02 0,-0.04 h -19.75 c 0,0 0,0.02 0,0.04 z"
61
+ id="path2" /></g></g></g></g><style
62
+ id="style7">
63
+ @media (prefers-color-scheme: dark) {g.name {fill: #ffffff;}}
64
+ @media (prefers-color-scheme: light) {g.name {fill: #000000;}}
65
+ @media (prefers-color-scheme: dark) {.astro-logo {fill: #ffffff;}}
66
+ @media (prefers-color-scheme: light) {.astro-logo {fill: #000000;}}
67
+ </style></svg>
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 jee-r
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
- ![Astro + Decap CMS](header.png)
2
-
3
- <p align="center">
4
- Add <a href="https://decapcms.org/">Decap CMS</a>’s admin dashboard
5
- to any <a href="https://astro.build/">Astro</a> project
6
- </p>
1
+ <div align="center">
2
+ <img src="./DecAp.svg" alt="DecAP" height="120" />
3
+ <p>
4
+ Add <a href="https://decapcms.org/">Decap CMS</a>'s admin dashboard
5
+ to any <a href="https://astro.build/">Astro</a> project
6
+ </p>
7
+ </div>
7
8
 
8
9
  ## Installation
9
10
 
10
11
  ```bash
11
- npm i astro-decap-cms
12
+ npm i @jee-r/astro-decap-cms
12
13
  ```
13
14
 
14
15
  ## What is this?
15
16
 
16
17
  This is an integration for the [Astro](https://astro.build/) site builder,
17
- which adds support for [Decap CMS](https:///), an
18
+ which adds support for [Decap CMS](https://decapcms.org/), an
18
19
  open-source, Git-based content management system.
19
20
 
20
21
  Adding the integration will:
@@ -25,7 +26,7 @@ Adding the integration will:
25
26
 
26
27
  Usually each of these requires individual set up and configuration. Using this integration, you configure your CMS once in `astro.config.mjs`, sit back, and enjoy!
27
28
 
28
- > Looking for a quick way to get started? [Try out the Blog Starter with Decap CMS →](https://github.com/delucis/astro-netlify-cms-starter)
29
+ > Looking for a quick way to get started? Check out the [demo](./demo) included in this repository.
29
30
 
30
31
  ## Usage
31
32
 
@@ -38,11 +39,11 @@ Astro config file, adding it to the `integrations` array.
38
39
  // astro.config.mjs
39
40
 
40
41
  import { defineConfig } from 'astro/config';
41
- import NetlifyCMS from 'astro-decap-cms';
42
+ import DecapCMS from '@jee-r/astro-decap-cms';
42
43
 
43
44
  export default defineConfig({
44
45
  integrations: [
45
- NetlifyCMS({
46
+ DecapCMS({
46
47
  config: {
47
48
  backend: {
48
49
  name: 'git-gateway',
@@ -63,7 +64,7 @@ You can pass an options object to the integration to configure how it behaves.
63
64
 
64
65
  #### `adminPath`
65
66
 
66
- **Type:** `string`
67
+ **Type:** `string`
67
68
  **Default:** `'/admin'`
68
69
 
69
70
  Determines the route where the Decap CMS admin dashboard will be available on your site.
@@ -128,10 +129,71 @@ previewStyles: [
128
129
 
129
130
  #### `disableIdentityWidgetInjection`
130
131
 
131
- **Type:** `boolean`
132
+ **Type:** `boolean`
132
133
  **Default:** `false`
133
134
 
134
- By default, `astro-decap-cms` injects Netlifys [Identity Widget](https://github.com/netlify/netlify-identity-widget) across your site to enable authentication. If you only want to inject the widget on the admin route, you can set `disableIdentityWidgetInjection: true`.
135
+ By default, `@jee-r/astro-decap-cms` injects Netlify's [Identity Widget](https://github.com/netlify/netlify-identity-widget) across your site to enable authentication. If you only want to inject the widget on the admin route, you can set `disableIdentityWidgetInjection: true`.
136
+
137
+ ## Development
138
+
139
+ ### Prerequisites
140
+
141
+ This project uses [pnpm](https://pnpm.io/) as package manager. Make sure you have it installed:
142
+
143
+ ```bash
144
+ npm install -g pnpm
145
+ ```
146
+
147
+ ### Building the package
148
+
149
+ To compile the TypeScript source code:
150
+
151
+ ```bash
152
+ pnpm run build
153
+ ```
154
+
155
+ This compiles all files from `src/` to `dist/`.
156
+
157
+ ### Testing
158
+
159
+ Run the full test suite (builds the package and the demo):
160
+
161
+ ```bash
162
+ pnpm test
163
+ ```
164
+
165
+ This will:
166
+ 1. Build the package (`pnpm run build`)
167
+ 2. Install demo dependencies (`cd demo && pnpm install --frozen-lockfile`)
168
+ 3. Build the demo Astro site (`pnpm run build`)
169
+
170
+ ### Working with the demo
171
+
172
+ The `demo/` directory contains a working example of the integration.
173
+
174
+ To run the demo in development mode:
175
+
176
+ ```bash
177
+ cd demo
178
+ pnpm install
179
+ pnpm run dev
180
+ ```
181
+
182
+ This will start:
183
+ - The Astro dev server (typically at `http://localhost:4321`)
184
+ - The Decap CMS proxy server for local content editing
185
+
186
+ ## Credits
187
+
188
+ This project is a maintained fork of [astro-netlify-cms](https://github.com/delucis/astro-netlify-cms) by [@delucis](https://github.com/delucis), updated to support [Decap CMS](https://decapcms.org/) (the community-maintained successor to Netlify CMS).
189
+
190
+ Some improvements were inspired by the [Advanced Astro fork](https://github.com/advanced-astro/astro-decap-cms), including dependency updates and tooling configurations. These changes were manually integrated rather than cherry-picked to maintain:
191
+ - Conventional commit format
192
+ - Semantic versioning continuity (their fork reset from 0.6.1 to 0.2.0)
193
+ - Consistent package naming and branding
194
+ - Clean project history
195
+
196
+ Thanks to all contributors and maintainers of both projects.
135
197
 
136
198
  ## To-do
137
199
 
@@ -1,11 +1,14 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>Content Manager</title>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="robots" content="noindex" />
5
7
  <meta
6
- name="description"
7
- content="Admin dashboard for managing website content"
8
+ name="description"
9
+ content="Admin dashboard for managing website content"
8
10
  />
11
+ <title>Content Manager</title>
9
12
  <script>
10
13
  import options from 'virtual:astro-decap-cms/user-config';
11
14
  import initCMS from './dist/cms';
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import config from 'conventional-changelog-conventionalcommits'
4
+
5
+ export default config({
6
+ types: [
7
+ { type: 'feat', section: 'Features' },
8
+ { type: 'feature', section: 'Features' },
9
+ { type: 'fix', section: 'Bug Fixes' },
10
+ { type: 'perf', section: 'Performance Improvements' },
11
+ { type: 'revert', section: 'Reverts' },
12
+ { type: 'docs', section: 'Documentation' },
13
+ { type: 'style', section: 'Styles' },
14
+ { type: 'chore', section: 'Chores'},
15
+ { type: 'refactor', section: 'Code Refactoring' },
16
+ { type: 'test', section: 'Tests' },
17
+ { type: 'build', section: 'Build System' },
18
+ { type: 'ci', section: 'Continuous Integration' }
19
+ ],
20
+ })
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { AstroIntegration } from 'astro';
2
2
  import type { CmsConfig } from 'decap-cms-core';
3
3
  import type { PreviewStyle } from './types.js';
4
- interface NetlifyCMSOptions {
4
+ interface DecapCMSOptions {
5
5
  /**
6
- * Path at which the Netlify CMS admin dashboard should be served.
6
+ * Path at which the Decap CMS admin dashboard should be served.
7
7
  * @default '/admin'
8
8
  */
9
9
  adminPath?: string;
@@ -11,5 +11,11 @@ interface NetlifyCMSOptions {
11
11
  disableIdentityWidgetInjection?: boolean;
12
12
  previewStyles?: PreviewStyle[];
13
13
  }
14
- export default function NetlifyCMS({ disableIdentityWidgetInjection, adminPath, config: cmsConfig, previewStyles, }: NetlifyCMSOptions): AstroIntegration;
14
+ /**
15
+ * Creates an Astro integration for Decap CMS.
16
+ *
17
+ * @param options - Configuration options for the Decap CMS integration
18
+ * @returns An Astro integration that adds Decap CMS to your project
19
+ */
20
+ export default function DecapCMS({ disableIdentityWidgetInjection, adminPath, config: cmsConfig, previewStyles, }: DecapCMSOptions): AstroIntegration;
15
21
  export {};
package/dist/index.js CHANGED
@@ -1,29 +1,31 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import AdminDashboard from './vite-plugin-admin-dashboard.js';
3
3
  const widgetPath = '@jee-r/astro-decap-cms/identity-widget';
4
- export default function NetlifyCMS({ disableIdentityWidgetInjection = false, adminPath = '/admin', config: cmsConfig, previewStyles = [], }) {
4
+ /**
5
+ * Creates an Astro integration for Decap CMS.
6
+ *
7
+ * @param options - Configuration options for the Decap CMS integration
8
+ * @returns An Astro integration that adds Decap CMS to your project
9
+ */
10
+ export default function DecapCMS({ disableIdentityWidgetInjection = false, adminPath = '/admin', config: cmsConfig, previewStyles = [], }) {
5
11
  if (!adminPath.startsWith('/')) {
6
- throw new Error('`adminPath` option must be a root-relative pathname, starting with "/", got "' +
7
- adminPath +
8
- '"');
12
+ throw new Error(`'adminPath' option must be a root-relative pathname, starting with "/", got "${adminPath}"`);
9
13
  }
10
14
  if (adminPath.endsWith('/')) {
11
15
  adminPath = adminPath.slice(0, -1);
12
16
  }
13
17
  let proxy;
14
- const NetlifyCMSIntegration = {
18
+ const DecapCMSIntegration = {
15
19
  name: 'decap-cms',
16
20
  hooks: {
17
21
  'astro:config:setup': ({ config, injectRoute, injectScript, updateConfig, }) => {
18
- var _a;
19
22
  const identityWidgetScript = `import { initIdentity } from '${widgetPath}'; initIdentity('${adminPath}');`;
20
- const newConfig = {
23
+ updateConfig({
21
24
  // Default to the URL provided by Netlify when building there. See:
22
25
  // https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata
23
26
  site: config.site || process.env.URL,
24
27
  vite: {
25
28
  plugins: [
26
- ...(((_a = config.vite) === null || _a === void 0 ? void 0 : _a.plugins) || []),
27
29
  AdminDashboard({
28
30
  config: cmsConfig,
29
31
  previewStyles,
@@ -33,11 +35,10 @@ export default function NetlifyCMS({ disableIdentityWidgetInjection = false, adm
33
35
  }),
34
36
  ],
35
37
  },
36
- };
37
- updateConfig(newConfig);
38
+ });
38
39
  injectRoute({
39
40
  pattern: adminPath,
40
- entryPoint: '@jee-r/astro-decap-cms/admin-dashboard.astro',
41
+ entrypoint: '@jee-r/astro-decap-cms/admin-dashboard.astro',
41
42
  });
42
43
  if (!disableIdentityWidgetInjection) {
43
44
  injectScript('page', identityWidgetScript);
@@ -56,5 +57,5 @@ export default function NetlifyCMS({ disableIdentityWidgetInjection = false, adm
56
57
  },
57
58
  },
58
59
  };
59
- return NetlifyCMSIntegration;
60
+ return DecapCMSIntegration;
60
61
  }
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type CMS from 'decap-cms-app';
2
2
  import type { CmsConfig } from 'decap-cms-core';
3
- export declare type NormalizedPreviewStyle = [pathOrUrl: string] | [rawCSS: string, meta: {
3
+ export type NormalizedPreviewStyle = [pathOrUrl: string] | [rawCSS: string, meta: {
4
4
  raw: boolean;
5
5
  }];
6
- export declare type PreviewStyle = string | NormalizedPreviewStyle;
6
+ export type PreviewStyle = string | NormalizedPreviewStyle;
7
7
  export interface InitCmsOptions {
8
8
  cms: typeof CMS;
9
9
  config: CmsConfig;
@@ -17,10 +17,10 @@ function generateVirtualConfigModule({ config, previewStyles = [], identityWidge
17
17
  }
18
18
  });
19
19
  return `${imports.join('\n')}
20
- import * as NCMS from 'decap-cms-app';
20
+ import CMS from 'decap-cms-app';
21
21
  ${identityWidget}
22
22
  export default {
23
- cms: NCMS,
23
+ cms: CMS,
24
24
  config: JSON.parse('${JSON.stringify(config)}'),
25
25
  previewStyles: [${styles.join(',')}],
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jee-r/astro-decap-cms",
3
- "version": "0.6.1",
3
+ "version": "1.0.0",
4
4
  "description": "Add Decap CMS’s admin dashboard to your Astro project",
5
5
  "repository": "jee-r/astro-decap-cms",
6
6
  "homepage": "https://github.com/jee-r/astro-decap-cms",
@@ -16,31 +16,50 @@
16
16
  },
17
17
  "types": "./dist/index.d.ts",
18
18
  "scripts": {
19
- "prepack": "tsc",
20
- "test:smoke": "tsc && cd demo && npm ci && npm run build",
21
- "test": "npm run test:smoke"
19
+ "build": "tsc",
20
+ "dev:demo": "pnpm run build && cd demo && pnpm install && pnpm run dev",
21
+ "prepack": "pnpm run build",
22
+ "test:smoke": "pnpm run build && cd demo && pnpm install --frozen-lockfile && pnpm run build",
23
+ "test": "pnpm run test:smoke",
24
+ "changelog-latest": "conventional-changelog --config ./changelog-config.mjs -r 1",
25
+ "changelog": "conventional-changelog --config ./changelog-config.mjs -i CHANGELOG.md -s",
26
+ "version": "conventional-changelog --config ./changelog-config.mjs -i CHANGELOG.md -s && git add CHANGELOG.md"
22
27
  },
23
28
  "keywords": [
29
+ "astro",
24
30
  "astro-component",
31
+ "astro-integration",
25
32
  "cms",
26
- "astro",
27
33
  "decap-cms",
34
+ "headless-cms",
28
35
  "netlify-cms"
29
36
  ],
30
37
  "dependencies": {
31
- "@types/react": "^17.0.50",
32
- "decap-cms-app": "^3.0.0",
33
- "decap-server": "^3.0.0",
38
+ "@types/react": "^19.1.0",
39
+ "decap-cms-app": "^3.10.0",
40
+ "decap-server": "^3.5.0",
34
41
  "netlify-identity-widget": "^1.9.2",
35
- "react": "^17.0.2",
36
- "react-dom": "^17.0.2"
42
+ "react": "^19.1.0",
43
+ "react-dom": "^19.1.0"
37
44
  },
38
45
  "peerDependencies": {
39
- "astro": "^1.0.0 || ^2.0.0-beta || ^3.0.0-beta"
46
+ "astro": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
40
50
  },
41
51
  "devDependencies": {
42
- "@changesets/changelog-github": "^0.4.7",
43
- "@changesets/cli": "^2.25.0",
44
- "astro": "^1.5.2"
52
+ "@astrojs/check": "^0.9.4",
53
+ "astro": "^5.16.11",
54
+ "conventional-changelog-cli": "^5.0.0",
55
+ "conventional-changelog-conventionalcommits": "^9.1.0",
56
+ "typescript": "^5.7.2",
57
+ "vite": "^6.4.1"
58
+ },
59
+ "pnpm": {
60
+ "onlyBuiltDependencies": [
61
+ "esbuild",
62
+ "sharp"
63
+ ]
45
64
  }
46
65
  }
package/renovate.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ],
6
+ "packageRules": [
7
+ {
8
+ "matchUpdateTypes": ["minor", "patch"],
9
+ "automerge": true
10
+ }
11
+ ]
12
+ }
package/src/cms.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { InitCmsOptions } from './types';
2
+
3
+ export default function initCMS({
4
+ cms,
5
+ config,
6
+ previewStyles = [],
7
+ }: InitCmsOptions) {
8
+ // Provide default values given we can make a reasonable guess
9
+ const mediaDefaults = !config.media_folder
10
+ ? { media_folder: 'public', public_folder: '/' }
11
+ : {};
12
+
13
+ cms.init({
14
+ config: {
15
+ // Don’t try to load config.yml as we’re providing the config below
16
+ load_config_file: false,
17
+ // Enable use of the Netlify CMS proxy server when working locally
18
+ local_backend: true,
19
+ ...mediaDefaults,
20
+ ...config,
21
+ },
22
+ });
23
+
24
+ /**
25
+ * One drawback of using Netlify CMS is that it registers all preview
26
+ * styles globally — not scoped to a specific collection.
27
+ * You lose Astro components’ scoped styling anyway by being forced
28
+ * to use React, but just be extra careful.
29
+ *
30
+ * The (undocumented?) `raw: true` setting treats the first argument as
31
+ * a raw CSS string to inject instead of as a URL to load a stylesheet from.
32
+ */
33
+ previewStyles.forEach(([style, opts]) =>
34
+ cms.registerPreviewStyle(style, opts)
35
+ );
36
+ }
@@ -0,0 +1,13 @@
1
+ import identity from 'netlify-identity-widget';
2
+
3
+ export function initIdentity(adminPath: string) {
4
+ identity.on('init', (user) => {
5
+ if (!user) {
6
+ identity.on('login', () => {
7
+ document.location.href = adminPath;
8
+ });
9
+ }
10
+ });
11
+
12
+ identity.init();
13
+ }
package/src/index.ts ADDED
@@ -0,0 +1,95 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ import type { CmsConfig } from 'decap-cms-core';
3
+ import { spawn } from 'node:child_process';
4
+ import type { PreviewStyle } from './types.js';
5
+ import AdminDashboard from './vite-plugin-admin-dashboard.js';
6
+
7
+ const widgetPath = '@jee-r/astro-decap-cms/identity-widget';
8
+
9
+ interface DecapCMSOptions {
10
+ /**
11
+ * Path at which the Decap CMS admin dashboard should be served.
12
+ * @default '/admin'
13
+ */
14
+ adminPath?: string;
15
+ config: Omit<CmsConfig, 'load_config_file' | 'local_backend'>;
16
+ disableIdentityWidgetInjection?: boolean;
17
+ previewStyles?: PreviewStyle[];
18
+ }
19
+
20
+ /**
21
+ * Creates an Astro integration for Decap CMS.
22
+ *
23
+ * @param options - Configuration options for the Decap CMS integration
24
+ * @returns An Astro integration that adds Decap CMS to your project
25
+ */
26
+ export default function DecapCMS({
27
+ disableIdentityWidgetInjection = false,
28
+ adminPath = '/admin',
29
+ config: cmsConfig,
30
+ previewStyles = [],
31
+ }: DecapCMSOptions) {
32
+ if (!adminPath.startsWith('/')) {
33
+ throw new Error(
34
+ `'adminPath' option must be a root-relative pathname, starting with "/", got "${adminPath}"`
35
+ );
36
+ }
37
+ if (adminPath.endsWith('/')) {
38
+ adminPath = adminPath.slice(0, -1);
39
+ }
40
+
41
+ let proxy: ReturnType<typeof spawn>;
42
+
43
+ const DecapCMSIntegration: AstroIntegration = {
44
+ name: 'decap-cms',
45
+ hooks: {
46
+ 'astro:config:setup': ({
47
+ config,
48
+ injectRoute,
49
+ injectScript,
50
+ updateConfig,
51
+ }) => {
52
+ const identityWidgetScript = `import { initIdentity } from '${widgetPath}'; initIdentity('${adminPath}');`;
53
+ updateConfig({
54
+ // Default to the URL provided by Netlify when building there. See:
55
+ // https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata
56
+ site: config.site || process.env.URL,
57
+ vite: {
58
+ plugins: [
59
+ AdminDashboard({
60
+ config: cmsConfig,
61
+ previewStyles,
62
+ identityWidget: disableIdentityWidgetInjection
63
+ ? identityWidgetScript
64
+ : '',
65
+ }),
66
+ ],
67
+ },
68
+ });
69
+
70
+ injectRoute({
71
+ pattern: adminPath,
72
+ entrypoint: '@jee-r/astro-decap-cms/admin-dashboard.astro',
73
+ });
74
+
75
+ if (!disableIdentityWidgetInjection) {
76
+ injectScript('page', identityWidgetScript);
77
+ }
78
+ },
79
+
80
+ 'astro:server:start': () => {
81
+ proxy = spawn('decap-server', {
82
+ stdio: 'inherit',
83
+ // Run in shell on Windows to make sure the npm package can be found.
84
+ shell: process.platform === 'win32',
85
+ });
86
+ process.on('exit', () => proxy.kill());
87
+ },
88
+
89
+ 'astro:server:done': () => {
90
+ proxy.kill();
91
+ },
92
+ },
93
+ };
94
+ return DecapCMSIntegration;
95
+ }
package/src/types.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type CMS from 'decap-cms-app';
2
+ import type { CmsConfig } from 'decap-cms-core';
3
+
4
+ export type NormalizedPreviewStyle =
5
+ | [pathOrUrl: string]
6
+ | [rawCSS: string, meta: { raw: boolean }];
7
+
8
+ export type PreviewStyle = string | NormalizedPreviewStyle;
9
+
10
+ export interface InitCmsOptions {
11
+ cms: typeof CMS;
12
+ config: CmsConfig;
13
+ previewStyles?: NormalizedPreviewStyle[];
14
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'virtual:astro-decap-cms/user-config' {
2
+ import type { InitCmsOptions } from './types';
3
+ const CmsOptions: InitCmsOptions;
4
+ export default CmsOptions;
5
+ }
@@ -0,0 +1,68 @@
1
+ import type { CmsConfig } from 'decap-cms-core';
2
+ import type { Plugin } from 'vite';
3
+ import type { PreviewStyle } from './types';
4
+
5
+ const virtualModuleId = 'virtual:astro-decap-cms/user-config';
6
+ const resolvedVirtualModuleId = '\0' + virtualModuleId;
7
+
8
+ function generateVirtualConfigModule({
9
+ config,
10
+ previewStyles = [],
11
+ identityWidget,
12
+ }: {
13
+ config: CmsConfig;
14
+ previewStyles: Array<string | [string] | [string, { raw: boolean }]>;
15
+ identityWidget: string;
16
+ }) {
17
+ const imports: string[] = [];
18
+ const styles: string[] = [];
19
+
20
+ previewStyles.forEach((entry, index) => {
21
+ if (!Array.isArray(entry)) entry = [entry];
22
+ const [style, opts] = entry;
23
+ if (opts?.raw || style.startsWith('http')) {
24
+ styles.push(JSON.stringify([style, opts]));
25
+ } else {
26
+ const name = `style__${index}`;
27
+ imports.push(`import ${name} from '${style}?raw';`);
28
+ styles.push(`[${name}, { raw: true }]`);
29
+ }
30
+ });
31
+
32
+ return `${imports.join('\n')}
33
+ import CMS from 'decap-cms-app';
34
+ ${identityWidget}
35
+ export default {
36
+ cms: CMS,
37
+ config: JSON.parse('${JSON.stringify(config)}'),
38
+ previewStyles: [${styles.join(',')}],
39
+ };
40
+ `;
41
+ }
42
+
43
+ export default function AdminDashboardPlugin({
44
+ config,
45
+ previewStyles,
46
+ identityWidget,
47
+ }: {
48
+ config: Omit<CmsConfig, 'load_config_file' | 'local_backend'>;
49
+ previewStyles: PreviewStyle[];
50
+ identityWidget: string;
51
+ }): Plugin {
52
+ return {
53
+ name: 'vite-plugin-decap-cms-admin-dashboard',
54
+
55
+ resolveId(id) {
56
+ if (id === virtualModuleId) return resolvedVirtualModuleId;
57
+ },
58
+
59
+ load(id) {
60
+ if (id === resolvedVirtualModuleId)
61
+ return generateVirtualConfigModule({
62
+ config,
63
+ previewStyles,
64
+ identityWidget,
65
+ });
66
+ },
67
+ };
68
+ }
package/tsconfig.json CHANGED
@@ -6,5 +6,5 @@
6
6
  "outDir": "./dist",
7
7
  "skipLibCheck": true
8
8
  },
9
- "include": ["integration/**/*.ts"]
9
+ "include": ["src/**/*.ts"]
10
10
  }
@@ -1,8 +0,0 @@
1
- # Changesets
2
-
3
- Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
- with multi-package repos, or single-package repos to help you version and publish your code. You can
5
- find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
-
7
- We have a quick list of common questions to get you started engaging with this project in
8
- [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -1,14 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@2.1.1/schema.json",
3
- "changelog": [
4
- "@changesets/changelog-github",
5
- { "repo": "delucis/astro-netlify-cms" }
6
- ],
7
- "commit": false,
8
- "fixed": [],
9
- "linked": [],
10
- "access": "public",
11
- "baseBranch": "latest",
12
- "updateInternalDependencies": "patch",
13
- "ignore": []
14
- }