一些琐碎的笔记

134 阅读1分钟

几年来的一些琐碎零散笔记,整理一下,清空笔记!

npm 与 node

npm install -g npm
npm install -g npm@5.6.0

npm config set registry https://registry.npm.taobao.org
npm config set registry https://registry.npmjs.org
npm config get registry 

npm uninstall  sass-loader
npm install  sass-loader@7.1.0
npm --registry http://my.domain.com/npm-group/ install @my-code --save


node -v
npm cache clean -f
npm install -g n
n stable // 稳定版
n lts // 长期支持版
n latest // 最新版
n 10.14.2 // 指定版

yarn

npm install --global yarn
yarn --version
yarn init


yarn add [package]
yarn add [package]@[version]


yarn upgrade [package]
yarn upgrade [package]@[version]


yarn remove [package]
yarn 或者 yarn install

Chrome

// 打开非安全模式
open -n /Applications/Google\ Chrome.app/ --args --disable-web-security --user-data-dir=/Users/apple/Documents/MyChromeDevUserData


// vue-devtools 安装
//1,
git clone <https://github.com/vuejs/vue-devtools> ( master )
cd vue-devtools
npm i
npm run build

//2,
打开Chrome>更多工具>扩展程序>打开开发者模式

//3,
点击加载已解压的扩展程序 > 找到刚才生成的chrome文件夹 > 选择 vue-devtools > shells > chrome 放入

nginx

‌sudo nginx
‌sudo nginx -s reload
‌sudo nginx -s quit
‌sudo nginx -s
‌stop killall nginx

‌//端口被占
‌sudo lsof -i tcp:8088(端口)
‌kill 1882(PID)

常用文件地址

/etc/hosts
/usr/local/etc/nginx/
/Users/myMac/.bash_profile
‌/usr/bin/
‌~/.ssh/

yml

build:
  script:
    - git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@git.domain.com/code.git
    - code_branch=`cat version.txt`
    - echo "当前分支是:${code_branch}"
    - cd code
    - git checkout -b origin/${code_branch}
    - git branch -a
    - cd ../
    - chmod +x run.sh
    - bash run.sh code
    - chmod +x build.sh
    - bash build.sh
  cache:
    paths:
      - node_modules
  allow_failure: false
  only:
    - tags
  except:
    - branches
  tags:
    - node14

shell

// 运行
sh my.sh myPath

# 注释

:<<EOF
多行注释
EOF

path=$1
mkdir -p ./pkg/${path}/p1
cd ./whole/p2
zip -r -q ../../pkg/${path}/p1

code_path="../code"
for element in `ls $code_path`
    do
        dir_or_file=$code_path"/"$element
        if [ -d $dir_or_file ]
	then 
		if [ ${dir_or_file##*/} = "static" ]
		then
                    cp -r ./src/static/common $code_path/static
                    rm -r ./src/static/common
		else
			cp -r ./src/${dir_or_file##*/} $code_path
			rm -r ./src/${dir_or_file##*/}
		fi
	else
		if [[ ${dir_or_file##*/} = ".gitignore" || ${dir_or_file##*/} = ".git" ]] 
		then
			continue
		else
			cp -r ./src/${dir_or_file##*/} $code_path
			rm -r ./src/${dir_or_file##*/}
		fi
	fi  
   done


echo "已完成分离"

tag=$CI_COMMIT_TAG

npm config set registry https://registry.npm.taobao.org
npm i

if [[ "$tag" == *-baidu-* ]];then
    npm i swan-toolkit --save
fi

if [[ "$tag" == *-bj ]];then 
    npm run change-bj
elif [[ "$tag" == *-sh ]];then 
    npm run change-sh
fi;

if [[ "$tag" == *-weixin-* ]];then 
    npm run build:mp-weixin 
elif [[ "$tag" == *-baidu-* ]];then 
    npm run build:mp-baidu;
fi