npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

3d-core

v2.0.59

Published

A TypeScript library to build 3d park map

Downloads

188

Readme

项目技术选型

Three.js TypeScript Axios Less JsonServer

项目对接方法

import * as ThreeParkMap from '3d-park-map';

// 实例化
const threeParkMap = new ThreeParkMap()

// 初始化,config可以不传,有默认配置
threeParkMap.init(config)

// data是车场信息数据json,绘制3d车场
threeParkMap.draw(data)

项目开发流程

安装

yarn install

启动

开发环境

yarn start

启动mock服务

yarn mock

同时开启mock服务和开发服务

yarn serve

dll构建

yarn build:dll

生产构建(先运行dll构建)

yarn build

开发环境构建(先运行dll构建, 生成stats.json文件,上传webpack官网进行性能分析)

yarn dev-build

项目结构

|-- job
    |-- .eslintrc.json
    |-- .gitignore
    |-- README.md
    |-- package-lock.json
    |-- package.json
    |-- tsconfig.json
    |-- yarn-error.log
    |-- yarn.lock
    |-- config
    |   |-- common.js
    |   |-- dev.js
    |   |-- prod.js
    |   |-- webpack.config.js
    |   |-- webpack.dll.js
    |-- mock
    |   |-- db.json
    |-- public
    |   |-- index.html
    |   |-- dll
    |   |   |-- three.dll.js
    |   |   |-- three.dll.js.LICENSE.txt
    |   |   |-- three.manifest.json
    |   |-- static
    |       |-- fonts
    |       |   |-- helvetiker_regular.typeface.json
    |       |-- img
    |-- src
    |   |-- index.ts
    |   |-- components
    |   |   |-- cube.ts
    |   |   |-- index.ts
    |   |   |-- sphere.ts
    |   |-- config
    |   |   |-- enum.ts
    |   |-- core
    |   |   |-- base.ts
    |   |   |-- threeParkMap.ts
    |   |-- util
    |   |   |-- decoration.ts
    |   |   |-- storage.ts
    |   |-- view
    |       |-- index.ts
    |       |-- example
    |           |-- menu.ts
    |           |-- template
    |               |-- cameraConf.ts
    |               |-- menu.ts
    |-- typings
        |-- base.d.ts
        |-- index.d.ts
        |-- components
        |   |-- index.d.ts
        |-- core
        |   |-- threeParkMap.d.ts
        |-- util
        |   |-- storage.d.ts
        |-- view
            |-- menu.d.ts

项目结构说明

src下是所有核心代码文件

  1. 其中封装的所有基础模块,组件,放在components下,cube.tssphere.ts作为例子,所有模块需要继承抽象类Base,并且init方法作为绘制方法入口,在index.ts下导出所有模块,这样开发界面右侧的模块列表下就会读到模块(模块的name属性),点击渲染当前模块内容。
  |-- src
    |   |-- index.ts
    |   |-- components
    |   |   |-- cube.ts
    |   |   |-- index.ts
    |   |   |-- sphere.ts
    |   |-- config
    |   |   |-- enum.ts
    |   |-- core
    |   |   |-- base.ts
    |   |   |-- threeParkMap.ts
    |   |-- util
    |   |   |-- decoration.ts
    |   |   |-- storage.ts
    |   |-- view
    |       |-- index.ts
    |       |-- example
    |           |-- menu.ts
    |           |-- template
    |               |-- cameraConf.ts
    |               |-- menu.ts
  1. view下是视图文件,原则上本库是第三方库,不涉及具体视图,这里视图是开发时候用的界面,方便开发调试
  2. util下是所有工具类,工具方法
  3. config下是配置信息,常量,枚举等
  4. core是核心类比如 threeParkMap以及项目核心流程代码

typings下是ts声明文件,尽量保持和src下一样的结构

mockdb.json是开发时候需要假数据时生成假数据的文件

一些说明

工具方法

装饰器

  1. @log 装饰器实现对方法参数的打印,需要了解哪个方法的传参内容,加上此装饰器(参数是区分打印结果用的一段任意文本)