yalc | Work with yarn/npm packages locally like a boss | Build Tool library
kandi X-RAY | yalc Summary
kandi X-RAY | yalc Summary
Better workflow than npm | yarn link for package authors.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of yalc
yalc Key Features
yalc Examples and Code Snippets
Community Discussions
Trending Discussions on yalc
QUESTION
After a huge package upgrade, when running Jest tests on our application, we have this error :
...ANSWER
Answered 2022-Mar-02 at 16:48Updating Jest and Babel (and all our modules) fixed the bug...
QUESTION
I have an application built with NextJs (and React) and mobx-state-tree (but could be context or redux) as a package manager. All the stores are created and handled in an npm package called SMK (state management kit) that I created to make the sub-stores reusable in my mobile and web application.
How it works:
- Create the sub-store with
models
,actions
andviews
on the SMK and export it as a module. - Add the SMK using
yarn add @my-repo/smk
. - Create the root store in my app and import the sub-store from SMK as a child of the root store.
- Build and start the app and everything is working well.
But I need to run and publish the SMK locally to make it easier development. The solution I used to use is yalc.
Using yalc and running it locally this is the process:
- In the SMK, runs
yarn start
. (This will donodemon --ignore src/index.ts -e js,ts,tsx,json --watch src/ --exec yalc push --scripts
) - In the APP, runs
yalc add @my-repo/smk
. (This will add a dependency like"@my-repo/smk": "file:.yalc/@my-repo/smk"
). - In the APP, runs
yarn build
and thenyarn start
And voila! Everything is working perfect, any change I did locally on my SMK is working perfectly on the APP.
BUT, when I run yarn dev
that do next dev
as default of NextJs it doesn't work.
Error explanation: As I only added the setTestingState
and testingState
locally, it's saying that it doesn't exist.
Possible reason: The fast refresh is not refreshing the cache properly.
I've tried:
- Add
// @refresh reset
to force it, but didn't work. - Stop and start the application.
- Build, start and then run dev. (works for build and not for dev)
What is the solution/workaround to solve this issue with yarn dev
and yalc
?
ANSWER
Answered 2021-Dec-20 at 17:33Looks like it's a bug on NextJs and we can find some devs asking to NextJs to allow us to disable the Fast Refresh, and looks like they don't care or just don't have the intention to change it.
So, I found a third-party library, next-remote-watch, that is solving this issue for me. Basically, is an alternative script to use instead of next dev
and it will do a quick and simply build and active a watcher.
At package.json
use
QUESTION
Windows 10 Docker Desktop on WSL2
Goal: serve an angular app from my devcontainer over my local network (specifically for testing on mobile)
Reproduce:
- Create a hello world angular application in a clean git repo
- clone the repo into a new devcontainer (Typescript/Node)
- serve the applcation
Things I've tried (and every permutation herein):
--network=host
(Never worked on windows, but thought it might on WSL2 - doesn't)- EXPOSE 4200
- runArgs: "-p 4200:4200"
- appPort: [4200]
- opening port 4200 on PC firewall
- ng serve --host 0.0.0.0 --port 4200
Additional Information:
- ng serve does allow me to view the site on my host machine
- cloning the repo to my host and running
ng serve --host 0.0.0.0
does allow me to access the site over my network (but moving in and out of the devcontainer isn't reasonable)
My current DockerFile
is pretty vanilla:
ANSWER
Answered 2021-Oct-19 at 18:47DockerFile
QUESTION
I'm working on an NPM package that is intended for use solely via npx *
, a la packages like create-nuxt-app
.
Is there a way to test my package with npx *
? In other words, run my bin script without installing the package.
I've read this discussion, which suggests perhaps there isn't. I realise I can test the installation, rather than mere running, of my a packge via something like Yalc, but Yalc provides only yalc add *
, which simulates npm install *
, not npx *
.
What's the best approach here?
...ANSWER
Answered 2021-Jul-10 at 12:41After much digging and discussion it seems npm init *
is identical to npx *
provided the package name begins with create-
. (Source).
So:
QUESTION
I have two projects specified in the jest section of my package.json
.
ANSWER
Answered 2020-May-13 at 13:29Turns out I was overwriting my common jest config with the Object.assign(..)
and thus stopping whichever project was first in the list of projects.
To fix this, I was able to make a deep copy of it before using the assign instead.
QUESTION
Intro: I've generated two projects with vue-cli ~4.2.0:
parent-app
- main projectdummylib
- library which is imported byparent-app
. Has a bunch of.vue
components inside.
Currently, parent-app
works fine in dev mode with dummylib
being imported into it. All dummylib
's vue-components are rendering ok.
Problem: I want to edit dummylib
and see changes on the fly, as it takes place with parent-app
: without having to rebuild it after each code modification.
My current library development process:
- (
dummylib
):yalc publish
- assuming it has been built already - (
parent-app
):yalc link dummylib
- (
parent-app
):npm serve
- start local development - Editing
dummylib
... - (
dummylib
):npm build
- !!! Want to avoid this step !!! - (
dummylib
):yalc publish --push
- After this, I see my edits from (4) being applied...
So are there any options to avoid (5)? I've also thought about monorepo, but decided not to have it currently.
...ANSWER
Answered 2020-Mar-26 at 10:17Finally, got it working by adding:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yalc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page