Skip to content

Commit b3b4d1c

Browse files
committed
fix(admin): cannot use useStrapi outside of StrapiApp
Use npm instead of yarn, which seems to solve this issue. See strapi/strapi#22162
1 parent 9161b7f commit b3b4d1c

File tree

22 files changed

+32328
-26723
lines changed

22 files changed

+32328
-26723
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
ecmaVersion: 2020,
44
requireConfigFile: false,
55
},
6+
ignorePatterns: ["**/build", "**/dist", "**/node_modules"],
67
overrides: [
78
{
89
files: ['plugin/server/**/*.js', 'providers/**/lib/**/*.js'],

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ jobs:
3030
with:
3131
node-version: '20'
3232
- name: Install dependencies
33-
run: yarn
33+
run: npm ci
3434
- name: Build strapi-plugin-translate
35-
run: yarn workspace strapi-plugin-translate build
35+
run: npm run build --workspace strapi-plugin-translate
3636
- name: Build strapi-provider-translate-deepl
37-
run: yarn workspace strapi-provider-translate-deepl build
37+
run: npm run build --workspace strapi-provider-translate-deepl
3838
- name: Build strapi-provider-translate-libretranslate
39-
run: yarn workspace strapi-provider-translate-libretranslate build
39+
run: npm run build --workspace strapi-provider-translate-libretranslate
4040
- name: Release
4141
env:
4242
GH_TOKEN: ${{ secrets.GH_TOKEN }}
4343
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44-
run: yarn release
44+
run: npm run release

.github/workflows/e2e.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,40 @@ jobs:
66
strategy:
77
matrix:
88
node: [18, 20]
9-
strapi: [5.2, 5.3, 5.4]
9+
strapi: [5.6, 5.7, 5.8]
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
1313
- run: corepack enable
1414
- uses: actions/setup-node@v4
1515
with:
1616
node-version: ${{ matrix.node }}
17-
cache: 'yarn'
17+
cache: 'npm'
1818
- name: Install workspace dependencies
19-
run: yarn
19+
run: npm ci
2020
- name: Build strapi-plugin-translate
21-
run: yarn workspace strapi-plugin-translate build
21+
run: npm run build --workspace strapi-plugin-translate
2222
- name: Pack strapi-plugin-translate
23-
run: yarn workspace strapi-plugin-translate pack -o strapi-plugin-translate.tgz
23+
run: |
24+
PACKAGE_NAME=$(npm pack --workspace strapi-plugin-translate | tail -n 1);
25+
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> "$GITHUB_ENV"
2426
- name: Copy playground to e2e folder
2527
run: cp -r playground e2e
2628
- name: Configure strapi version for e2e test
2729
run: VERSION=${{ matrix.strapi }} envsubst < e2e/templates/template.package.json > e2e/package.json
28-
- name: Setup e2e folder to be a seperate workspace
29-
run: touch e2e/yarn.lock
30+
# - name: Setup e2e folder to be a seperate workspace
31+
# run: touch e2e/yarn.lock
3032
- name: Install e2e dependencies
31-
run: yarn install --no-immutable
33+
run: npm install
3234
working-directory: e2e
3335
- name: Add local strapi-plugin-translate
34-
run: yarn add ../plugin/strapi-plugin-translate.tgz
36+
run: npm install ../${PACKAGE_NAME}
3537
working-directory: e2e
3638
- name: Build strapi for e2e tests
37-
run: yarn build
39+
run: npm run build
3840
working-directory: e2e
3941
- name: Run e2e tests
40-
run: yarn e2e
42+
run: npm run e2e
4143
working-directory: e2e
4244
- name: Upload cypress results on failure
4345
uses: actions/upload-artifact@v4

.github/workflows/lint.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
- uses: actions/setup-node@v4
1010
with:
1111
node-version: '20'
12-
cache: 'yarn'
12+
cache: 'npm'
1313
- name: Install modules
14-
run: yarn
14+
run: npm ci
1515
- name: Run ESLint
16-
run: yarn lint
16+
run: npm run lint
1717

1818
verify:
1919
runs-on: ubuntu-latest
@@ -23,21 +23,21 @@ jobs:
2323
- uses: actions/setup-node@v4
2424
with:
2525
node-version: '20'
26-
cache: 'yarn'
26+
cache: 'npm'
2727
- name: Install modules
28-
run: yarn
28+
run: npm ci
2929
- name: Build strapi-plugin-translate
30-
run: yarn workspace strapi-plugin-translate build
30+
run: npm run build --workspace strapi-plugin-translate
3131
- name: Build strapi-provider-translate-deepl
32-
run: yarn workspace strapi-provider-translate-deepl build
32+
run: npm run build --workspace strapi-provider-translate-deepl
3333
- name: Build strapi-provider-translate-libretranslate
34-
run: yarn workspace strapi-provider-translate-libretranslate build
34+
run: npm run build --workspace strapi-provider-translate-libretranslate
3535
- name: Verify plugin with strapi-plugin
36-
run: yarn workspace strapi-plugin-translate verify
36+
run: npm run verify --workspace strapi-plugin-translate
3737
- name: Verify strapi-provider-translate-deepl
38-
run: yarn workspace strapi-provider-translate-deepl verify
38+
run: npm run verify --workspace strapi-provider-translate-deepl
3939
- name: Verify strapi-provider-translate-libretranslate
40-
run: yarn workspace strapi-provider-translate-libretranslate verify
40+
run: npm run verify --workspace strapi-provider-translate-libretranslate
4141

4242
commitlint:
4343
runs-on: ubuntu-latest

.github/workflows/unittest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
- uses: actions/setup-node@v4
1313
with:
1414
node-version: ${{ matrix.version }}
15-
cache: 'yarn'
15+
cache: 'npm'
1616
- name: Install dependencies
17-
run: yarn
17+
run: npm ci
1818
- name: Build strapi-plugin-translate
19-
run: yarn workspace strapi-plugin-translate build
19+
run: npm run build --workspace strapi-plugin-translate
2020
- name: run tests
21-
run: yarn test
21+
run: npm run test
2222
- uses: codecov/codecov-action@v5
2323
with:
2424
files: ./plugin/coverage/clover.xml,./providers/deepl/coverage/clover.xml,./providers/libretranslate/coverage/clover.xml

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
yarn lint-staged
4+
npm run lint-staged

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/Fekide
116116

117117
#### Required tooling <!-- omit in toc -->
118118

119-
- node 14-18
120-
- yarn
119+
- node 18-20
120+
- npm
121121

122122
#### Setup <!-- omit in toc -->
123123

124124
```bash
125-
yarn install
125+
npm install
126126
```
127127

128128
#### Before commiting <!-- omit in toc -->
129129

130130
```bash
131-
yarn test
132-
yarn lint
131+
npm run test
132+
npm run lint
133133
```
134134

135135
<!-- TODO
@@ -150,7 +150,7 @@ Updating, improving and correcting the documentation
150150

151151
We use [conventional-commits](https://www.conventionalcommits.org/en/v1.0.0/).
152152

153-
Please follow these guidelines or execute `yarn commit` to trigger `commitizen`
153+
Please follow these guidelines or execute `npm run commit` to trigger `commitizen`
154154

155155
## Join The Project Team
156156

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ module.exports = {
8484
],
8585
// If relations should be translated (default true)
8686
translateRelations: true,
87+
// ignore updates for certain content types (default [], i.e. no content types are ignored)
88+
ignoreUpdatedContentTypes: ['api::category.category'],
89+
// wether to regenerate uids when batch updating (default false)
90+
regenerateUids: true
8791
},
8892
},
8993
// ...
@@ -177,6 +181,14 @@ Additional remarks:
177181
- UIDs are automatically translated in batch translation mode, since otherwise the entities could not be created/published
178182
- If an error occurs, this will be shown in the logs or the message can be accessed by hovering over the `Job failed` badge
179183

184+
### Retranslating updated entities
185+
186+
If a localized entity is updated, an entry is added to the batch update section of the admin page. This allows easy retranslation of updated entities.
187+
By default, uids will be ignored. You can opt to regenerate them by setting the `translate.config.regenerateUids` key of the plugin options to `true`.
188+
The `translate.config.ignoreUpdatedContentTypes` key of the plugin options can be used to define an array of content types for which such updates should not be recorded.
189+
190+
Note that updates are only considered if they trigger the `afterUpdate` lifecycle hook provided by strapi.
191+
180192
### Schema for translating relations
181193

182194
_The related objects are not translated directly, only the relation itself is translated_

0 commit comments

Comments
 (0)