yalc:像老板一样在本地使用yarnnpm软件包

  • z2_644194
    了解作者
  • 86.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-04 01:43
    上传日期
Yalc 比npm更好的工作流程| 纱包作者的链接。 为什么 在开发和创作多个程序包(私有程序包或公共程序包)时,通常会发现自己需要在本地环境中正在使用的其他项目中使用最新的/ WIP版本,而无需将这些程序包发布到远程注册表中。 NPM和Yarn通过类似的( npm/yarn link )解决了这个问题。 尽管这可能在许多情况下可行,但它经常带来讨厌的相关性解析,文件系统之间符号链接互操作性等问题。 什么 对于要在本地环境中共享的本地开发软件包, yalc充当非常简单的本地存储库。 在程序包目录中运行yalc publish时,它仅yalc publish应发布到NPM的文件,并将它们放在特殊的全局存储中(例如,位于~/.yalc )。 当您运行yalc add my-package在你的project它拉包内容到.yalc在当前文件夹并注入一个file: / link:依赖到package.json 。 或者,您可以使用yalc link my-package ,它将在node_modules创建到包内容的符号链接,并且不会触摸package.json (就像npm/yarn
yalc-master.zip
内容介绍
# Yalc > Better workflow than **npm | yarn link** for package authors. ## Why When developing and authoring multiple packages (private or public), you often find yourself in need of using the latest/WIP versions in other projects that you are working on in your local environment **without publishing those packages to the remote registry.** NPM and Yarn address this issue with a similar approach of [symlinked packages](https://docs.npmjs.com/cli/link) (`npm/yarn link`). Though this may work in many cases, it often brings nasty [constraints and problems](https://github.com/yarnpkg/yarn/issues/1761#issuecomment-259706202) with dependency resolution, symlink interoperability between file systems, etc. ## What - `yalc` acts as very simple local repository for your locally developed packages that you want to share across your local environment. - When you run `yalc publish` in the package directory, it grabs only files that should be published to NPM and _puts_ them in a special global store (located, for example, in `~/.yalc`). - When you run `yalc add my-package` in your `project` it _pulls_ package content into `.yalc` in the current folder and injects a `file:`/`link:` dependency into `package.json`. Alternatively, you may use `yalc link my-package` which will create a symlink to the package content in `node_modules` and will not touch `package.json` (like `npm/yarn link` does), or you even may use it with **Yarn workspaces**. - `yalc` creates a special `yalc.lock` file in your project (similar to `yarn.lock` and `package-lock.json`) that is used to ensure consistency while performing `yalc`'s routines. - `yalc` can be used with projects where `yarn` or `npm` package managers are used for managing `package.json` dependencies. ## Installation ![npm (scoped)](https://img.shields.io/npm/v/yalc.svg?maxAge=86400) [![Build Status](https://travis-ci.org/whitecolor/yalc.svg?branch=master)](https://travis-ci.org/whitecolor/yalc) Using NPM: ``` npm i yalc -g ``` Using Yarn: ``` yarn global add yalc ``` Some documented features might not have been published yet, see the [change log](./CHANGELOG.md). ## Usage ### Publish - Run `yalc publish` in your dependency package `my-package`. - It will copy [all the files that should be published in remote NPM registry](https://docs.npmjs.com/files/package.json#files). - If your package has any of these lifecycle scripts: `prepublish`, `prepare`, `prepublishOnly`, `prepack`, `preyalcpublish`, they will run before in this order. If your package has any of these: `postyalcpublish`, `postpack`, `publish`, `postpublish`, they will run after in this order. Use `--no-scripts` to publish without running scripts. - While copying package content, `yalc` calculates the hash signature of all files and, by default, adds this signature to the package manifest `version`. You can disable this by using the `--no-sig` option. - You may also use `.yalcignore` to exclude files from publishing to yalc repo, for example, files like README.md, etc. - `--files` flag will show included files in the published package - **NB!** In terms of which files will be included in the package `yalc` fully supposed to emulate behavior of `npm` client (`npm pack`). [If you have nested `.yalc` folder in your package](https://github.com/whitecolor/yalc/issues/95) that you are going to publish with `yalc` and you use `package.json` `files` list, it should be included there explicitly. - **NB!** Windows users should make sure the `LF` new line symbol is used in published sources; it may be needed for some packages to work correctly (for example, `bin` scripts). `yalc` won't convert line endings for you (because `npm` and `yarn` won't either). - **NB!** Note that, if you want to include `.yalc` folder in published package content, you should add `!.yalc` line to `.npmignore`. - [Easily propagate package updates everywhere.](#pushing-updates-automatically-to-all-installations) - Yalc by default resolve `workspace:` protocol in dependencies, to omit this use `-no-workspace-resolve` flag ### Add - Run `yalc add my-package` in your dependent project, which will copy the current version from the store to your project's `.yalc` folder and inject a `file:.yalc/my-package` dependency into `package.json`. - You may specify a particular version with `yalc add my-package@version`. This version will be fixed in `yalc.lock` and will not affect newly published versions during updates. - Use the `--link` option to add a `link:` dependency instead of `file:`. - Use the `--dev` option to add yalc package to dev dependencies. - With `--pure` flag it will not touch `package.json` file, nor it will touch modules folder, this is useful for example when working with [**Yarn workspaces**](https://yarnpkg.com/lang/en/docs/workspaces/) (read below in _Advanced usage_ section) ### Link - As an alternative to `add`, you can use the `link` command which is similar to `npm/yarn link`, except that the symlink source will be not the global link directory but the local `.yalc` folder of your project. - After `yalc` copies package content to `.yalc` folder it will create a symlink: `project/.yalc/my-package ==> project/node_modules/my-package`. It will not touch `package.json` in this case. ### Update - Run `yalc update my-package` to update the latest version from store. - Run `yalc update` to update all the packages found in `yalc.lock`. - While update if yalc'ed package has `scripts.postupdate` this command will run in host package dir. - `preyalc` and `postyalc` scripts will be executed in target package on add/update operations which are performed while `push` - if need to perform pre/post `scripts` on update of particular package use `(pre|post)yalc.package-name` name for script in your `package.json`. - update `--update` (`--upgrade`, `--up`) to run package managers's update command for packages. ### Remove - Run `yalc remove my-package`, it will remove package info from `package.json` and `yalc.lock` - Run `yalc remove --all` to remove all packages from project. ### Installations - Run `yalc installations clean my-package` to unpublish a package published with `yalc publish` - Run `yalc installations show my-package` to show all packages to which `my-package` has been installed. ## Advanced usage ### Pushing updates automatically to all installations - When you run `yalc add|link|update`, the project's package locations are tracked and saved, so `yalc` knows where each package in the store is being used in your local environment. - `yalc publish --push` will publish your package to the store and propagate all changes to existing `yalc` package installations (this will actually do `update` operation on the location). - `yalc push` - is a use shortcut command for push operation (which will likely become your primarily used command for publication): - `force` options is `true` by default, so it won't run `pre/post` scripts (may change this with `--no-force` flag). - `scripts.postupdate` will be executed in host package dir, like while `update` operation. - With `--changed` flag yalc will first check if package content has changed before publishing and pushing, it is a quick operation and may be useful for _file watching scenarios_ with pushing on changes. - Use `--replace` option to force replacement of package content. - Use `preyalc` and `postyalc` (read in `update` docs) to execute needed script on every push. - Use `--update` to run `yarn/npm/pnpm update` command for pushed packages. ### Keep it out of git - If you are using `yalc'ed` modules temporarily during development, first add `.yalc` and `yalc.lock` to `.gitignore`. - Use `yalc link`, that won't touch `package.json` - If you use `yalc add` it will change `package.json`, and ads `file:`/`link:` dependencies, if you may want to use `yalc check` in the [precommit hook](https://github.com/typicode/husky) which will check package.json for `yalc'ed` dependencies and exits with an error if you forgot
评论
    相关推荐
    • pyTorch_RNN_Examples:在Pytorch中使用RNN进行序列学习
      在Pytorch中使用RNN进行序列学习 这里介绍了很少使用RNN进行序列学习的问题。 维护主要是出于学习的敏锐度。 如果您正在寻找可重用的最佳解决方案,那么此回购协议就不适合您的要求我将尝试添加更多的解释性数字,并...
    • clockwork-rnn-in-pytorch:该存储库包含使用pytorch的发条rnn的实现
      发条上的发条 该存储库包含使用pytorch的发条rnn的实现
    • is13:RNN用于口语理解
      为了重现结果,请确保已安装Theano且存储库在您的PYTHONPATH ,例如,运行命令export PYTHONPATH=/path/where/is13/is:$PYTHONPATH 。 然后,运行以下命令: git clone git@github.com:mesnilgr/is13.git python ...
    • RNN_Aquaponics
      您可以在存储库中找到以下文件: Aquaponics数据摘要.pdf -Aquaponics工厂中所有传感器的描述 dataset_aquaponics_03232021_03292021.txt-包含传感器信息的原始数据集,从20/02/20到29/03/2021 download_data_...
    • DREAM:基于rnn的建议模型
      存储库包含我对下一个购物篮预测的DREAM实现。 此外,我将DREAM框架扩展为对预测方案进行重新排序。 它帮助我在Kaggle Instacart重新排序预测比赛中获得了39/2669的席位。 对于任何有兴趣的人,请查看以获取有关...
    • RNN:递归神经网络模型用于纠错
      存储库提供了在描述的各种模型的源代码。 该项目旨在实现和评估神经网络模型,特别是递归神经网络(RNN),双向递归神经网络(BRNN),序列到序列(seq-to-seq)模型以及最终基于注意力的机制。序列到序列模型。 ...
    • DEEP-LEARNING:RNN和CNN
      存储库包含两个项目-1)基于CNN(Counvolutional Neural Network) 2)Based on RNN(Recurrent neural network) 1)CNN: 该模型可以识别图像中的花朵!! 模型将输入的图像分为5类-> 1)雏菊> 2)蒲公英> 3)...
    • CSI_prediction_RNN
      CSI_prediction_RNN
    • 使用RNN写诗.rar
      RNN写诗《深度学习框架PyTorch:入门与实践》 RNN写诗《深度学习框架PyTorch:入门与实践》
    • RNN加法.zip
      基于python编写的RNN循环神经网络实现二进制加法