Yawancin lokaci, kowane aikin da muke aiki da shi zai sami abubuwan dogaro daban-daban, kuma yana da mahimmanci don sabunta waɗannan abubuwan dogaro saboda dalilai da yawa waɗanda suka haɗa da ingantaccen aiki, tsaro, da gyaran kwaro. Ɗayan irin wannan umarni mai fa'ida don sarrafa fakitinmu a cikin Node.js muhallin sumul shine 'haɓaka zaren'.
Yarn shine manajan kunshin don lambar ku. Yana ba ku damar amfani da raba lamba tare da sauran masu haɓakawa daga ko'ina cikin duniya. Yarn yana yin wannan cikin sauri, amintacce, kuma amintacce don kada ku taɓa damuwa.
Umurnin 'yarn haɓakawa' yana sabunta duk abin dogara zuwa sabon sigar su bisa kewayon da aka kayyade a cikin fayilolin 'package.json', da 'yarn.lock' a cikin kundin tsarin aikin ku.
Ilimi mai amfani don magance matsalar
Don haɓaka takamaiman fakiti, muna amfani da umarni mai zuwa:
yarn upgrade package-name
Inda 'kunshin-name' shine sunan dogara da kuke son haɓakawa.
lura: Idan ba ku ƙididdige sunan fakitin ba, to za a haɓaka duk abubuwan dogaron aikin. Umurnin zai mutunta semver da aka ayyana a cikin fayil ɗin 'package.json'. Idan kuna son haɓaka fakiti zuwa siga a wajen ma'anar semver, yi amfani da alamar '@' kamar:
yarn upgrade package-name@version-number
Hakanan ana iya amfani da tutoci tare da wannan umarni don dalilai daban-daban kamar -last (/-L, –caret, –tilde, –daidai).
Nutse cikin TypeScript
A cikin mahallin TypeScript, ana buƙatar aiki mai kama da 'haɓaka zaren' don sarrafa nau'ikan abubuwan dogaronmu ta hanya mai inganci. 'TypeScript', kamar yadda muka sani, wani babban tsari ne na JavaScript wanda ya tattara zuwa JavaScript bayyananne.
A cikin TypeScript, ana iya sarrafa nau'in fayilolin ma'anar ta amfani da umarnin 'npm install @types/package-name'. Abubuwan fakitin '@types/' sune nau'ikan da DefinitelyTyped aikin ya bayar. Kunshin '@types/' yana da tsari iri ɗaya zuwa fakiti na yau da kullun, amma galibi muna amfani da shi don samun nau'ikan da muke buƙata.
Ka tuna, sarrafa sigar akan wannan nau'in kunshin shima ya zama dole. Don ci gaba da sabunta nau'ikan nau'ikan, ya kamata mu nemi sabuntawa lokaci-lokaci kuma mu tabbatar cewa lambar mu har yanzu tana dacewa da sabbin nau'ikan fayilolin ma'anar nau'in. Don samun ƙarin iko, ya kamata mu tsaya kan takamaiman nau'ikan don guje wa karya lambar mu saboda nau'in canje-canje.
Gudanar da Dakunan karatu & Ayyuka
Kamar yadda muka gani a sama, sarrafa dakunan karatu da ayyuka daban-daban da ke cikin su muhimmin bangare ne na kowane ci gaban aiki. Kasance ɗakin karatu mai alaƙa da ƙarshen gaba kamar React ko Vue, ko baya kamar Express ko Apollo, sabunta shi yana da mahimmanci.
Ta yin amfani da umarnin 'haɓaka zaren' da ƙwazo, za mu iya samun tasiri mai kyau akan ingantaccen ɗakunan karatu da aka yi amfani da su. Ba wannan kaɗai ba, za a iya amfani da fasali da ayyukan da waɗannan ɗakunan karatu suka fallasa don ɗaukar ƙarfin yanayin JavaScript (a cikin mahallin TypeScript).
A ƙarshen rana, duk abin da ke shirin sarrafa juyi cikin inganci don kiyaye duk abin da ke cikin daidaitawa kuma suna yin aikin ci gaba. "