Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Nov 11, 2024
1 parent 31e9f87 commit 2033a4c
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 502 deletions.
70 changes: 35 additions & 35 deletions .github/workflow_scripts/sync-repo.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");

module.exports = async ({ github, context }) => {
const { owner, repo } = context.repo;

try {
const packageJSONPath = path.join(
__dirname,
'..',
'..',
'packages',
'remix-dev',
'package.json'
"..",
"..",
"packages",
"remix-dev",
"package.json"
);

let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf-8"));

const existingVersion = packageJSON.version;

await github.rest.repos.mergeUpstream({
owner,
repo,
branch: 'main',
branch: "main",
});

execSync('git pull origin main');
execSync("git pull origin main");

packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf-8"));

const newVersion = packageJSON.version;

if (existingVersion !== newVersion) {
// Sync the version in the `@vercel/remix` package
const vercelRemixPackageJSONPath = path.join(
__dirname,
'..',
'..',
'packages',
'vercel-remix',
'package.json'
"..",
"..",
"packages",
"vercel-remix",
"package.json"
);
const vercelRemixPackageJSON = JSON.parse(
fs.readFileSync(vercelRemixPackageJSONPath, 'utf-8')
fs.readFileSync(vercelRemixPackageJSONPath, "utf-8")
);
vercelRemixPackageJSON.version =
vercelRemixPackageJSON.peerDependencies['@remix-run/dev'] =
vercelRemixPackageJSON.peerDependencies['@remix-run/node'] =
vercelRemixPackageJSON.peerDependencies['@remix-run/server-runtime'] =
vercelRemixPackageJSON.devDependencies['@remix-run/dev'] =
vercelRemixPackageJSON.devDependencies['@remix-run/node'] =
vercelRemixPackageJSON.devDependencies['@remix-run/server-runtime'] =
vercelRemixPackageJSON.peerDependencies["@remix-run/dev"] =
vercelRemixPackageJSON.peerDependencies["@remix-run/node"] =
vercelRemixPackageJSON.peerDependencies["@remix-run/server-runtime"] =
vercelRemixPackageJSON.devDependencies["@remix-run/dev"] =
vercelRemixPackageJSON.devDependencies["@remix-run/node"] =
vercelRemixPackageJSON.devDependencies["@remix-run/server-runtime"] =
newVersion;
fs.writeFileSync(
vercelRemixPackageJSONPath,
`${JSON.stringify(vercelRemixPackageJSON, null, 2)}\n`
);

execSync('pnpm i --no-frozen-lockfile');
execSync('git config --global user.email infra+release@vercel.com');
execSync('git config --global user.name vercel-release-bot');
execSync("pnpm i --no-frozen-lockfile");
execSync("git config --global user.email infra+release@vercel.com");
execSync("git config --global user.name vercel-release-bot");
execSync(
'git add packages/vercel-remix/package.json pnpm-workspace.yaml pnpm-lock.yaml'
"git add packages/vercel-remix/package.json pnpm-workspace.yaml pnpm-lock.yaml"
);
execSync(`git commit -m "Set version in @vercel/remix to ${newVersion}"`);
execSync('git push origin main');
execSync("git push origin main");

await github.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id: 'publish.yml',
ref: 'main',
workflow_id: "publish.yml",
ref: "main",
});
}
} catch (err) {
// Conflict detected
if (err.status === 409) {
const commit = await github.rest.repos.getCommit({
owner: 'remix-run',
repo: 'remix',
ref: 'main',
owner: "remix-run",
repo: "remix",
ref: "main",
});
const title = 'Merge Conflict ❌';
const title = "Merge Conflict ❌";
const body = `Latest commit: ${commit.data.html_url}
## How to resolve
Expand Down
8 changes: 4 additions & 4 deletions .github/workflow_scripts/trigger-builder-update.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = async ({ github, context }, version) => {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'vercel',
workflow_id: 'update-remix-run-dev.yml',
ref: 'main',
repo: "vercel",
workflow_id: "update-remix-run-dev.yml",
ref: "main",
inputs: {
'new-version': version,
"new-version": version,
},
});
};
26 changes: 13 additions & 13 deletions .github/workflow_scripts/update-package.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

module.exports = async ({ github, context }, versionPostfix) => {
const packagesDir = path.join(__dirname, '..', '..', 'packages');
const packagesDir = path.join(__dirname, "..", "..", "packages");
const devPackageJSONPath = path.join(
packagesDir,
'remix-dev',
'package.json'
"remix-dev",
"package.json"
);
const vercelPackageJSONPath = path.join(
packagesDir,
'vercel-remix',
'package.json'
"vercel-remix",
"package.json"
);

const devPackageJSON = JSON.parse(
fs.readFileSync(devPackageJSONPath, 'utf-8')
fs.readFileSync(devPackageJSONPath, "utf-8")
);

devPackageJSON.name = '@vercel/remix-run-dev';
devPackageJSON.name = "@vercel/remix-run-dev";

if (versionPostfix !== '') {
if (versionPostfix !== "") {
if (!/[a-z]+\.\d+/.test(versionPostfix)) {
throw new Error(
`version-postfix, '${versionPostfix}', is invalid. Must be a word and a number seperated by a '.' character. Example: 'patch.1'`
Expand All @@ -29,18 +29,18 @@ module.exports = async ({ github, context }, versionPostfix) => {
devPackageJSON.version = `${devPackageJSON.version}-${versionPostfix}`;

const vercelPackageJSON = JSON.parse(
fs.readFileSync(vercelPackageJSONPath, 'utf-8')
fs.readFileSync(vercelPackageJSONPath, "utf-8")
);
vercelPackageJSON.version = `${vercelPackageJSON.version}-${versionPostfix}`;
fs.writeFileSync(
vercelPackageJSONPath,
JSON.stringify(vercelPackageJSON, null, 2) + '\n'
JSON.stringify(vercelPackageJSON, null, 2) + "\n"
);
}

fs.writeFileSync(
devPackageJSONPath,
JSON.stringify(devPackageJSON, null, 2) + '\n'
JSON.stringify(devPackageJSON, null, 2) + "\n"
);

return devPackageJSON.version;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install
run: pnpm i
- name: Build
run : pnpm build:vercel
run: pnpm build:vercel
- name: Update package
id: update-package
uses: actions/github-script@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
schedule:
# Once an hour
- cron: '0 * * * *'
- cron: "0 * * * *"

jobs:
build:
Expand All @@ -23,4 +23,4 @@ jobs:
with:
script: |
const script = require('./.github/workflow_scripts/sync-repo.js');
await script({ github, context });
await script({ github, context });
2 changes: 1 addition & 1 deletion packages/remix-dev/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
// This is a compatibility shim for Remix < v1.6.4,
// since the "bin" field used to point to this path.
module.exports = require('./dist/cli');
module.exports = require("./dist/cli");
7 changes: 4 additions & 3 deletions packages/remix-dev/compiler/server/plugins/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { Cancel } from "../../cancel";
* the assets manifest. This is used in the server entry module to access the
* assets manifest in the server build.
*/
export function serverAssetsManifestPlugin(refs: {
manifestChannel: Channel.Type<Manifest>;
},
export function serverAssetsManifestPlugin(
refs: {
manifestChannel: Channel.Type<Manifest>;
},
routes: RouteManifest
): Plugin {
let filter = assetsManifestVirtualModule.filter;
Expand Down
Loading

0 comments on commit 2033a4c

Please sign in to comment.