Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^srcjs
^\.babelrc$
^\.eslintrc\.js$
^\.flowconfig$
^Gruntfile\.js$
^srcts
^package\.json$
^prettier\.config\.js$
^package-lock\.json$
^tsconfig\.json$
^CODE_OF_CONDUCT\.md$
^node_modules
^bin
^inst/reactlog/reactlogAsset/report\.html$
^flow-typed
^_ignore
^\.lintr$
.*\.js\.map$
Expand All @@ -37,3 +32,4 @@
^\.context$
^\.git$
^\.conductor$
^\.playwright-mcp$
15 changes: 0 additions & 15 deletions .babelrc

This file was deleted.

31 changes: 0 additions & 31 deletions .eslintrc.js

This file was deleted.

29 changes: 0 additions & 29 deletions .flowconfig

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/shiny-target.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Keep the JS build target in step with rstudio/shiny.
# Runs weekly too, because shiny can change without a reactlog PR.
on:
pull_request:
paths:
- "tsconfig.json"
- "package.json"
- "bin/check_shiny_target.js"
- ".github/workflows/shiny-target.yaml"
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:

name: Shiny build target

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
- run: npm run check-shiny-target
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ vignettes/*.pdf
rsconnect/

.Rproj.user
inst/reactlog/reactlogAsset/report.html
node_modules
npm-debug.log*
src_old
Expand All @@ -58,3 +57,4 @@ _ignore
!/.agents/skills/
/.agents/skills/*
!/.agents/skills/memory-bank/
.playwright-mcp/
67 changes: 0 additions & 67 deletions Gruntfile.js

This file was deleted.

71 changes: 71 additions & 0 deletions bin/check_shiny_target.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env node
// Fail if reactlog's tsc / esbuild targets differ from rstudio/shiny's.
// The viewer only runs inside Shiny apps, so it should need no newer browser
// than Shiny does, and gains nothing from an older target.
// Usage: node bin/check_shiny_target.js [shiny-ref] (default: main)

const fs = require("fs");
const path = require("path");

const ref = process.argv[2] || "main";
const root = path.join(__dirname, "..");
const shinyUrl = file =>
`https://raw.githubusercontent.com/rstudio/shiny/${ref}/${file}`;

async function fetchText(file) {
const res = await fetch(shinyUrl(file));
if (!res.ok) throw new Error(`${res.status} fetching ${shinyUrl(file)}`);
return res.text();
}

function match(text, regex, what) {
const m = text.match(regex);
if (!m) throw new Error(`Could not find ${what}`);
return m[1].toLowerCase();
}

async function main() {
const shinyTsconfig = await fetchText("tsconfig.json");
const shinyBuild = await fetchText("srcts/build/_build.ts");

// tsconfig.json files may have comments, so read them with a regex
const tsconfig = fs.readFileSync(path.join(root, "tsconfig.json"), "utf8");
const buildOnly = JSON.parse(
fs.readFileSync(path.join(root, "package.json"), "utf8")
).scripts["build-only"];

const targets = [
[
"shiny tsconfig.json target",
match(shinyTsconfig, /"target":\s*"([^"]+)"/, "target in shiny tsconfig.json"),
],
[
"shiny srcts/build/_build.ts esbuild target",
match(shinyBuild, /target:\s*"([^"]+)"/, "target in shiny _build.ts"),
],
[
"reactlog tsconfig.json target",
match(tsconfig, /"target":\s*"([^"]+)"/, "target in tsconfig.json"),
],
[
"reactlog package.json build-only --target",
match(buildOnly, /--target=(\S+)/, "--target in build-only"),
],
];

for (const [name, value] of targets) console.log(`${value}\t${name}`);

if (new Set(targets.map(([, value]) => value)).size !== 1) {
console.error(
`\nTargets differ from rstudio/shiny@${ref}. Update tsconfig.json ` +
"(target and lib) and the build-only script in package.json to match, " +
"then rebuild."
);
process.exit(1);
}
}

main().catch(err => {
console.error(err.message);
process.exit(1);
});
2 changes: 1 addition & 1 deletion bin/clean_rlog_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# should be used with `npm run fix FILE`

npm run lint -- "$@"
npm run typecheck

npm run build-only
11 changes: 0 additions & 11 deletions bin/flow_report.sh

This file was deleted.

4 changes: 0 additions & 4 deletions flow-typed/npm/@babel/polyfill_v7.x.x.js

This file was deleted.

Loading
Loading