From e255c358cba2253e3c5e08827068da31241e1bad Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 5 May 2024 17:45:23 +0100 Subject: [PATCH] Updates configration for Vercel and Typescript --- serverless.yml | 256 ------------------------------------------------- tsconfig.json | 17 +++- vercel.json | 22 +++++ 3 files changed, 37 insertions(+), 258 deletions(-) delete mode 100644 serverless.yml diff --git a/serverless.yml b/serverless.yml deleted file mode 100644 index b81b754..0000000 --- a/serverless.yml +++ /dev/null @@ -1,256 +0,0 @@ -service: web-check-api - -provider: - name: aws - runtime: nodejs14.x - region: us-east-1 - # environment: - # GOOGLE_CLOUD_API_KEY: ${ssm:GOOGLE_CLOUD_API_KEY~true, ''} - # TORRENT_IP_API_KEY: ${ssm:TORRENT_IP_API_KEY~true, ''} - # SECURITY_TRAILS_API_KEY: ${ssm:SECURITY_TRAILS_API_KEY~true, ''} - # BUILT_WITH_API_KEY: ${ssm:BUILT_WITH_API_KEY~true, ''} - # URL_SCAN_API_KEY: ${ssm:URL_SCAN_API_KEY~true, ''} - # TRANCO_USERNAME: ${ssm:TRANCO_USERNAME~true, ''} - # TRANCO_API_KEY: ${ssm:TRANCO_API_KEY~true, ''} - # CLOUDMERSIVE_API_KEY: ${ssm:CLOUDMERSIVE_API_KEY~true, ''} - # CHROME_PATH: ${ssm:CHROME_PATH~true, ''} - # API_TIMEOUT_LIMIT: ${ssm:API_TIMEOUT_LIMIT~true, ''} - # API_CORS_ORIGIN: ${ssm:API_CORS_ORIGIN~true, ''} - iamRoleStatements: - - Effect: Allow - Action: - - ssm:GetParameter - Resource: - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/GOOGLE_CLOUD_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/TORRENT_IP_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/SECURITY_TRAILS_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/BUILT_WITH_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/URL_SCAN_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/TRANCO_USERNAME - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/TRANCO_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/CLOUDMERSIVE_API_KEY - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/CHROME_PATH - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/API_TIMEOUT_LIMIT - - arn:aws:ssm:us-east-1:${env:AWS_ACCOUNT_ID}:parameter/API_CORS_ORIGIN -functions: - archives: - handler: api/archives.handler - events: - - http: - path: api/archives - method: get - blockLists: - handler: api/block-lists.handler - events: - - http: - path: api/block-lists - method: get - carbon: - handler: api/carbon.handler - events: - - http: - path: api/carbon - method: get - cookies: - handler: api/cookies.handler - events: - - http: - path: api/cookies - method: get - dnsServer: - handler: api/dns-server.handler - events: - - http: - path: api/dns-server - method: get - dns: - handler: api/dns.handler - events: - - http: - path: api/dns - method: get - dnssec: - handler: api/dnssec.handler - events: - - http: - path: api/dnssec - method: get - features: - handler: api/features.handler - events: - - http: - path: api/features - method: get - firewall: - handler: api/firewall.handler - events: - - http: - path: api/firewall - method: get - getIp: - handler: api/get-ip.handler - events: - - http: - path: api/get-ip - method: get - headers: - handler: api/headers.handler - events: - - http: - path: api/headers - method: get - hsts: - handler: api/hsts.handler - events: - - http: - path: api/hsts - method: get - httpSecurity: - handler: api/http-security.handler - events: - - http: - path: api/http-security - method: get - legacyRank: - handler: api/legacy-rank.handler - events: - - http: - path: api/legacy-rank - method: get - linkedPages: - handler: api/linked-pages.handler - events: - - http: - path: api/linked-pages - method: get - mailConfig: - handler: api/mail-config.handler - events: - - http: - path: api/mail-config - method: get - ports: - handler: api/ports.handler - events: - - http: - path: api/ports - method: get - quality: - handler: api/quality.handler - events: - - http: - path: api/quality - method: get - rank: - handler: api/rank.handler - events: - - http: - path: api/rank - method: get - redirects: - handler: api/redirects.handler - events: - - http: - path: api/redirects - method: get - robotsTxt: - handler: api/robots-txt.handler - events: - - http: - path: api/robots-txt - method: get - screenshot: - handler: api/screenshot.handler - events: - - http: - path: api/screenshot - method: get - securityTxt: - handler: api/security-txt.handler - events: - - http: - path: api/security-txt - method: get - sitemap: - handler: api/sitemap.handler - events: - - http: - path: api/sitemap - method: get - socialTags: - handler: api/social-tags.handler - events: - - http: - path: api/social-tags - method: get - ssl: - handler: api/ssl.handler - events: - - http: - path: api/ssl - method: get - status: - handler: api/status.handler - events: - - http: - path: api/status - method: get - techStack: - handler: api/tech-stack.handler - events: - - http: - path: api/tech-stack - method: get - threats: - handler: api/threats.handler - events: - - http: - path: api/threats - method: get - tls: - handler: api/tls.handler - events: - - http: - path: api/tls - method: get - traceRoute: - handler: api/trace-route.handler - events: - - http: - path: api/trace-route - method: get - txtRecords: - handler: api/txt-records.handler - events: - - http: - path: api/txt-records - method: get - whois: - handler: api/whois.handler - events: - - http: - path: api/whois - method: get - - -plugins: - - serverless-webpack - # - serverless-domain-manager - # - serverless-offline - -custom: - webpack: - webpackConfig: 'api/_common/aws-webpack.config.js' - includeModules: false - packagerOptions: - noInstall: true - - # customDomain: - # domainName: example.com - # basePath: 'api' - # stage: ${self:provider.stage} - # createRoute53Record: true - - # serverless-offline: - # prefix: '' - # httpPort: 3000 diff --git a/tsconfig.json b/tsconfig.json index 947bbc1..dffb624 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,17 @@ "target": "ES2020", "module": "ES2020", "moduleResolution": "node", - "lib": ["DOM", "DOM.Iterable", "ES2020"], + "allowImportingTsExtensions": true, + "plugins": [ + { + "name": "@astrojs/ts-plugin" + }, + ], + "lib": [ + "DOM", + "DOM.Iterable", + "ES2020" + ], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -16,6 +26,9 @@ "noEmit": true, "jsx": "react-jsx", "baseUrl": "src", + "jsxImportSource": "react" }, - "include": [ "src" ] + "include": [ + "src" + ] } diff --git a/vercel.json b/vercel.json index 4f6e76c..9491afa 100644 --- a/vercel.json +++ b/vercel.json @@ -1,7 +1,29 @@ { + "version": 2, + "routes": [ + { + "src": "/api/(.*)", + "dest": "/api/$1.js" + } + ], "functions": { "api/*.js": { "maxDuration": 10 } + }, + "env": { + "PLATFORM": "vercel", + "CI": "false", + "CHROME_PATH": "/usr/bin/chromium", + "NODE_VERSION": "21.x", + "GOOGLE_CLOUD_API_KEY": "", + "BUILT_WITH_API_KEY": "", + "REACT_APP_SHODAN_API_KEY": "", + "REACT_APP_WHO_API_KEY": "" + }, + "build": { + "env": { + "PLATFORM": "vercel" + } } }