0.21.0-alpha.6 • Published 18 hours ago

@beabee/beabee-common v0.21.0-alpha.6

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
18 hours ago

beabee-common

beabee-common is a shared codebase utilized across Beabee projects, compatible with Node.js, Deno, and web browsers.

Installation

To install beabee-common, use the following command:

npm install @beabee/beabee-common --save

Usage

Node.js

In a Node.js environment, use beabee-common as follows:

import { parseDate } from "@beabee/beabee-common";

parseDate("2022"); // Returns: [ 2021-12-31T23:00:00.000Z, 'y' ]

Deno

Support for Deno is planned. Details on publishing to deno.land will be provided in the future.

Development

Requirements

Development of beabee-common requires the latest stable versions of both Deno and Node.js:

  • Deno (latest stable version)
  • Node.js (latest stable version)

Build Process

To build the project, run:

npm install
npm run build # Alternatively, use `deno task build`

Scripts

Scripts for NPM and Deno tasks are synchronized, ensuring consistency whether you use npm run ... or deno task .... They are defined in both package.json and deno.json. New scripts can be synchronized with via deno task sync or npm run sync.

Key scripts include:

build

Node.js builds are created using esbuild from Deno source. Deno projects can directly utilize TypeScript source from ./mod.ts.

This runs several sub-scripts:

  • build:types - Generates TypeScript types using the tsc compiler.
  • build:node:
    • build:node:cjs - Creates a CommonJS bundle with esbuild, script located at ./scripts/esbuild.cjs.ts.
    • build:node:esm - Generates an ESM bundle using esbuild, script found at ./scripts/esbuild.esm.ts.

Deno's support for NPM packages differs in syntax, e.g., date-fns is imported as import { format } from "npm:date-fns"; in Deno, and import { format } from "date-fns"; in Node.js. Aliases in deno.json enable consistent codebase usage across environments.

sync

Synchronizes dependencies and scripts across package.json and deno.json to establishing necessary aliases in Deno and to make the scripts callable from both. See ./scripts/sync.ts for details.

generate:index

Generates index.ts files. Located at ./scripts/generate-index.ts.

format

Formats code using Deno's standard formatter.

lint

Lints code using Deno's standard linter.

test

Testing is divided into several scripts:

  • test:types - Checks for type errors using tsc.
  • test:deno - Main tests using Deno's standard testing framework.
  • test:node:
    • test:node:esm - Tests ESM build importability in Node.js.
    • test:node:cjs - Tests CJS build importability in Node.js.

Manage Dependencies

You can use dependencies for both NPM and Deno. When incorporating Deno packages, they must be bundled for Node.js compatibility. For a practical example, refer to this pull request. For integrating NPM dependencies, consult the sync script which ensures synchronization between the dependency configurations for both environments.

Cross Platform Compatibility

This module is cross platform independent and can be used under Node.js, Deno and in the browser. Therefore, please do not use any runtime APIs from Node.js, Deno or the Web API unless it is available in all these runtimes.

License

beabee-common is licensed under the AGPL-3.0 license.

0.21.0-alpha.5

19 hours ago

0.21.0-alpha.4

20 hours ago

0.21.0-alpha.3

21 hours ago

0.21.0-alpha.6

18 hours ago

0.21.0-alpha.2

6 days ago

0.21.0-alpha.1

6 days ago

0.20.5

13 days ago

0.20.4

13 days ago

0.20.3-alpha.2

1 month ago

0.20.3-alpha.1

1 month ago

0.20.3

1 month ago

1.19.17

2 months ago

0.20.2-alpha.2

2 months ago

0.20.2-alpha.1

2 months ago

0.20.2

2 months ago

1.19.16

2 months ago

1.19.15

2 months ago

1.19.14

2 months ago

1.19.13

2 months ago

1.19.12

3 months ago

0.20.1

3 months ago

1.19.11

3 months ago

0.20.0

3 months ago

0.20.0-alpha.3

3 months ago

0.20.0-alpha.1

3 months ago

0.20.0-alpha.2

3 months ago

1.19.10

3 months ago

1.19.8

3 months ago

1.19.7

3 months ago

1.19.9

3 months ago

1.19.6

5 months ago

1.19.4

5 months ago

1.19.3

5 months ago

1.19.2

5 months ago

1.19.1

5 months ago

1.19.5

5 months ago

1.19.0

5 months ago

1.18.1

7 months ago

1.18.0

7 months ago

1.18.1-alpha.1

7 months ago

1.13.2

10 months ago

1.13.6

8 months ago

1.13.5

8 months ago

1.17.1

10 months ago

1.13.4

9 months ago

1.13.3

9 months ago

1.13.8

7 months ago

1.13.7

8 months ago

1.18.0-alpha.9

7 months ago

1.18.0-alpha.7

7 months ago

1.18.0-alpha.8

7 months ago

1.18.0-alpha.1

7 months ago

1.18.0-alpha.2

7 months ago

1.18.0-alpha.5

7 months ago

1.18.0-alpha.6

7 months ago

1.18.0-alpha.3

7 months ago

1.18.0-alpha.4

7 months ago

1.16.0

11 months ago

1.17.0

11 months ago

1.15.2

11 months ago

1.15.1

11 months ago

1.12.3

1 year ago

1.14.0

12 months ago

1.12.2

1 year ago

1.15.0

11 months ago

1.13.1

1 year ago

1.13.0

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.11.0

1 year ago

1.10.22

1 year ago

1.10.23

1 year ago

1.10.20

1 year ago

1.10.21

1 year ago

1.10.15

1 year ago

1.10.16

1 year ago

1.10.13

1 year ago

1.10.14

1 year ago

1.10.19

1 year ago

1.10.17

1 year ago

1.10.18

1 year ago

1.10.5

1 year ago

1.10.4

1 year ago

1.10.3

1 year ago

1.10.2

1 year ago

1.10.9

1 year ago

1.10.8

1 year ago

1.10.7

1 year ago

1.10.6

1 year ago

1.10.1-a

1 year ago

1.10.11

1 year ago

1.10.12

1 year ago

1.10.10

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.9.4

1 year ago

1.9.3

1 year ago

1.9.2

1 year ago

1.9.1

1 year ago

1.9.0

1 year ago

1.8.4

1 year ago

1.8.3

1 year ago

1.8.2

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.4

1 year ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago