@extravirgin/payload-plugin-meilisearch 0.0.1-1 → 0.0.1-2
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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js.map +1 -0
- package/dist/indexCollections.d.ts +3 -0
- package/dist/indexCollections.js +275 -0
- package/dist/indexCollections.js.map +1 -0
- package/dist/mocks/mockFile.d.ts +1 -0
- package/dist/mocks/mockFile.js +3 -0
- package/dist/mocks/mockFile.js.map +1 -0
- package/dist/onInitExtension.d.ts +3 -0
- package/dist/onInitExtension.js +17 -0
- package/dist/onInitExtension.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +103 -0
- package/dist/plugin.js.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/webpack.d.ts +3 -0
- package/dist/webpack.js +32 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +4 -1
- package/.editorconfig +0 -10
- package/.eslintrc.js +0 -17
- package/.github/workflows/test.yml +0 -19
- package/.prettierrc.js +0 -8
- package/dev/.env.example +0 -2
- package/dev/Dockerfile +0 -27
- package/dev/docker-compose.yml +0 -31
- package/dev/jest.config.js +0 -12
- package/dev/nodemon.json +0 -6
- package/dev/package.json +0 -35
- package/dev/plugin.spec.ts +0 -30
- package/dev/src/collections/Examples.ts +0 -17
- package/dev/src/collections/Users.ts +0 -15
- package/dev/src/mocks/fileStub.js +0 -1
- package/dev/src/payload.config.ts +0 -44
- package/dev/src/server.ts +0 -29
- package/dev/tsconfig.json +0 -34
- package/eslint-config/index.js +0 -15
- package/eslint-config/rules/import.js +0 -38
- package/eslint-config/rules/prettier.js +0 -7
- package/eslint-config/rules/style.js +0 -21
- package/eslint-config/rules/typescript.js +0 -628
- package/src/index.ts +0 -3
- package/src/indexCollections.ts +0 -155
- package/src/mocks/mockFile.js +0 -1
- package/src/onInitExtension.ts +0 -16
- package/src/plugin.ts +0 -67
- package/src/types.ts +0 -20
- package/src/webpack.ts +0 -28
- package/tsconfig.json +0 -23
package/dev/docker-compose.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
version: '3'
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
payload:
|
|
5
|
-
image: node:18-alpine
|
|
6
|
-
ports:
|
|
7
|
-
- '3000:3000'
|
|
8
|
-
volumes:
|
|
9
|
-
- .:/home/node/app
|
|
10
|
-
- node_modules:/home/node/app/node_modules
|
|
11
|
-
working_dir: /home/node/app/
|
|
12
|
-
command: sh -c "yarn install && yarn dev"
|
|
13
|
-
depends_on:
|
|
14
|
-
- mongo
|
|
15
|
-
env_file:
|
|
16
|
-
- .env
|
|
17
|
-
|
|
18
|
-
mongo:
|
|
19
|
-
image: mongo:latest
|
|
20
|
-
ports:
|
|
21
|
-
- '27017:27017'
|
|
22
|
-
command:
|
|
23
|
-
- --storageEngine=wiredTiger
|
|
24
|
-
volumes:
|
|
25
|
-
- data:/data/db
|
|
26
|
-
logging:
|
|
27
|
-
driver: none
|
|
28
|
-
|
|
29
|
-
volumes:
|
|
30
|
-
data:
|
|
31
|
-
node_modules:
|
package/dev/jest.config.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
verbose: true,
|
|
3
|
-
testEnvironment: 'node',
|
|
4
|
-
transform: {
|
|
5
|
-
'^.+\\.(t|j)sx?$': '<rootDir>/node_modules/@swc/jest',
|
|
6
|
-
},
|
|
7
|
-
moduleNameMapper: {
|
|
8
|
-
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
|
9
|
-
'<rootDir>/src/mocks/fileStub.js',
|
|
10
|
-
'\\.(css|scss)$': '<rootDir>/src/mocks/fileStub.js',
|
|
11
|
-
},
|
|
12
|
-
}
|
package/dev/nodemon.json
DELETED
package/dev/package.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Payload2Blank",
|
|
3
|
-
"description": "A blank template to get started with Payload",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"main": "dist/server.js",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
|
|
9
|
-
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
|
|
10
|
-
"build:server": "tsc",
|
|
11
|
-
"build": "yarn copyfiles && yarn build:payload && yarn build:server",
|
|
12
|
-
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
|
|
13
|
-
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
|
|
14
|
-
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
|
|
15
|
-
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema",
|
|
16
|
-
"payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@payloadcms/bundler-webpack": "^1.0.0",
|
|
20
|
-
"@payloadcms/db-mongodb": "^1.0.0",
|
|
21
|
-
"@payloadcms/plugin-cloud": "^2.0.0",
|
|
22
|
-
"@payloadcms/richtext-slate": "^1.0.0",
|
|
23
|
-
"cross-env": "^7.0.3",
|
|
24
|
-
"dotenv": "^8.2.0",
|
|
25
|
-
"express": "^4.17.1",
|
|
26
|
-
"payload": "^2.0.0"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@types/express": "^4.17.9",
|
|
30
|
-
"copyfiles": "^2.4.1",
|
|
31
|
-
"nodemon": "^2.0.6",
|
|
32
|
-
"ts-node": "^9.1.1",
|
|
33
|
-
"typescript": "^4.8.4"
|
|
34
|
-
}
|
|
35
|
-
}
|
package/dev/plugin.spec.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Server } from 'http'
|
|
2
|
-
import mongoose from 'mongoose'
|
|
3
|
-
import payload from 'payload'
|
|
4
|
-
import { start } from './src/server'
|
|
5
|
-
|
|
6
|
-
describe('Plugin tests', () => {
|
|
7
|
-
let server: Server
|
|
8
|
-
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
await start({ local: true })
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
afterAll(async () => {
|
|
14
|
-
await mongoose.connection.dropDatabase()
|
|
15
|
-
await mongoose.connection.close()
|
|
16
|
-
server.close()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// Add tests to ensure that the plugin works as expected
|
|
20
|
-
|
|
21
|
-
// Example test to check for seeded data
|
|
22
|
-
it('seeds data accordingly', async () => {
|
|
23
|
-
const newCollectionQuery = await payload.find({
|
|
24
|
-
collection: 'new-collection',
|
|
25
|
-
sort: 'createdAt',
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
expect(newCollectionQuery.totalDocs).toEqual(1)
|
|
29
|
-
})
|
|
30
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CollectionConfig } from 'payload/types';
|
|
2
|
-
|
|
3
|
-
// Example Collection - For reference only, this must be added to payload.config.ts to be used.
|
|
4
|
-
const Examples: CollectionConfig = {
|
|
5
|
-
slug: 'examples',
|
|
6
|
-
admin: {
|
|
7
|
-
useAsTitle: 'someField',
|
|
8
|
-
},
|
|
9
|
-
fields: [
|
|
10
|
-
{
|
|
11
|
-
name: 'someField',
|
|
12
|
-
type: 'text',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default Examples;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CollectionConfig } from 'payload/types';
|
|
2
|
-
|
|
3
|
-
const Users: CollectionConfig = {
|
|
4
|
-
slug: 'users',
|
|
5
|
-
auth: true,
|
|
6
|
-
admin: {
|
|
7
|
-
useAsTitle: 'email',
|
|
8
|
-
},
|
|
9
|
-
fields: [
|
|
10
|
-
// Email added by default
|
|
11
|
-
// Add more fields as needed
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default Users;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default 'file-stub'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { buildConfig } from 'payload/config';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import Users from './collections/Users';
|
|
4
|
-
import Examples from './collections/Examples';
|
|
5
|
-
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
|
6
|
-
import { webpackBundler } from '@payloadcms/bundler-webpack'
|
|
7
|
-
import { slateEditor } from '@payloadcms/richtext-slate'
|
|
8
|
-
import { samplePlugin } from '../../src/index'
|
|
9
|
-
|
|
10
|
-
export default buildConfig({
|
|
11
|
-
admin: {
|
|
12
|
-
user: Users.slug,
|
|
13
|
-
bundler: webpackBundler(),
|
|
14
|
-
webpack: config => {
|
|
15
|
-
const newConfig = {
|
|
16
|
-
...config,
|
|
17
|
-
resolve: {
|
|
18
|
-
...config.resolve,
|
|
19
|
-
alias: {
|
|
20
|
-
...(config?.resolve?.alias || {}),
|
|
21
|
-
react: path.join(__dirname, '../node_modules/react'),
|
|
22
|
-
'react-dom': path.join(__dirname, '../node_modules/react-dom'),
|
|
23
|
-
payload: path.join(__dirname, '../node_modules/payload'),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
return newConfig
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
editor: slateEditor({}),
|
|
31
|
-
collections: [
|
|
32
|
-
Examples, Users,
|
|
33
|
-
],
|
|
34
|
-
typescript: {
|
|
35
|
-
outputFile: path.resolve(__dirname, 'payload-types.ts'),
|
|
36
|
-
},
|
|
37
|
-
graphQL: {
|
|
38
|
-
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
|
|
39
|
-
},
|
|
40
|
-
plugins: [samplePlugin({ enabled: true })],
|
|
41
|
-
db: mongooseAdapter({
|
|
42
|
-
url: process.env.DATABASE_URI,
|
|
43
|
-
}),
|
|
44
|
-
})
|
package/dev/src/server.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import express from 'express'
|
|
2
|
-
import payload from 'payload'
|
|
3
|
-
import { InitOptions } from 'payload/config'
|
|
4
|
-
|
|
5
|
-
require('dotenv').config()
|
|
6
|
-
const app = express()
|
|
7
|
-
|
|
8
|
-
// Redirect root to Admin panel
|
|
9
|
-
app.get('/', (_, res) => {
|
|
10
|
-
res.redirect('/admin')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
export const start = async (args?: Partial<InitOptions>) => {
|
|
14
|
-
// Initialize Payload
|
|
15
|
-
await payload.init({
|
|
16
|
-
secret: process.env.PAYLOAD_SECRET,
|
|
17
|
-
express: app,
|
|
18
|
-
onInit: async () => {
|
|
19
|
-
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
|
|
20
|
-
},
|
|
21
|
-
...(args || {}),
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// Add your own express routes here
|
|
25
|
-
|
|
26
|
-
app.listen(3000)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
start()
|
package/dev/tsconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"strict": false,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"outDir": "./dist",
|
|
14
|
-
"rootDir": "./src",
|
|
15
|
-
"jsx": "react",
|
|
16
|
-
"paths": {
|
|
17
|
-
"payload/generated-types": [
|
|
18
|
-
"./src/payload-types.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"include": [
|
|
23
|
-
"src"
|
|
24
|
-
],
|
|
25
|
-
"exclude": [
|
|
26
|
-
"node_modules",
|
|
27
|
-
"dist",
|
|
28
|
-
"build"
|
|
29
|
-
],
|
|
30
|
-
"ts-node": {
|
|
31
|
-
"transpileOnly": true,
|
|
32
|
-
"swc": true
|
|
33
|
-
}
|
|
34
|
-
}
|
package/eslint-config/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
extends: [
|
|
4
|
-
'airbnb-base',
|
|
5
|
-
require.resolve('./rules/style.js'),
|
|
6
|
-
require.resolve('./rules/import.js'),
|
|
7
|
-
require.resolve('./rules/typescript.js'),
|
|
8
|
-
require.resolve('./rules/prettier.js'),
|
|
9
|
-
],
|
|
10
|
-
env: {
|
|
11
|
-
es6: true,
|
|
12
|
-
browser: true,
|
|
13
|
-
node: true,
|
|
14
|
-
},
|
|
15
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
es6: true,
|
|
4
|
-
},
|
|
5
|
-
extends: ['plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript'],
|
|
6
|
-
plugins: ['import'],
|
|
7
|
-
settings: {
|
|
8
|
-
'import/parsers': {
|
|
9
|
-
'@typescript-eslint/parser': ['.ts'],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
rules: {
|
|
13
|
-
/**
|
|
14
|
-
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
|
|
15
|
-
*/
|
|
16
|
-
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
|
|
17
|
-
'import/no-default-export': 'off',
|
|
18
|
-
'import/prefer-default-export': 'off',
|
|
19
|
-
'import/extensions': [
|
|
20
|
-
'error',
|
|
21
|
-
'ignorePackages',
|
|
22
|
-
{
|
|
23
|
-
ts: 'never',
|
|
24
|
-
tsx: 'never',
|
|
25
|
-
js: 'never',
|
|
26
|
-
jsx: 'never',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
'import/no-extraneous-dependencies': 'off',
|
|
30
|
-
/**
|
|
31
|
-
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
|
|
32
|
-
*/
|
|
33
|
-
'import/named': 'error',
|
|
34
|
-
'import/no-relative-packages': 'warn',
|
|
35
|
-
'import/no-import-module-exports': 'warn',
|
|
36
|
-
'import/no-cycle': 'warn',
|
|
37
|
-
},
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
'prefer-named-exports': 'off',
|
|
4
|
-
|
|
5
|
-
'prefer-destructuring': 'off',
|
|
6
|
-
// 'prefer-destructuring': ['warn', { object: true, array: true }],
|
|
7
|
-
// ensure all object/arrays end with a comma
|
|
8
|
-
'comma-dangle': ['error', 'always-multiline'],
|
|
9
|
-
'class-methods-use-this': 'off',
|
|
10
|
-
// consistent new lines
|
|
11
|
-
'function-paren-newline': ['error', 'consistent'],
|
|
12
|
-
'eol-last': ['error', 'always'],
|
|
13
|
-
// allow restricted syntax like for...of loops
|
|
14
|
-
'no-restricted-syntax': 'off',
|
|
15
|
-
'no-await-in-loop': 'off',
|
|
16
|
-
'no-console': 'error',
|
|
17
|
-
// 'no-floating-promises': true,
|
|
18
|
-
// do not allow process.env access in files
|
|
19
|
-
'no-process-env': 'warn',
|
|
20
|
-
},
|
|
21
|
-
}
|