You want to contribute to google-docs-mustaches? Great!
First, you can follow the Getting started guide.
Ready to code? Check out the Ready to code section to find available tools and resources to improve your contributor experience.
In order to start using google-docs-mustaches, you will need to follow those 6 quick steps:
- Install the project
- Create a Google App project
- Create an OAuth key
- Enable the Drive and Docs APIs
- Generate a token
- Create your Docs template
- Run the playground
Before doing anything, install the project with the following commands:
git clone https://github.com/errorname/google-docs-mustaches
cd google-docs-mustaches
npm install
npm run build
Go to the New Project setup page. Write the name of your app.
Once the creation is complete, use the selector on the top left of the page to select your newly created app.
Go to the Oauth consent screen and fill in with the name of your app.
Go to the Credentials page. Click on "Create Credentials", choose "OAuth Client ID", select "Other" and validate with a name for your new key.
Finally, by clicking on the arrow icon on the right of the table, download the credentials and put the JSON file at dev/credentials.json
Go to those APIs and click "Enable"
- Drive API: https://console.developers.google.com/apis/library/drive.googleapis.com
- Docs API: https://console.developers.google.com/apis/library/docs.googleapis.com
Note: Google may need a few minutes to propagate the action into their systems. Wait a couple of minutes and retry.
Execute the following command:
npm run token
Go the URL given, authenticate with your Google account, and copy the given code.
Paste the code in the console. You now have a new token available for your project!
Note: If you need to regenerate a token, remove the generated
dev/token.json
file and re-execute the command.
In Google Drive, create a new Docs file and write the following:
Hello {{ firstname }} {{ lastname | uppercase }}!
You have {{ accounts[0].money }}€ in you account...
In the URL, retrieve the ID of the file
https://docs.google.com/document/d/[THE-ID-OF-THE-FILE]/edit
Create a new folder where your interpolated files will be put and also retrieve the id
https://drive.google.com/drive/u/0/folders/[THE-ID-OF-THE-FOLDER]
Copy-paste the dev/playground.js.sample
file:
cp dev/playground.js.sample dev/playground.js
In the playground.js
file, replace with the ids of the template file and destination folders with yours.
You are now ready to interpolate your first mustaches:
npm run playground
You now have an interpolated file in your folder!
Have fun! 🚀
Since you now have a working playground, check out the list of available commands and resources to help you code on this project!
Command | Notes |
---|---|
npm run build | This project uses Typescript, so you need to transpile into Javascript to run it. (Auto retranspile: npm run build -- -w ) |
npm run test | Run Jest for the tests. This command will also give you the code coverage of your tests. |
npm run lint | Run eslint to check for lint issues. |
npm run lint:fix | Run eslint to fix lint issues. |
npm run prettier:write | Run Prettier to prettify the files. |
npm run prettier:check | Run Prettier to check against prettier rules. |
npm run token | Generate a new OAuth token and write it in dev/token.json |
npm run playground | Run the dev/playground.js file |
- Google Drive API: https://developers.google.com/drive/api/v3/about-sdk
- Google Docs API: https://developers.google.com/docs/api/reference/rest/