Commit 9c3f5042 authored by 曾沂轮's avatar 曾沂轮

初始化工程

parents
# svi-cli smart3d-vue3 Template
> 一个基于vite搭建的vue + typescript + smart3d-vue组件库应用模板,提供给svi-cli脚手架获取.
> 提供内部用Vue3 + smart3d-vue开发页面的初始模板
> 主要包含 `vue`, `smart3d-vue`, `@smart/eslint-config-typescript` 智能的规范
## Usage / 用法
``` bash
$ npm install -g svi-cli
$ svi init smart3d-vue3 my-project
$ cd my-project
$ npm install
$ npm run serve
```
module.exports = {
renderFiles: ['package.json', 'README.md'],
prompts: {
name: {
type: 'string',
required: true,
message: 'Project name',
},
description: {
type: 'string',
required: false,
message: 'Project description',
default: 'a smart3d api vue3 project',
},
author: {
type: 'string',
message: 'Author',
},
},
};
\ No newline at end of file
{
"name": "smart3d-vue3",
"version": "0.0.1",
"description": "a svi CLI smart3d vue3 app template.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"template"
],
"author": "zengyl@southzn.com",
"license": "MIT"
}
*.d.ts
vite.config.ts
public/
assets/
\ No newline at end of file
module.exports = {
env: {
node: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: require.resolve('@typescript-eslint/parser'),
extraFileExtensions: ['.vue'],
ecmaFeatures: {
jsx: true,
},
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:vue/vue3-recommended',
'prettier',
'@vue/prettier',
'@smart/typescript',
],
rules: {
// vue
'vue/html-self-closing': [
'error',
{
html: {
void: 'any',
normal: 'never',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 4,
},
multiline: {
max: 1,
},
},
],
'vue/require-default-prop': 'off',
},
globals: {
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
withDefaults: 'readonly',
},
};
node_modules
.DS_Store
dist
dist-ssr
*.local
/public/assets
.pnpm-debug.*
yarn.lock
package-lock.json
*.log
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit $1
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install lint-staged
npx --no-install pretty-quick --staged
# Ignore everything
*
# Unignore directories (to all depths) and unignore code and style files in these directories
!src/**/
!**/*.js
!**/*.jsx
!**/*.css
!**/*.scss
!**/*.html
!**/*.vue
!**/*.md
!**/*.ts
!**/*.tsx
# some souces directories
src/assets
#
CHANGELOG.md
vue.config.js
babel.config.js
commitlint.config.js
vite.config.js
.eslintrc.js
module.exports = {
tabWidth: 2,
trailingComma: 'all',
semi: true,
singleQuote: true,
printWidth: 100,
};
{
"recommendations": ["johnsoncodehk.volar"]
}
# {{name}}
This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's `.vue` type support plugin by running `Volar: Switch TS Plugin on/off` from VSCode command palette.
## Producer
South Smart FE 团队。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Smart3D Vue3 App</title>
<script>
window.CESIUM_BASE_URL = './assets/Cesium/'
window.SMART3D_GLOBAL_CONFIG = {
SMART3D_BASE_URL: './assets/smart3d/',
TIANDITU_TOKEN: '7069066df4358502f008781498945359'
}
</script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
{
"name": "{{ name }}",
"version": "0.0.0",
"description": "{{ description }}",
"author": "{{ author }}",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"serve": "vite preview",
"lint": "eslint \"src/*.ts\" \"src/**\" --fix && pretty-quick --check",
"prepare": "husky install"
},
"dependencies": {
"smart3d-vue": "^1.2.0",
"vue": "^3.2.13"
},
"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@smart/commitlint-config": "^0.1.2",
"@smart/conventional-changelog-smart": "^1.0.6",
"@smart/eslint-config-typescript": "^2.0.0",
"@smart/vite-plugin-copy": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@vitejs/plugin-vue": "^2.3.1",
"@vue/compiler-sfc": "^3.2.6",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"eslint": "^8.14.0",
"eslint-plugin-vue": "^8.7.1",
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
"prettier": "2.6.2",
"pretty-quick": "3.1.3",
"sass": "^1.51.0",
"typescript": "^4.6.3",
"vite": "^2.9.6",
"vite-plugin-package-config": "^0.1.1",
"vue-tsc": "^0.2.2"
},
"lint-staged": {
"*.{vue,js,ts,jsx,tsx}": "eslint --fix"
}
}
<script setup lang="ts">
import Viewer from './components/Viewer.vue';
</script>
<template>
<div class="app">
<Viewer />
</div>
</template>
<style>
.app {
width: 100%;
height: 100%;
}
</style>
<script setup lang="ts">
import type { Viewer } from 'smart3d';
import { SMap } from 'smart3d-vue';
const viewerReady = (viewer: Viewer) => {
console.log(viewer);
};
</script>
<template>
<SMap class="viewer" @ready="viewerReady" />
</template>
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
import { createApp } from 'vue';
import App from './App.vue';
import 'smart3d-vue/es/style/base.scss';
createApp(App).mount('#app');
{
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"]
},
"paths": {
"@/*": [
"src/*"
],
"@components/*": [
"src/components/*"
]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"exclude": ["node_modules", "dist"]
}
/* eslint-disable import/no-extraneous-dependencies */
import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import PkgConfig from 'vite-plugin-package-config';
import { vitePluginCopy } from '@smart/vite-plugin-copy';
const appRoot = '.';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
PkgConfig(),
vue(),
vitePluginCopy([
{
src: 'node_modules/@smart/cesium/Build/Cesium/*',
target: path.resolve(appRoot, 'public/assets/Cesium'),
},
{
src: 'node_modules/smart3d/dist/smart3d/*',
target: path.resolve(appRoot, 'public/assets/smart3d'),
},
// {
// src: '../node_modules/@turf/turf/turf.min.js',
// target: path.resolve(appRoot, 'public/assets/turf'),
// },
]),
],
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment