Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'./.eslintrc-auto-import.json'
],
overrides: [
{
files: [
'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'
],
'extends': [
'plugin:cypress/recommended'
]
}
],
parserOptions: {
ecmaVersion: 'latest'
}
}
68 changes: 68 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# .github/workflows/auto-deploy.yml

name: auto deploy 🚀

on:
# 监听push操作
push:
branches:
- main # 这里只配置了main分支,所以只有推送main分支才会触发以下任务
pull_request:

# 这个选项可以使你手动在 Action tab 页面触发工作流
# workflow_dispatch:

permissions:
# 允许对仓库的内容进行写操作。包括创建、修改和删除文件、目录以及提交更改等
# 这里只配置了push,所以只有推送main分支才会触发以下任务
contents: write
# 允许管理 GitHub Pages 服务并对其进行写操作
pages: write


jobs:
# 任务ID
build-and-deploy:
# 运行环境
# runs-on: macos-latest
# runs-on: windows-latest
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

# 步骤
steps:
# 官方action,将代码拉取到虚拟机
- name: Checkout
uses: actions/checkout@v3

# 建一个名为setup-node的步骤(安装指定版本的Node.js)
- name: setup-node
# 使用setup-node@v3这个action
uses: actions/setup-node@v3
# 指定某个action 可能需要输入的参数
with:
node-version: '20'

# 安装 pnpm
- name: Install pnpm
run: npm install pnpm -g

# 安装依赖
- name: Install dependencies
run: pnpm i
# 打包
- name: Build application 🔧
run: pnpm run build

# 部署 https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # default: gh-pages
folder: dist
clean: true # Automatically remove deleted files from the deploy branch
# commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/setting.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*auto-import*
src/types/auto-import.d.ts
src/types/components.d.ts
.eslintrc-auto-import.json
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
78 changes: 77 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,78 @@
# scene-editor
Scene-editor is a WebGL based JS SDK, built on top of three.js. focuses on 2D and 3D graphics rendering technology and is committed to providing leading display and simulation solutions in the fields of industry, architecture, home decoration, and digital twins, driving the infinite possibilities of future visualization.

Developed with vue3 + antd4 + vite4 + pnpm

## References

[vue3](https://staging-cn.vuejs.org/guide/introduction.html)

[vite](https://cn.vitejs.dev/)

[pinia](https://pinia.vuejs.org/)

[Vue Router](https://router.vuejs.org/zh/index.html)

[pnpm](https://pnpm.io/zh/)

[qiankun](https://qiankun.umijs.org/zh/)

[vite-plugin-qiankun](https://github.com/tengmaoqing/vite-plugin-qiankun)

[VueUse](https://vueuse.org/)

[Unocss](https://uno.antfu.me/)

[ant design](https://ant.design/components/)

[ant design icons](https://2fd.github.io/ant-design-icons/)


## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
pnpm install
```

### Compile and Hot-Reload for Development

```sh
pnpm dev
```

### Type-Check, Compile and Minify for Production

```sh
pnpm build
```

### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
pnpm test:unit
```

### Run End-to-End Tests with [Cypress](https://www.cypress.io/)

```sh
pnpm test:e2e:dev
```

This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.

But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):

```sh
pnpm build
pnpm test:e2e
```

### Lint with [ESLint](https://eslint.org/)

```sh
pnpm lint
```
8 changes: 8 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:4173'
}
})
8 changes: 8 additions & 0 deletions cypress/e2e/example.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// https://on.cypress.io/api

describe('My First Test', () => {
it('visits the app root url', () => {
cy.visit('/')
cy.contains('h1', 'You did it!')
})
})
10 changes: 10 additions & 0 deletions cypress/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["./**/*", "../support/**/*"],
"compilerOptions": {
"isolatedModules": false,
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
}
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
39 changes: 39 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

export {}
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
11 changes: 11 additions & 0 deletions env/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 环境
NODE_ENV=development

# API base path
VITE_API_BASEPATH=base

# Build base path
VITE_BASE_PATH=/

# 标题
VITE_APP_TITLE=scene-editor
26 changes: 26 additions & 0 deletions env/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Environment
NODE_ENV=development

# API base URL
VITE_API_BASEPATH=http://10.2.5.65:9080

# Build base path
VITE_BASE_PATH=/dist/

# Remove debugger statements
VITE_DROP_DEBUGGER=false

# Remove console.log statements
VITE_DROP_CONSOLE=false

# Enable sourcemaps
VITE_SOURCEMAP=true

# Output directory
VITE_OUT_DIR=dist

# Title
VITE_APP_TITLE=scene-editor

# Router base URL
VITE_ROUTER_BASE_URL=/vue3-antd4-admin
23 changes: 23 additions & 0 deletions env/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Environment
NODE_ENV=production

# API base path
VITE_API_BASEPATH=pro

# Build base path
VITE_BASE_PATH=/

# Remove debugger statements
VITE_DROP_DEBUGGER=true

# Remove console.log statements
VITE_DROP_CONSOLE=true

# Enable sourcemaps
VITE_SOURCEMAP=false

# Output directory
VITE_OUT_DIR=dist

# Title
VITE_APP_TITLE=scene-editor
Loading