jdt-generator - by Azecko
jdt-generator is a project created for the EPFL ISAS-FSD team to generate their weekly report directly without even thinking about it.
- Clone this repository
- Move in this new repository using the command
cd jdt-generator
- Run
npm i
(this will create a folder namednode_modules
and install all the dependencies) - Rename the file
.env.example
in.env
- Replace the variables in
.env
with your variables (explained below) - Run the different Commands available
DOC_ID is the document id of your google spreadsheet file.
You can find it in the URL when opening your file on Google.
Example : https://docs.google.com/spreadsheets/d/
1gZUSyHdif9KVEUAP1_445dCbyitvc7HMpbu9SM-C_BB
This one is the path to a file generated by Google.
Follow those steps to generate this file.
Thanks to the documentation of google-spreadsheet !
- Go to the Google Developers Console
- Select your project or create a new one (and then select it)
- Enable the sheets API for your project
- In the sidebar on the left, select APIs & Services > Library
- Search for "sheets"
- Click on "Google Sheets API"
- Click the "Enable" button
- Create a service account for your project
- In the sidebar on the left, select APIs & Services > Credentials
- Click the blue "+ CREATE CREDENTIALS" button and select the "Service account" option
- Enter the name and description and click "CREATE"
- You can skip permissions, click "CONTINUE"
- Click the "+ CREATE KEY" button
- Select the "JSON" key type option
- Click the "Create" button
- Your JSON key file is generated and downloaded to your machine (it's the only copy !)
- Click "DONE"
- And then you can put the PATH to the downloaded file in the .env
- Don't forget to share the spreadsheet document with the e-mail that is in the JSON file !
The email should look something like
[email protected]
The link of your email server. Example : yourhost.mail.com
The port that will be used by the SMTP server.
Those are the username and password that you use to connect to the SMTP server.
All commands need at least two required option. from
and to
They both take Date as value as format : YYYY-MM-DD
Example : --from=2022-01-01 --to=2022-12-31
This command will log the MarkDown format of the JDT.
Usage : node index.js md --from=2022-01-01 --to=2022-12-31
If you want to have the result in a file and not just in the console, add > my_report.md
at the end of the command. This will put the result of the console in a markdown file. node index.js md --from=2022-01-01 --to=2022-12-31 > my_report.md
This command will send the generated JDT by email to one or multiple email adresses.
Usage example : node index.js email --from=2022-01-01 --to=2022-12-31 --receiver="[email protected], [email protected]" --subject="My weekly report"
Make sure your SMTP configuration is working properly before using this command or you will have multiple errors.