-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from mogeko/dev
Rewrite build scripts with TypeScript
- Loading branch information
Showing
6 changed files
with
81 additions
and
67 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ORIGINALLY FROM CLOUDFLARE WRANGLER: | ||
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js | ||
|
||
import { exec } from "node:child_process"; | ||
import util from "node:util"; | ||
|
||
const execPromise = util.promisify(exec); | ||
|
||
try { | ||
const results = [ | ||
// This script is used by the `release.yml` workflow to update the version of the packages being released. | ||
// The standard step is only to run `changeset version` but this does not update the pnpm-lock.yaml file. | ||
// So we also run `pnpm install`, which does this update. | ||
// This is a workaround until this is handled automatically by `changeset version`. | ||
// See https://github.com/changesets/changesets/issues/421. | ||
await execPromise("pnpm changeset version"), | ||
// Run `pnpm install` to update the pnpm-lock.yaml file. | ||
await execPromise("pnpm install --lockfile-only"), | ||
]; | ||
|
||
console.log(results.map(({ stdout, stderr }) => stdout || stderr).join("\n")); | ||
} catch (error) { | ||
console.error(error.message); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,16 +18,18 @@ | |
"build": "turbo run build && pnpm run meta", | ||
"test": "turbo run test", | ||
"cov": "turbo run cov", | ||
"meta": "node ./scripts/meta.cjs", | ||
"meta": "vite-node ./scripts/meta.ts", | ||
"lint": "turbo run lint", | ||
"fmt": "turbo run fmt" | ||
}, | ||
"devDependencies": { | ||
"@changesets/changelog-github": "^0.5.0", | ||
"@changesets/cli": "^2.27.5", | ||
"@types/node": "^20.14.2", | ||
"prettier": "^3.3.2", | ||
"turbo": "^2.0.4", | ||
"typescript": "^5.4.5" | ||
"typescript": "^5.4.5", | ||
"vite-node": "^1.6.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fs from "node:fs/promises"; | ||
import path from "node:path"; | ||
import pkg from "../package.json"; | ||
|
||
const releasePath = path.resolve(__dirname, "../release"); | ||
const releaseFiles = await fs.readdir(releasePath); | ||
const baseURL = process.env.BASE_URL || "https://mogeko.github.io/userscripts"; | ||
|
||
const meta = { | ||
name: pkg.name, | ||
description: pkg.description, | ||
homepage: pkg.homepage, | ||
author: pkg.author, | ||
license: pkg.license, | ||
resource: releaseFiles | ||
.filter((file) => !file.endsWith("index.json")) | ||
.map((file) => [baseURL, file].join("/")), | ||
packer: "https://www.npmjs.com/package/vite", | ||
env: { | ||
NODE_VERSION: process.version, | ||
RUNNER_OS: process.env.RUNNER_OS, | ||
RUNNER_ARCH: process.env.RUNNER_ARCH, | ||
}, | ||
date: new Date(Date.now()).toISOString(), | ||
}; | ||
|
||
await fs.writeFile( | ||
path.resolve(__dirname, "../release/index.json"), | ||
JSON.stringify(meta, null, 2) | ||
); |