0.1.28 • Published 9 months ago

nebula-lib v0.1.28

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
9 months ago

Dev Notes On Nebula Web Tier

Nebula web tier is designed for supplying web faced layer to run user requests. Through this tier, Nebula provides supports for

  • Nebula UI via web requests (GET).
  • Nebula REST API - defined by api.js extensions

Some UI Dependencies In Use

Web tier is fully in ESM.

To embrace ESM is a good choice as modern browser and node.js (>v13) server are all supporting it. This is good for

  • module reuse by both browser stack and web stack stack (node).
  • good for future upgrade with optimizations.

Hence, we're declaring Nebula Web Tier is fully in ESM mode. However, there are some legacy dependencies require us stay in require for some cases. So here are some detailed notes. 1. We use webpack to build bundle for NebulaClient library, we keep this in commonjs still due to its own limitation. 2. Because of #1, we have to use createRequire to ensure require is still available in ES module mode. 3. We're enforcing using named export rather than default export, so please keep export default xx out of the code base. 4. All Nebula ES modules will be organized in folder _ for better identification, please follow this convension as well. 5. If a module is used by both Web Server and Browser, we will minify it, we use VS Code extension Minify to do this work.

Nebula tier is designed to be a plugable platform so that any adopter can customize Nebula for its own appication. That is why I spent a lot of effort to enforce Nebula Web to be a consistent tech stack, above convensions are some basic requirements for nebula web advanced development.

Use Webpack

Webpack is used to produce two bundles for both browser and node.js, follow these steps to refresh them whenver proto contracts updated in the service. Note: make sure run below command in terminal that has node version of lts/gallium (nvm use lts/gallium).

  1. remove "type:module" from package.json to make below command work (due to webpack bad support for ES6).
  2. $ ~/nebula/src/service/http/nebula > npm install (based on package.json - can be reused for all service)
  3. (temporary), current grpc node plugin generates import of grpc not grpc-js, we will manually change it in nebula_grpc_pb.js
  4. ~/nebula/src/service/http/nebula > npx webpack
  5. $ in dist/web/main.js and dist/web/main2.js, prepend "export" in it to export NebulaClient. (webpack doesn't generate export key)

Publish nebula-lib

Publish nebula-lib to npmjs 1. npm login 2. npm version patch 3. npm publish

0.1.27

9 months ago

0.1.28

9 months ago

0.1.26

9 months ago

0.1.25

1 year ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago