Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initiate the links addon with a custom field and install it int… #162

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e6d6b01
feat: initiate the links addon with a custom field and install it int…
boazpoolman Aug 15, 2024
b224d71
feat: search all content admin route (wip)
boazpoolman Aug 16, 2024
8063ceb
Merge branch 'master' of github.com:pluginpal/strapi-webtools into fe…
boazpoolman Aug 20, 2024
172c2df
chore: tmp disable webtools
boazpoolman Aug 21, 2024
34ce37c
fix: test deploy
boazpoolman Aug 21, 2024
51c897d
chore: update lock files
boazpoolman Aug 21, 2024
da02b30
fix: don't postinstall playground node_modules
boazpoolman Aug 21, 2024
c64e24c
chore: add playground install to test deploy steps
boazpoolman Aug 21, 2024
c5df65c
Revert "chore: update lock files"
boazpoolman Aug 21, 2024
7241095
chore: update lockfile
boazpoolman Aug 21, 2024
b46bf3c
chore: update lockfile
boazpoolman Aug 21, 2024
9a25066
chore: update lockfile
boazpoolman Aug 21, 2024
f619fc7
chore: update lockfile
boazpoolman Aug 21, 2024
43b42d4
fix: issue in lockfile
boazpoolman Aug 21, 2024
8b6f38a
chore: update lockfile
boazpoolman Aug 21, 2024
cdc20c3
chore: update lockfile
boazpoolman Aug 21, 2024
71afc1d
chore: update lockfile
boazpoolman Aug 21, 2024
aa7d551
chore: update Dockerfile
boazpoolman Aug 21, 2024
37d2090
chore: fix test deploy
boazpoolman Aug 21, 2024
dffa0d3
chore: update lockfile
boazpoolman Aug 21, 2024
ec60bc4
fix: test deploy
boazpoolman Aug 21, 2024
034ec60
chore: use yalc file: instead of yalc link:
boazpoolman Aug 21, 2024
d31583e
chore: don't playground:install in the deploy pipeline
boazpoolman Aug 21, 2024
ea73e2c
fix: test deploy
boazpoolman Aug 21, 2024
7ec9ef5
fix: test deploy
boazpoolman Aug 21, 2024
06223f9
fix: change the default yalc store folder to be inside the playground
boazpoolman Aug 21, 2024
bcc407d
chore: update the yalc store to be in the root of the repo
boazpoolman Aug 21, 2024
d91ed6c
fix: test deploy
boazpoolman Aug 21, 2024
35d7368
chore: temp disable webtools
boazpoolman Aug 21, 2024
89fc53f
chore: temp remove the link field from one of the test content types
boazpoolman Aug 21, 2024
28be067
chore: fix test build
boazpoolman Aug 21, 2024
d21dfde
fix: test deploy
boazpoolman Aug 21, 2024
1fbbfda
chore: add link field to the test content type
boazpoolman Aug 21, 2024
f0ca278
chore: allow for different databses (sqlite local, postres on test se…
boazpoolman Aug 21, 2024
b5b03c4
fix: use yalc --link during development
boazpoolman Sep 1, 2024
2be88d5
chore: update lockfiles
boazpoolman Sep 1, 2024
4307954
fix: strapi/strapi dependency managements
boazpoolman Sep 2, 2024
738e0d2
fix: conflicts
boazpoolman Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-test-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
- name: Build the packages
run: yarn run build

- name: Install de playground dependencies
run: yarn playground:install
- name: Add yalc packages to playground
run: yarn playground:yalc-add

- name: Build a Docker image of the playground
run: |
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"packages/addons/*"
],
"scripts": {
"postinstall": "yarn playground:install",
"build": "turbo run build",
"develop": "FORCE_COLOR=1 turbo run watch:link",
"eslint": "turbo run eslint",
"eslint:fix": "turbo run eslint:fix",
"release:publish": "turbo run build && changeset publish",
"release:prepare": "changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
"playground:install": "cd playground && yarn dlx yalc add --link @pluginpal/webtools-helper-plugin @pluginpal/webtools-core @pluginpal/webtools-addon-sitemap && yarn install",
"playground:install": "yarn playground:yalc-add-link && cd playground && yarn install",
"playground:yalc-add": "cd playground && yarn dlx yalc add @pluginpal/webtools-helper-plugin @pluginpal/webtools-core @pluginpal/webtools-addon-sitemap @pluginpal/webtools-addon-links",
"playground:yalc-add-link": "cd playground && yarn dlx yalc add --link @pluginpal/webtools-helper-plugin @pluginpal/webtools-core @pluginpal/webtools-addon-sitemap @pluginpal/webtools-addon-links",
"playground:build": "cd playground && yarn build",
"playground:start": "cd playground && yarn start",
"playground:develop": "rm -rf playground/node_modules/.strapi/ && cd playground && yarn develop --watch-admin --bundler=vite",
Expand Down Expand Up @@ -41,10 +42,5 @@
"engines": {
"node": ">=14.0.0"
},
"packageManager": "[email protected]",
"dependencies": {
"@pluginpal/webtools-addon-sitemap": "link:.yalc/@pluginpal/webtools-addon-sitemap",
"@pluginpal/webtools-core": "link:.yalc/@pluginpal/webtools-core",
"@pluginpal/webtools-helper-plugin": "link:.yalc/@pluginpal/webtools-helper-plugin"
}
"packageManager": "[email protected]"
}
13 changes: 13 additions & 0 deletions packages/addons/links/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/node_modules
**/playground
**/public
**/build
**/dist
**/bundle
**/config
**/scripts
**/docs
**/server/types/generated
**/__tests__
strapi-admin.js
strapi-server.js
18 changes: 18 additions & 0 deletions packages/addons/links/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Don't check auto-generated stuff into git
coverage
node_modules
stats.json
package-lock.json

# Cruft
.DS_Store
npm-debug.log
.idea

# Strapi
.strapi-updater.json

# Production build
build
dist
bundle
6 changes: 6 additions & 0 deletions packages/addons/links/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore the .ts and .tsx files
*.ts
*.tsx

# include the .d.ts files
!*.d.ts
71 changes: 71 additions & 0 deletions packages/addons/links/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# addon-links

## 1.0.0-beta.8

### Patch Changes

- Updated dependencies [[`e5c0587`](https://github.com/pluginpal/strapi-webtools/commit/e5c058758087c9d878ab7f40466672b340731e99)]:
- @pluginpal/[email protected]

## 1.0.0-beta.7

### Patch Changes

- Updated dependencies [[`60b5eff`](https://github.com/pluginpal/strapi-webtools/commit/60b5eff18795afd173a57380a87767fc29d06b3d), [`d620caa`](https://github.com/pluginpal/strapi-webtools/commit/d620caa4d42b409e87fd604d88e99d23ac6e985a)]:
- @pluginpal/[email protected]

## 1.0.0-beta.6

### Patch Changes

- Updated dependencies [[`ff7cb45`](https://github.com/pluginpal/strapi-webtools/commit/ff7cb457cd292f6b1ff938adf655c678e1cb446d), [`49fe9bc`](https://github.com/pluginpal/strapi-webtools/commit/49fe9bc05fc2799735e92a76dd8639982aa04680), [`ff0851a`](https://github.com/pluginpal/strapi-webtools/commit/ff0851a7a335ff8c0d79428f7b209c5675546bea), [`c99b57e`](https://github.com/pluginpal/strapi-webtools/commit/c99b57eee5910e9a49534980f678cdc4c0b14471), [`4fd5602`](https://github.com/pluginpal/strapi-webtools/commit/4fd56026d262e4f0a30cf5ab8274d916d29aadd6), [`05ae3ca`](https://github.com/pluginpal/strapi-webtools/commit/05ae3ca82ac1f2eb7c825852b0d24408daf1b501)]:
- @pluginpal/[email protected]
- @pluginpal/[email protected]

## 1.0.0-beta.5

### Patch Changes

- Updated dependencies [[`a48cc8c`](https://github.com/pluginpal/strapi-webtools/commit/a48cc8cc2fb4a02e74418c0ad326c44ad5c97a65)]:
- @pluginpal/[email protected]

## 1.0.0-beta.4

### Patch Changes

- Updated dependencies [[`9b81da2`](https://github.com/pluginpal/strapi-webtools/commit/9b81da214ec8a1aa3f42d2d4eadaa30688ff4fe7), [`cb59eb7`](https://github.com/pluginpal/strapi-webtools/commit/cb59eb78ef7d45d7c3c07ec7350747b6bc611b27)]:
- @pluginpal/[email protected]

## 1.0.0-beta.3

### Patch Changes

- Updated dependencies [[`1f01462`](https://github.com/pluginpal/strapi-webtools/commit/1f01462d4bcabd65772eb9733d76746834d9e508), [`905ff2e`](https://github.com/pluginpal/strapi-webtools/commit/905ff2ea322aa1a21b836e76fb6f095de660c430)]:
- @pluginpal/[email protected]

## 1.0.0-beta.2

### Patch Changes

- Updated dependencies [[`fae4c75`](https://github.com/pluginpal/strapi-webtools/commit/fae4c75d7fb67ab9cc60d5b8a48d4f136b24e128)]:
- @pluginpal/[email protected]

## 1.0.0-beta.1

### Patch Changes

- Updated dependencies [[`6d2ee80`](https://github.com/pluginpal/strapi-webtools/commit/6d2ee80506aa3df8d0bc6ceb5031bc79cd253e8d), [`816f4db`](https://github.com/pluginpal/strapi-webtools/commit/816f4db1577a576438d048d5e244d19a17035e57), [`6a6fb9d`](https://github.com/pluginpal/strapi-webtools/commit/6a6fb9d0a58c8cf9d1ed159c11b6a197ec3de916), [`3aba7ed`](https://github.com/pluginpal/strapi-webtools/commit/3aba7ed6b814e2588f3403b5f8884f9e90ac7b34), [`a628383`](https://github.com/pluginpal/strapi-webtools/commit/a628383adf5aa0640c97e7379af1a2dd308e80fb), [`426b4ae`](https://github.com/pluginpal/strapi-webtools/commit/426b4aee9a80f080cd3ba2627360eb5b23230c88), [`5da6433`](https://github.com/pluginpal/strapi-webtools/commit/5da643305f62a2a2cd6d56a9ffa9885a3d2d9a02)]:
- @pluginpal/[email protected]

## 0.0.1-beta.0

### Patch Changes

- feb9d87: Removed redundant files from the npm builds
- dee1907: Fix issue with the admin translations
- Updated dependencies [0b32de2]
- Updated dependencies [feb9d87]
- Updated dependencies [d7be9d5]
- Updated dependencies [e5ba503]
- Updated dependencies [dee1907]
- @pluginpal/[email protected]
3 changes: 3 additions & 0 deletions packages/addons/links/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Strapi plugin sitemap

A quick description of sitemap.
11 changes: 11 additions & 0 deletions packages/addons/links/admin/components/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { Link } from '@strapi/icons';

const Icon = () => {
return (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<Link />
);
};

export default Icon;
36 changes: 36 additions & 0 deletions packages/addons/links/admin/components/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react';

import { useIntl } from 'react-intl';

const Input = React.forwardRef((props, ref) => {
const {
// @ts-ignore
attribute, disabled, intlLabel, name, onChange, required, value,
} = props; // these are just some of the props passed by the content-manager

const { formatMessage } = useIntl();

const handleChange = (e) => {
onChange({

Check warning on line 14 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe call of an `any` typed value

Check warning on line 14 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value
target: { name, type: attribute.type, value: e.currentTarget.value },

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .type on an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .currentTarget on an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .type on an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 15 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .currentTarget on an `any` value
});
};

return (
// eslint-disable-next-line jsx-a11y/label-has-associated-control
<label>
{formatMessage(intlLabel)}

Check warning on line 22 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe argument of type `any` assigned to a parameter of type `MessageDescriptor`

Check warning on line 22 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `MessageDescriptor`
<input
// @ts-ignore
ref={ref}
name={name}

Check warning on line 26 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 26 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
disabled={disabled}

Check warning on line 27 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 27 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
value={value}

Check warning on line 28 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 28 in packages/addons/links/admin/components/Input/index.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
required={required}
onChange={handleChange}
/>
</label>
);
});

export default Input;
10 changes: 10 additions & 0 deletions packages/addons/links/admin/helpers/getTrad.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pluginId from './pluginId';

/**
* A helper function to obtain a translation id.
*
* @return {string} The plugin id.
*/
const getTrad = (id: string): string => `${pluginId}.${id}`;

export default getTrad;
10 changes: 10 additions & 0 deletions packages/addons/links/admin/helpers/pluginId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pluginPkg from '../../package.json';

/**
* A helper function to obtain the plugin id.
*
* @return {string} The plugin id.
*/
const pluginId: string = pluginPkg.strapi.name;

export default pluginId;
60 changes: 60 additions & 0 deletions packages/addons/links/admin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { prefixPluginTranslations } from '@strapi/helper-plugin';
import { AdminApp } from '@pluginpal/webtools-helper-plugin';
import pluginPkg from '../package.json';
import pluginId from './helpers/pluginId';
import getTrad from './helpers/getTrad';
import Icon from './components/Icon';

const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
const { name } = pluginPkg.strapi;

export default {
register(app: AdminApp) {
app.customFields.register({
name: 'link',
pluginId: 'webtools-addon-links', // the custom field is created by a webtools-addon-links plugin
type: 'string', // the link will be stored as a string
intlLabel: {
id: 'webtools-addon-links.link.label',
defaultMessage: 'Link',
},
intlDescription: {
id: 'webtools-addon-links.link.description',
defaultMessage: 'For internal and external links',
},
icon: Icon, // don't forget to create/import your icon component
components: {
Input: async () => import(
/* webpackChunkName: "input-component" */ "./components/Input"
),
},
options: {
// declare options here
},
});
},
bootstrap(app: AdminApp) {

},
// async registerTrads({ locales }: { locales: string[] }) {
// const importedTrads = await Promise.all(
// locales.map((locale) => {
// try {
// // eslint-disable-next-line import/no-dynamic-require, global-require
// const data = require(`./translations/${locale}.json`) as Record<string, string>;
// return {
// data: prefixPluginTranslations(data, pluginId),
// locale,
// };
// } catch {
// return {
// data: {},
// locale,
// };
// }
// }),
// );

// return Promise.resolve(importedTrads);
// },
};
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
49 changes: 49 additions & 0 deletions packages/addons/links/admin/translations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import ar from './ar.json';
import cs from './cs.json';
import de from './de.json';
import en from './en.json';
import es from './es.json';
import fr from './fr.json';
import id from './id.json';
import it from './it.json';
import ko from './ko.json';
import ms from './ms.json';
import nl from './nl.json';
import pl from './pl.json';
import ptBR from './pt-BR.json';
import pt from './pt.json';
import ru from './ru.json';
import th from './th.json';
import tr from './tr.json';
import uk from './uk.json';
import vi from './vi.json';
import zhHans from './zh-Hans.json';
import zh from './zh.json';
import sk from './sk.json';

const trads = {
ar,
cs,
de,
en,
es,
fr,
id,
it,
ko,
ms,
nl,
pl,
'pt-BR': ptBR,
pt,
ru,
th,
tr,
uk,
vi,
'zh-Hans': zhHans,
zh,
sk,
};

export default trads;
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/ms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/pt-BR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/sk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/th.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/uk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/vi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/zh-Hans.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions packages/addons/links/admin/translations/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading
Loading