Skip to content

Commit

Permalink
chore: code formatting and type export fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cngJo committed Feb 5, 2024
1 parent 2130d11 commit 2692244
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jop-software/astro-cookieconsent",
"version": "3.0.0",
"version": "2.0.0",
"description": "vanilla-cookieconsent for astro",
"type": "module",
"license": "GPL-3.0-or-later",
Expand Down Expand Up @@ -31,7 +31,9 @@
},
"main": "./dist/astro-cookieconsent.umd.js",
"module": "./dist/astro-cookieconsent.es.js",
"files": ["dist"],
"files": [
"dist"
],
"scripts": {
"build": "vite build && tsc --emitDeclarationOnly",
"build:watch": "vite build --watch",
Expand Down
16 changes: 8 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { type AstroIntegration } from 'astro';
import { type CookieConsentConfig } from 'vanilla-cookieconsent';
import { type AstroIntegration } from "astro";
import { type CookieConsentConfig } from "vanilla-cookieconsent";

const createPlugin = (config: CookieConsentConfig): AstroIntegration => {
return {
name: '@jop-software/astro-cookieconsent',
name: "@jop-software/astro-cookieconsent",
hooks: {
'astro:config:setup': async ({ injectScript }) => {
"astro:config:setup": async ({ injectScript }) => {
injectScript(
'page',
"page",
"import * as cookieConsent from 'vanilla-cookieconsent';"
);
injectScript(
'page-ssr',
"page-ssr",
"import 'vanilla-cookieconsent/dist/cookieconsent.css';"
);
injectScript('page', `cookieConsent.run(${JSON.stringify(config)});`);
injectScript("page", `cookieConsent.run(${JSON.stringify(config)});`);
},
},
};
};

export type { CookieConsent };
export type { CookieConsentConfig };

export default createPlugin;

0 comments on commit 2692244

Please sign in to comment.