Browse Source

Refactor: Change import to CDN

Yaavi 8 months ago
parent
commit
3c19e86a70
6 changed files with 10 additions and 10 deletions
  1. 3 0
      docs/env.d.ts
  2. 1 0
      docs/index.html
  3. 1 8
      docs/package-lock.json
  4. 0 1
      docs/package.json
  5. 2 1
      docs/src/components/CalendarComp.vue
  6. 3 0
      docs/vite.config.ts

+ 3 - 0
docs/env.d.ts

@@ -1 +1,4 @@
 /// <reference types="vite/client" />
 /// <reference types="vite/client" />
+
+// chineseDays
+declare var chineseDays: any;

+ 1 - 0
docs/index.html

@@ -5,6 +5,7 @@
     <link rel="icon" href="/favicon.ico">
     <link rel="icon" href="/favicon.ico">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Chinese Days</title>
     <title>Chinese Days</title>
+    <script src="//cdn.jsdelivr.net/npm/chinese-days/dist/index.min.js"></script>
   </head>
   </head>
   <body>
   <body>
     <div id="app"></div>
     <div id="app"></div>

+ 1 - 8
docs/package-lock.json

@@ -8,7 +8,6 @@
       "name": "demo",
       "name": "demo",
       "version": "0.0.0",
       "version": "0.0.0",
       "dependencies": {
       "dependencies": {
-        "chinese-days": "^1.3.3",
         "highlight.js": "^11.10.0",
         "highlight.js": "^11.10.0",
         "markdown-it": "^14.1.0",
         "markdown-it": "^14.1.0",
         "vue": "^3.4.38"
         "vue": "^3.4.38"
@@ -795,7 +794,7 @@
     },
     },
     "node_modules/@clack/prompts/node_modules/is-unicode-supported": {
     "node_modules/@clack/prompts/node_modules/is-unicode-supported": {
       "version": "1.3.0",
       "version": "1.3.0",
-      "dev": true,
+      "extraneous": true,
       "inBundle": true,
       "inBundle": true,
       "license": "MIT",
       "license": "MIT",
       "engines": {
       "engines": {
@@ -2812,12 +2811,6 @@
         "url": "https://github.com/sponsors/wooorm"
         "url": "https://github.com/sponsors/wooorm"
       }
       }
     },
     },
-    "node_modules/chinese-days": {
-      "version": "1.3.3",
-      "resolved": "https://registry.npmjs.org/chinese-days/-/chinese-days-1.3.3.tgz",
-      "integrity": "sha512-0/MKbcpYiE/Pm+AeIRSB6Z9PyFsBF2BNi7hi3McLHDT7+G/hYbHA5K8KUMWp7A5H1CMZpwQ1YovVY7xUMz1p6g==",
-      "license": "MIT"
-    },
     "node_modules/ci-info": {
     "node_modules/ci-info": {
       "version": "4.0.0",
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz",
       "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz",

+ 0 - 1
docs/package.json

@@ -13,7 +13,6 @@
     "lint:fix": "eslint . --fix"
     "lint:fix": "eslint . --fix"
   },
   },
   "dependencies": {
   "dependencies": {
-    "chinese-days": "^1.3.3",
     "highlight.js": "^11.10.0",
     "highlight.js": "^11.10.0",
     "markdown-it": "^14.1.0",
     "markdown-it": "^14.1.0",
     "vue": "^3.4.38"
     "vue": "^3.4.38"

+ 2 - 1
docs/src/components/CalendarComp.vue

@@ -1,6 +1,7 @@
 <script lang="ts" setup>
 <script lang="ts" setup>
 import { computed, ref } from 'vue'
 import { computed, ref } from 'vue'
-import { getDayDetail, getLunarDate, getSolarTermsInRange, isInLieu } from 'chinese-days'
+
+const { getDayDetail, getLunarDate, getSolarTermsInRange, isInLieu } = chineseDays
 
 
 const props = withDefaults(
 const props = withDefaults(
   defineProps<{
   defineProps<{

+ 3 - 0
docs/vite.config.ts

@@ -15,4 +15,7 @@ export default defineConfig({
       '@': fileURLToPath(new URL('./src', import.meta.url)),
       '@': fileURLToPath(new URL('./src', import.meta.url)),
     },
     },
   },
   },
+  define: {
+    chineseDays: 'window.chineseDays'
+  }
 })
 })