The npm publish command is used to publish a JS package to a private or public registry. However, I previously ignored how the lock file is handled during publishing, such as the processing of the resolutions field. Here, I will organize the issues I have learned.

Package publish without package-lock.json

  1. When developing a JS package, we need to include package-lock.json in VCS management, but the lock file will not be published when using npm publish.
  2. When we execute the npm install command in a specific project, the lock file of the top-level package (i.e., the target project) zeds for a recognize-specific version installation. Still, the lock files included in the dependent packages will be directly ignored.

Including lock file in published package?

  • With npm cli >=v6, package-lock.json will not be published regardless of whether it is configured in the package.json files whitelist. However, under the older CLI, it can be published through a whitelist configuration.
  • Testing with v6 will show this issue. From the official version history, it can be seen that, for example, nodev8 default npm CLI is v6, and trying that version can reproduce this issue.
Read more »

When implementing terminal search highlighting using xterm.js, it’s necessary to recognize whether the terminal is currently in vi editor mode. Upon investigation, it was found that xterm.buffer.active.type can be used for this purpose.

Upon examining the corresponding type definitions, it was found that the values are only “normal” and “alternate.” It wasn’t clear why it’s called “alternate,” so further investigation revealed that this concept originates from the terminal’s alternate screen. Here’s an overall introduction.

Alternate Screen

  1. The alternate screen is a temporary screen for interactive input, which eventually returns to the main screen. For example, in VI mode, the screen display area is the same as in normal mode. When the alternate screen is activated, the original screen content is saved, and the original content is restored upon exiting the alternate screen.
  2. Therefore, the normal/alternate concepts in xterm are not original but are inherent to the terminal’s design, with these two modes being standard and alternate.

At the end

Read more »

Besides the Mac version, Alfred also offers a iOS App for iPhone/iPad. After some time of use, here is a summary of my personal practice.

  1. The remote itself is just an extension of the desktop version of Alfred, essentially still operating the Mac version of Alfred, so it is somewhat fun but still quite limited.
  2. If there is no need for a remote control of the Mac, I personally do not recommend purchasing it, as it is not frequently used.

For those who need it, continue reading 👇

Download/Cost

Read more »

Recently, when using an open source tool, I found a tool called tmux. Then I found that Tmux is quite popular, the repo star has 20K+, and my commonly used iTerm2 is also integrated with tmux. Based on this, it is necessary to understand tmux and clarify the usage scenarios.

Since the current use is still shallow, please point out if any mistakes

Concept

Start with the concept and understand its function.

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

  1. Personal understanding is that tmux saves the terminal session on-site. For example, SSH is connected to a VPS, vi edit a file, directly closes the session, and then reopens the connection, you will find that the state is lost, you need to re-enter the target path and reopen it edit. With tmux, you can save this session, re-access the target machine, load the previously saved session, and everything will be restored as before.
  2. The reason why tmux can save sessions is because after tmux is installed on the target server, a separate service will be started for on-site saving.

Tmux Installation

Understand the above principles, you can understand that tmux is not necessarily installed locally, but installed on the machine that needs to save the session.

The installation commands in common operating system environments are as follows

1
2
3
4
5
# macOS
brew install tmux

# centos
yum install tmux
Read more »

Maintaining open-source projects requires effort, and monetary rewards are a great incentive. GitHub now provides a sponsor mechanism allowing you to support project developers easily. Here’s how to proceed.

Sponsoring Others

On the right side of a project, under “Sponsor this project,” click on the ❤️ next to each specific developer to sponsor them. You can choose between one-time payments or regular payments.

Applying for Sponsorship

Read more »
0%