Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest): Add auto-retry on 429 #24

Merged
merged 6 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"test:coverage": "vitest --coverage run",
"test:dev": "vitest dev",
"typecheck": "tsc --noEmit"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/cache/src/__tests__/constants.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os from 'node:os';
import path from 'node:path';

import * as constants from '../constants';

describe('@figmarine/cache - constants', () => {
Expand All @@ -6,7 +9,7 @@ describe('@figmarine/cache - constants', () => {
expect(constants).toHaveProperty('DEFAULT_CACHE_PATH');
});
it('scopes cache content with the package name', () => {
expect(constants.DEFAULT_CACHE_PATH.startsWith('/tmp/@figmarine')).toBeTruthy();
expect(constants.DEFAULT_CACHE_PATH.startsWith(path.join(os.tmpdir()))).toBeTruthy();
});
});
describe('YEAR_IN_SECONDS', () => {
Expand Down
13 changes: 11 additions & 2 deletions packages/config-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"url": "https://github.com/Sidnioulz/figmarine",
"directory": "packages/config-eslint"
},
"scripts": {
"build": "tsc"
},
"bugs": {
"url": "https://github.com/Sidnioulz/figmarine/issues"
},
Expand All @@ -23,8 +26,14 @@
"*.js"
],
"exports": {
".": "./index.js",
"./*": "./*.js"
".": {
"types": "./dist/index.d.ts",
"default": "./index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"default": "./*.js"
}
},
"dependencies": {
"@eslint/json": "^0.4.0",
Expand Down
10 changes: 10 additions & 0 deletions packages/config-eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": true
},
"include": ["index.js"]
}
8 changes: 6 additions & 2 deletions packages/config-tsup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"license": "MIT",
"type": "module",
"description": "tsup config package for the Figmarine monorepo",
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "https://github.com/Sidnioulz/figmarine",
Expand All @@ -24,11 +27,12 @@
],
"exports": {
".": {
"types": "./index.d.ts",
"types": "./dist/index.d.ts",
"default": "./index.js"
}
},
"devDependencies": {
"tsup": "^8.2.4"
"tsup": "^8.2.4",
"typescript": "^5.6.2"
}
}
10 changes: 10 additions & 0 deletions packages/config-tsup/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": true
},
"include": ["index.js"]
}
23 changes: 0 additions & 23 deletions packages/config-vitest/index.js

This file was deleted.

13 changes: 13 additions & 0 deletions packages/config-vitest/integration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'vitest/config';

import { coverage } from './shared.js';

export default defineConfig({
test: {
globals: true,
threads: false,
setupFiles: ['./src/__tests__/setupIntegration.ts'],
include: ['**/__tests__/**/*.integration.ts',],
coverage,
},
});
20 changes: 19 additions & 1 deletion packages/config-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"url": "https://github.com/Sidnioulz/figmarine",
"directory": "packages/config-vitest"
},
"scripts": {
"build": "tsc"
},
"bugs": {
"url": "https://github.com/Sidnioulz/figmarine/issues"
},
Expand All @@ -20,9 +23,24 @@
"author": "Steve Dodier-Lazaro",
"homepage": "https://github.com/Sidnioulz/figmarine",
"files": [
"index.js"
"integration.js",
"unit.js"
],
"exports": {
".": {
"types": "./dist/unit.d.ts",
"default": "./unit.js"
},
"./*": {
"types": "./dist/*.d.ts",
"default": "./*.js"
}
},
"dependencies": {
"vitest": "^2.0.5"
},
"devDependencies": {
"typescript": "^5.6.2",
"vite": "^5.4.5"
}
}
16 changes: 16 additions & 0 deletions packages/config-vitest/shared.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const coverage = {
include: [
'**/*.{mjs,mjsx,js,jsx,ts,tsx}',
'!*.config.{js,ts,cjs}',
'!**/coverage/**',
'!**/scripts/**',
'!**/__fixtures__/**',
'!**/__mocks__/**',
'!**/__tests__/**',
'!**/__generated__/**',
'!**/node_modules/**',
'!**/dist/**',
'!**/src/debug.ts',
],
provider: 'istanbul',
};
11 changes: 11 additions & 0 deletions packages/config-vitest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": true,
"types": ["vitest/globals"]
},
"include": ["integration.js", "unit.js"],
}
10 changes: 10 additions & 0 deletions packages/config-vitest/unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vitest/config';

import { coverage } from './shared.js';

export default defineConfig({
test: {
globals: true,
coverage,
},
});
2 changes: 1 addition & 1 deletion packages/cuttings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"test:coverage": "vitest --coverage run",
"test:dev": "vitest dev",
"typecheck": "tsc --noEmit"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"test:coverage": "vitest --coverage run",
"test:dev": "vitest dev",
"typecheck": "tsc --noEmit"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"test:coverage": "vitest --coverage run",
"test:dev": "vitest dev",
"typecheck": "tsc --noEmit"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"test:coverage": "vitest --coverage run",
"test:dev": "vitest dev",
"typecheck": "tsc --noEmit"
},
Expand Down Expand Up @@ -63,6 +63,7 @@
"cacheable": "^0.8.0",
"memfs": "^4.11.1",
"mocked-env": "^1.3.5",
"nock": "^13.5.5",
"swagger-typescript-api": "^13.0.22",
"tsc-watch": "^6.2.0",
"tsup": "^8.2.4",
Expand All @@ -73,6 +74,7 @@
"@figmarine/cache": "workspace:*",
"@figmarine/logger": "workspace:*",
"axios": "^1.7.7",
"axios-cache-interceptor": "^1.6.0"
"axios-cache-interceptor": "^1.6.0",
"axios-retry": "^4.5.0"
}
}
Loading