Skip to content

Commit c474936

Browse files
committed
fix(scraper): ignore tests on scrape
1 parent 47edd2e commit c474936

12 files changed

Lines changed: 1680 additions & 1577 deletions

File tree

apps/functions/notify-slack/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
"license": "MIT",
1414
"dependencies": {
1515
"@google-cloud/functions-framework": "3.2.0",
16-
"@google-cloud/storage": "^5.19.3",
17-
"@types/express": "^4.17.13",
16+
"@google-cloud/storage": "^5.20.5",
17+
"@types/express": "^4.17.20",
1818
"dotenv": "16.0.3",
1919
"form-data": "^4.0.0",
20-
"node-fetch": "^2.6.7",
21-
"zod": "3.20.2"
20+
"node-fetch": "^2.7.0",
21+
"zod": "^3.22.4"
2222
},
2323
"devDependencies": {
24-
"@devolunch/shared": "workspace:",
25-
"@pnpm/make-dedicated-lockfile": "^0.5.5",
24+
"@devolunch/shared": "workspace:^",
25+
"@pnpm/make-dedicated-lockfile": "^0.5.10",
2626
"@types/node": "20.1.7",
27-
"@types/node-fetch": "^2.6.1",
28-
"eslint-config-custom": "workspace:",
27+
"@types/node-fetch": "^2.6.7",
28+
"eslint-config-custom": "workspace:^",
2929
"prettier": "2.8.8",
30-
"typescript": "^5.0.4"
30+
"typescript": "^5.2.2"
3131
}
3232
}

apps/functions/notify-slack/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"target": "ESNext",
44
"module": "NodeNext",
5-
"moduleResolution": "node",
5+
"moduleResolution": "NodeNext",
66
"lib": ["ESNext", "dom", "dom.iterable"],
77
"esModuleInterop": true,
88
"strict": true,

apps/functions/scraper/jest.config.cjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ module.exports = {
55
moduleNameMapper: {
66
'^@/(.*)$': '<rootDir>/src/$1',
77
},
8+
testMatch: ['**/src/**/*.test.(ts|tsx)'],
89
transform: {
9-
'^.+\\.tsx?$': ['ts-jest', {}],
10+
'^.+\\.tsx?$': [
11+
'ts-jest',
12+
{
13+
tsconfig: 'tsconfig.jest.json',
14+
},
15+
],
1016
},
1117
};

apps/functions/scraper/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
"license": "MIT",
1818
"dependencies": {
1919
"@google-cloud/functions-framework": "3.2.0",
20-
"@google-cloud/storage": "^5.19.3",
20+
"@google-cloud/storage": "^5.20.5",
2121
"@google-cloud/translate": "^6.3.1",
2222
"dotenv": "16.0.3",
2323
"pdf-parse": "1.1.1",
24-
"puppeteer": "^20.1.2",
24+
"puppeteer": "^20.9.0",
2525
"sharp": "0.32.1",
26-
"zod": "3.20.2"
26+
"zod": "^3.22.4"
2727
},
2828
"devDependencies": {
29-
"@devolunch/shared": "workspace:",
30-
"@pnpm/make-dedicated-lockfile": "^0.5.5",
31-
"@types/express": "^4.17.13",
32-
"@types/jest": "^29.5.5",
29+
"@devolunch/shared": "workspace:^",
30+
"@pnpm/make-dedicated-lockfile": "^0.5.10",
31+
"@types/express": "^4.17.20",
32+
"@types/jest": "^29.5.6",
3333
"@types/node": "20.1.7",
3434
"@types/pdf-parse": "1.1.1",
35-
"eslint-config-custom": "workspace:",
35+
"eslint-config-custom": "workspace:^",
3636
"jest": "^29.7.0",
3737
"prettier": "2.8.8",
3838
"ts-jest": "^29.1.1",
39-
"typescript": "^5.0.4"
39+
"typescript": "^5.2.2"
4040
}
4141
}

apps/functions/scraper/src/scraper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const TIMEOUT = 120000;
1313
export const getRestaurantFilePaths = async (dir: string) => {
1414
const files = await fs.readdir(dir);
1515
let targetFiles = files.filter((file) => {
16-
return path.extname(file).toLowerCase() === '.js';
16+
const extname = path.extname(file).toLowerCase();
17+
const isTestFile = file.toLowerCase().endsWith('.test.js');
18+
return extname === '.js' && !isTestFile;
1719
});
1820

1921
const filesOverride = config.filesOverride?.split(',');
@@ -39,6 +41,7 @@ export const scrapeRestaurant = async (browser: Browser, dir: string, file: stri
3941
const dishes = await browserScrapeFunction(page);
4042

4143
console.log(`Resizing image for ${restaurantMeta.title}`);
44+
4245
// upload image to bucket if there are any
4346
const imageUrl = await resizeImage(restaurantMeta.imageUrl, restaurantMeta.title, {
4447
size: {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"esModuleInterop": true
4+
"module": "NodeNext"
55
},
66
"include": ["src/**/*.test.ts"]
77
}

apps/functions/scraper/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"target": "ESNext",
44
"module": "ESNext",
5-
"moduleResolution": "node",
5+
"moduleResolution": "NodeNext",
66
"lib": ["ESNext", "dom", "dom.iterable"],
77
"esModuleInterop": true,
88
"strict": true,

apps/server/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
},
1212
"dependencies": {
1313
"@devolunch/shared": "workspace:*",
14-
"@google-cloud/storage": "^5.19.3",
15-
"@slack/web-api": "^6.7.1",
14+
"@google-cloud/storage": "^5.20.5",
15+
"@slack/web-api": "^6.9.0",
1616
"compression": "1.7.4",
1717
"cors": "^2.8.5",
1818
"dotenv": "16.0.3",
19-
"express": "^4.17.3",
20-
"zod": "3.20.2"
19+
"express": "^4.18.2",
20+
"zod": "^3.22.4"
2121
},
2222
"devDependencies": {
23-
"eslint-config-custom": "workspace:*",
24-
"@tsconfig/node18": "^2.0.0",
23+
"@tsconfig/node18": "^2.0.1",
2524
"@types/compression": "1.7.2",
26-
"@types/cors": "^2.8.12",
27-
"@types/express": "^4.17.13",
28-
"@types/node": "^20.1.0",
29-
"@types/node-fetch": "^2.6.1",
30-
"nodemon": "^2.0.15",
31-
"pino": "^7.10.0",
25+
"@types/cors": "^2.8.15",
26+
"@types/express": "^4.17.20",
27+
"@types/node": "^20.8.7",
28+
"@types/node-fetch": "^2.6.7",
29+
"eslint-config-custom": "workspace:*",
30+
"nodemon": "^2.0.22",
31+
"pino": "^7.11.0",
3232
"pino-pretty": "^7.6.1",
3333
"prettier": "2.6.2",
34-
"ts-node": "^10.7.0",
35-
"typescript": "^5.0.4"
34+
"ts-node": "^10.9.1",
35+
"typescript": "^5.2.2"
3636
}
3737
}

apps/server/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"noUnusedLocals": true,
1414
"skipLibCheck": true,
1515
"sourceMap": true,
16-
"moduleResolution": "node",
16+
"moduleResolution": "NodeNext",
1717
"composite": false,
1818
"baseUrl": "."
1919
},

package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@
2020
"preinstall": "npx only-allow pnpm"
2121
},
2222
"devDependencies": {
23-
"husky": "^8.0.0",
23+
"husky": "^8.0.3",
2424
"prettier": "^2.8.8",
2525
"turbo": "1.10.7"
26+
},
27+
"pnpm": {
28+
"overrides": {
29+
"got@<11.8.5": ">=11.8.5",
30+
"protobufjs@>=6.10.0 <6.11.4": ">=6.11.4",
31+
"vite@>=4.3.0 <4.3.9": ">=4.3.9",
32+
"semver@<5.7.2": ">=5.7.2",
33+
"semver@>=6.0.0 <6.3.1": ">=6.3.1",
34+
"get-func-name@<2.0.1": ">=2.0.1",
35+
"zod@<=3.22.2": ">=3.22.3",
36+
"postcss@<8.4.31": ">=8.4.31"
37+
}
2638
}
2739
}

0 commit comments

Comments
 (0)