Our great sponsors
pnpm | npm | |
---|---|---|
90 | 48 | |
27,371 | 17,233 | |
2.2% | - | |
9.8 | 2.1 | |
4 days ago | over 3 years ago | |
TypeScript | JavaScript | |
MIT License | Artistic License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pnpm
-
Unit Testing in Node.js and TypeScript: A Comprehensive Guide with Jest Integration
A package manager such as npm, Yarn, or pnpm. A package manager is a tool that helps you manage the dependencies of your project. You can use any of these package managers to install Jest and other packages.
-
Effective nodejs version management for the busy developer
I also recommend using pnpm as a package manager, it's faster and more efficient than npm or yarn with great capabilities concerning monorepo setup. On recent nodejs versions (v16.13+), you can install it easily with:
-
.dockerignore being ignored by docker-compose? no space left on device
FROM node:21-alpine AS base FROM base AS builder Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. RUN apk add --no-cache libc6-compat RUN apk update Set working directory WORKDIR /app Install pnpm with corepack RUN corepack enable && corepack prepare pnpm@latest --activate Enable pnpm add --global on Alpine Linux by setting home location environment variable to a location already in $PATH https://github.com/pnpm/pnpm/issues/784#issuecomment-1518582235 ENV PNPM_HOME=/usr/local/bin RUN pnpm install turbo --global COPY . . RUN turbo prune web --docker Add lockfile and package.json's of isolated subworkspace FROM base AS installer RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /app First install the dependencies (as they change less often) COPY .gitignore .gitignore COPY --from=builder /app/out/json/ . COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml RUN pnpm install Build the project COPY --from=builder /app/out/full/ . RUN pnpm turbo run build --filter=web FROM base AS runner WORKDIR /app Don't run production as root RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs USER nextjs COPY --from=installer /app/apps/web/next.config.js . COPY --from=installer /app/apps/web/package.json . Automatically leverage output traces to reduce image size https://nextjs.org/docs/advanced-features/output-file-tracing COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public CMD node apps/web/server.js
-
NPMprune: Remove unnecessary files from node_modules to optimize storage
I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.
-
how to manage node modules in every proj?
Also maybe try https://pnpm.io/ which aparently does linking or something for you, havent used it.
-
Yarn 4.0
│ └── tsconfig.json
Whenever pnpm installs workspace dependencies, it installs them at the root of the workspace, (in the tore inside the docker build image of course, not on the host), and those are the dependencies for all 3 packages all together in one virtual store, here:
./node_modules/.pnpm
So, when I want to create my container image for say packages/app1, I don't see how I could copy only my dependencies for that app from the build image like this:
COPY --from=deps /app/packages/app2/node_modules/ /app/packages/app2/node_modules
Because while of course the dependencies are installed in the build image, they are at the root of the workspace in virtual store there, and not in /app/packages/app2/node_modules/ – this directory only contains symlinks to the root virtual store.
Of course I can copy all the dependencies from the root virtual store of the build image into my image, but then those are the dependencies for ALL packages in the workspace, not just for app1
I suppose I could try to install only the dependencies for app1, but this is broken with the default pnpm settings at the moment (it still installs dependencies for everything in the workspace)
-
Building a Minimalist Docker Image with Node, TypeScript
FROM node:18.16.0-alpine RUN apk add \ curl \ git \ && rm -rf /var/cache/* \ && mkdir /var/cache/apk RUN mkdir -p /app WORKDIR /app RUN mkdir -p /bin && curl -fsSL "https://github.com/pnpm/pnpm/releases/download/v8.6.3/pnpm-linuxstatic-x64" -o /bin/pnpm; chmod +x /bin/pnpm; ENV PATH /app/node_modules/.bin:$PATH ADD package.json pnpm-lock.yaml .npmrc /app/ RUN pnpm install ADD . /app RUN pnpm run build EXPOSE 5000 CMD [ "pnpm", "start" ]
-
Lockfile merge conflicts, how to handle it correctly?
The conflict resolution algorithm for pnpm is maintained by the @pnpm/merge-lockfile-changes project.
-
Releasing local.ai - an LLM local playground with minimal setup
What version of pnpm are you using? I found this issue, maybe it's related?
-
Why is PNPM not supported in Expo app?
Please check here https://github.com/nrwl/nx-labs/issues/34 and here https://github.com/pnpm/pnpm/issues/1501
npm
-
XML is better than YAML
The fact that JSON doesn't support comments is so annoying, and I always thought that Douglas Crockford's rationale for this basically made no sense ("They can be misused!" - like, so what, nearly anything can be misused. So without support for comments e.g. in package.json files I have to do even worse hacky workaround bullshit like "__some_field_comment": "this is my comment"). There is of course jsonc and JSON5 but the fact that it's not supported everywhere means 10 years later we still can't write comments in package.json (there is https://github.com/npm/npm/issues/4482 and about a million related issues).
-
Jest not recommended to be used in Node.js due to instanceOf operator issues
Things like the sparkline charts on npmjs (e.g. https://www.npmjs.com/package/npm ) are interactive SVGs. I think they're pretty common for data visualizations of all kinds
-
JavaScript registry NPM vulnerable to 'manifest confusion' abuse
I actually did a POC 7 years ago about this - https://github.com/tanepiper/steal-ur-stuff
It was reported to npm at the time, but they chose to ignore it - https://github.com/npm/npm/issues/17724
-
I'm a Teapot
Every time this pops up, I'm reminded of the day that the NPM registry started returning 418 responses.
I remember being at a training course that day and my manager asking me what we could do to fix it because our CI was failing to pull dependencies from NPM.
Trying to explain that NPM was returning a status code intended as an April Fools joke and which was never meant to see the light of production was quite difficult
-
Dissecting Npm Malware: Five Packages And Their Evil Install Scripts
I should really get around to how I discovered this 6 years ago and still nothing done about it
-
Attackers are hiding malware in minified packages distributed to NPM
Whenever something like this comes up I usually have to tap the sign (and the original report)
-
A not so unfortunate sharp edge in Pipenv
> which can be overriden with env setting
Support for this is not great. Lots of packages still don't support this properly. My experience matches the 2015 comment https://github.com/npm/npm/issues/775#issuecomment-71294085
> Not sure why "symlinks" would be involved.
If you make your node_modules a symlink, multiple packages will fail. Even if you're not interested in doing that, others are.
> What NPM does is leaps and bounds ahead
Unless you change your node / gyp version. It doesn't really have a concept of runtime version. You can restrict it, but not have two concurrent versions if they conflict.
-
Front-end Guide
[email protected] was released in May 2017 and it seems to address many of the issues that Yarn aims to solve. Do keep an eye on it!
-
Framework axios pushed a broken update, crippling thousands of websites
I think it's had been supposed to do that since forever. Apart from some bug in npm 5.3. Are you sure your package-lock versions actually conform to the semver ranges in your package.json?
- Should we tell him?
What are some alternatives?
nx - Smart Monorepos · Fast CI
lerna - :dragon: Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
berry - 📦🐈 Active development trunk for Yarn ⚒
yarn - The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
deno - A modern runtime for JavaScript and TypeScript.
corepack - Zero-runtime-dependency package acting as bridge between Node projects and their package managers
Bower - A package manager for the web
spm
npm-check-updates - Find newer versions of package dependencies than what your package.json allows
jspm