Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.6.1 Enhancements #9

Merged
merged 10 commits into from
Sep 2, 2020
Merged

v0.6.1 Enhancements #9

merged 10 commits into from
Sep 2, 2020

Conversation

alex996
Copy link
Collaborator

@alex996 alex996 commented Aug 30, 2020

  • build for node (cjs), bundlers like webpack (esm), and browser (umd)
  • separate FS and memory DBs into /lib/fs and lib/mem dirs
    • this way we bypass node-only code in rollup and avoid warnings like below (resulting from the output format being umd)
      image
  • add DB helpers with a proxy
  • add examples of use

Breakdown of the current build folder:

/build
  /cli # Executable files in CommonJS
    cmds
    jsongo-cli.js
  /esm # Same as /lib but in ES Modules
    fs
    mem
    shared
    index.js
  /lib # Entrypoint in CommonJS
    fs
    mem
    shared
    index.js
  jsongo.min.js # UMD bundle

Breakdown of the fields in package.json:

  • "bin" - when you run jsongo CLI, it resolves to /build/cli
  • "main" - when you require("jsongo") in Node, it resolves to /build/lib
  • "module" - when you import jsongo with a front-end bundler (e.g. webpack), it resolves to /build/esm
  • "unpkg" - when you load jsongo from a CDN, it serves up /build/jsongo.min.js

@@ -12,7 +14,7 @@
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./build" /* Redirect output structure to the directory. */,
// "outDir": "./", /* Redirect output structure to the directory. */
Copy link
Collaborator Author

@alex996 alex996 Aug 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran into circular errors in rollup saying that only one of output.dir or output.file is permitted in rollup.config.js, while at the same time output.dir is required when "ourDir" is specified in tsconfig.json. Solved by removing "outDir" entirely; it gets populated in tsconfig.build.json instead.

@alex996 alex996 mentioned this pull request Sep 2, 2020
@alex996 alex996 changed the base branch from wip-v0.6-alex to wip-v0.6 September 2, 2020 16:13
@rentzsch rentzsch merged commit 7b45d56 into wip-v0.6 Sep 2, 2020
@alex996 alex996 deleted the wip-v0.6.1-alex branch September 2, 2020 16:20
@rentzsch rentzsch mentioned this pull request Sep 2, 2020
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants