Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use packageManager as a attempt to identify node package manager #1263

Merged
merged 5 commits into from
Jan 21, 2025
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
2 changes: 1 addition & 1 deletion docs/pages/docs/providers/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If [node-canvas](https://www.npmjs.com/package/canvas) is found in the `package.

## Install

All dependencies found in `package.json` are installed with either NPM, Yarn, PNPM, or Bun (depending on the lockfile detected).
All dependencies found in `package.json` are installed with either NPM, Yarn, PNPM, or Bun (depending on `packageManager` field in package.json if present, or the detected lockfile).

## Build

Expand Down
10 changes: 10 additions & 0 deletions examples/node-pnpm-monorepo/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
};
33 changes: 33 additions & 0 deletions examples/node-pnpm-monorepo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo
4 changes: 4 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
};
30 changes: 30 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Getting Started

First, run the development server:

```bash
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const withTM = require("next-transpile-modules")(["ui"]);

module.exports = withTM({
reactStrictMode: true,
});
28 changes: 28 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev --port 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"ui": "*"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"eslint": "7.32.0",
"eslint-config-custom": "*",
"next-transpile-modules": "9.0.0",
"tsconfig": "*",
"@types/node": "^17.0.12",
"@types/react": "18.0.17",
"typescript": "^4.5.3"
},
"packageManager": "[email protected]"
}
10 changes: 10 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Button } from "ui";

export default function Docs() {
return (
<div>
<h1>Docs</h1>
<Button />
</div>
);
}
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
4 changes: 4 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
};
30 changes: 30 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Getting Started

First, run the development server:

```bash
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const withTM = require("next-transpile-modules")(["ui"]);

module.exports = withTM({
reactStrictMode: true,
});
28 changes: 28 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "web",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"ui": "*"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"eslint": "7.32.0",
"eslint-config-custom": "*",
"next-transpile-modules": "9.0.0",
"tsconfig": "*",
"@types/node": "^17.0.12",
"@types/react": "18.0.17",
"typescript": "^4.5.3"
},
"packageManager": "[email protected]"
}
10 changes: 10 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Button } from "ui";

export default function Web() {
return (
<div>
<h1>Web</h1>
<Button />
</div>
);
}
5 changes: 5 additions & 0 deletions examples/node-pnpm-monorepo/apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
25 changes: 25 additions & 0 deletions examples/node-pnpm-monorepo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "node-turborepo",
"version": "0.0.0",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"eslint-config-custom": "*",
"prettier": "latest",
"turbo": "latest"
},
"engines": {
"node": ">=18.0.0"
},
"dependencies": {},
"packageManager": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ["next", "turbo", "prettier"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "eslint-config-custom",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"eslint": "^7.23.0",
"eslint-config-next": "^12.0.8",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "7.31.0",
"eslint-config-turbo": "latest"
},
"devDependencies": {
"typescript": "^4.7.4"
},
"publishConfig": {
"access": "public"
}
}
3 changes: 3 additions & 0 deletions examples/node-pnpm-monorepo/packages/tsconfig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `tsconfig`

These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from.
20 changes: 20 additions & 0 deletions examples/node-pnpm-monorepo/packages/tsconfig/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["node_modules"]
}
22 changes: 22 additions & 0 deletions examples/node-pnpm-monorepo/packages/tsconfig/nextjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}
10 changes: 10 additions & 0 deletions examples/node-pnpm-monorepo/packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "tsconfig",
"version": "0.0.0",
"private": true,
"files": [
"base.json",
"nextjs.json",
"react-library.json"
]
}
11 changes: 11 additions & 0 deletions examples/node-pnpm-monorepo/packages/tsconfig/react-library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx",
"lib": ["ES2015"],
"module": "ESNext",
"target": "es6"
}
}
4 changes: 4 additions & 0 deletions examples/node-pnpm-monorepo/packages/ui/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as React from "react";
export const Button = () => {
return <button>Boop</button>;
};
2 changes: 2 additions & 0 deletions examples/node-pnpm-monorepo/packages/ui/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as React from "react";
export * from "./Button";
19 changes: 19 additions & 0 deletions examples/node-pnpm-monorepo/packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ui",
"version": "0.0.0",
"main": "./index.tsx",
"types": "./index.tsx",
"license": "MIT",
"scripts": {
"lint": "eslint *.ts*"
},
"devDependencies": {
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"eslint": "^7.32.0",
"eslint-config-custom": "*",
"react": "^18.2.0",
"tsconfig": "*",
"typescript": "^4.5.2"
}
}
Loading
Loading