Blazing Fast Tips: Publishing to NPM

Blazing Fast Tips: Publishing to NPM

Matt Pocock

1 год назад

66,570 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@mr.c0de
@mr.c0de - 06.02.2024 05:02

Nice video, how you can group files index.js and index.d.ts in file explorer?

Ответить
@danwhite2717
@danwhite2717 - 13.01.2024 12:48

Probably one of the best informative videos I’ve seen in a long time

Ответить
@arthurvanleeuwen9650
@arthurvanleeuwen9650 - 01.01.2024 17:10

Awesome! Could you make a tutorial of you how to this while using bun?

Ответить
@lion-gg
@lion-gg - 26.12.2023 13:12

On using "type": "module", config change to "main": "dist/index.cjs", "module": "dist/index.js". Right ?

Ответить
@JoystickStereo
@JoystickStereo - 23.12.2023 12:36

I've been running around in circles all day trying to figure out how to bundle my TS package properly in a way that let's it work properly with 'npm link'. Finally, finally, I've found a video that gives a working process (and in a very concise, easily digestible manner at that)—thank you.

Ответить
@nader2560
@nader2560 - 18.12.2023 12:14

That is great but if you want to deploy a package that has multiple files and you want it to export files individually (like date-fns or lodash to name a few) then you will find zero docs/common best practices to do it online

Ответить
@ironsand
@ironsand - 26.11.2023 19:03

It when from 0-100 so fast! 😂

Ответить
@AdamM
@AdamM - 10.11.2023 00:45

Love this... Would this work with a mono-repo style where you have several packages all with differing versions?

Ответить
@denniseriksson1071
@denniseriksson1071 - 04.11.2023 17:50

Awesome video/videos, thanks! Heads up for a newbie question.. When you publish the package to NPM would you publish it with the same package.json as you have when coding the package? I guess that the final package sent to NPM does not need/need to know the dependency to tsup now when the source code is bundled? Even if they are set as 'devDependencies' do we really need to include them in the final package.json at all?

Ответить
@pablom8854
@pablom8854 - 31.10.2023 22:55

couldn' get the changeset part please make a video about it

Ответить
@CaleMcCollough
@CaleMcCollough - 10.10.2023 21:27

I'm in Windows and I can't run npm changeset. Does anyone else have this problem or know a solution? Thanks. *Update* You have to run npx changeset, but now I'm getting Error: Failed to find where HEAD diverged from main. Does main exist?

Ответить
@totetoBT
@totetoBT - 08.10.2023 16:07

Great summary, just what I was looking for. Nice pace also!

Ответить
@gabrielgomes2041
@gabrielgomes2041 - 06.10.2023 23:03

Hey Matt!

I was following your video and encountered a few issues. I'll list them here along with their respective solutions:

If you are getting this error: EUNSCOPED Can't restrict access to unscoped packages.
it can be 2 things, you package name already is in use, or you are using free NPM and can't publish private packages:

- I use free NPM, so I can't publish a private package, so I have to change:
.changeset/config.json > "access": "restricted" -> "public"

It was my first time using GitHub Actions, so I didn't know I have to change Workflow permissions:
- To change workflow permissions, go to your project settings > actions > general.
- On the bottom of the page, change Workflow permissions to Read and Write.
- Finally, checkmark permissions for RP request.

I hope this helps someone ;)

Ответить
@baldcoder_
@baldcoder_ - 03.10.2023 23:40

I'm sure it's just me being a novice, but Rollup gave me nightmares! No matter what I tried, nothing worked, and don't get me started on the questions I had to go through to resolve path alias errors.

tsup just works! 😍This video is such a life saver, THANK YOU!!!

Ответить
@andrevenancio
@andrevenancio - 29.09.2023 17:50

This looks awesome, but my main question around changeset is how to add it in the context of a monorepo (lets say with turborepo). Video idea right there!

Ответить
@XXlikeabauss
@XXlikeabauss - 29.09.2023 03:50

The fact that this video is < 4 minutes is incredibly appreciated

Ответить
@ricardor8044
@ricardor8044 - 13.09.2023 17:37

This publish thing didn't work for me, too many errors

Ответить
@scriptcomedian
@scriptcomedian - 12.09.2023 18:27

Now its time to do it with the Bun bundler :D

Ответить
@robschilder3092
@robschilder3092 - 12.09.2023 16:52

Anyone know how this differs when using bun?

Ответить
@statecznylukas
@statecznylukas - 08.09.2023 10:07

Does not fully work for me. Build fails with pnpm install --frozen-lock-file. I had to add auto-install-peers=false in .npmrc file, then it works.
Publish however requires GITHUB_TOKEN so I added env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} line in publish.yaml, but github does not allow secret name to start with GITHUB so I'm kinda stuck on publish step.

Ответить
@JaeTask
@JaeTask - 22.08.2023 18:47

Matt, do you still use this method? or do you use another packager now? using vite etc

Ответить
@healingwithlove8614
@healingwithlove8614 - 13.08.2023 16:20

This is what I looking for

Ответить
@dgcp354
@dgcp354 - 12.08.2023 19:22

how can i export css file from the package?

Ответить
@danielnoworyta
@danielnoworyta - 02.08.2023 08:55

Getting publish
Error: The process '/usr/bin/git' failed with exit code 128

Anyone know the answer? :)

Ответить
@prasathsoosaithasan1281
@prasathsoosaithasan1281 - 30.07.2023 10:41

Awesome, thank you. Good introduction to tsup will help me to get rid of my overkill rollup setup.

Ответить
@spiffjekey-green4034
@spiffjekey-green4034 - 20.07.2023 18:43

You made me watch a 3 minutes video in 40 minutes, the content is just too good. Big thanks :)

Ответить
@leumasme
@leumasme - 11.07.2023 02:19

I'd recommend the `wireit` script runner developed by google for all but the most simple `npm run` scripts.

Ответить
@user-rb4kf4ip4r
@user-rb4kf4ip4r - 24.06.2023 16:58

Seriously I had lost hope to support CommonJS and ES6 imports and publish a package ... but at last found your video ... Tks man!!

Ответить
@goodboyneon
@goodboyneon - 16.06.2023 16:22

I just across your channel. Can't belive I've been missing all of these golden content for all these days!

Ответить
@HosamSultan
@HosamSultan - 10.06.2023 00:30

I really can't thank you enough for this condensed video.
The pace made me struggle the first time I watched the video a while ago, but now that I needed the instructions, I know that this pace is all I needed! <3

I also struggled with github actions and workflows at first (because of an authentication problem, and the fact that this is my first time ever to try actions), but when I fussed around with it I learned a lot.
Also, thanks for not using npm by default. I learned a lot about the use of npx to run stuff like changeset and the likes.

A 3 and a half minute video that gave me a crash course for a lifetime. <3

So, thanks a bunch!

Ответить
@AnonAnon-qw3zh
@AnonAnon-qw3zh - 06.06.2023 00:57

publish workflow doesn't work

Ответить
@vpetryniak
@vpetryniak - 27.04.2023 20:51

does it work for building backend nodejs library? Should we bundle backend nodejs libraries?

Ответить
@Luxcium
@Luxcium - 27.04.2023 06:46

Ho other people are asking about monorepo stuff and they do deserve to learn all that jazz from you 😅 oh — Me? No I am just asking for a friend… I am using multi root VSCode workspaces and I started using the Rush Stack but I feel like it is not something that is convivial enough for my workflow 😮

Ответить
@Luxcium
@Luxcium - 27.04.2023 06:43

I would love to have a long form video about each of those topics all alone for maximum understanding… it could be fast paced I love it when it is fast but it should be going more into the details… 🎉🎉🎉🎉

Ответить
@thomas-sinkala
@thomas-sinkala - 20.04.2023 12:02

Thank Matt. Any idea how I can build to a single .js file that could be hosted on a CDN?

Ответить
@samuelwittlinger7790
@samuelwittlinger7790 - 03.04.2023 12:52

I used the bundler and now I am getting a bunch of errors of these 2 types. Does anyone please know how to fix this?

The inferred type of 'router' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@types/express'. This is likely not portable. A type annotation is necessary.
Property 'app' of exported class expression may not be private or protected.ts(4094)

Ответить
@rahulsriram6295
@rahulsriram6295 - 30.03.2023 15:46

Amazing video! But how good it changesets for beta releases?

Ответить
@lakardion
@lakardion - 12.03.2023 01:36

This is exactly what I was looking for. Thank you very much Matt!

Ответить
@whoman7930
@whoman7930 - 25.02.2023 10:17

Would it be the same process for creating a react package?

Ответить
@driverjb09
@driverjb09 - 23.02.2023 17:41

This is great! Any chance you could do a GitLab version of the video?

Ответить
@OdwallaJuice
@OdwallaJuice - 21.02.2023 19:57

One part of the flow I'm confused about is when the changeset action creates a PR? So for example, a changeset would be created in a feature PR and then that would get merged into main. After the feature PR is merged into main, is that when the action creates the new PR for bumping the version and adding the changeset to the changelog? Then once that's merged it publishes the package?

Ответить
@AmodeusR
@AmodeusR - 18.02.2023 04:34

Oof, that looks so unnecessarily complicated ( ̄ヘ ̄;) But probably very handy for big/complex packages.

Ответить
@AmodeusR
@AmodeusR - 18.02.2023 04:28

What's the difference between tsc and tsup?

Ответить
@mrbanana6969
@mrbanana6969 - 08.02.2023 13:12

Nice video. One thing isn't fully clear though. Am I right in saying that with changesets the commit messages don't matter and. the semver bump info is taken fully from when the contributor runs pnpm changeset?

Ответить
@MobiusCoin
@MobiusCoin - 05.02.2023 19:42

I usually use tsc noEmit and then bundle with esbuild. What's tsup and should I be using it instead of esbuild?

Ответить
@somebody656
@somebody656 - 22.01.2023 07:03

Love it. I have been doing my old export to only cjs for a while now. It’s about time my workflow for publish gets a upgrade

Ответить
@DanielKanem
@DanielKanem - 21.01.2023 08:00

Amazing!

Ответить
@romolocodes701
@romolocodes701 - 19.01.2023 02:23

All terminal commands in the video (I think)

pnpm add -D typescript
pnpm tsc --init
git init
pnpm add -D tsup
pnpm run build
pnpm run lint
pnpm add -D @changesets/cli
pnpm changeset init
pnpm changeset
git add . && git commit -m ""
git push

Ответить
@anushibinj
@anushibinj - 18.01.2023 03:38

🤯 Amazing video

Ответить
@sle6423
@sle6423 - 18.01.2023 03:38

This is such a great reference!! Thank you

Would love to see the Deno version next

Ответить