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(preview): adding standardized preview data cards #697

Merged
merged 13 commits into from
Aug 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 .github/workflows/parser-graphql-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
federated-graph-name: pocket-admin-api
graph-name: parser
schema-file-path: servers/parser-graphql-wrapper/schema.graphql
schema-file-path: servers/parser-graphql-wrapper/schema-admin.graphql
prod-graph-url: https://parser-graphql-wrapper.readitlater.com
dev-graph-url: https://parser-graphql-wrapper.getpocket.dev
secrets:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@pocket-tools/eslint-config": "workspace:*",
"syncpack": "^12.4.0",
"tsconfig": "workspace:*",
"turbo": "^2.0.14"
"turbo": "^2.1.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
8 changes: 8 additions & 0 deletions packages/image-utils/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src
.github
.idea
.prettier*
.eslintrc.js
.tsconfig.js
*.spec.ts
*.integration.ts
3 changes: 3 additions & 0 deletions packages/image-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Image Utils

We use this repository as a place to keep code we use across our backend services that implement anything to do with image urls
3 changes: 3 additions & 0 deletions packages/image-utils/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import packages from '@pocket-tools/eslint-config/packages';
import tseslint from 'typescript-eslint';
export default tseslint.config(...packages);
7 changes: 7 additions & 0 deletions packages/image-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(jest|spec).[jt]s?(x)'],
testPathIgnorePatterns: ['/dist/'],
setupFilesAfterEnv: ['jest-extended/all'],
};
91 changes: 91 additions & 0 deletions packages/image-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@pocket-tools/image-utils",
"version": "0.0.0-development",
"description": "Utilities for working with image urls",
"keywords": [
"image"
],
"repository": {
"type": "git",
"url": "git+https://github.com/Pocket/pocket-monorepo.git"
},
"license": "Apache-2.0",
"author": "",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist",
"package.json"
],
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
},
"release": {
"branches": [
"main"
],
"extends": "semantic-release-monorepo",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"writerOpts": {
"commitsSort": [
"subject",
"scope"
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
},
"dependencies": {
"parse-url": "9.2.0"
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@pocket-tools/eslint-config": "workspace:*",
"@types/jest": "29.5.12",
"@types/node": "^20.16",
"jest": "29.7.0",
"jest-extended": "4.0.2",
"semantic-release": "24.1.0",
"semantic-release-monorepo": "8.0.2",
"ts-jest": "29.2.4",
"ts-node": "10.9.2",
"tsconfig": "workspace:*",
"tsup": "8.2.4",
"typescript": "5.5.4"
},
"peerDependencies": {}
}
1 change: 1 addition & 0 deletions packages/image-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './utils';
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NotFoundError } from '@pocket-tools/apollo-utils';
import { getOriginalUrlIfPocketImageCached } from './utils';

describe('getOriginalUrlIfPocketImageCached', () => {
Expand Down Expand Up @@ -29,8 +28,6 @@ describe('getOriginalUrlIfPocketImageCached', () => {
const url = 'https://pocket-image-cache.com/direct?resize=2000w';
expect(() => {
getOriginalUrlIfPocketImageCached(url);
}).toThrowError(
new NotFoundError('Pocket image cache url is missing a source url'),
);
}).toThrow(new Error('Source URL Missing'));
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NotFoundError } from '@pocket-tools/apollo-utils';
import parseUrl from 'parse-url';

//Functions on this page taken from Web Client.
Expand All @@ -19,7 +18,7 @@ export const getOriginalUrlIfPocketImageCached = (url: string): string => {
if (isEncoded) {
const urlToUse = extractImageCacheUrl(url);
if (!urlToUse) {
throw new NotFoundError('Pocket image cache url is missing a source url');
throw new Error('Source URL Missing');
}
return decodeURIComponent(urlToUse);
}
Expand Down
9 changes: 9 additions & 0 deletions packages/image-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "tsconfig/library.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*.ts", "src/config"]
}
Loading
Loading