(options)
| 948 | * @param {boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers. |
| 949 | */ |
| 950 | export const buildEngine = async (options) => { |
| 951 | options = options || {}; |
| 952 | |
| 953 | const incremental = options.incremental ?? false; |
| 954 | const minify = options.minify ?? false; |
| 955 | const write = options.write ?? true; |
| 956 | |
| 957 | // Create Build folder to place build artifacts. |
| 958 | mkdirp.sync("packages/engine/Build"); |
| 959 | |
| 960 | // Convert GLSL files to JavaScript modules. |
| 961 | await glslToJavaScript( |
| 962 | minify, |
| 963 | "packages/engine/Build/minifyShaders.state", |
| 964 | "engine", |
| 965 | ); |
| 966 | |
| 967 | // Create index.js |
| 968 | await createIndexJs("engine"); |
| 969 | |
| 970 | const contexts = await bundleIndexJs({ |
| 971 | minify: minify, |
| 972 | incremental: incremental, |
| 973 | sourcemap: true, |
| 974 | removePragmas: false, |
| 975 | outputDirectory: path.join( |
| 976 | `packages/engine/Build`, |
| 977 | `${!minify ? "Unminified" : "Minified"}`, |
| 978 | ), |
| 979 | write: write, |
| 980 | entryPoint: `packages/engine/index.js`, |
| 981 | }); |
| 982 | |
| 983 | // Build workers. |
| 984 | await bundleWorkers({ |
| 985 | ...options, |
| 986 | iife: false, |
| 987 | path: "packages/engine/Build", |
| 988 | }); |
| 989 | |
| 990 | // Create SpecList.js |
| 991 | const specFiles = await globby(workspaceSpecFiles["engine"]); |
| 992 | const specListFile = path.join("packages/engine/Specs", "SpecList.js"); |
| 993 | await createSpecListForWorkspace(specFiles, "engine", specListFile); |
| 994 | |
| 995 | await bundleSpecs({ |
| 996 | incremental: incremental, |
| 997 | outbase: "packages/engine/Specs", |
| 998 | outdir: "packages/engine/Build/Specs", |
| 999 | specListFile: specListFile, |
| 1000 | write: write, |
| 1001 | }); |
| 1002 | |
| 1003 | return contexts; |
| 1004 | }; |
| 1005 | |
| 1006 | /** |
| 1007 | * Builds the widgets workspace. |
no test coverage detected
searching dependent graphs…