Skip to content

Commit

Permalink
feat: component import finish
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahengz committed Mar 28, 2023
1 parent 38203c1 commit c9b22b4
Show file tree
Hide file tree
Showing 22 changed files with 8,734 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": [
"@nuxtjs/eslint-config-typescript"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"off"
]
}
}
140 changes: 46 additions & 94 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,56 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm
# Dependencies
node_modules

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
# Logs
*.log*

# parcel-bundler cache (https://parceljs.org/)
# Temp directories
.temp
.tmp
.cache

# Next.js build output
.next
# Yarn
**/.yarn/cache
**/.yarn/*state*

# Nuxt.js build / generate output
.nuxt
# Generated dirs
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/
# Nuxt
.nuxt
.output
.vercel_build_output
.build-*
.env
.netlify

# FuseBox cache
.fusebox/
# Env
.env

# DynamoDB Local files
.dynamodb/
# Testing
reports
coverage
*.lcov
.nyc_output

# TernJS port file
.tern-port
# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
2 changes: 2 additions & 0 deletions .nuxtrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports.autoImport=true
typescript.includeWorkspace=true
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
}
96 changes: 94 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,94 @@
# varlet-nuxt
Varlet module for Nuxt
<!--
Get your module up and running quickly.
Find and replace all on all files (CMD+SHIFT+F):
- Name: My Module
- Package name: my-module
- Description: My new Nuxt module
-->

# My Module

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

My new Nuxt module for doing amazing things.

- [&nbsp;Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->

## Features

<!-- Highlight some of the features your module provide here -->
-&nbsp;Foo
- 🚠 &nbsp;Bar
- 🌲 &nbsp;Baz

## Quick Setup

1. Add `my-module` dependency to your project

```bash
# Using pnpm
pnpm add -D my-module

# Using yarn
yarn add --dev my-module

# Using npm
npm install --save-dev my-module
```

2. Add `my-module` to the `modules` section of `nuxt.config.ts`

```js
export default defineNuxtConfig({
modules: [
'my-module'
]
})
```

That's it! You can now use My Module in your Nuxt app ✨

## Development

```bash
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release
```

<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/my-module

[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/my-module

[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/my-module

[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com
80 changes: 80 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "varlet-nuxt",
"version": "1.0.0",
"description": "varlet module for nuxt",
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./dist/types.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist"
],
"packageManager": "pnpm@7.22.0",
"keywords": [
"varlet",
"nuxt"
],
"repository": {
"type": "git",
"url": "git+https://github.com/varletjs/varlet.git"
},
"bugs": "https://github.com/varletjs/varlet/issues",
"scripts": {
"prepack": "nuxt-module-build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
"build": "npm run dev:prepare && nuxt-module-build",
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
"lint": "eslint . --fix"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"git add"
],
"*.{ts,tsx}": [
"eslint --fix",
"git add"
]
},
"dependencies": {
"@nuxt/kit": "^3.3.2",
"magic-string": "^0.29.0",
"unplugin": "^1.0.1"
},
"peerDependencies": {
"@varlet/shared": "^2.9.3",
"@varlet/ui": "^2.9.3"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.1.1",
"@nuxt/module-builder": "^0.2.1",
"@nuxt/schema": "^3.3.2",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@types/node": "^18.13.0",
"@varlet/shared": "^2.9.3",
"@varlet/ui": "^2.9.3",
"eslint": "^8.36.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"nuxt": "^3.3.2",
"typescript": "^4.9.5"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
31 changes: 31 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
</script>

<template>
<div>
<var-button>qfqw</var-button>
<var-skeleton :loading="true">
加载的数据
</var-skeleton>
<var-space>
<var-button>Button1</var-button>
<var-button>Button2</var-button>
<var-button>Button3</var-button>
</var-space>
<var-progress :value="20" :track="false" />
<var-card
title="本草纲目"
description="如果华佗再世,崇洋都被医治,外邦来学汉字,激发我民族意识。马钱子、决明子、苍耳子,还有莲子;黄药子、苦豆子、川楝子,我要面子。用我的方式,改写一部历史。没什么别的事,跟着我念几个字。山药当归枸杞 GO,山药 当归 枸杞 GO,看我抓一把中药,服下一帖骄傲~"
/>
<var-result type="success" title="Success" description="Hi, I'm a result description.">
<template #footer>
<var-button type="success">
OK
</var-button>
</template>
</var-result>
</div>
</template>

<style>
</style>
7 changes: 7 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineNuxtConfig } from 'nuxt/config'
import varlet from '..'

export default defineNuxtConfig({
modules: [varlet],
varlet: {}
})
4 changes: 4 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"private": true,
"name": "my-module-playground"
}
Loading

0 comments on commit c9b22b4

Please sign in to comment.