Appendix A — Codespaces

The icj-project-rig can be used in GitHub Codespaces, a free virtual machine environment. This might be helpful if you have trouble with your own computer.

This isn’t a tutorial on using Codespaces, but it does provide some necessary information if you explore the option. This assumes you already have your own copy of the project and it is pushed to Github. You work out of your own project.

A.1 Install gulp

Once you launch a codespace it will recognize you are in a Node environment but you still need to install some packages the first time you launch it:

  1. Once the container is up and running, do npm install -g gulp to install gulp. 2. Run npm ci to do a clean install on all the other packages in the project.

If you come back to an existing Codespace you should not have to run those again.

A.2 Google auth access

There is one gulp command that will not work in Codespaces unless you jump through some extra hoops.

gulp fetch is the command that downloads Google Docs and Sheets documents as JSON, as outlined in project.config.json. The process expects to find an authorization file on your own computer that we set up in icj-setting-up Part 2, but that file doesn’t exist on the Codespaces virtual machine.

You’ll need to set up two environment variables to make it work.

NOTE: It is absolutely imperative that you DO NOT commit the contents of service_account_key.json to your branch at all. If someone else were able to see the contents of that file, they could execute any action that service account has in its abilities. Since service_account_key.json is in the .gitignore file, you should not be able to check it in, but it is important to remember that for the sake of transparency.

We will be following the process shown here

As you follow those steps you’ll need the information below.

A.2.1 Codespaces secret

  • The “Name” of the secret will be SERVICE_ACCOUNT_CREDENTIALS.

  • The “Content” of the secret will be the contents of the file created in ICJ setup Part 2. You should be able to “copy” that file from your terminal by running the following command:

    pbcopy < $HOME/.config/gcloud/service_account_key.json

    Return to your web browser and for the “Value” do Cmd-v to paste the contents of your clipboard.

  • At the step you add repositories, you’ll need to add your repo that is a copy of the icj-project-rig.

If you build other projects that need the credential, you can come here and edit the secret to add the new repo.

A.2.2 Might have to restart

If you already had a Codespace running, you might have to stop and restart it to recognize the new secret.

You could try this command below first, but I’m not certain it will work.

npm run codespace-google-auth

After doing that, you should be able to run gulp fetch to update the data JSON files.