@caiquecamargo/vite-plugin-netlify-cms 0.0.18 → 0.1.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/README.md +51 -1
- package/dist/chunk-JOUSWMWF.js +13 -0
- package/dist/chunk-JOUSWMWF.js.map +1 -0
- package/dist/index.d.ts +462 -41
- package/dist/index.js +204 -11
- package/dist/index.js.map +1 -1
- package/dist/src/oauth/astro-callback.d.ts +4 -0
- package/dist/src/oauth/astro-callback.js +67 -0
- package/dist/src/oauth/astro-callback.js.map +1 -0
- package/dist/src/oauth/astro-login.d.ts +4 -0
- package/dist/src/oauth/astro-login.js +14 -0
- package/dist/src/oauth/astro-login.js.map +1 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
# vite-plugin-netlify-cms
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Simple plugin to generate config.yml for Netlify CMS / Sveltia CMS with TypeScript support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎯 TypeScript-first configuration
|
|
8
|
+
- 📦 Automatic `config.yml` generation
|
|
9
|
+
- 🔐 OAuth authentication (GitHub)
|
|
10
|
+
- ✨ **Astro Integration** for seamless SSR routing
|
|
11
|
+
- 🔌 **Vite Plugin** for other frameworks
|
|
12
|
+
- 🚀 Hot reload support
|
|
13
|
+
- ✨ Support for Sveltia CMS and Decap CMS
|
|
14
|
+
- 🎨 Type-safe widget definitions
|
|
15
|
+
|
|
16
|
+
## OAuth Authentication
|
|
17
|
+
|
|
18
|
+
### For Astro Projects (Recommended)
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// astro.config.ts
|
|
22
|
+
import { defineConfig } from 'astro/config';
|
|
23
|
+
import { astroOAuthIntegration } from 'vite-plugin-netlify-cms';
|
|
24
|
+
import sveltiaCMS from 'vite-plugin-netlify-cms';
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
integrations: [
|
|
28
|
+
astroOAuthIntegration(), // Adds /oauth and /oauth/callback routes
|
|
29
|
+
],
|
|
30
|
+
vite: {
|
|
31
|
+
plugins: [sveltiaCMS({ type: 'sveltia' })],
|
|
32
|
+
},
|
|
33
|
+
output: 'server', // or 'hybrid'
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### For Other Projects (Vite, SvelteKit, Nuxt, etc.)
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// vite.config.ts
|
|
41
|
+
import { defineConfig } from 'vite';
|
|
42
|
+
import sveltiaCMS, { oauthPlugin } from 'vite-plugin-netlify-cms';
|
|
43
|
+
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
plugins: [
|
|
46
|
+
sveltiaCMS({ type: 'sveltia' }),
|
|
47
|
+
oauthPlugin(), // Works in dev, needs serverless setup for production
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**[📖 Complete OAuth Setup Guide](./OAUTH_SETUP.md)**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/oauth/config.ts
|
|
2
|
+
var clientId = process.env.OAUTH_GITHUB_CLIENT_ID;
|
|
3
|
+
var clientSecret = process.env.OAUTH_GITHUB_CLIENT_SECRET;
|
|
4
|
+
var authUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=repo,user`;
|
|
5
|
+
var tokenUrl = "https://github.com/login/oauth/access_token";
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
clientId,
|
|
9
|
+
clientSecret,
|
|
10
|
+
authUrl,
|
|
11
|
+
tokenUrl
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-JOUSWMWF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/oauth/config.ts"],"sourcesContent":["export const clientId = process.env.OAUTH_GITHUB_CLIENT_ID;\nexport const clientSecret = process.env.OAUTH_GITHUB_CLIENT_SECRET;\n\nexport const authUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=repo,user`;\nexport const tokenUrl = 'https://github.com/login/oauth/access_token';\n"],"mappings":";AAAO,IAAM,WAAW,QAAQ,IAAI;AAC7B,IAAM,eAAe,QAAQ,IAAI;AAEjC,IAAM,UAAU,sDAAsD,QAAQ;AAC9E,IAAM,WAAW;","names":[]}
|