Skip to content

Commit

Permalink
feat: add first mastodon types
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarogfn committed Apr 17, 2024
1 parent 82ab677 commit f0e8981
Show file tree
Hide file tree
Showing 20 changed files with 4,717 additions and 3,077 deletions.
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"@changesets/changelog-github",
{ "repo": "devhatt/octopost-backend" }
],
"commit": false,
"commit": true,
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@octopost/backend"]
Expand Down
Empty file added .env
Empty file.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
.vscode
build
coverage
dist
coverage
*.env.*
6 changes: 5 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ engine-strict=true
# Enable pre/post scripts
# This is a feature that allows you to run scripts before and after the installation of dependencies.
# https://pnpm.io/npmrc#enable-pre-post-scripts
enable-pre-post-scripts=true
enable-pre-post-scripts=true

# This is a feature that allows you to ignore the workspace root check when running pnpm commands.
# https://pnpm.io/npmrc#ignore-workspace-root-check
ignore-workspace-root-check=true
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# octopost-backend


## Nomenclatura
### Verbos

FindById - Buscar um por Id
FindAll - Buscar todos
Create - Criar
Remove - Remover
Update - Atualizar
4 changes: 4 additions & 0 deletions dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT=3000
HOSTNAME=localhost
OAUTH_MASTODON_CLIENT_SECRET=26i7dYcaL-6SrKN_p2-9eMbI0FypxKTRB7aQ1je53D8
OAUTH_MASTODON_CLIENT_ID=3aZKgaFqNSBKyCt7WAzYb3HxNNvhCXl7WPJUHLYl3l8
25 changes: 16 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import { defineFlatConfig } from 'eslint-define-config';
import tsEslint from 'typescript-eslint';
// import arrayFuncPlugin from 'eslint-plugin-array-func';
// import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
import arrayFuncPlugin from 'eslint-plugin-array-func';
import importPlugin from 'eslint-plugin-import';
import perfectionistPlugin from 'eslint-plugin-perfectionist';
import unicornPlugin, { configs as unicornConfig } from 'eslint-plugin-unicorn';
// import promisePlugin from 'eslint-plugin-promise';
// import noSecretsPlugin from 'eslint-plugin-no-secrets';
// import regexpPlugin from 'eslint-plugin-regexp';
// import writeGoodCommentsPlugin from 'eslint-plugin-write-good-comments';
import onlyWarnPlugin from 'eslint-plugin-only-warn';
import vitestPlugin from 'eslint-plugin-vitest';
import globals from 'globals';

import 'eslint-plugin-only-warn';

export default defineFlatConfig([
// global ignores
{
Expand All @@ -37,16 +33,16 @@ export default defineFlatConfig([
},

{
files: ['**/*'],
files: ['**/*.(js|ts)'],
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
'array-func': arrayFuncPlugin,
import: importPlugin,
'only-warn': onlyWarnPlugin,
perfectionist: perfectionistPlugin,
unicorn: unicornPlugin,
},
Expand All @@ -63,6 +59,7 @@ export default defineFlatConfig([
'import/no-named-as-default-member': 'warn',
'import/no-unused-modules': 'warn',
'import/order': 'warn',
'import/no-default-export': 'warn',

'perfectionist/sort-array-includes': 'warn',
'perfectionist/sort-classes': 'warn',
Expand All @@ -79,8 +76,13 @@ export default defineFlatConfig([

...unicornConfig.recommended.rules,
'unicorn/prevent-abbreviations': 'off',

...arrayFuncPlugin.configs.recommended.rules,
},
settings: {
'import/parsers': {
espree: ['.js', '.cjs', '.mjs', '.jsx'],
},
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
Expand Down Expand Up @@ -121,6 +123,11 @@ export default defineFlatConfig([
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/consistent-type-imports': [
'warn',
{ prefer: 'type-imports' },
],
'@typescript-eslint/consistent-type-exports': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
Expand Down
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"private": "true",
"engines": {
"node": "20",
"pnpm": "8"
"pnpm": "9"
},
"scripts": {
"dev": "tsx --watch src/index.ts",
"dev": " cross-env MODE=DEV tsx --watch src/index.ts",
"start": "node build/index.js",
"prestart": "pnpm run build",
"changeset": "changeset add",
Expand All @@ -28,11 +28,15 @@
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@commitlint/cz-commitlint": "19.2.0",
"@eslint/js": "9.0.0",
"@octopost/types": "workspace:*",
"@types/express": "4.17.21",
"@vitest/coverage-istanbul": "1.5.0",
"axios": "1.6.8",
"commitizen": "4.3.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
Expand All @@ -52,9 +56,16 @@
"tsx": "4.7.2",
"typescript": "5.4.5",
"typescript-eslint": "7.6.0",
"typescript-transform-paths": "3.4.7",
"vite-tsconfig-paths": "4.3.2",
"cross-env": "7.0.3",
"vitest": "1.5.0"
},
"dependencies": {
"dotenv": "16.4.5",
"express": "4.19.2",
"glob": "10.3.12"
},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
Expand All @@ -66,9 +77,5 @@
"prettier --write --ignore-unknown",
"vitest related --run --passWithNoTests --no-cache"
]
},
"dependencies": {
"@changesets/cli": "2.27.1",
"typescript-transform-paths": "3.4.7"
}
}
1 change: 1 addition & 0 deletions packages/types/dist/features/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mastodon';
1 change: 1 addition & 0 deletions packages/types/dist/features/mastodon/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mastodon-auth';
5 changes: 5 additions & 0 deletions packages/types/dist/features/mastodon/mastodon-auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type MastodonAuthRequestBody = {
/** The mastodon instance origin, for example: https://mastodon.social */
instance: string;
};
export type MastodonAuthRequestResponse = string;
1 change: 1 addition & 0 deletions packages/types/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './features';
21 changes: 21 additions & 0 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@octopost/types",
"version": "0.1.0",
"description": "",
"private": false,
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc -p ./tsconfig.json",
"prebuild": "rimraf ./dist",
"version": "changeset version",
"publish": "changeset publish"
},
"author": "@devhat",
"license": "MIT",
"devDependencies": {
"rimraf": "5.0.5"
},
"publishConfig": {
"access": "public"
}
}
1 change: 1 addition & 0 deletions packages/types/src/features/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mastodon';
1 change: 1 addition & 0 deletions packages/types/src/features/mastodon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mastodon-auth';
6 changes: 6 additions & 0 deletions packages/types/src/features/mastodon/mastodon-auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type MastodonAuthRequestBody = {
/** The mastodon instance origin, for example: https://mastodon.social */
instance: string;
};

export type MastodonAuthRequestResponse = string;
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './features';
9 changes: 9 additions & 0 deletions packages/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"]
}
Loading

0 comments on commit f0e8981

Please sign in to comment.