diff --git a/.github/workflows/deploy-test-server.yml b/.github/workflows/deploy-test-server.yml
index d9ad6c80..ecf57d61 100644
--- a/.github/workflows/deploy-test-server.yml
+++ b/.github/workflows/deploy-test-server.yml
@@ -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: |
diff --git a/package.json b/package.json
index 46d861d1..bd8dd3cc 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -41,10 +42,5 @@
"engines": {
"node": ">=14.0.0"
},
- "packageManager": "yarn@4.0.2",
- "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": "yarn@4.0.2"
}
diff --git a/packages/addons/links/.eslintignore b/packages/addons/links/.eslintignore
new file mode 100644
index 00000000..3a1ec13c
--- /dev/null
+++ b/packages/addons/links/.eslintignore
@@ -0,0 +1,13 @@
+**/node_modules
+**/playground
+**/public
+**/build
+**/dist
+**/bundle
+**/config
+**/scripts
+**/docs
+**/server/types/generated
+**/__tests__
+strapi-admin.js
+strapi-server.js
diff --git a/packages/addons/links/.gitignore b/packages/addons/links/.gitignore
new file mode 100644
index 00000000..e7a1942a
--- /dev/null
+++ b/packages/addons/links/.gitignore
@@ -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
diff --git a/packages/addons/links/.npmignore b/packages/addons/links/.npmignore
new file mode 100644
index 00000000..572309c0
--- /dev/null
+++ b/packages/addons/links/.npmignore
@@ -0,0 +1,6 @@
+# ignore the .ts and .tsx files
+*.ts
+*.tsx
+
+# include the .d.ts files
+!*.d.ts
diff --git a/packages/addons/links/CHANGELOG.md b/packages/addons/links/CHANGELOG.md
new file mode 100644
index 00000000..81659d0e
--- /dev/null
+++ b/packages/addons/links/CHANGELOG.md
@@ -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/webtools-core@1.0.0-beta.13
+
+## 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/webtools-core@1.0.0-beta.12
+
+## 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/webtools-core@1.0.0-beta.11
+ - @pluginpal/webtools-helper-plugin@1.0.0-beta.4
+
+## 1.0.0-beta.5
+
+### Patch Changes
+
+- Updated dependencies [[`a48cc8c`](https://github.com/pluginpal/strapi-webtools/commit/a48cc8cc2fb4a02e74418c0ad326c44ad5c97a65)]:
+ - @pluginpal/webtools-core@1.0.0-beta.10
+
+## 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/webtools-core@1.0.0-beta.9
+
+## 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/webtools-core@1.0.0-beta.8
+
+## 1.0.0-beta.2
+
+### Patch Changes
+
+- Updated dependencies [[`fae4c75`](https://github.com/pluginpal/strapi-webtools/commit/fae4c75d7fb67ab9cc60d5b8a48d4f136b24e128)]:
+ - @pluginpal/webtools-core@1.0.0-beta.7
+
+## 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/webtools-core@1.0.0-beta.6
+
+## 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/webtools-core@1.0.0-beta.5
diff --git a/packages/addons/links/README.md b/packages/addons/links/README.md
new file mode 100644
index 00000000..bf9fb777
--- /dev/null
+++ b/packages/addons/links/README.md
@@ -0,0 +1,3 @@
+# Strapi plugin sitemap
+
+A quick description of sitemap.
diff --git a/packages/addons/links/admin/components/Icon/index.tsx b/packages/addons/links/admin/components/Icon/index.tsx
new file mode 100644
index 00000000..89f48e9f
--- /dev/null
+++ b/packages/addons/links/admin/components/Icon/index.tsx
@@ -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
+
+ );
+};
+
+export default Icon;
diff --git a/packages/addons/links/admin/components/Input/index.tsx b/packages/addons/links/admin/components/Input/index.tsx
new file mode 100644
index 00000000..cd79f17f
--- /dev/null
+++ b/packages/addons/links/admin/components/Input/index.tsx
@@ -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({
+ target: { name, type: attribute.type, value: e.currentTarget.value },
+ });
+ };
+
+ return (
+ // eslint-disable-next-line jsx-a11y/label-has-associated-control
+
+ );
+});
+
+export default Input;
diff --git a/packages/addons/links/admin/helpers/getTrad.ts b/packages/addons/links/admin/helpers/getTrad.ts
new file mode 100644
index 00000000..737066c2
--- /dev/null
+++ b/packages/addons/links/admin/helpers/getTrad.ts
@@ -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;
diff --git a/packages/addons/links/admin/helpers/pluginId.ts b/packages/addons/links/admin/helpers/pluginId.ts
new file mode 100644
index 00000000..4f69c433
--- /dev/null
+++ b/packages/addons/links/admin/helpers/pluginId.ts
@@ -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;
diff --git a/packages/addons/links/admin/index.ts b/packages/addons/links/admin/index.ts
new file mode 100644
index 00000000..565a7981
--- /dev/null
+++ b/packages/addons/links/admin/index.ts
@@ -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;
+ // return {
+ // data: prefixPluginTranslations(data, pluginId),
+ // locale,
+ // };
+ // } catch {
+ // return {
+ // data: {},
+ // locale,
+ // };
+ // }
+ // }),
+ // );
+
+ // return Promise.resolve(importedTrads);
+ // },
+};
diff --git a/packages/addons/links/admin/translations/ar.json b/packages/addons/links/admin/translations/ar.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/ar.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/cs.json b/packages/addons/links/admin/translations/cs.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/cs.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/de.json b/packages/addons/links/admin/translations/de.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/de.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/en.json b/packages/addons/links/admin/translations/en.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/en.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/es.json b/packages/addons/links/admin/translations/es.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/es.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/fr.json b/packages/addons/links/admin/translations/fr.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/fr.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/id.json b/packages/addons/links/admin/translations/id.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/id.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/index.ts b/packages/addons/links/admin/translations/index.ts
new file mode 100644
index 00000000..d990d5ae
--- /dev/null
+++ b/packages/addons/links/admin/translations/index.ts
@@ -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;
diff --git a/packages/addons/links/admin/translations/it.json b/packages/addons/links/admin/translations/it.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/it.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/ko.json b/packages/addons/links/admin/translations/ko.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/ko.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/ms.json b/packages/addons/links/admin/translations/ms.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/ms.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/nl.json b/packages/addons/links/admin/translations/nl.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/nl.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/pl.json b/packages/addons/links/admin/translations/pl.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/pl.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/pt-BR.json b/packages/addons/links/admin/translations/pt-BR.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/pt-BR.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/pt.json b/packages/addons/links/admin/translations/pt.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/pt.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/ru.json b/packages/addons/links/admin/translations/ru.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/ru.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/sk.json b/packages/addons/links/admin/translations/sk.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/sk.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/th.json b/packages/addons/links/admin/translations/th.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/th.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/tr.json b/packages/addons/links/admin/translations/tr.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/tr.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/uk.json b/packages/addons/links/admin/translations/uk.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/uk.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/vi.json b/packages/addons/links/admin/translations/vi.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/packages/addons/links/admin/translations/vi.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/packages/addons/links/admin/translations/zh-Hans.json b/packages/addons/links/admin/translations/zh-Hans.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/zh-Hans.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/admin/translations/zh.json b/packages/addons/links/admin/translations/zh.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/packages/addons/links/admin/translations/zh.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/addons/links/package.json b/packages/addons/links/package.json
new file mode 100644
index 00000000..5a69d4d2
--- /dev/null
+++ b/packages/addons/links/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "@pluginpal/webtools-addon-links",
+ "version": "1.0.0-beta.1",
+ "description": "This is the description of the plugin.",
+ "strapi": {
+ "name": "webtools-addon-links",
+ "icon": "list",
+ "displayName": "Webtools Links",
+ "description": "This is the description of the plugin.",
+ "required": false,
+ "kind": "plugin",
+ "webtoolsAddon": true,
+ "addonName": "Links"
+ },
+ "files": [
+ "dist",
+ "strapi-admin.js",
+ "strapi-server.js"
+ ],
+ "exports": {
+ "./strapi-admin": {
+ "types": "./dist/admin/index.d.ts",
+ "source": "./admin/index.ts",
+ "import": "./dist/admin/index.mjs",
+ "require": "./dist/admin/index.js",
+ "default": "./dist/admin/index.js"
+ },
+ "./strapi-server": {
+ "types": "./dist/server/index.d.ts",
+ "source": "./server/index.ts",
+ "import": "./dist/server/index.mjs",
+ "require": "./dist/server/index.js",
+ "default": "./dist/server/index.js"
+ },
+ "./package.json": "./package.json"
+ },
+ "scripts": {
+ "build": "../../../node_modules/.bin/pack-up build && ../../../node_modules/.bin/yalc push --publish",
+ "watch": "../../../node_modules/.bin/pack-up watch",
+ "watch:link": "../../../node_modules/.bin/strapi plugin:watch:link",
+ "eslint": "../../../node_modules/.bin/eslint --max-warnings=0 './**/*.{js,jsx,ts,tsx}'",
+ "eslint:fix": "../../../node_modules/.bin/eslint --fix './**/*.{js,jsx,ts,tsx}'"
+ },
+ "dependencies": {
+ "@pluginpal/webtools-helper-plugin": "1.0.0-beta.4",
+ "@strapi/strapi": "4.20.3"
+ },
+ "devDependencies": {
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0",
+ "react-router-dom": "^5.2.0",
+ "styled-components": "5.3.3"
+ },
+ "peerDependencies": {
+ "@pluginpal/webtools-core": "1.0.0-beta.13",
+ "react": "^17.0.0 || ^18.0.0",
+ "react-dom": "^17.0.0 || ^18.0.0",
+ "react-router-dom": "^5.2.0",
+ "styled-components": "^5.2.1"
+ },
+ "author": {
+ "name": "TODO"
+ },
+ "maintainers": [],
+ "engines": {
+ "node": ">=18.x.x <=20.x.x",
+ "npm": ">=6.0.0"
+ },
+ "license": "MIT"
+}
diff --git a/packages/addons/links/packup.config.ts b/packages/addons/links/packup.config.ts
new file mode 100644
index 00000000..3fc65a1f
--- /dev/null
+++ b/packages/addons/links/packup.config.ts
@@ -0,0 +1,27 @@
+import { Config, defineConfig } from '@strapi/pack-up';
+
+const config: Config = defineConfig({
+ bundles: [
+ {
+ source: './admin/index.ts',
+ import: './dist/admin/index.mjs',
+ require: './dist/admin/index.js',
+ runtime: 'web',
+ },
+ {
+ source: './server/index.ts',
+ import: './dist/server/index.mjs',
+ require: './dist/server/index.js',
+ runtime: 'node',
+ },
+ ],
+ dist: './dist',
+ /**
+ * Because we're exporting a server & client package
+ * which have different runtimes we want to ignore
+ * what they look like in the package.json
+ */
+ exports: {},
+});
+
+export default config;
diff --git a/packages/addons/links/server/bootstrap.ts b/packages/addons/links/server/bootstrap.ts
new file mode 100644
index 00000000..481648a0
--- /dev/null
+++ b/packages/addons/links/server/bootstrap.ts
@@ -0,0 +1,2 @@
+export default () => {
+};
diff --git a/packages/addons/links/server/controllers/search.ts b/packages/addons/links/server/controllers/search.ts
new file mode 100644
index 00000000..b3276387
--- /dev/null
+++ b/packages/addons/links/server/controllers/search.ts
@@ -0,0 +1,68 @@
+
+
+import { Context } from 'koa';
+import { Common } from '@strapi/strapi';
+import { isContentTypeEnabled } from '../util/enabledContentTypes';
+
+/**
+ * Search controller
+ */
+
+export default {
+ index: async (ctx: Context & { params: { id: number } }) => {
+ const { q } = ctx.query;
+ const { id } = ctx.params;
+ let results = [];
+
+ await Promise.all(Object.entries(strapi.contentTypes)
+ .map(async ([uid, config]: [Common.UID.CollectionType, any]) => {
+ const hasWT = isContentTypeEnabled(uid);
+
+ console.log(uid, hasWT);
+
+ if (!hasWT) {
+ return;
+ }
+
+ console.log('goo');
+
+ const coreStoreSettings = await strapi.query('strapi::core-store').findMany({
+ where: {
+ key: `plugin_content_manager_configuration_content_types::${uid}`,
+ },
+ });
+
+ console.log('yes');
+
+ if (!coreStoreSettings[0]) {
+ // no settings for the contnet type.
+ return;
+ }
+
+ console.log('no');
+
+ // @ts-ignore
+ const value = JSON.parse(coreStoreSettings[0].value);
+ const { mainField } = value.settings;
+
+ const entries = await strapi.entityService.findMany(uid, {
+ filters: {
+ [mainField]: {
+ $containsi: q,
+ },
+ },
+ fields: [mainField],
+ populate: {
+ url_alias: {
+ fields: ['id'],
+ },
+ },
+ }) as any[];
+
+ results = [...results, ...entries];
+ }));
+
+ // @ts-ignore
+ ctx.body = results;
+ },
+};
diff --git a/packages/addons/links/server/index.ts b/packages/addons/links/server/index.ts
new file mode 100644
index 00000000..03ce9066
--- /dev/null
+++ b/packages/addons/links/server/index.ts
@@ -0,0 +1,20 @@
+import register from './register';
+import bootstrap from './bootstrap';
+import searchRoutes from './routes/search';
+import searchControllers from './controllers/search';
+
+export default {
+ register,
+ bootstrap,
+ routes: {
+ 'content-api': {
+ type: 'content-api',
+ routes: [
+ ...searchRoutes,
+ ],
+ },
+ },
+ controllers: {
+ search: searchControllers,
+ },
+};
diff --git a/packages/addons/links/server/register.ts b/packages/addons/links/server/register.ts
new file mode 100644
index 00000000..38fe227d
--- /dev/null
+++ b/packages/addons/links/server/register.ts
@@ -0,0 +1,9 @@
+import { Strapi } from '@strapi/strapi';
+
+export default ({ strapi }: { strapi: Strapi }) => {
+ strapi.customFields.register({
+ name: 'link',
+ plugin: 'webtools-addon-links',
+ type: 'string',
+ });
+};
diff --git a/packages/addons/links/server/routes/search.ts b/packages/addons/links/server/routes/search.ts
new file mode 100644
index 00000000..6281a46f
--- /dev/null
+++ b/packages/addons/links/server/routes/search.ts
@@ -0,0 +1,12 @@
+
+
+export default [
+ {
+ method: 'GET',
+ path: '/search',
+ handler: 'search.index',
+ config: {
+ policies: [],
+ },
+ },
+];
diff --git a/packages/addons/links/server/strapi.d.ts b/packages/addons/links/server/strapi.d.ts
new file mode 100644
index 00000000..2f049265
--- /dev/null
+++ b/packages/addons/links/server/strapi.d.ts
@@ -0,0 +1,7 @@
+import { Strapi } from '@strapi/strapi';
+
+declare global {
+ const strapi: Strapi;
+}
+
+export default global;
diff --git a/packages/addons/links/server/util/enabledContentTypes.ts b/packages/addons/links/server/util/enabledContentTypes.ts
new file mode 100644
index 00000000..ddf52a7a
--- /dev/null
+++ b/packages/addons/links/server/util/enabledContentTypes.ts
@@ -0,0 +1,19 @@
+import _ from 'lodash';
+import { Common, Schema } from '@strapi/strapi';
+
+export const isContentTypeEnabled = (ct: Common.UID.ContentType | Schema.ContentType) => {
+ let contentType: Schema.ContentType;
+
+ if (typeof ct === 'string') {
+ contentType = strapi.contentTypes[ct];
+ } else {
+ contentType = ct;
+ }
+
+ const { pluginOptions } = contentType;
+ const enabled = _.get(pluginOptions, ['webtools', 'enabled'], false) as boolean;
+
+ if (!enabled) return false;
+
+ return true;
+};
diff --git a/packages/addons/links/strapi-server.js b/packages/addons/links/strapi-server.js
new file mode 100644
index 00000000..bf559588
--- /dev/null
+++ b/packages/addons/links/strapi-server.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('./dist/server');
diff --git a/packages/addons/links/tsconfig.json b/packages/addons/links/tsconfig.json
new file mode 100644
index 00000000..b84c43d4
--- /dev/null
+++ b/packages/addons/links/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "../../../tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "../../../playground/src/plugins/webtools-addon-links",
+ },
+ "include": [
+ "./server/**/*",
+ "./admin/**/*",
+ "./types/**/*",
+ "./strapi-server.*",
+ "./strapi-admin.*"
+ ],
+}
diff --git a/packages/addons/links/types/app.ts b/packages/addons/links/types/app.ts
new file mode 100644
index 00000000..bbac54aa
--- /dev/null
+++ b/packages/addons/links/types/app.ts
@@ -0,0 +1,14 @@
+export type App = {
+ registerPlugin: (plugin: {
+ [key: string]: any;
+ }) => void;
+ createSettingSection: (id: any, sections: any[]) => void;
+
+ injectContentManagerComponent: (a: string, b: string, ...args: any[]) => void;
+
+ getPlugin: (name: string) => null | undefined | {
+ [key: string]: any;
+ };
+
+ [key: string]: any;
+};
diff --git a/packages/addons/menus/package.json b/packages/addons/menus/package.json
index c487c4af..6e811ea2 100644
--- a/packages/addons/menus/package.json
+++ b/packages/addons/menus/package.json
@@ -44,7 +44,7 @@
},
"dependencies": {
"@pluginpal/webtools-helper-plugin": "1.0.0-beta.4",
- "@strapi/strapi": "^4"
+ "@strapi/strapi": "4.20.3"
},
"devDependencies": {
"react": "^18.0.0",
diff --git a/packages/addons/redirects/package.json b/packages/addons/redirects/package.json
index 79d935a6..d1c451c5 100644
--- a/packages/addons/redirects/package.json
+++ b/packages/addons/redirects/package.json
@@ -44,7 +44,7 @@
},
"dependencies": {
"@pluginpal/webtools-helper-plugin": "1.0.0-beta.4",
- "@strapi/strapi": "^4"
+ "@strapi/strapi": "4.20.3"
},
"devDependencies": {
"react": "^18.0.0",
diff --git a/packages/addons/sitemap/package.json b/packages/addons/sitemap/package.json
index 85416ffa..ee9cd019 100644
--- a/packages/addons/sitemap/package.json
+++ b/packages/addons/sitemap/package.json
@@ -43,7 +43,6 @@
},
"peerDependencies": {
"@pluginpal/webtools-core": "1.0.0-beta.14",
- "@strapi/strapi": "^4.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"react-router-dom": "^5.2.0",
diff --git a/packages/core/package.json b/packages/core/package.json
index fdbf6c72..ea57c705 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -40,7 +40,6 @@
"eslint:fix": "../../node_modules/.bin/eslint --fix './**/*.{js,jsx,ts,tsx}'"
},
"peerDependencies": {
- "@strapi/strapi": "^4.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"react-router-dom": "^5.2.0",
diff --git a/packages/helper-plugin/package.json b/packages/helper-plugin/package.json
index 207f3cf8..f7b2dee9 100644
--- a/packages/helper-plugin/package.json
+++ b/packages/helper-plugin/package.json
@@ -15,7 +15,7 @@
"typescript": "5.2.2"
},
"dependencies": {
- "@strapi/strapi": "^4"
+ "@strapi/strapi": "4.20.3"
},
"author": {
"name": "TODO"
diff --git a/playground/.strapi/client/app.js b/playground/.strapi/client/app.js
index e5d337bb..407bd93b 100644
--- a/playground/.strapi/client/app.js
+++ b/playground/.strapi/client/app.js
@@ -2,6 +2,7 @@
* This file was automatically generated by Strapi.
* Any modifications made will be discarded.
*/
+import webtoolsAddonLinks from "@pluginpal/webtools-addon-links/strapi-admin";
import webtoolsAddonSitemap from "@pluginpal/webtools-addon-sitemap/strapi-admin";
import webtools from "@pluginpal/webtools-core/strapi-admin";
import i18N from "@strapi/plugin-i18n/strapi-admin";
@@ -14,6 +15,7 @@ renderAdmin(document.getElementById("strapi"), {
customisations,
plugins: {
+ "webtools-addon-links": webtoolsAddonLinks,
"webtools-addon-sitemap": webtoolsAddonSitemap,
webtools: webtools,
i18n: i18N,
diff --git a/playground/.strapi/client/index.html b/playground/.strapi/client/index.html
index c6639409..08d9c27c 100644
--- a/playground/.strapi/client/index.html
+++ b/playground/.strapi/client/index.html
@@ -58,6 +58,5 @@ JavaScript disabled
-