諸行無常

IT色々お勉強中のブログ

webpack3→4でエラーになった webpack-cli

webpack3→4に帰るとエラーになった。

The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
module.js:549
    throw err;
    ^

Error: Cannot find module 'webpack-cli/bin/config-yargs'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)

WebPack 3では、WebPack自体とそのCLIは同じパッケージに入ってたが、バージョン4では、それぞれをよりよく管理するために2つに分けたそう。

yarn add webpack-cli -D

これで解決

続く

20190421ワイの .bashrc

HISTSIZE=50000

alias ll='ls -la'
alias vi='vim'
alias dock='docker-compose'
alias ctags="`brew --prefix`/bin/ctags"

alias xl='cd ~/Xleap'
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
java -jar $HOME/lib/java/plantuml.jar -tpng $@

GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\h\[\033[00m\]:\W\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '

if [ -f ~/.nodebrew/completions/bash/nodebrew-completion ]; then
    . ~/.nodebrew/completions/bash/nodebrew-completion
fi

export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
shopt -u histappend

[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# fbr - checkout git branch
fbr() {
  local branches branch
  branches=$(git branch -vv) &&
  branch=$(echo "$branches" | fzf +m) &&
  git checkout $(echo "$branch" | awk '{print $1}' | sed "s/.* //")
}
# fbrm - checkout git branch (including remote branches)
fbrm() {
  local branches branch
  branches=$(git branch --all | grep -v HEAD) &&
  branch=$(echo "$branches" |
           fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
  git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
fvimg() {
  vim $(git ls-files | xargs grep "" | fzf -m | sed -e 's/:/ /' | awk '{print $1}')
}

React Native I18n.localeがenしか取得できない

I18n.localeがenしか取得できないケースがあるらしい

Both in android and ios locale always returns 'en' · Issue #7 · xcarpentier/ex-react-native-i18n · GitHub

I18n.initAsync()をして上げると解決する

import I18n from 'ex-react-native-i18n'


  componentWillMount() {
    this._loadAssetsAsync()
  }

  _loadAssetsAsync = async () => {
    try {
      await I18n.initAsync()
    } catch (e) {
      console.log(e.message)
    } finally {
      this.setState({ isAssetsLoaded: true })
    }
  }

Rail5.2.3アップグレードでArgumentError: wrong number of argumentsエラー発生

Rspec流して出たエラーはこれ

from /hogehoge/gems/will_paginate-3.1.6/lib/will_paginate/active_record.rb:140:in `select_for_count'```

will_paginateでエラー出てるっぽいから、PR調べてると、それっぽいの発見

ArgumentError: wrong number of arguments (given 0, expected 1) · Issue #589 · mislav/will_paginate · GitHub

active_recordのselect_for_countメソッドと被っちゃったっぽい 修正PRはすでに出ていた。ので

bundle update will_pagenate

で現在最新の3.1.7にあげたら解決

ReactNative初めてのお勉強

children 子に要素を出すことができる

{children}

こんな感じで

エミュレーター上でcmd + D でデバックモードとか設定出来る

Reducer にアクションを通知する関数dispatch

dispatchでSagaを呼び出してstateを変えている?

export default connect(mapStateToProps, mapDispatchToProps)(Test);
  • 第一引数の「func1」はcomponentに渡すpropsを制御する

  • 第二引数の「func2」はreducerを呼び出して、reduxで管理しているstateを更新する

複数Githubアカウントでssh接続設定(config)を使い分ける手順

cd ~/.ssh
ssh-keygen -t rsa -C {Githubメールアドレス} -f {作成する鍵の名前}
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

vim ~/.ssh/config

Host github.sub # サブアカウント
  HostName github.com
  User git
  Port 22
  IdentityFile ~/.ssh/private  # サブアカウント用の鍵
  TCPKeepAlive yes
  IdentitiesOnly yes

↓参考

.ssh/configファイルでSSH接続を管理する - Qiita

github秘密鍵登録

pbcopy < ~/.ssh/private.pub

f:id:babababand:20190406091723p:plain
設定画面

Adding a new SSH key to your GitHub account - GitHub Help

ssh -T git@github
Hi hogehoge! You've successfully authenticated, but GitHub does not provide shell access.

subに切り替え

ssh -T git@github.sub
Hi hogehoge! You've successfully authenticated, but GitHub does not provide shell access.

subの方のローカルを変更する。直接vim .git/config変えても良い

git config --local user.name {ユーザー名}
git config --local user.email {メールアドレス}