@extravirgin/payload-plugin-meilisearch 0.0.1 → 0.0.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.
Files changed (51) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js.map +1 -0
  3. package/dist/indexCollections.d.ts +3 -0
  4. package/dist/indexCollections.js +395 -0
  5. package/dist/indexCollections.js.map +1 -0
  6. package/dist/mocks/mockFile.d.ts +1 -0
  7. package/dist/mocks/mockFile.js +3 -0
  8. package/dist/mocks/mockFile.js.map +1 -0
  9. package/dist/onInitExtension.d.ts +3 -0
  10. package/dist/onInitExtension.js +17 -0
  11. package/dist/onInitExtension.js.map +1 -0
  12. package/dist/plugin.d.ts +3 -0
  13. package/dist/plugin.js +103 -0
  14. package/dist/plugin.js.map +1 -0
  15. package/dist/types.d.ts +18 -0
  16. package/dist/types.js +3 -0
  17. package/dist/types.js.map +1 -0
  18. package/dist/webpack.d.ts +3 -0
  19. package/dist/webpack.js +32 -0
  20. package/dist/webpack.js.map +1 -0
  21. package/package.json +4 -1
  22. package/.editorconfig +0 -10
  23. package/.eslintrc.js +0 -17
  24. package/.github/workflows/test.yml +0 -19
  25. package/.prettierrc.js +0 -8
  26. package/dev/.env.example +0 -2
  27. package/dev/Dockerfile +0 -27
  28. package/dev/docker-compose.yml +0 -31
  29. package/dev/jest.config.js +0 -12
  30. package/dev/nodemon.json +0 -6
  31. package/dev/package.json +0 -35
  32. package/dev/plugin.spec.ts +0 -30
  33. package/dev/src/collections/Examples.ts +0 -17
  34. package/dev/src/collections/Users.ts +0 -15
  35. package/dev/src/mocks/fileStub.js +0 -1
  36. package/dev/src/payload.config.ts +0 -44
  37. package/dev/src/server.ts +0 -29
  38. package/dev/tsconfig.json +0 -34
  39. package/eslint-config/index.js +0 -15
  40. package/eslint-config/rules/import.js +0 -38
  41. package/eslint-config/rules/prettier.js +0 -7
  42. package/eslint-config/rules/style.js +0 -21
  43. package/eslint-config/rules/typescript.js +0 -628
  44. package/src/index.ts +0 -2
  45. package/src/indexCollections.ts +0 -155
  46. package/src/mocks/mockFile.js +0 -1
  47. package/src/onInitExtension.ts +0 -16
  48. package/src/plugin.ts +0 -67
  49. package/src/types.ts +0 -20
  50. package/src/webpack.ts +0 -28
  51. package/tsconfig.json +0 -23
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAuB;AAIhB,IAAM,mBAAmB,GAC9B,UAAC,MAAc;IACf,OAAA,UAAA,aAAa;;;QACX,IAAM,qBAAqB,GACzB,OAAO,CAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,OAAO,CAAA,KAAK,UAAU;YACzC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;YACrC,CAAC,CAAC,aAAa,CAAA;QAEnB,IAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;QAErE,IAAM,UAAU,yBACX,qBAAqB,KACxB,OAAO,wBACF,CAAC,qBAAqB,CAAC,OAAO,IAAI,EAAE,CAAC,KACxC,KAAK,wBACA,CAAC,CAAA,MAAA,qBAAqB,CAAC,OAAO,0CAAE,KAAK,EAAC,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,gBAEnF,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,IAAG,cAAc,YAGhE,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;AArBD,CAqBC,CAAA;AAvBU,QAAA,mBAAmB,uBAuB7B"}
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@extravirgin/payload-plugin-meilisearch",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "homepage:": "https://extravirgin.ch",
5
5
  "description": "Index your payload collections to meilisearch",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
8
11
  "keywords": [
9
12
  "payload",
10
13
  "cms",
package/.editorconfig DELETED
@@ -1,10 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
9
- end_of_line = lf
10
- max_line_length = null
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['./eslint-config'],
4
- overrides: [
5
- // Temporary overrides
6
- {
7
- files: ['dev/**/*.ts'],
8
- rules: {
9
- 'import/no-relative-packages': 'off',
10
- 'no-process-env': 'off',
11
- },
12
- },
13
- ],
14
- excludes: [
15
- 'dev/plugin.spec.ts',
16
- ]
17
- }
@@ -1,19 +0,0 @@
1
- name: Build
2
-
3
- on:
4
- pull_request:
5
- types: [ opened, reopened, synchronize ]
6
- push:
7
- branches: [ main ]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - uses: actions/setup-node@v2
15
- with:
16
- node-version: '14.x'
17
- registry-url: 'https://registry.npmjs.org'
18
- - run: yarn install
19
- - run: yarn build
package/.prettierrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- printWidth: 100,
3
- parser: "typescript",
4
- semi: false,
5
- singleQuote: true,
6
- trailingComma: "all",
7
- arrowParens: "avoid",
8
- };
package/dev/.env.example DELETED
@@ -1,2 +0,0 @@
1
- DATABASE_URI=mongodb://127.0.0.1/plugin-development
2
- PAYLOAD_SECRET=hellohereisasecretforyou
package/dev/Dockerfile DELETED
@@ -1,27 +0,0 @@
1
- FROM node:18.8-alpine as base
2
-
3
- FROM base as builder
4
-
5
- WORKDIR /home/node/app
6
- COPY package*.json ./
7
-
8
- COPY . .
9
- RUN yarn install
10
- RUN yarn build
11
-
12
- FROM base as runtime
13
-
14
- ENV NODE_ENV=production
15
- ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js
16
-
17
- WORKDIR /home/node/app
18
- COPY package*.json ./
19
- COPY yarn.lock ./
20
-
21
- RUN yarn install --production
22
- COPY --from=builder /home/node/app/dist ./dist
23
- COPY --from=builder /home/node/app/build ./build
24
-
25
- EXPOSE 3000
26
-
27
- CMD ["node", "dist/server.js"]
@@ -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:
@@ -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
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/nodemon.json",
3
- "ext": "ts",
4
- "exec": "ts-node src/server.ts -- -I",
5
- "stdin": false
6
- }
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
- }
@@ -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
- }
@@ -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,7 +0,0 @@
1
- module.exports = {
2
- plugins: ['prettier'],
3
- extends: ['plugin:prettier/recommended'],
4
- rules: {
5
- 'prettier/prettier': 'error',
6
- },
7
- }
@@ -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
- }