Skip to content

Commit

Permalink
fix: fix issues with incorrect matches for polyfills on Android based…
Browse files Browse the repository at this point in the history
… browsers such as Firefox
  • Loading branch information
wessberg committed Jan 23, 2023
1 parent af353e3 commit 6b66383
Show file tree
Hide file tree
Showing 61 changed files with 6,644 additions and 5,990 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,6 @@ You can also request polyfills from Node, if that's a thing you want to do. It i
not include any polyfills that won't work in a Node environment.

```typescript
// Could be anything, but let's use fetch for this example
const fetch = require("node-fetch");

(async () => {
// Remember to provide a user agent header if you want anything meaningful back
const response = await fetch("https://polyfill.app/api/polyfill?features=intl&context=node");
Expand Down
10 changes: 7 additions & 3 deletions deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(async () => {
const {NodeSSH} = require("node-ssh");
const {satisfies} = require("semver");
const pkg = require("./package.json");
const {join, dirname, basename} = require("path");
const {writeFileSync, readFileSync, existsSync, mkdirSync, copyFileSync, chmodSync, readdirSync} = require("fs");
Expand Down Expand Up @@ -89,7 +90,7 @@ server {
`;


const PREFERRED_NODE_VERSION = "16.x";
const PREFERRED_NODE_VERSION = "19.x";
const APP_NAME = PRODUCTION ? "polyfiller" : "polyfiller-development";
const LOCAL_WRITE_ROOT = RUNNER_TEMP ?? "temp";
const REMOTE_ROOT = `/var/www/${APP_NAME}`;
Expand Down Expand Up @@ -156,8 +157,11 @@ server {

console.log("Checking for Node.js support");
const needsNode = (await ssh.execCommand("which node")).stdout === "";
if (needsNode) {
console.log("Node.js is missing on the host machine. Installing");
const nodeVersion = needsNode ? undefined : (await ssh.execCommand("node -v")).stdout.slice(1);
const hasAcceptableNodeVersion = nodeVersion != null && satisfies(nodeVersion, PREFERRED_NODE_VERSION);
if (needsNode || !hasAcceptableNodeVersion) {
console.log(!needsNode ? `v${nodeVersion} of Node.js is installed on the host machine, which is lower than the requested v${PREFERRED_NODE_VERSION}. Node.js will need to be updated.` : "Node.js is missing on the host machine. Installing");

await ssh.execCommand(`cd ~`);
await ssh.execCommand(`curl -sL https://deb.nodesource.com/setup_${PREFERRED_NODE_VERSION} -o nodesource_setup.sh`);
await ssh.execCommand(`sudo bash nodesource_setup.sh`);
Expand Down
2 changes: 1 addition & 1 deletion file-content-injector.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require("fs");
import fs from "fs";

[
{
Expand Down
Loading

0 comments on commit 6b66383

Please sign in to comment.