Skip to content

Commit

Permalink
Fix local package bins (remix-run#11763)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Jul 2, 2024
1 parent 0a78b29 commit ec37db8
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/react-router-dev/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require("./dist/cli");
3 changes: 2 additions & 1 deletion packages/react-router-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"bin": {
"react-router": "dist/cli.js"
"react-router": "bin.js"
},
"scripts": {
"tsc": "tsc"
Expand Down Expand Up @@ -91,6 +91,7 @@
},
"files": [
"dist/",
"bin.js",
"CHANGELOG.md",
"LICENSE.md",
"README.md"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router-dev/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function rollup() {
},
input: `${SOURCE_DIR}/cli.ts`,
output: {
banner: createBanner(name, version, { executable: true }),
banner: createBanner(name, version),
dir: OUTPUT_DIR,
format: "cjs",
},
Expand Down
2 changes: 2 additions & 0 deletions packages/react-router-serve/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require("./dist/cli");
3 changes: 2 additions & 1 deletion packages/react-router-serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"license": "MIT",
"bin": {
"react-router-serve": "dist/cli.js"
"react-router-serve": "bin.js"
},
"scripts": {
"tsc": "tsc"
Expand Down Expand Up @@ -40,6 +40,7 @@
},
"files": [
"dist/",
"bin.js",
"CHANGELOG.md",
"LICENSE.md",
"README.md"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router-serve/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function rollup() {
},
input: `${SOURCE_DIR}/cli.ts`,
output: {
banner: createBanner(name, version, { executable: true }),
banner: createBanner(name, version),
dir: OUTPUT_DIR,
format: "cjs",
},
Expand Down
1 change: 0 additions & 1 deletion playground/compiler-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "react-router build",
"dev": "node ./server.js",
"setup": "pnpm i react-router@workspace",
"start": "cross-env NODE_ENV=production node ./server.js",
"typecheck": "tsc"
},
Expand Down
1 change: 0 additions & 1 deletion playground/compiler-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"build": "react-router build",
"dev": "react-router dev",
"preview": "vite preview",
"setup": "pnpm i react-router@workspace",
"typecheck": "tsc"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion playground/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "react-router build",
"dev": "react-router dev",
"setup": "pnpm i @react-router/serve@workspace react-router@workspace",
"start": "react-router-serve ./build/server/index.js",
"typecheck": "tsc"
},
Expand Down
5 changes: 2 additions & 3 deletions rollup.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function getBuildDirectories(packageName, folderName) {
return { SOURCE_DIR, OUTPUT_DIR };
}

function createBanner(packageName, version, { executable = false } = {}) {
let banner = `/**
function createBanner(packageName, version) {
return `/**
* ${packageName} v${version}
*
* Copyright (c) Remix Software Inc.
Expand All @@ -55,7 +55,6 @@ function createBanner(packageName, version, { executable = false } = {}) {
*
* @license MIT
*/`;
return executable ? "#!/usr/bin/env node\n" + banner : banner;
}

// Babel plugin to replace `const REACT_ROUTER_VERSION = "0.0.0";` with the
Expand Down
1 change: 0 additions & 1 deletion scripts/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ async function copyPlayground() {
chalk.green`To start playground, run:`,
"",
`cd ${relativeDestDir}`,
"pnpm setup",
"pnpm dev",
].join("\n")
);
Expand Down

0 comments on commit ec37db8

Please sign in to comment.