3.96.3 • Published 2 years ago

@tutao/tutanota-build-server v3.96.3

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

Tutanota Build Tools

Synopsis

The easiest way to use the build tools, is to set up a build server using BuildServerClient.js:

import {BuildServerClient} from "./buildSrc/BuildServerClient.js"

const buildServerClient = new BuildServerClient()

buildServerClient.buildWithServer({
	forceRestart: true,
	builder: path.resolve("./buildSrc/Builder.js"),
	watchFolders: opts.watch ? [path.resolve("src")] : null,
	buildOpts: {clean: true},
	webRoot: path.resolve(('../build')),
	spaRedirect: true,
})
.then(
	console.log("Build finished")
)
.catch(
	console.log("Build failed")
)

You also need to provide a builder with an appropriate build() function:

export async function build({clean}, {devServerPort, watchFolders}, log) {
	// Build specific parameter passed from buildWithServer()
	if (clean) {
		doClean()
	}
	// use the provided log method to appenend to build server log file and print to STDOUT
	log("Starting build")
	return generateBundles()
}

Components

Build Server

The build server (BuildServer.js) provides all functionality to build our code. This includes running a local devServer, watching for changes in source code and re-triggering builds. It can be used programatically from javascript code and invoked via the commandline (using BuildServerStarter.js).

Dev Server, Single Page Applications and Hot Module Replacement

If you speficy a devServerPort and webRoot, the BuildServer will start a devServer listening on devServerPort serving webRoot. If you enable spaRedirect the devServer will set a route to catch any requests and redirect them to the site's base URL appending the originally requested URL as a query parameter. The latter can be used to serve Single Page Applications (SPAs). If you define watchFolders with the build server, any changes files within the watched folders will trigger a rebuild of the affected bundles. Any changes will be propagated to the devServer using Hot Module Replacement (HMR).

Build Server Factory

The build server factory provides a simplified programmatic interface for starting a build server instance in a new operating system process. It provides some IPC handling and should be the preferred way of starting a build server.

Build Server Client

Build server client uses the build server factory to bootstrap a build server when required, takes care of connection handling and forwards build commands to the build server. Using this class in your Makefile.js or build script is the recommended way of interacting with the build server.

Builders

The build server makes little assumption about what is built and how. The logic to execute the actual build process must be provided by the client in form of a Builder. Every Builder must have a build() function that takes three arguments:

  1. Build parameters: An object containing arbitrary data. If you need to pass any data from your Makefile to your your builder, you can pass an object to the build server client's buildWithServer() method. This object will be passed through to the Builder without the build server or other components in the build chain making any assumptions about its content.
  2. Server parameters: Contains the build server's configuration parameters. You probably won't need it.
  3. Log method: Log method provided by the build server. The builder can use this method to append to the build server's log file. If using the whole build toolchain including build server client, any messages passed to the log method will also be printed to STDOUT of the client process, i.e. your Makefile.

In addition to the build() function, a Builder can define a preBuild() and postBuild() function. These methods will be called by the BuildServer before/after calling the build() function itself. Both methods accept a log method (see 3. above) as an argument.

3.96.3

2 years ago

3.96.2

2 years ago

3.96.1

2 years ago

3.94.7

2 years ago

3.94.6

2 years ago

3.96.0

2 years ago

3.94.9

2 years ago

3.94.8

2 years ago

3.95.4

2 years ago

3.95.3

2 years ago

3.95.0

2 years ago

3.95.2

2 years ago

3.95.1

2 years ago

3.94.5

2 years ago

3.94.4

2 years ago

3.94.3

2 years ago

3.94.1

2 years ago

3.94.0

2 years ago

3.94.2

2 years ago

3.93.7

2 years ago

3.93.6

2 years ago

3.93.5

2 years ago

3.93.4

2 years ago

3.92.0

2 years ago

3.91.2-beta.0

2 years ago

3.91.11

2 years ago

3.91.10

2 years ago

3.91.12

2 years ago

3.93.0

2 years ago

3.91.2

2 years ago

3.91.1

2 years ago

3.91.8

2 years ago

3.91.7

2 years ago

3.91.9

2 years ago

3.93.2

2 years ago

3.91.4

2 years ago

3.93.1

2 years ago

3.91.3

2 years ago

3.91.6

2 years ago

3.93.3

2 years ago

3.91.5

2 years ago

3.89.23

2 years ago

3.89.22

2 years ago

3.89.20

2 years ago

3.89.25

2 years ago

3.89.24

2 years ago

3.89.16

2 years ago

3.89.19

2 years ago

3.89.18

2 years ago

3.89.17

2 years ago

3.91.0

2 years ago

3.89.12

3 years ago

3.89.11

3 years ago

3.90.0-beta.0

3 years ago

3.89.8

3 years ago

3.89.9

3 years ago

3.89.6

3 years ago

3.89.7

3 years ago

3.89.0

3 years ago

3.89.1

3 years ago

3.89.4

3 years ago

3.89.5

3 years ago

3.89.2

3 years ago

3.89.3

3 years ago

3.88.4

3 years ago

3.88.2

3 years ago

3.88.3

3 years ago

3.88.1

3 years ago

3.88.0

3 years ago

3.87.3-beta.1

3 years ago

3.87.2-beta.1

3 years ago

3.87.2-beta.2

3 years ago

3.87.2

3 years ago

3.87.1

3 years ago

3.86.4

3 years ago

3.87.0

3 years ago

3.86.3

3 years ago

3.86.2

3 years ago

3.86.0

3 years ago

3.85.10

3 years ago

3.85.9

3 years ago

3.85.5

3 years ago

3.85.6

3 years ago

3.85.4

3 years ago

3.85.2

3 years ago

3.85.3

3 years ago

3.85.1

3 years ago

3.85.0

3 years ago

3.84.11

3 years ago

3.84.10

3 years ago

3.84.9

3 years ago

3.84.8-1

3 years ago

3.84.2

3 years ago