6.46.8 • Published 5 days ago

@gasket/plugin-start v6.46.8

Weekly downloads
35
License
MIT
Repository
github
Last release
5 days ago

@gasket/plugin-start

Enables commands essential to building and running Gasket projects.

Installation

This is a default plugin in the Gasket CLI and is always available for use.

Commands

build command

Executes the build lifecycle. Use this to prepare your app for running, such as bundling files, minifying code, processing assets, etc.

start command

Executes the preboot and start lifecycles. Upon building your app, use this command to run it.

local command

Executes the build, preboot and start lifecycles. This command defaults the environment to local, and is intended for local app development, only.

Plugins can hook the start lifecycle, inspect the command id, and adjust startup behavior based on if the start or local commands was used. This is useful, for example, to enabling hot reload or disabling service worker caching during development.

This simple example hooks the start lifecycle to start up a web server, and changes the port if using the local command.

// gasket-plugin-example.js
const http = require('http');

module.exports = {
  name: 'example-server',
  hooks: {
    async start(gasket) {
      // set things unique for the local command
      const isLocal = gasket.command.id === 'local';

      const port = isLocal ? 3000 : 8000;
      const message = isLocal ? 'Hello.' : 'Hello World!';
      
      http.createServer(function (req, res) {
        res.write(message);
        res.end();
      }).listen(port);
    }
  }
}

Lifecycles

build

Plugins should hook this lifecycle to prepare files for the app to be run.

start

This lifecycle can be used to run an app, such as by starting up a port listener. Generally, the start lifecycle should only be hooked by one plugin in an app.

preboot

This lifecycle can be hooked by plugins to prepare an app before startup. This should be used for in-memory setup, with an on disk prep handled during the build lifecycle.

License

MIT

7.0.0-next.21

5 days ago

7.0.0-next.9

9 days ago

7.0.0-next.10

9 days ago

7.0.0-next.7

10 days ago

7.0.0-next.11

9 days ago

7.0.0-next.8

9 days ago

7.0.0-next.12

9 days ago

7.0.0-next.13

9 days ago

7.0.0-next.6

10 days ago

7.0.0-next.20

9 days ago

7.0.0-next.5

10 days ago

6.46.8

12 days ago

7.0.0-next.4

12 days ago

7.0.0-next.3

17 days ago

7.0.0-next.2

24 days ago

7.0.0-next.1

24 days ago

7.0.0-next.0

24 days ago

6.46.7

1 month ago

7.0.0-cli.7

2 months ago

7.0.0-cli.6

2 months ago

6.46.1-cli.0

2 months ago

7.0.0-cli.5

2 months ago

7.0.0-cli.4

2 months ago

7.0.0-cli.1

2 months ago

7.0.0-cli.0

2 months ago

7.0.0-cli.3

2 months ago

7.0.0-cli.2

2 months ago

6.46.3-cli.0

2 months ago

6.46.2

2 months ago

7.0.0-canary.1

2 months ago

6.46.2-esm.0

3 months ago

6.45.2

3 months ago

6.45.0

4 months ago

6.43.0

7 months ago

6.39.3

11 months ago

6.39.0

12 months ago

6.38.8

12 months ago

6.38.5

1 year ago

6.38.1

1 year ago

6.36.1

1 year ago

6.38.0

1 year ago

6.34.6

2 years ago

6.36.0

1 year ago

6.34.3

2 years ago

6.34.4

2 years ago

6.34.2

2 years ago

6.27.0

2 years ago

6.26.1

2 years ago

6.21.0

2 years ago

6.24.2

2 years ago

6.24.0

2 years ago

6.20.4

2 years ago

6.20.3

2 years ago

6.20.2

2 years ago

6.19.0

2 years ago

6.10.1

2 years ago

6.10.0

2 years ago

6.14.0

2 years ago

6.13.0

2 years ago

6.17.0

2 years ago

6.15.2

2 years ago

6.0.12

3 years ago

6.0.0

3 years ago

6.0.0-canary.13

3 years ago

6.0.0-canary.0

4 years ago

5.6.0

4 years ago

5.1.3

4 years ago

5.0.2

4 years ago

5.0.0

4 years ago

5.0.0-canary.4

4 years ago

5.0.0-canary.3

4 years ago

5.0.0-canary.2

4 years ago

5.0.0-canary.1

4 years ago

5.0.0-canary.0

4 years ago