What is the difference between running npm dedupe in npm2 versus using npm3? - npm

In npm3, it tries to install dependancies in a maximally flat way. But in npm2, we already have the npm dedupe command which seems to also flatten dependancies. If I am already doing npm dedupe with npm2, is there any advantage to using npm3?

I did some research and installed npm3 and it turns out that it seems there is no difference between the two in terms of the dedupe command. The main difference is that when modules are installed in npm3, they will tend to be installed "flat", whereas in npm2 and earlier, they will go below the dependent module in a node_modules directory.
An series of illustrative ASCII diagrams follow.
In npm2 (module A depends on B and C, which both depend on D):
+----A----B----D
|
\
-C----D
After dedupe in both npm2 and npm3, D is moved up to the top level:
+----A----B
| |
| \
| -C
D
In npm3, after npm install, we will see that B and C are also moved up to the top level:
+----A
|
|
|
D
|
|
|
B
|
|
|
C

Related

How to publish multiple versions of same package to gitlab registry

I am working on a usecase where there is a requirement to publish multiple versions of same package.
I have to publish these version of package in to my gitlab npm registry. I have searched on this but everyone is telling to use scopes which is not possible in my requirement. Is there a way that i can publish both these versions to my gitlab registry?
when i try to publish first version its publishing fine but for second version its giving me an error -
Alialising is the life saver if you want to publish multiple versions of same package in gitlab, especially if you are trying to publish unscoped packages.
#!/bin/sh
list=$(npm ll --json | jq -r 'recurse(.dependencies[]) | [.name+"#"+.version] |#csv' | sed 's/"//g'| sort -u)
for i in $list; do
version_num=$(echo $i | rev | awk -F'#' '{print $1}' | tr '\.' '.'| rev);
name=$(echo $i | perl -pne 's/#[0-9]+(\.[0-9]+)+$//');
npm install $name-$version_num#npm:$i;
done
dirs=$(ls node_modules | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for i in $dirs; do
echo $i
npm publish node_modules/$i --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
atdirs=$(ls node_modules | grep "#")
for k in $atdirs; do
indirs=$(ls node_modules/$k | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for j in $indirs;do
echo $k/$j
npm publish node_modules/$k/$j --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
done
Unfortunately, you are forced to use scopes in the GitLab npm registry. See the documentation: Link
So the issue you are facing is not about the multiple Versions (that should work) but that you are not providing any scope.
On a side note: It seems like you are trying to proxy the actual entities package, while you try to use some private packages? You don't need to do so and I would recommend against that. Some solutions:
Use a Package Proxy like Nexus, jFrog or Verdaccio
You configure your npmrc to only use the GitLab Registry once a specific Scope is used and grab the package from npm.js or a mirror otherwise.

How do I use `srb rbi suggest-typed` without downgrading sigils?

The Sorbet typechecker for Ruby has a utility, srb rbi suggest-typed, which will automatically update the # typed: sigils on each file. However, as the Sorbet docs explain, “currently, the suggestion process is fallible, and may suggest downgrading when it's not necessary.” I have a Sorbet-typed codebase that I’d like to try upgrading the types on (to “ratchet” any files that have been fully typed without having their sigil changed), but because it’s a very large codebase I don’t want to have to manually audit every file that’s changed. Is there a way to get Sorbet to only apply a change to the sigil if it’s an upgrade?
There doesn’t seem to be any way to get Sorbet to do this itself. Instead, as a workaround, here are some instructions for using Git to only commit the changes that upgrade the sigil, and discard any changes that would be a downgrade.
Start with a clean working directory (make sure git status doesn’t show any changed files).
Run srb rbi suggest-typed. This will change a lot of sigils, both upgrading and downgrading them.
Produce a summary of the different kinds of changes that have been made:
git diff --word-diff -U0 | grep '# typed: ' | sort | uniq -c
36 # typed: [-false-]{+ignore+}
8 # typed: [-false-]{+strict+}
27 # typed: [-false-]{+true+}
36 # typed: [-strict-]{+false+}
150 # typed: [-true-]{+strict+}
80 {+# typed: false+}
Use grepdiff to find each of the changes you don’t want, and pipe the result to git checkout to drop those changes (modify the below commands as needed for the changes you have gotten):
git diff | grepdiff --output-matching=hunk --only-match=rem 'typed: false' | grepdiff --only-match=add 'typed: ignore' --strip=1 | xargs git checkout --
git diff | grepdiff --output-matching=hunk --only-match=rem 'typed: strict' | grepdiff --only-match=add 'typed: false' --strip=1 | xargs git checkout --
git diff | grepdiff --only-match=add 'typed: false' --strip=1 | xargs git checkout --
Rerun the summary command from step 3 to make sure the results include only what you want.
Commit.
I think you can make creative use of rubocop-sorbet for this:
Add rubocop-sorbet if it isn't already in the Gemfile
Change rubocop.yml to something like:
---
inherit_from: .rubocop_todo.yml
inherit_mode:
merge:
- Include
require:
- rubocop-sorbet
AllCops:
DisabledByDefault: true
Include:
- '**/*/*.rbi'
Sorbet/FalseSigil:
Enabled: true
Sorbet/IgnoreSigil:
Enabled: true
Sorbet/StrictSigil:
Enabled: true
Sorbet/StrongSigil:
Enabled: true
Sorbet/TrueSigil:
Enabled: true
Invoke rubocop --auto-gen-config --exclude-limit 10000 (or some other sufficiently large number that prevents rubocop from disabling rules entirely)
Invoke srb rbi suggest-typed
Any downgraded files should now trigger rubocop violations. You can undo changes to these files with rubocop -f fi | xargs git checkout --
Also remember to revert any unwanted changes to Gemfile, .rubocop.yml, .rubocop_todo.yml, etc. before committing the result.

Action 'firebase_app_distribution' not available, run `fastlane actions` to get a full list

❯ bundle exec fastlane run firebase_app_distribution
[✔] 🚀
+------------------------------------+---------+----------------------------------------------------+
| Used plugins |
+------------------------------------+---------+----------------------------------------------------+
| Plugin | Version | Action |
+------------------------------------+---------+----------------------------------------------------+
| fastlane-plugin-badge | 1.1.0 | add_badge |
| fastlane-plugin-versioning_android | 0.1.0 | android_get_version_name android_set_version_code |
| | | android_set_version_name android_get_version_code |
| fastlane-plugin-android_sdk_update | 1.0.0 | android_sdk_update |
+------------------------------------+---------+----------------------------------------------------+
[!] Action 'firebase_app_distribution' not available, run `fastlane actions` to get a full list
I had no problems until 2 weeks ago. I could not find what affect it. does not appear in the list of "Used plugins" I can see the error with this command.
❯ bundle exec fastlane run fenter code hereirebase_app_distribution
I have this in fastlane/Pluginfile >>> gem 'fastlane-plugin-firebase_app_distribution'
and i can see the plugin in tmp-fastlane-ci-bundle/gems/fastlane-plugin-firebase_app_distribution
I have tried the following solutions
❯ sudo gem uninstall fastlane-plugin-firebase_app_distribution
❯ gem install fastlane-plugin-firebase_app_distribution --user-install
these doesn't work
❯ sudo chmod -R a+r /Library/Ruby/Gems/2.6.0/gems/fastlane-plugin-firebase_app_distribution-
0.1.4
chmod: /Library/Ruby/Gems/2.6.0/gems/fastlane-plugin-firebase_app_distribution-0.1.4:
No such file or directory
❯ bundle exec fassudo chmod -R a+r /Library/Ruby/Gems/2.6.0/gems/fastlane-plugin-
firebase_app_distribution-0.1.4
bundler: command not found: fassudo
Install missing gem executables with `bundle install`
A little late but for others that run into this issue: run fastlane add_plugin firebase_app_distribution to add that plugin to fastlane

I have a problem with it when i use Powerlevel10k which is a theme for ZSH?

I have a problem with it when i use Powerlevel10k which is a theme for ZSH?
From the Powerlevel10k FAQ:
Q: What do different symbols in Git status mean?
When using Lean, Classic or Rainbow style, Git status may look like this:
feature:master ⇣42⇡42 *42 merge ~42 +42 !42 ?42
Legend:
| Symbol | Meaning | Source |
| --------| ------------------------------------------------------------------| ---------------------------------------------------- |
| feature | current branch; replaced with #tag or #commit if not on a branch | git status |
| master | remote tracking branch; only shown if different from local branch | git rev-parse --abbrev-ref --symbolic-full-name #{u} |
| ⇣42 | this many commits behind the remote | git status |
| ⇡42 | this many commits ahead of the remote | git status |
| *42 | this many stashes | git stash list |
| merge | repository state | git status |
| ~42 | this many merge conflicts | git status |
| +42 | this many staged changes | git status |
| !42 | this many unstaged changes | git status |
| ?42 | this many untracked files | git status |
See also: How do I change the format of Git status?
If you've created a Git repository at the root of your home directory to store dotfiles, you probably want to ignore untracked files in it. You can achieve this by executing the following command:
git -C ~ config status.showuntrackedfiles no
This will have several effects:
git status will be faster.
git status won't list 171 untracked files.
?171 will disappear from your prompt.
You can undo the above command with the following command:
git -C ~ config --unset status.showuntrackedfiles
if you don't want to see Git status in your prompt while in home directory, add this parameter to ~/.p10k.zsh:
# Don't display Git status in prompt for Git repositories whose workdir matches
# this pattern.
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
If you don't want to see Git status in your prompt at all, remove vcs from POWERLEVEL9K_LEFT_PROMPT_ELEMENTS array in ~/.p10k.zsh.

vir-install virtual machine hang on Probbing EDD

I'm using vir-stall virtual machine, and my command is
virt-install --name=gust --vcpus=4 --ram=8192 --network bridge:br0 --cdrom=/opt/rhel-server-6.2-x86_64-dvd.iso --disk path=/opt/as1/as1.img,size=50 --accelerate
After running the command, it hangs on probing EDD,
- Press the <ENTER> key to begin the installation process.
+----------------------------------------------------------+
| Welcome to Red Hat Enterprise Linux 6.2! |
|----------------------------------------------------------|
| Install or upgrade an existing system |
| Install system with basic video driver |
| Rescue installed system |
| Boot from local drive |
| Memory test |
| |
| |
| |
| |
| |
| |
| |
+----------------------------------------------------------+
Press [Tab] to edit options
Automatic boot in 57 seconds...
Loading vmlinuz......
Loading initrd.img...............................ready.
Probing EDD (edd=off to disable)... ok
ÿ
Previously, I wait a long time, it seems no marching. After I press ctrl + ] and stop it. I find it was running using virsh list, but I cannot console it using virsh concole gust. Any problem and how should I do. Many Thanks
Add the following to your virt-install
--extra-args="console=tty0 console=ttyS0,115200n8 edd=off"
The edd=off is the critical part for this