Litvis as a framework for interpreting markdown documents can have multiple implementations in various programming languages. A reference implementation of litvis has been developed using TypeScript, a typed superset of JavaScript. Most of this open-source software can be found in https://github.com/gicentre/litvis → packages
directory and the remaining bits are located in these repositories:
- gicentre/mume-with-litvis
- gicentre/markdown-preview-enhanced-with-litvis
- gicentre/vscode-markdown-preview-enhanced-with-litvis
The easiest way to try litvis is to install either the Atom package or the Visual Studio Code extension.
Litvis code is organised in a form of a monorepo and relies on yarn
workspaces for package management. It also uses lerna
for orchestrating packages in the monorepo.
Before getting started, please make sure you have the latest node
and the latest yarn
installed on your machine.
node --version
## ≥ 12.15
yarn --version
## ≥ 1.22
# cd gicentre/litvis
yarn
## once
yarn build
## continuously
yarn build:watch
## one-time password for two-factor auth
export NPM_CONFIG_OTP=??
yarn lerna exec npm publish
yarn lerna exec yarn link
## to unregister
# yarn lerna exec --no-bail yarn unlink
yarn lint
yarn test
Checking file formatting with Prettier
yarn format:check
yarn qa
yarn build-and-qa
## ‘build-and-qa‘ is recommended for ‘cold start’
## (i.e. when packages have not been built previously)
This section is based on the assumption that at least one package in this repo is being worked on.
First step is to clone the three repositories (this one, plus gicentre/mume-with-litvis and gicentre/markdown-preview-enhanced-with-litvis.
Open a terminal in the folder of this repo (gicentre/litvis),
-
Run
yarn
/yarn install
-
For each package being worked on, go the folder of the package (e.g.
cd packages\narrative-schema
) and runnpm link
. This will create a symlink in a global/user node_modules folder. -
Back in the main folder, run
yarn build:watch
Open a new terminal and navigate to the mume-with-litvis folder.
-
Run
npm install
-
Open the
node_modules
folder and check the modules that are dependencies from the litvis repository (e.g. litvis-integration-mume). Now, for those packages that were linked in the previous step, runnpm link package_name
. For example, if working on litvis-integration-mume, runnpm link litvis-integration-mume
. -
Back in the main folder, run
npm run build:watch
Lastly, open a new terminal in the markdown-preview-enhanced-with-litvis folder.
-
Run
npm install
-
Open the
node_modules
folder and find modules that are dependencies from the previous two repositories (mume-with-litivs and any of the packages in this repo). For each of them, runnpm link package_name
as previously. -
Back in the main folder, run
npm run build
. -
Run
apm link -d
. This will create a link from the package (in the repo) to the development folder of atom. -
Run again
npm run build:watch
.
Finally, in a separate terminal, run atom -d
to open the development version of Atom. This will ensure that the markdown preview litvis-enhanced package is taken from the development folder and will not conflict with the release version. Now, every time a file in this repo is changed and saved, a chain of build commands will be triggered, ensuring that the Markdown Preview package is (locally) updated. To reload Atom and the packages to actually see the changes, go to View -> Developer -> Reload Window. When committing and merging changes, don't forget to use yarn lint
to pass the github checks.
MacOS related:
-
coreutils
might be required (npm install -g coreutils
). -
There might be a problem with
fsevents
when building the packages or loading Atom.npm install -g [email protected]
and rebuilding the package when requested, in Atom, should solve it.
TODO
Vega and Vega-Lite are not direct dependencies of gicentre/litvis
.
They are introduced downstream inside NPM package mume-with-litvis
, which in turn is a dependency of Atom and VSCode extensions.
Vega, Vega-Lite and their auxiliary libraries are listed in mume-with-litvis
→ package.json
.
The versions are specified with ^
, which means that the latest available patches or semver minor features will be picked automatically on extension install (or reinstall).
To upgrade development versions of vega libraries in mume-with-litvis
, you need to remove them from yarn.lock
and reinstall dependencies (yarn install
).
If you need to upgrade major versions, e.g. [email protected]
to vega-lite@[X+1].0.0
, new extension releases are necessary.
Please follow the steps below.
-
Check out the latest commit on the
main
branch of https://github.com/gicentre/mume-with-litvis.git. -
Update versions for
vega
,vega-lite
,vega-embed
,vega-loader
,apache-arrow
orvega-loader-arrow
inpackage.json
. -
Run
yarn install
. -
Find
dependentLibraryConfigs
insrc/markdown-engine.ts
and upgrade versions accordingly. Note that you might also need to updatebuildPathForWebview
if it has changed. -
In the unlikely case of breaking changes that affect the lifecycle of vega-based visualizations, consider updating additional files in
src
folder. This may be necessary in a small subset of cases, and only when the major versions are bumped. -
Update
CHANGELOG.md
file by adding a new## Unreleased (minor|patch)
section (example). -
Commit the changes.
-
Update
CHANGELOG.md
again by replacing## Unreleased (...)
with a new expected version number. Stage this file. -
Run
yarn publish --minor
oryarn publish --patch
. This will buildmume-with-litvis
from its source, change version inpackage.json
, publish the new version on NPM, commit tomain
and add git tag (v*
). 2FA authentication token should be asked as part of this. Beware that publishing may fail on a slow internet connection due to the size ofmume-with-litvis
combined with the expiration of 2FA tokens. -
Open https://www.npmjs.com/package/mume-with-litvis and verify that the package version has been updated.
-
Commit your change in
package.json
and push both commits to themain
branch on github.
You may also want to cherry-pick the first commit to mume
in order to keep the fork in sync with its origin.
Example pull request: shd101wyy/mume#79.
-
Check out the latest commit on the
main
branch of https://github.com/gicentre/markdown-preview-enhanced-with-litvis.git. -
Run
yarn install
. -
Run
yarn install mume-with-litvis@latest
to update the version of this dependency. -
Open
CHANGELOG.md
and document upcoming changes. -
Commit (see example) and push.
-
Run
apm publish patch
orapm publish minor
depending on the nature of the upstream changes. This should automatically bump the version inpackage.json
and push a new commit to GitHub, which constitutes the release (see example). You will be asked to authenticate at APM if needed. -
Push the
main
branch.
The new package version should now show up in Atom and it should be possible to upgrade.
If the new version ends up broken, you can rollback by running apm install markdown-preview-enhanced@another-version
.
-
Make sure you have the latest version of
vsce
installed globally.npm install -g vsce
-
Check out the latest commit on the
main
branch of https://github.com/gicentre/vscode-markdown-preview-enhanced-with-litvis.git. -
Run
yarn install
. -
Run
yarn install mume-with-litvis@latest
to update the version of this dependency. -
Open
CHANGELOG.md
and document upcoming changes. -
Commit (see example) and push.
-
Run
vsce publish patch
orvsce publish minor
depending on the nature of the upstream changes. You will be asked to authenticate at Visual Studio Marketplace if needed. -
Push the
main
branch.