Giter Club home page Giter Club logo

docs's People

Contributors

yanoo1497 avatar

docs's Issues

关于构建发布的大体流程

构建发布

image
预览需要的 setting 信息,直接调用构建脚本的接口,因而内部需要做一些不同的分支处理

环境配置准备工作

  • 根据传入参数,计算好对应需要的路径信息;

  • 清空原文件夹内容;

  • 配置好一些引擎内部需要的全局变量值;

构建拷贝模板文件

主要是一些模板变量替换,和拷贝压缩资源工作

  • 根据传入配置参数渲染 index.html 文件,压缩、拷贝对应的调试工具);

  • 根据传入配置参数渲染 main.js,并压缩;

  • 拷贝一些固定的 css 图片等;

构建切割引擎

  • 获取设置里排除的引擎模块信息;

  • 检查缓存中的引擎版本与当前需要编译的引擎是否一致,内容一致无法再次编译直接拷贝;

  • 根据引擎接口,执行打包引擎的 gulp 任务,之后拷贝编译后的 js 文件,并保存模块数据与引擎版本信息用于下次比对。

构建 setting

  1. 根据传入参数,查询插件获取构建所需的各类设置信息,写入 setting 对象;

  2. 构建脚本

  • 扫描项目内的所有脚本资源信息;
  • 整理脚本信息,按照指定格式输出返回(预览需要分析脚本依赖关系);
  • 对扫描到的脚本做构建发布做分包整理,针对不同的包进行构建合并,并写入对应文件;
  • 加载项目内的脚本,配置当前的项目脚本环境;
  1. 构建资源
  • 使用传入的场景数据与查询到的 resource 目录下资源的 uuid 集合作为初始构建数据,缓存查到的 asset;
  • 遍历 uuid 集合,对资源序列化 json 数据进行反序列化拿到依赖资源 uuid 数组,再对反序列化后的 asset 进行序列化,缓存 json 数据。过程中遇到原始资源,需要压缩的添加到压缩队列中,需要拷贝的添加到拷贝数组中。扫到依赖资源 uuid 数组时递归执行该流程;
  • 整理扫描出的所有资源信息,按照规定的格式输出,同时对该对象做排序处理;
  • 并发执行构建资源过程中收集的原始资源的拷贝与压缩任务(图片与纹理压缩);
  • 利用之前缓存的依赖关系对象,对资源 json 进行依赖关系进行分组打包处理,计算分组的新 uuid 值,并将缓存的序列化 json 信息写入文件,记录新的 hasName 与原 uuid 的映射关系。

压缩 setting

  • 将各个分包对象内有使用到收集的超过两次使用的 uuid,则替换为对应位置索引;

  • 收集各个分包、场景...内所有的 uuid ,并记录出现超过 2 次的 uuid 存为 uuids;

  • 保存 setting 脚本;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.