@sjcrh/proteinpaint-shared
v2.178.1-0
Published
ProteinPaint code that is shared between server and client-side workspaces
Readme
@sjcrh/proteinpaint-shared
Background
This workspace was separate from the deprecated server/shared dir.
The code here are meant to be consumed at runtime by either client or server
code. Do NOT put utility/helper code here that are specific to only one
workspace, those files should be saved in that workspace.
IMPORTANT:
- code must work in browser and nodejs: do not import libs, deps, or globals that
are specific to
nodejsorbrowserenvironments, likefsorDOMelements
Develop
For server dev, the tsx library will accept imports with or without file extension.
Server (consumer) code MUST use the .js file extension even when importing
#shared/*.ts files.
For client dev, the esbuild config will bundle the #shared imports correctly, even
when .js extension is used to import what is actually a .ts file, by using
custom plugins like dirname.
Build
This package will be bundled as part of the client dependencies.
For server builds, run npm run build to generate src/*.js from src/*.ts files.
This is also automatically done as part of the prepack package script.
NOTE: For now, only code in .js files.
If using .ts files:
- commit the generated
.jsfiles - add the js file to package.json prettier command
keep doing this until a dev script or another approach can take care of the
.jsfile requirement.
Test
# run all tests
npm test
# run one script
node test/mds3tk.unit.spec.js