![]() The requirements for the learning uploader have changed since it was first created. It was originally intended to be used locally by writers to quickly push content to the platform. I wrote it in Python so writers would not need to install node, and using string manipulations to interact with the REST API was good enough for just uploading the zip and linking the new file. It also included functionality for a writer to log into the database through a CLI. Now, the uploader is only used in CI, so we don't care about logging in or sticking to Python, and we want to be able to do more complex manipulations such as adding new lessons and changing metadata. For this reason, this PR rewrites the uploader using the official [Directus SDK](https://docs.directus.io/guides/sdk/), which makes interacting with the API a lot easier. --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com> Co-authored-by: Abby Mitchell <23662430+javabster@users.noreply.github.com> |
||
---|---|---|
.. | ||
lib | ||
README.md | ||
setup-for-testing.ts | ||
sync.ts | ||
validate-config.ts |
README.md
Tutorial uploader
This script uploads tutorials to IBM Quantum Learning.
Developing
To work on this script, you'll need to set up the saiba-api
project locally.
There are some extra steps you'll need to take to set up saiba-api
for
developing this script:
-
Follow the instructions in the README in the saiba-api repo. Don't forget the instructions to add the
PUBLIC_URL
entry to yourdocker-compose.yaml
. -
Login into the local CMS (http://0.0.0.0:8055/admin/) using
- email:
admin@example.com
- password:
password
- email:
-
Create a token for local testing.
- In the local CMS, go to "User directory" (in the leftmost navbar)
- Click "Create item"
- Create a new user with the "Content creator admin" role and generate a new static token. Copy the token to your clipboard. Then click the tick on the top-right of the page to save the user.
- To test the script in this repo, export the following environment
variables.
Consider using direnv to handle this.export LEARNING_API_URL=http://0.0.0.0:8055 export LEARNING_API_TOKEN=<copied-token>
-
With the local database running, run the following command to add the topics and categories that we expect to exist.
npm run tutorial:setup-testing