Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ When developing and authoring multiple packages (private or public), you often f

## What

- `yalc` acts as very simple local repository for your locally developed packages that you want to share across your local environment.
- `yalc` acts as a 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 **Pnmp/Yarn/Npm 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.
Expand Down Expand Up @@ -41,13 +41,13 @@ Some documented features might not have been published yet, see the [change log]
- 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.
- When publishing, `yalc` can optionally calculate a hash signature from the file contents and use the signature in the resulting package `version` (like `"1.2.3+ffffffff"`). To enable this, pass the `--sig` option to the `yalc publish` command.
- You may also use `.yalcignore` to exclude files from publishing to yalc repo, for example, files like README.md, etc.
- You may also use `.yalcignore` to exclude files from publishing to yalc repo, such as files like README.md.
- `--content` 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!** In terms of which files will be included in the package `yalc` is entirely supposed to emulate behavior of `npm` client (`npm pack`). [If you have a 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
- Yalc by default resolves `workspace:` protocol in dependencies, to omit this use `-no-workspace-resolve` flag

### Add

Expand All @@ -69,14 +69,14 @@ Some documented features might not have been published yet, see the [change log]

- Run `yalc update my-package` to update the latest version from store.
- Run `yalc update` to update all the packages found in `yalc.lock`.
- `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.
- `preyalc` and `postyalc` scripts will be executed in the target package on add/update operations which are performed while `push`
- if need to perform pre/post `scripts` on an update of particular package use `(pre|post)yalc.package-name` name for the script in your `package.json`.
- update `--update` (`--upgrade`, `--up`) to run package managers' 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.
- Run `yalc remove --all` to remove all packages from the project.

### Installations

Expand All @@ -90,10 +90,10 @@ Some documented features might not have been published yet, see the [change log]
- 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):
- `scripts` options is `false` by default, so it won't run `pre/post` scripts (may change this with passing `--scripts` flag).
- `scripts` option is `false` by default, so it won't run `pre/post` scripts (may change this by passing `--scripts` flag).
- 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 `preyalc` and `postyalc` (read in `update` docs) to execute the needed script on every push.
- Use `--update` to run `yarn/npm/pnpm update` command for pushed packages.

### Keep it out of git
Expand All @@ -105,7 +105,7 @@ Some documented features might not have been published yet, see the [change log]
### Keep it in git

- You may want to keep shared `yalc'ed` stuff within the projects you are working on and treat it as a part of the project's codebase. This may really simplify management and usage of shared _work in progress_ packages within your projects and help to make things consistent. So, then just do it, keep `.yalc` folder and `yalc.lock` in git.
- Replace it with published versions from remote repository when ready.
- Replace it with published versions from the remote repository when ready.
- **NB!** - standard non-code files like `README`, `LICENCE` etc. will be included also, so you may want to exclude them in `.gitignore` with a line like `**/.yalc/**/*.md` or you may use `.yalcignore` not to include those files in package content.

### Publish/push sub-projects
Expand All @@ -114,32 +114,32 @@ Some documented features might not have been published yet, see the [change log]

### Retreat and Restore

- Instead of completely removing package you may temporary set it back with `yalc retreat [--all]` for example before package publication to remote registry.
- Instead of completely removing the package you may temporarily set it back with `yalc retreat [--all]` for example before package publication to the remote registry.
- After or later restore it with `yalc restore`.

### Use with **Yarn/Pnpm workspaces**

Use if you will try to `add` repo in `workspaces` enabled package, `--pure` option will be used by default, so `package.json` and modules folder will not be touched.
If you try to `add` repo in `workspaces` enabled package, `--pure` option will be used by default, so `package.json` and modules folder will not be touched.

Then you add yalc'ed package folder to `workspaces` in `package.json` (you may just add `.yalc/*` and `.yalc/@*/*` patterns). While `update` (or `push`) operation, packages content will be updated automatically and `yarn` will care about everything else.
Then you add yalc'ed package folder to `workspaces` in `package.json` (you may just add `.yalc/*` and `.yalc/@*/*` patterns). While `update` (or `push`) operation, packages content will be updated automatically, and `yarn` will care about everything else.

If you want to override default pure behavior use `--no-pure` flag.

### Clean up installations file

- While working with yalc for some time on the dev machine you may face the situation when you have locations where you added yalc'ed packages being removed from file system, and this will cause some warning messages when yalc will try to push package to removed location. To get rid of such messages, there is an explicit command for this: `yalc installations clean [package]`.
- While working with yalc for some time on the dev machine you may face the situation when you have locations where you added yalc'ed packages being removed from the file system, and this will cause some warning messages when yalc tries to push the package to the removed location. To get rid of such messages, there is an explicit command for this: `yalc installations clean [package]`.

### Override default package store folder

- You may use `--store-folder` flag option to override default location for storing published packages.
- You may use `--store-folder` flag option to override the default location for storing published packages.

### Control output

- Use `--quiet` to fully disable output (except of errors). Use `--no-colors` to disable colors.
- Use `--quiet` to fully disable output (except for errors). Use `--no-colors` to disable colors.

### Set default options via .yalcrc

- For example add `workspace-resolve=false` line to the `.yalcrc` file to turn off `workspace:` protocol resolution or `sig=false` to disable package version hash signature.
- For example add `workspace-resolve=false` line to the `.yalcrc` file to turn off `workspace:` protocol resolution or `sig=false` to disable the package version hash signature.

## Related links

Expand Down