Skip to content

Commit

Permalink
Merge pull request #11 from lucasvtiradentes/feature/update_project
Browse files Browse the repository at this point in the history
Feature/update project
  • Loading branch information
lucasvtiradentes authored Dec 31, 2023
2 parents 0fc0b60 + c1cc3a6 commit c9f1822
Show file tree
Hide file tree
Showing 49 changed files with 1,091 additions and 1,389 deletions.
11 changes: 9 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# https://prettier.io/docs/en/options.html
# FODLER =======================================================================

utils/
.github
.husky
.vscode
dist
ignore
node_modules

# FILES ========================================================================
14 changes: 4 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off"
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/ban-types": "off"
}
}
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# FOLDERS ###############################
node_modules/

dist/
build/
offline/
/package
.next/
ignore/
node_modules/
package/

# FILES #################################

package-lock.json
yarn-lock.json
pnpm-lock.yaml
Expand Down
3 changes: 3 additions & 0 deletions .husky/commit-msg
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🐶 husky script: [commit-msg]"
npx --no -- commitlint --edit ${1}
echo "✅ husky script: [commit-msg]"
echo ""
7 changes: 7 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🐶 husky script: [pre-commit]"
npx --no-install lint-staged
echo "✅ husky script: [pre-commit]"
echo ""
7 changes: 7 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🐶 husky script: [pre-push]"
npm run build
echo "✅ husky script: [pre-push]"
echo ""
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js, jsx, ts, tsx}": ["prettier --write", "eslint --fix"],
"*.{json, yaml}": ["prettier --write"]
}
13 changes: 11 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# https://prettier.io/docs/en/options.html
# FODLER =======================================================================

examples/
.github
.husky
.vscode
dist
ignore
node_modules

# FILES ========================================================================

README.md
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"editorconfig.editorconfig"
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"package.json": ".czrc, .editorconfig, .commitlintrc, .eslintignore, .eslintrc, .lintstagedrc.json, .prettierignore, .prettierrc, tsconfig.json, package-lock.json, yarn.lock, pnpm-lock.yaml",
".env": ".env.example",
".releaserc": ".npmignore",
"README.md": "LICENSE, CHANGELOG.md",
},
"files.associations": {
".czrc": "json"
}
}
115 changes: 22 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
</h3>

<div align="center">
<a href="https://nextjs.org/"><img src="https://img.shields.io/badge/made%20with-node-1f425f?logo=node.js&.svg" /></a>
<a href="https://www.github.com/lucasvtiradentes/ticktick-api-lvt/commits/master"><img src="https://img.shields.io/github/last-commit/lucasvtiradentes/ticktick-api-lvt?color=green&label=updated"></a>
<br>
<a href="#"><img src="https://img.shields.io/badge/maintained%3F-yes-green.svg" alt="maintance" /></a>
<a href="https://www.github.com/lucasvtiradentes"><img src="https://img.shields.io/badge/maintainer-%40lucasvtiradentes-yellow"></a>
<a href="https://www.npmjs.com/package/ticktick-api-lvt"><img src="https://img.shields.io/npm/v/ticktick-api-lvt.svg?style=flat" alt="npm version"></a>
<a href="https://nodejs.org/en/"><img src="https://img.shields.io/badge/made%20with-node-1f425f?logo=node.js&.svg" /></a>
<a href="https://github.com/lucasvtiradentes/ticktick-api-lvt#contributing"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="contributions" /></a>
</div>

Expand All @@ -29,7 +26,6 @@
<ul>
<li><a href="#development-setup">Development setup</a></li>
<li><a href="#used-technologies">Used technologies</a></li>
<li><a href="#commit-messages-style">Commit messages style</a></li>
</ul>
</li>
<li>
Expand All @@ -38,13 +34,6 @@
<li><a href="#license">License</a></li>
</ul>
</li>
<li>
<a href="#family-community">Community</a>
<ul>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#feedback">Feedback</a></li>
</ul>
</li>
</ul>
</p>
</details>
Expand All @@ -53,20 +42,14 @@

## :trumpet: Overview

This is a notifications microservice that implements hyped technologies, such as kafka and nestjs.

The main goal of this project was to understand key concepts of kafka and nestjs.
This is a [ticktick](ticktick.com) api wrapper developed to be used on [Node.js](https://nodejs.org/en) based projects.

## :dart: Features<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

&nbsp;&nbsp;&nbsp;✔️ Login into ticktick;<br>
&nbsp;&nbsp;&nbsp;✔️ Add tasks;<br>
&nbsp;&nbsp;&nbsp;✔️ Get user tasks;<br>
&nbsp;&nbsp;&nbsp;✔️ Get user projects;<br>
&nbsp;&nbsp;&nbsp;✔️ Get user project groups<br>
&nbsp;&nbsp;&nbsp;✔️ Get user tags<br>
&nbsp;&nbsp;&nbsp;✔️ Get user filters<br>
&nbsp;&nbsp;&nbsp;✔️ Get user habits<br>
&nbsp;&nbsp;&nbsp;✔️ type safe api methods by using [zod](https://github.com/colinhacks/zod) validation;<br>
&nbsp;&nbsp;&nbsp;✔️ methods for common actions, find more [here](./src/routes/);<br>
&nbsp;&nbsp;&nbsp;✔️ support to china [api version](https://api.dida365.com) [thanks to [@quanru](https://github.com/quanru)];<br>
&nbsp;&nbsp;&nbsp;✔️ custom headers required in order to make api calls [thanks to [@thesamim](https://github.com/thesamim)].<br>

## :warning: Requirements<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

Expand All @@ -75,11 +58,6 @@ In order to use this project in your computer, you need to have the following it
- [npm](https://www.npmjs.com/): To install the package. Npm is installed alongside nodejs;
- [nodejs](https://nodejs.org/en/): To actually run the package.

If you want to make changes to the source code, it is recommended to also install the following items:

- [git](https://git-scm.com/): To work with version controlling;
- [vscode](https://code.visualstudio.com/): Useful for editing the code. You can choose a similar editor as you wish.

## :bulb: Usage<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

To use it from the registry, first install the npm package:
Expand All @@ -95,46 +73,29 @@ And you can normally use it in your code as it follows:
import { Tick } from 'ticktick-api-lvt';

async function main() {
const USERNAME = 'username';
const PASSWORD = 'password';
const username = 'your_username';
const password = 'your_password';

const tickSession = new Tick({ username: USERNAME, password: PASSWORD });
const hasLoggedIn = await tickSession.login();
if (!hasLoggedIn) {
throw new Error('Coudnt login with this username/password.');
}
const tickInstance = new Ticktick({ username, password });

// const userPreferences = await tickSession.getUserSettings()
// console.log(Object.keys(userPreferences))
// LOGIN =====================================================================

// const allAllTasks = await tickSession.getAllTasks();
// console.log(allAllTasks.map((item) => item.title));
await tickInstance.auth.login();

// const tasks = await tickSession.getTasks();
// console.log(tasks.map((item) => item.title));
// METHODS ===================================================================

// const filters = await tickSession.getFilters();
// console.log(filters.map((item) => item.name));
console.log(await tickInstance.user.getUserInformation());
console.log(await tickInstance.user.getUserDailyReminder());
console.log(await tickInstance.user.getUserSettings());
console.log(await tickInstance.tags.getTags());
console.log(await tickInstance.tasks.getCompletedTasks());

// const projectGroups = await tickSession.getProjectGroups();
// console.log(projectGroups.map((item) => item.name));

// const projects = await tickSession.getProjects();
// console.log(projects.map((item) => item.name));

// const habits = await tickSession.getHabits();
// console.log(habits.map((item) => item.name));

// const tags = await tickSession.getTags();
// console.log(tags);

// uncomment the methods you want to see ;)
}

main();
```

To see further examples, check out the examples folder.
To see further usage, check out the provided [example](./examples/dev-example.ts).

## :wrench: Development<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

Expand All @@ -153,7 +114,7 @@ $ cd ticktick-api-lvt
After download it, go to the project folder and run these commands:

```bash
# Install dependencies
# Install dependencies using npm
$ npm install

# Run the typescript code in development mode
Expand Down Expand Up @@ -219,45 +180,13 @@ This project uses the following thechnologies:
</table>
</div>

### Commit messages style

This project uses the best of two main conventions to commit messages validation:

- [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/): it's powerfull messages structure;
- [gitmoji](https://gitmoji.dev/): it's beutiful and visual way to display commits.

So a typically valid commit message has this pattern:

> 🔧 config: add lint-staged to the project (#2)
Also, in order to have this integration working correctly, I buld a [script](../scripts/update-commits-configs.ts) that we can specify only allowed types and it take care to update both commitizen and commitlint settings.

<a href="#"><img src="./.github/images/divider.png" /></a>

## :books: About<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

## License

**Boilermanager** is distributed under the terms of the MIT License Version 2.0. A complete version of the license is available in the [LICENSE](LICENSE) file in this repository. Any contribution made to this project will be licensed under the MIT License Version 2.0.

<a href="#"><img src="./.github/images/divider.png" /></a>

## :family: Community<a href="#TOC"><img align="right" src="./.github/images/up_arrow.png" width="22"></a>

## Contributing
if you want to positivily impact this project, consider:

- **:star: Star this repository**: my goal is to impact the maximum number of developers around the world;
- ✍️ **Fix english mistakes** I might have made in this project, may it be in the DOCS or even in the code (I'm a portuguese natural speaker);
- [:heart: Say thanks](https://saythanks.io/to/lucasvtiradentes): kind words have a huge impact in anyone's life;
- [💰 Donate](https://github.com/lucasvtiradentes): if you want to support my work even more, consider make a small donation. I would be really happy!

## Feedback

Any questions or suggestions? You are welcome to discuss it on:

- [Github issues](https://github.com/lucasvtiradentes/ticktick-api-lvt/discussions)
- [Email](mailto:[email protected])
This project is distributed under the terms of the MIT License Version 2.0. A complete version of the license is available in the [LICENSE](LICENSE) file in this repository. Any contribution made to this project will be licensed under the MIT License Version 2.0.

<a href="#"><img src="./.github/images/divider.png" /></a>

Expand All @@ -268,7 +197,7 @@ Any questions or suggestions? You are welcome to discuss it on:
<a target="_blank" href="https://discord.com/users/262326726892191744"><img src="https://img.shields.io/badge/discord-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
<a target="_blank" href="https://github.com/lucasvtiradentes/"><img src="https://img.shields.io/badge/github-gray?logo=github&logoColor=white" alt="Github"></a>
</p>
<p>Made with ❤️ by Lucas Vieira.</p>
<p>Made with ❤️ by <strong>Lucas Vieira</strong></p>
<p>👉 See also all <a href="https://github.com/lucasvtiradentes/lucasvtiradentes/blob/master/portfolio/PROJECTS.md#TOC">my projects</a></p>
<p>👉 See also all <a href="https://github.com/lucasvtiradentes/my-tutorials#readme">my articles</a></p>
</div>
Loading

0 comments on commit c9f1822

Please sign in to comment.