diff --git a/pkgs/LoadMore/.npmignore b/pkgs/Scripts/.npmignore
similarity index 100%
rename from pkgs/LoadMore/.npmignore
rename to pkgs/Scripts/.npmignore
diff --git a/pkgs/LoadMore/README.md b/pkgs/Scripts/README.md
similarity index 100%
rename from pkgs/LoadMore/README.md
rename to pkgs/Scripts/README.md
diff --git a/pkgs/LoadMore/cmd.mjs b/pkgs/Scripts/cmd.mjs
similarity index 81%
rename from pkgs/LoadMore/cmd.mjs
rename to pkgs/Scripts/cmd.mjs
index 09213a2..f35e7d7 100644
--- a/pkgs/LoadMore/cmd.mjs
+++ b/pkgs/Scripts/cmd.mjs
@@ -5,13 +5,12 @@ const bundleFile = async () => {
const getPkg = JSON.parse(readFileSync('./package.json'))
const Opts = {
- entryPoints: ['src/index.ts'],
+ entryPoints: ['src/loadmore/index.ts', 'src/gisqus.ts'],
bundle: true,
minify: true,
outdir: 'dist',
platform: 'node',
format: 'esm',
- outExtension: { '.js': '.mjs' },
external: [
'vite',
...Object.keys(getPkg.dependencies || {}),
@@ -19,9 +18,6 @@ const bundleFile = async () => {
],
}
- await build(Opts)
- Opts.format = 'cjs'
- Opts.outExtension = { '.js': '.cjs' }
await build(Opts)
const replaceHtml = (PATH) => {
@@ -30,8 +26,7 @@ const bundleFile = async () => {
writeFileSync(PATH, result)
}
- replaceHtml('./dist/index.mjs')
- replaceHtml('./dist/index.cjs')
+ replaceHtml('./dist/loadmore/index.js')
}
const isBuild = process.env.BUILD === 'true'
diff --git a/pkgs/LoadMore/package.json b/pkgs/Scripts/package.json
similarity index 80%
rename from pkgs/LoadMore/package.json
rename to pkgs/Scripts/package.json
index 1079eb7..1bc0668 100644
--- a/pkgs/LoadMore/package.json
+++ b/pkgs/Scripts/package.json
@@ -1,5 +1,5 @@
{
- "name": "loadmore",
+ "name": "myscript",
"version": "1.0.0",
"description": "vite plugin for html literal and ",
"scripts": {
@@ -25,13 +25,13 @@
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "require": "./dist/index.cjs",
- "import": "./dist/index.mjs"
+ "./loadmore": {
+ "types": "./dist/loadmore/index.d.ts",
+ "import": "./dist/loadmore/index.js"
},
- "./type": {
- "types": "./dist/types.d.ts"
+ "./giscus": {
+ "types": "./dist/gisqus.d.ts",
+ "import": "./dist/gisqus.js"
}
},
"files": [
diff --git a/pkgs/Scripts/src/gisqus.ts b/pkgs/Scripts/src/gisqus.ts
new file mode 100644
index 0000000..642c485
--- /dev/null
+++ b/pkgs/Scripts/src/gisqus.ts
@@ -0,0 +1,44 @@
+;(function () {
+ let isClick = false
+ const ELEMENT_COMMENT = document.getElementById('content-comment')!
+ const BtnToggle = document.getElementById('toggle-comment')!
+ BtnToggle.onclick = () => {
+ ELEMENT_COMMENT.classList.toggle('hidden')
+ let isHide = true
+ if (isHide) {
+ isClick = false
+ BtnToggle.innerHTML = 'Hide Comments'
+ } else {
+ isClick = true
+ BtnToggle.innerHTML = 'Show Comments'
+ }
+ if (!isClick) {
+ isClick = true
+ const REPO = 'alifprihantoro/pawartatech'
+ const REPO_ID = 'R_kgDONCtgBQ'
+ const DATA_CATEGORY = 'Gisqus'
+ const CATEGORY_ID = 'DIC_kwDONCtgBc4CkVdt'
+ const DATA_MAPPING = 'pathname'
+ const isLazy = true
+ const DATA_THEMES = 'dark'
+ const script = document.createElement('script')
+ script.src = 'https://giscus.app/client.js'
+ script.setAttribute('data-repo', REPO)
+ script.setAttribute('data-repo-id', REPO_ID)
+ script.setAttribute('data-category', DATA_CATEGORY)
+ script.setAttribute('data-category-id', CATEGORY_ID)
+ script.setAttribute('data-mapping', DATA_MAPPING)
+ script.setAttribute('data-strict', '1')
+ script.setAttribute('data-reactions-enabled', '1')
+ script.setAttribute('data-emit-metadata', '1')
+ script.setAttribute('data-input-position', 'top')
+ script.setAttribute('data-theme', DATA_THEMES)
+ if (isLazy) {
+ script.setAttribute('data-loading', 'lazy')
+ }
+ script.setAttribute('data-lang', 'id')
+ script.setAttribute('crossorigin', 'anonymous')
+ ELEMENT_COMMENT.appendChild(script)
+ }
+ }
+})()
diff --git a/pkgs/LoadMore/src/Render.ts b/pkgs/Scripts/src/loadmore/Render.ts
similarity index 100%
rename from pkgs/LoadMore/src/Render.ts
rename to pkgs/Scripts/src/loadmore/Render.ts
diff --git a/pkgs/LoadMore/src/event.ts b/pkgs/Scripts/src/loadmore/event.ts
similarity index 100%
rename from pkgs/LoadMore/src/event.ts
rename to pkgs/Scripts/src/loadmore/event.ts
diff --git a/pkgs/LoadMore/src/getFeed.ts b/pkgs/Scripts/src/loadmore/getFeed.ts
similarity index 100%
rename from pkgs/LoadMore/src/getFeed.ts
rename to pkgs/Scripts/src/loadmore/getFeed.ts
diff --git a/pkgs/LoadMore/src/index.ts b/pkgs/Scripts/src/loadmore/index.ts
similarity index 100%
rename from pkgs/LoadMore/src/index.ts
rename to pkgs/Scripts/src/loadmore/index.ts
diff --git a/pkgs/LoadMore/src/vite-env.d.ts b/pkgs/Scripts/src/loadmore/vite-env.d.ts
similarity index 100%
rename from pkgs/LoadMore/src/vite-env.d.ts
rename to pkgs/Scripts/src/loadmore/vite-env.d.ts
diff --git a/pkgs/LoadMore/tsconfig.json b/pkgs/Scripts/tsconfig.json
similarity index 100%
rename from pkgs/LoadMore/tsconfig.json
rename to pkgs/Scripts/tsconfig.json
diff --git a/pkgs/ui/package.json b/pkgs/ui/package.json
index fbc0ed4..a925b4c 100644
--- a/pkgs/ui/package.json
+++ b/pkgs/ui/package.json
@@ -39,6 +39,7 @@
"@muryp/vite-html": "^1.0.6",
"@storybook/addon-console": "^3.0.0",
"@storybook/test": "^8.3.6",
- "configs": "workspace:^"
+ "configs": "workspace:^",
+ "myscript": "workspace:^"
}
}
diff --git a/pkgs/ui/src/assets/css/main.css b/pkgs/ui/src/assets/css/main.css
index 295cffb..b580abd 100644
--- a/pkgs/ui/src/assets/css/main.css
+++ b/pkgs/ui/src/assets/css/main.css
@@ -1,7 +1,6 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
-
/* default */
h1,
h2,
diff --git a/pkgs/ui/src/view/pages/post/index.ts b/pkgs/ui/src/view/pages/post/index.ts
index 5cf5da4..b5b0100 100644
--- a/pkgs/ui/src/view/pages/post/index.ts
+++ b/pkgs/ui/src/view/pages/post/index.ts
@@ -1,3 +1,4 @@
+import Scripts from 'myscript/giscus?raw'
export default function Post({
Content,
title,
@@ -20,10 +21,19 @@ export default function Post({
${Content}
Baca Juga :