Skip to content

Commit 3c8bcfb

Browse files
authored
Initialize feat/update-template
0 parents  commit 3c8bcfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+18015
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [Tahul]

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Logs
5+
*.log*
6+
7+
# Temp directories
8+
.temp
9+
.tmp
10+
.cache
11+
**/.vitepress/cache
12+
13+
# Yarn
14+
**/.yarn/cache
15+
**/.yarn/*state*
16+
17+
# Generated dirs
18+
dist
19+
20+
# Nuxt
21+
.nuxt
22+
.output
23+
.vercel_build_output
24+
.build-*
25+
.env
26+
.netlify
27+
28+
# Env
29+
.env
30+
31+
# Testing
32+
reports
33+
coverage
34+
*.lcov
35+
.nyc_output
36+
37+
# VSCode
38+
.vscode
39+
40+
# Intellij idea
41+
*.iml
42+
.idea
43+
44+
# OSX
45+
.DS_Store
46+
.AppleDouble
47+
.LSOverride
48+
.AppleDB
49+
.AppleDesktop
50+
Network Trash Folder
51+
Temporary Items
52+
.apdisk

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
ignore-workspace-root-check=true

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["znck.vue-language-features", "johnsoncodehk.volar"]
3+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Yaël GUILLOUX <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# 🪝 vue-composable-starter
2+
3+
A minimalist starting point for your next Vue 3 composable.
4+
5+
- 🧩 **TypeScript** by default
6+
- 📦 **PNPM** as package manager
7+
- 🤹 Testing using [**Vitest**](https://vitest.dev)
8+
- ☑️ Linting using [**@antfu/eslint-config**](https://github.com/antfu/eslint-config)
9+
- 🌐 [**Nuxt 3**](https://nuxtjs.org) as a playground
10+
- 📸 Playgrounds using [**Vite**](https://vitejs.dev) and [Nuxt](https://nuxt.com/)
11+
- 🚚 Built using [**unbuild**](https://github.com/unjs/unbuild)
12+
- 📚 Documentation using [**Vitepress**](https://vitepress.dev)
13+
14+
> Edit [variables](#to-do), implement, test, publish 🏎
15+
16+
## Commands
17+
18+
Build the package:
19+
20+
```bash
21+
pnpm build
22+
```
23+
24+
Run the development environment (vite):
25+
26+
```bash
27+
pnpm dev
28+
```
29+
30+
Run the docs:
31+
32+
```bash
33+
pnpm dev:docs
34+
```
35+
36+
Build the docs:
37+
38+
```bash
39+
pnpm build:docs
40+
```
41+
42+
Lint the package:
43+
44+
```bash
45+
pnpm lint
46+
```
47+
48+
Run test suite:
49+
50+
```bash
51+
pnpm test
52+
```
53+
54+
Start Nuxt dev environment:
55+
56+
```bash
57+
pnpm dev:nuxt
58+
```
59+
60+
Build Nuxt environment:
61+
62+
```bash
63+
pnpm build:nuxt
64+
```
65+
66+
Preview Nuxt environment:
67+
68+
```bash
69+
pnpm start:nuxt
70+
```
71+
72+
## Why
73+
74+
This repository is useful if you want to start a new Vue composable, or a general Vue package.
75+
76+
I used it personally for:
77+
78+
- [**@vueuse/motion**](https://github.com/vueuse/motion)
79+
- [**@vueuse/gesture**](https://github.com/vueuse/gesture)
80+
- [**@vueuse/sound**](https://github.com/vueuse/sound)
81+
82+
I try to keep it updated when I upgrade my own workflow!
83+
84+
## Workflow
85+
86+
I usually develop with the `dev:nuxt` command.
87+
88+
Your changes on any file will be reloaded by **Nuxt**, and you can start trying SSR capabilities of your composable easily!
89+
90+
The general Nuxt environment does not differ from a classic Vue app.
91+
92+
## To-Do
93+
94+
- [ ] Edit package.json `name`, `description`, `repository` and `author` keys.
95+
- [ ] Rename all `vue-composable-starter` with your package name.
96+
- [ ] Rename `VueComposableStarterPluginOptions` with your plugin options.
97+
- [ ] Remove .vscode folder (containing recommended extensions)
98+
- [ ] Edit README.md.
99+
- [ ] Implement my composable.
100+
- [ ] Test my composable.
101+
- [ ] Document my composable.
102+
- [ ] Publish on [NPM](npmjs.com), [awesome-vue](https://github.com/vuejs/awesome-vue), [vue-forum](https://forum.vuejs.org/), [Vue Discord](https://fr.vuejs.org/v2/guide/join.html).
103+
104+
## Contributing
105+
106+
You are more than welcome to improve this starter template.
107+
108+
Just submit your changes via pull request and I will review them before merging.
109+
110+
If you are making a fix on the template, you can use the `main` branch and send a pull request.
111+
112+
If you are adding a new features, please create a new branch with a name describing your feature (`my-new-feature`), push to your branch and then submit a pull request.

build.config.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
3+
export default defineBuildConfig({
4+
rollup: {
5+
emitCJS: true,
6+
},
7+
declaration: true,
8+
// warnings triggered by nuxt exports not being built - happens in separate script
9+
failOnWarn: false,
10+
// TODO: check if all are needed
11+
externals: [
12+
'@nuxt/kit',
13+
'@nuxt/schema',
14+
'nuxt3',
15+
'nuxt',
16+
'vue',
17+
'defu',
18+
'@vueuse/motion',
19+
'csstype',
20+
'@vueuse/shared',
21+
'framesync',
22+
'style-value-types',
23+
'@vue/compiler-core',
24+
'@babel/parser',
25+
'@vue/shared',
26+
'@vueuse/core',
27+
],
28+
entries: [
29+
// Plugin
30+
{
31+
input: 'src/index.ts',
32+
outDir: 'dist',
33+
name: 'index',
34+
format: 'esm',
35+
ext: 'mjs',
36+
},
37+
{
38+
input: 'src/index.ts',
39+
outDir: 'dist',
40+
name: 'index',
41+
format: 'cjs',
42+
ext: 'cjs',
43+
},
44+
],
45+
})

docs/.vitepress/config.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { resolve } from 'node:path'
2+
import { defineConfig } from 'vitepress'
3+
4+
// https://vitepress.dev/reference/site-config
5+
export default defineConfig({
6+
title: 'vue-composable-starter',
7+
description: 'A Vue Composable',
8+
vite: {
9+
resolve: {
10+
alias: [
11+
{
12+
find: 'vue-composable-starter',
13+
replacement: resolve(__dirname, '../../src/index.ts'),
14+
},
15+
],
16+
},
17+
},
18+
themeConfig: {
19+
// https://vitepress.dev/reference/default-theme-config
20+
nav: [
21+
{ text: 'Home', link: '/' },
22+
{ text: 'Examples', link: '/api-examples' },
23+
],
24+
25+
sidebar: [
26+
{
27+
text: 'Examples',
28+
items: [
29+
{ text: 'Runtime API Examples', link: '/api-examples' },
30+
],
31+
},
32+
],
33+
34+
socialLinks: [
35+
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
36+
],
37+
},
38+
})

docs/api-examples.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# EXAMPLE
6+
7+
<<< @/example.vue
8+
9+
## Results
10+
11+
<script setup>
12+
import Example from './example.vue'
13+
</script>
14+
15+
<Example />

docs/example.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup>
2+
import { useToggle } from 'vue-composable-starter'
3+
4+
const [toggleable, toggle] = useToggle()
5+
</script>
6+
7+
<template>
8+
<button :style="{ background: toggleable ? 'green' : 'red' }" @click="toggle">
9+
Toggle: {{ toggleable }}
10+
</button>
11+
</template>

0 commit comments

Comments
 (0)