master
yutent 2022-12-29 19:05:15 +08:00
commit 4d116f8ac2
16 changed files with 446 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
node_modules
*.sublime-project
*.sublime-workspace
package-lock.json
._*
.Spotlight-V100
.Trashes
.DS_Store
.AppleDouble
.LSOverride

11
.prettierrc.yaml Normal file
View File

@ -0,0 +1,11 @@
jsxBracketSameLine: true
jsxSingleQuote: true
semi: false
singleQuote: true
printWidth: 100
useTabs: false
tabWidth: 2
trailingComma: none
bracketSpacing: true
arrowParens: avoid

18
index.html Normal file
View File

@ -0,0 +1,18 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/dist/css/reset-basic.css">
<script async src="//esm.tool/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script>
</head>
<body>
<div class="app noselect"></div>
<script src="main.js"></script>
</body>
</html>

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "jscdn.ink",
"type": "module",
"scripts": {
"start": "vue-live dev",
"build": "vue-live build"
},
"dependencies": {
"@bytedo/vue-live": "^0.0.13"
}
}

36
src/app.vue Normal file
View File

@ -0,0 +1,36 @@
<template>
<Header />
<router-view class="main-body" />
<Footer />
</template>
<script>
import Header from './components/header.vue'
import Footer from './components/footer.vue'
export default {
components: { Header, Footer }
}
</script>
<style lang="scss">
body {
line-height: 1.5;
font-size: 14px;
color: var(--color-dark-1);
}
a {
color: inherit;
text-decoration: none;
}
.app {
display: flex;
flex-direction: column;
width: 100%;
min-height: 100vh;
}
.main-body {
flex: 1;
}
</style>

1
src/assets/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 261.76 226.69" xmlns="http://www.w3.org/2000/svg"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/><path d="M36.21 192.639l160.921-74.805-81.778-5.063 119.519-67.69L49.06 126.138l88.8 2.712z" fill="rgb(252, 118, 97)"/></svg>

After

Width:  |  Height:  |  Size: 394 B

28
src/components/footer.vue Normal file
View File

@ -0,0 +1,28 @@
<template>
<footer class="copyright">
<a target="_blank" href="https://beian.miit.gov.cn/">桂ICP备2022011680号-1</a>
<span>&copy;Copyright 2022 jscdn.ink </span>
</footer>
</template>
<script>
export default {}
</script>
<style lang="scss" scoped>
.copyright {
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 128px;
background: var(--color-plain-1);
color: var(--color-grey-2);
a {
margin-bottom: 16px;
}
}
</style>

113
src/components/header.vue Normal file
View File

@ -0,0 +1,113 @@
<template>
<div class="common-header" :class="{ 'search-show': $store.searchShow }">
<header class="navibar">
<div class="wrapper">
<a class="logo">Js CDN</a>
<nav class="navi">
<router-link to="/"> </router-link>
<router-link to="/request"> </router-link>
<router-link to="/about"> </router-link>
</nav>
</div>
</header>
<cite class="banner">
<p>
我们的目标是提供这样一个仓库让它尽可能全面收录优秀的支持ESM访问的开源库并免费为之提供
CDN加速服务使之有更好的访问速度和稳定的环境
</p>
<p>同时我们也提供自主提交开源库的收录(前提是在npm上发布的)</p>
</cite>
<wc-input class="search" no-border placeholder="请输入开源库的名字~~" />
</div>
</template>
<script>
export default {
props: {}
}
</script>
<style lang="scss">
.common-header {
flex-shrink: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
height: 240px;
background: var(--color-red-1);
color: #fff;
.wrapper {
display: flex;
width: 1024px;
justify-content: space-between;
align-items: center;
}
.navibar {
height: 36px;
margin-top: 24px;
.logo {
font-weight: bold;
font-size: 26px;
}
.navi {
display: flex;
align-items: center;
font-size: 16px;
a {
margin: 0 16px;
padding: 3px 6px;
border-radius: 4px;
transition: background 0.2s ease-in-out;
&:hover {
background: rgba(255, 255, 255, 0.3);
}
&.router-link-active {
text-decoration: underline;
}
}
}
}
.banner {
width: 640px;
text-align: center;
}
.search {
display: none;
width: 520px;
color: #fff;
--bg-color: rgba(0, 0, 0, 0.3);
}
&.search-show {
height: 320px;
.search {
display: inline-block;
}
}
&::after {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 48px;
font-size: 16px;
background: rgba(0, 0, 0, 0.1);
content: '免费、快速、开放的 CDN 服务';
}
}
</style>

BIN
src/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

11
src/main.js Normal file
View File

@ -0,0 +1,11 @@
import { createApp } from 'vue'
import App from './app.vue'
import router from './router'
import store from './store'
import '//jscdn.ink/@bytedo/wcui/dist/form/input.js'
const app = createApp(App)
app.use(router).use(store).mount('.app')

25
src/router.js Normal file
View File

@ -0,0 +1,25 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from './views/home.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
component: () => import('./views/about.vue')
},
{
path: '/request',
name: 'request',
component: () => import('./views/request.vue')
}
]
})
export default router

11
src/store.js Normal file
View File

@ -0,0 +1,11 @@
import { reactive } from 'vue'
const store = reactive({
foo: 'bar',
version: '0.0.13',
searchShow: true
})
export default function (app) {
app.config.globalProperties.$store = store
}

86
src/views/about.vue Normal file
View File

@ -0,0 +1,86 @@
<template>
<main class="about-page">
<dl>
<dt>背景和目标</dt>
<dd>
<p>国内免费的几个js cdn加速站, 要么收录太少, 要么已经不维护</p>
<p>
我们的目标是提供这样一个仓库让它尽可能全面收录优秀的支持ESM访问的开源库并免费为之提供
CDN加速服务使之有更好的访问速度和稳定的环境
</p>
<p>同时我们也提供自主提交开源库的收录(前提是在npm上发布的)</p>
</dd>
<dt>更新开源库</dt>
<dd>
<p>
理论上, 程序会自动更新开源库, 目前更新周期为1个星期, 如果你有需要使用新版而我们还未更新,
可以来手动同步
</p>
<p>
原则上我们不会删除旧版本(如发现该开源库包含无用的大文件如图片, 音视频及其他附件时,
则会清除所有的旧版本, 只保留最新的一份, 严重时直接下架该库)
</p>
</dd>
<dt>收录事项</dt>
<dd>
<p>
开源库未发布到npm上时, 我们原则上不会收录(如有特殊且合理原因未提交到npm又想收录的,
可在意见反馈处提交相关信息)
</p>
<p>原则上我们只收录支持esm方式访问的开源库</p>
</dd>
<dt>维护者</dt>
<dd>
<a href="//github.com/yutent" target="_blank">yutent</a>
<p>项目托管于阿里云oss</p>
</dd>
</dl>
</main>
</template>
<script>
export default {
data() {
return {
content: '这是关于我们页面'
}
},
mounted() {
this.$store.searchShow = false
}
}
</script>
<style lang="scss">
.about-page {
width: 1024px;
margin: 0 auto;
padding: 16px;
dl {
font-size: 16px;
dt {
margin-top: 32px;
font-size: 22px;
font-weight: bold;
color: var(--color-grey-3);
}
dd {
margin-top: 16px;
}
}
p {
margin-top: 8px;
}
a {
color: var(--color-red-1);
text-decoration: underline;
}
}
</style>

19
src/views/home.vue Normal file
View File

@ -0,0 +1,19 @@
<script>
export default {
data() {
return {
content: '欢迎访问~~ 这是首页'
}
},
mounted() {
this.$store.searchShow = true
}
}
</script>
<template>
<main>
<h1>{{ content }}</h1>
</main>
</template>

26
src/views/request.vue Normal file
View File

@ -0,0 +1,26 @@
<script>
export default {
data() {
return {
content: '这是关于我们页面'
}
},
mounted() {
this.$store.searchShow = false
}
}
</script>
<template>
<main>
<table>
<thead>
<tr>
<th>开源库</th>
<th>介绍</th>
<th>收录状态</th>
</tr>
</thead>
</table>
</main>
</template>

35
vue.live.js Normal file
View File

@ -0,0 +1,35 @@
import { resolve } from 'path'
export default {
devServer: {
port: 8080,
domain: '',
https: false,
ssl: {
key: '',
cert: ''
// ca: ''
}
},
pages: {
// 如果多页应用, 则这里写传入多个值即可(注意不是数组格式)
// 这里的key值, 将是最终的页面的名称
index: {
// 这里的resolve可将相对路径转为绝对路径
// 如果传入的路径已经是绝对路径的, 可不需要resolve
entry: resolve('./src/main.js'),
title: '免费、快速、开放的 CDN 服务'
}
},
// 以下cdn地址, 可自行修改为适合的
// 有用到其他的库, 可以手动添加,
// 也可以在页面中直接引入完整的路径, 而不必须在这里声明
imports: {
vue: '//jscdn.ink/vue/dist/vue.esm-browser.prod.js',
'vue-router': '//jscdn.ink/vue-router/dist/vue-router.esm-browser.js',
// 这个库被vue-router依赖, 可以注释掉vue-router代码中的 @vue/devtools-api 的引入
// 以达到减少不必须的体积的效果
'@vue/devtools-api': '//jscdn.ink/@vue/devtools-api@6.4.4/lib/esm/index.js',
fetch: '//jscdn.ink/@bytedo/fetch/dist/next.js'
}
}