diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e35c9d6..e8616af 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -4,7 +4,7 @@ on: pull_request: types: [closed] branches: [main] - paths: ['packages/*'] + paths: ['packages/**'] jobs: publish: if: github.event.pull_request.merged == true @@ -59,7 +59,7 @@ jobs: restore-keys: ${{ runner.os }}-pnpm-store- - name: Install - run: pnpm ci + run: pnpm i - name: Publish run: pnpm run publish diff --git a/package.json b/package.json index 3a2d7be..5aca41d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "clean": "rm -rf node_modules && lerna clean", - "publish": "lerna publish -y --no-private --pre-id ci --npm-tag=ci --force-publish=* --registry '@r1oga:registry=https://npm.pkg.github.com' --message ':package: Publish'" + "publish": "lerna publish -y --no-private --preid ci --npm-tag=ci --force-publish=* --registry '@r1oga:registry=https://npm.pkg.github.com' --message ':package: Publish'" }, "devDependencies": { "lerna": "^6.1.0" diff --git a/packages/eslint/package.json b/packages/eslint/package.json index c9ba016..6c62fee 100644 --- a/packages/eslint/package.json +++ b/packages/eslint/package.json @@ -21,7 +21,7 @@ "access": "public" }, "scripts": { - "postinstall": "sh postinstall.sh" + "postinstall": "bash postinstall.sh" }, "peerDependencies": { "@typescript-eslint/eslint-plugin": "^5.46.1", diff --git a/packages/eslint/postinstall.sh b/packages/eslint/postinstall.sh index 4b3595d..9d7f648 100644 --- a/packages/eslint/postinstall.sh +++ b/packages/eslint/postinstall.sh @@ -1,5 +1,13 @@ #!/bin/bash # see sharing eslint config & npm scoped modules https://eslint.org/docs/latest/developer-guide/shareable-configs#npm-scoped-modules -echo "extends: ['@r1oga']" > "$INIT_CWD/.eslintrc.yaml" -cp .eslintignore "$INIT_CWD/.eslintignore" +if [[ ! -f "$INIT_CWD/.eslintrc.yaml" ]];then + echo "extends: ['@r1oga']" > "$INIT_CWD/.eslintrc.yaml" +else + read -p "overwrite .eslintrc.yaml?(Yn) " overwrite + if [[ -z "$overwrite" || "$overwrite" -eq "Y" || "$overwrite" -eq "y" ]];then + echo "extends: ['@r1oga']" > "$INIT_CWD/.eslintrc.yaml" + fi +fi + +cp -i .eslintignore "$INIT_CWD/.eslintignore" diff --git a/packages/prettier/package.json b/packages/prettier/package.json index aa48bde..5fed885 100644 --- a/packages/prettier/package.json +++ b/packages/prettier/package.json @@ -20,7 +20,7 @@ }, "scripts": { "build": "js-yaml .prettierrc.yaml > .prettierrc.json", - "postinstall": "sh postinstall.sh" + "postinstall": "bash postinstall.sh" }, "peerDependencies": { "prettier": "^2.8.1" diff --git a/packages/prettier/postinstall.sh b/packages/prettier/postinstall.sh index 030ef8c..bbc5c2b 100644 --- a/packages/prettier/postinstall.sh +++ b/packages/prettier/postinstall.sh @@ -1,4 +1,13 @@ #!/bin/bash -echo "'@r1oga/prettier-config'" > "$INIT_CWD/.prettierrc.yaml" -cp .prettierignore "$INIT_CWD/.prettierignore" \ No newline at end of file +if [[ ! -f "$INIT_CWD/.prettierrc.yaml" ]];then + echo "'@r1oga/prettier-config'" > "$INIT_CWD/.prettierrc.yaml" +else + # shellcheck disable=SC2162 + read -p "overwrite .prettierrc.yaml?(Yn) " overwrite + if [[ -z "$overwrite" || "$overwrite" -eq "Y" || "$overwrite" -eq "y" ]];then + echo "'@r1oga/prettier-config'" > "$INIT_CWD/.prettierrc.yaml" + fi +fi + +cp -i .prettierignore "$INIT_CWD/.prettierignore" \ No newline at end of file