@kununu/phraseapp-cli 4.0.5 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+
2
+ # These owners will be the default owners for everything in
3
+ # the repo. Unless a later match takes precedence,
4
+ # @global-owner1 and @global-owner2 will be requested for
5
+ # review when someone opens a pull request.
6
+ * @kununu/Frontend
@@ -0,0 +1,13 @@
1
+ name: Auto assign owner when opening PRs
2
+ on:
3
+ pull_request:
4
+ types: [ opened ]
5
+ jobs:
6
+ auto-assign-owner:
7
+ if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Auto assign owner
11
+ uses: danielswensson/auto-assign-owner-action@v1.0.2
12
+ with:
13
+ github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,161 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Semver version (major / minor / patch)"
8
+
9
+ required: true
10
+ type: choice
11
+ options:
12
+ - patch
13
+ - minor
14
+ - major
15
+
16
+ env:
17
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18
+
19
+ jobs:
20
+ release:
21
+ runs-on: ubuntu-latest
22
+
23
+ permissions:
24
+ id-token: write # Required for OIDC
25
+ contents: write
26
+ pull-requests: write
27
+
28
+ steps:
29
+ - name: Generate GitHub App Token
30
+ id: generate_token
31
+ env:
32
+ GITHUB_APP_ID: ${{ secrets.GH_APPS_APP_ID }}
33
+ GITHUB_INST_ID: ${{ secrets.GH_APPS_INSTALLATION_ID }}
34
+ GITHUB_KEY_VALUE: ${{ secrets.GH_APPS_PRIVATE_KEY }}
35
+ run: |
36
+ GO_GITHUB_VERSION="1.0.1"
37
+ wget -O ghapps https://github.com/kununu/go-github/releases/download/v${GO_GITHUB_VERSION}/go-github_${GO_GITHUB_VERSION}_linux_amd64 && chmod +x ghapps
38
+
39
+ echo "GH_APPS_TOKEN=$(./ghapps)" >> $GITHUB_ENV
40
+ echo "GH_TOKEN=$(./ghapps)" >> $GITHUB_ENV
41
+
42
+ - name: Checkout Source
43
+ uses: actions/checkout@v6
44
+ with:
45
+ fetch-depth: 0
46
+ token: ${{ env.GH_APPS_TOKEN }}
47
+
48
+ - name: Setup Node
49
+ uses: actions/setup-node@v6
50
+ with:
51
+ node-version: 20
52
+ cache: "npm"
53
+
54
+ # Ensure npm 11.5.1 or later is installed
55
+ - name: Update npm
56
+ run: npm install -g npm@latest
57
+
58
+ - name: Setup git
59
+ run: |
60
+ git config user.name "github-actions[bot]"
61
+ git config user.email "technik@kununu.com"
62
+
63
+ - name: Install Packages
64
+ run: npm ci
65
+
66
+ # avoid npm version to auto-commit, so we can update the version in the changelog in the same commit
67
+ - name: Bump Package Version
68
+ run: |
69
+ npm version ${{ github.event.inputs.version }} --git-tag-version false
70
+
71
+ - name: Read NPM package version from package.json
72
+ run: |
73
+ echo "PACKAGE_VERSION=$(sed -n 's/.*\"version\": \"\([^\"]*\)\".*/\1/p' package.json)" >> "$GITHUB_ENV"
74
+
75
+ - name: Create Release Branch
76
+ run: |
77
+ BRANCH_NAME="release/$PACKAGE_VERSION"
78
+ git checkout -b $BRANCH_NAME
79
+ echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
80
+
81
+ - name: Commit Version Changes
82
+ run: |
83
+ git add package.json
84
+ git add package-lock.json
85
+ git commit -m "chore: release $PACKAGE_VERSION"
86
+ git push origin $BRANCH_NAME
87
+
88
+ - name: Create Pull Request
89
+ run: |
90
+ gh pr create \
91
+ --title "chore: release $PACKAGE_VERSION" \
92
+ --body "Automated release PR for version $PACKAGE_VERSION" \
93
+ --base master \
94
+ --head $BRANCH_NAME
95
+ PR_NUMBER=$(gh pr view $BRANCH_NAME --json number --jq '.number')
96
+ echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
97
+
98
+ - name: Wait for passed checks
99
+ run: |
100
+ TIMEOUT=300 # 5 minutes
101
+ INTERVAL=10 # 10 seconds
102
+ ELAPSED=0
103
+ sleep $INTERVAL # Initial wait before first check
104
+ while [[ $ELAPSED -lt $TIMEOUT ]]; do
105
+ echo "Waiting for status checks... ($ELAPSED of $TIMEOUT seconds)"
106
+ CHECKS_STATUS=$(gh pr checks "$PR_NUMBER" --json state --jq '.[].state')
107
+ ALL_PASSED=true
108
+ ALL_EXECUTED=true
109
+
110
+ for state in $CHECKS_STATUS; do
111
+ if [[ "$state" == "PENDING" || "$state" == "QUEUED" || "$state" == "IN_PROGRESS" ]]; then
112
+ ALL_EXECUTED=false
113
+ ALL_PASSED=false
114
+ break
115
+ fi
116
+ if [[ "$state" != "SUCCESS" && "$state" != "COMPLETED" && "$state" != "SKIPPED" ]]; then
117
+ ALL_PASSED=false
118
+ fi
119
+ done
120
+
121
+ if $ALL_EXECUTED && $ALL_PASSED; then
122
+ echo "All checks passed for PR #$PR_NUMBER."
123
+ exit 0
124
+ fi
125
+
126
+ if $ALL_EXECUTED; then
127
+ if $ALL_PASSED; then
128
+ echo "All checks passed for PR #$PR_NUMBER."
129
+ exit 0
130
+ else
131
+ echo "All checks executed but some failed for PR #$PR_NUMBER."
132
+ exit 1
133
+ fi
134
+ fi
135
+
136
+ sleep $INTERVAL
137
+ ELAPSED=$((ELAPSED + INTERVAL))
138
+ done
139
+ echo "Timeout: Checks did not pass within $TIMEOUT seconds for PR #$PR_NUMBER."
140
+ exit 1
141
+
142
+ - name: Merge PR
143
+ run: |
144
+ gh pr merge $PR_NUMBER --squash --delete-branch --admin
145
+
146
+ - name: Checkout Master and Tag
147
+ run: |
148
+ git fetch origin
149
+ git checkout master
150
+ git pull origin master
151
+ git tag $PACKAGE_VERSION
152
+ git push origin --tags
153
+
154
+ # leave npm publish to the end, so we avoid publishing a version that did not finish the entire flow
155
+ - name: Publish
156
+ run: |
157
+ npm publish
158
+
159
+ - name: Create Github Release
160
+ run: |
161
+ gh release create $PACKAGE_VERSION --generate-notes
package/index.js CHANGED
@@ -157,7 +157,7 @@ function downloadLocaleFile(phrase, locale) {
157
157
  } else {
158
158
  // Handle any errors
159
159
  console.error(
160
- `Error: locale file ${getFileName(filePrefix, localeId)}. Message: ${error.message}`
160
+ `Error: locale file ${getFileName(filePrefix, localeId)}. Message: ${JSON.stringify(error)}`
161
161
  .red,
162
162
  );
163
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kununu/phraseapp-cli",
3
- "version": "4.0.5",
3
+ "version": "4.1.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "kununu",
@@ -9,13 +9,13 @@
9
9
  "lint": "eslint . --ext jsx --ext js --ext tsx --ext ts --ignore-path .eslintignore --max-warnings 10"
10
10
  },
11
11
  "dependencies": {
12
- "@babel/parser": "7.28.4",
13
- "@babel/traverse": "7.28.4",
12
+ "@babel/parser": "7.28.5",
13
+ "@babel/traverse": "7.28.5",
14
14
  "colors": "1.4.0",
15
- "dotenv": "17.2.2",
16
- "glob": "11.0.3"
15
+ "dotenv": "17.2.3",
16
+ "glob": "13.0.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@kununu/eslint-config": "5.10.1"
19
+ "@kununu/eslint-config": "5.11.5"
20
20
  }
21
21
  }