This is a monorepository containing all official Hull connectors and supporting libraries.
The repository is configured using yarn workspaces
feature.
Root of the repository contains:
- workspaces definition in package.json
- linting configuration and dependencies
- building/transpilation configuration and dependencies
- flow types configuration and dependencies
- jest configuration and dependencies
- common production dependencies
Then separate packages are defined here:
pacakges/connectors/*/package.json
- connectorspackages/*/package.json
- supporting libraries
How repository is built/linted/flow tested?
There is one configuration in the root of repository,
the whole project is linted, flow tested and built as one package.
Everything from packages/*
directory is transpiled into
dist/*
with the very same structure.
After babeljs build rest of the files such as assets are copied into the dist
.
How packages are tested?
Linting and flow testing is global (look above). Tests are done in two different ways:
- new tests are using
jest
framework and it's run globally across whole repository - some of packages are still using deprecated
mocha
framework, so when performing tests, yarn is getting into every package/workspace and runtest
script
- copy the code into
pacakges/connectors/hull-foo
- make sure that the
name
in package.json ishull-foo
(some steps depends on it) - remove all unnecessary dev and prod dependencies from
package.json
(look at root package.json to see what can be removed) - remove all unnecessary npm/yarn scripts for linting and building
- plug in testing:
- if tests are written in deprecated
mocha
framework keeptest
script which runs the mocha tests, but include a specialbabel
js file to make sure transpilation is applied:mocha --require ../../root-babel-register
- if tests are written in new
jest
framework go tojest.config.js
file and add your connector paths
- make sure that links to hull packages are local:
"hull": "link:../../hull",
"hull-connector-framework": "link:../../hull-connector-framework",
- remove all unnecessary configuration files:
.eslintrc
,.babelrc
,.editorconfig
etc.
How to start connector in dev mode?
First copy the env file and fill it in:
cp packages/connectors/hull-foo/.env-sample .env.hull-foo
Then you can start it with the dev
script:
dotenv -e .env.hull-foo yarn dev hull-foo
How to start connector in production mode?
First build the production dist:
6463
yarn build
Then given you have the env file in place (if not look above), you can use bash script to run:
dotenv -e .env.hull-foo bash scripts/bash-entrypoint.sh hull-foo
How to test single connector?
Run jest packages/connectors/hull-foo
if the connector is already on jest.
If on mocha run yarn workspace hull-foo run test
.
How to lint single connector?
Run eslint packages/connectors/hull-foo
Monorepository has one global version and changelog.