chore: pack-up providers (#18320)

* chore: convert upload-local

* chore: convert upload-cloudinary

* chore: convert upload-aws-s3

* chore: convert email-sendmail

* chore: convert email-sendgrid

* chore: convert email-nodemailer

* chore: convert email-mailgun

* chore: convert email-amazon-ses

* chore: convert audit-logs-local

* chore(utils): fix eslint error
This commit is contained in:
Josh 2023-10-05 16:50:32 +01:00 committed by GitHub
parent 99d74cdc29
commit 5dcfae1dbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 217 additions and 86 deletions

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({

View File

@ -28,19 +28,21 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@strapi/types": "4.14.3",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -12,7 +12,7 @@ interface Log extends Omit<Event, 'userId'> {
user: string | number;
}
export = {
export default {
async register({ strapi }: { strapi: Strapi }) {
const contentTypes = strapi.container.get('content-types');
if (!contentTypes.keys().includes('admin::audit-log')) {

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -29,23 +29,25 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/utils": "4.14.3",
"node-ses": "^3.0.3"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"
},

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -23,7 +23,7 @@ interface ProviderOptions {
amazon?: string;
}
export = {
export default {
init(providerOptions: ProviderOptions, settings: Settings) {
const client = nodeSES.createClient(providerOptions);

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -29,19 +29,20 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"test:unit": "run -T jest",
"test:unit:watch": "run -T jest --watch",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/utils": "4.14.3",
@ -49,6 +50,7 @@
"mailgun.js": "8.2.1"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"
},

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -31,7 +31,7 @@ const optionsMap: Record<string, LegacyOptionMapper> = {
host: { field: 'url', fn: (value) => `https://${value || 'api.mailgun.net'}` },
};
export = {
export default {
convertProviderOptions(providerOptions: ProviderOptions): Record<string, unknown> {
const newOptions: Record<string, unknown> = {};
if (typeof providerOptions === 'object') {

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -42,23 +42,25 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"lodash": "4.17.21",
"nodemailer": "6.9.1"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@types/nodemailer": "6.4.7",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -32,7 +32,7 @@ const emailFields = [
'attachments',
];
export = {
export default {
provider: 'nodemailer',
name: 'Nodemailer',

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -29,23 +29,25 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@sendgrid/mail": "7.7.0",
"@strapi/utils": "4.14.3"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"
},

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -21,7 +21,7 @@ interface ProviderOptions {
apiKey: string;
}
export = {
export default {
init(providerOptions: ProviderOptions, settings: Settings) {
sendgrid.setApiKey(providerOptions.apiKey);

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -28,23 +28,25 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/utils": "4.14.3",
"sendmail": "^1.6.1"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@types/sendmail": "1.4.4",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -19,7 +19,7 @@ interface SendOptions {
type ProviderOptions = Options;
export = {
export default {
init(providerOptions: ProviderOptions, settings: Settings) {
const sendmail = sendmailFactory({
silent: true,

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -30,25 +30,27 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"test:unit": "run -T jest",
"test:unit:watch": "run -T jest --watch",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"aws-sdk": "2.1437.0",
"lodash": "4.17.21"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@types/jest": "29.5.2",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -44,7 +44,7 @@ interface InitOptions extends Partial<AWS.S3.ClientConfiguration> {
};
}
export = {
export default {
init({ baseUrl, rootPath, s3Options, ...legacyS3Options }: InitOptions) {
if (Object.keys(legacyS3Options).length > 0) {
process.emitWarning(

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -29,17 +29,18 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/utils": "4.14.3",
@ -47,6 +48,7 @@
"into-stream": "^5.1.0"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"
},

View File

@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
runtime: 'node',
});

View File

@ -23,7 +23,7 @@ interface File {
buffer?: Buffer;
}
export = {
export default {
init(options: ConfigOptions) {
cloudinary.config(options);

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -28,25 +28,27 @@
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"test:unit": "run -T jest",
"test:unit:watch": "run -T jest --watch",
"lint": "run -T eslint ."
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/utils": "4.14.3",
"fs-extra": "10.0.0"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@types/jest": "29.5.2",
"eslint-config-custom": "4.14.3",
"tsconfig": "4.14.3"

View File

@ -0,0 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from '@strapi/pack-up';
export default defineConfig({
externals: ['stream', 'fs', 'path'],
runtime: 'node',
});

View File

@ -37,7 +37,7 @@ interface CheckFileSizeOptions {
sizeLimit?: number;
}
export = {
export default {
init({ sizeLimit: providerOptionsSizeLimit }: InitOptions = {}) {
// TODO V5: remove providerOptions sizeLimit
if (providerOptionsSizeLimit) {

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["**/__tests__/**"]
}

View File

@ -3,6 +3,6 @@
"compilerOptions": {
"noEmit": true
},
"include": ["src"],
"include": ["src", "packup.config.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,8 +1,5 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/**"]
"exclude": ["node_modules"]
}

View File

@ -8150,6 +8150,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-audit-logs-local@workspace:packages/providers/audit-logs-local"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/types": 4.14.3
eslint-config-custom: 4.14.3
tsconfig: 4.14.3
@ -8160,6 +8161,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-email-amazon-ses@workspace:packages/providers/email-amazon-ses"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
eslint-config-custom: 4.14.3
node-ses: ^3.0.3
@ -8171,6 +8173,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-email-mailgun@workspace:packages/providers/email-mailgun"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
eslint-config-custom: 4.14.3
form-data: ^4.0.0
@ -8183,6 +8186,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-email-nodemailer@workspace:packages/providers/email-nodemailer"
dependencies:
"@strapi/pack-up": "workspace:*"
"@types/nodemailer": 6.4.7
eslint-config-custom: 4.14.3
lodash: 4.17.21
@ -8196,6 +8200,7 @@ __metadata:
resolution: "@strapi/provider-email-sendgrid@workspace:packages/providers/email-sendgrid"
dependencies:
"@sendgrid/mail": 7.7.0
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
eslint-config-custom: 4.14.3
tsconfig: 4.14.3
@ -8206,6 +8211,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-email-sendmail@workspace:packages/providers/email-sendmail"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
"@types/sendmail": 1.4.4
eslint-config-custom: 4.14.3
@ -8218,6 +8224,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-upload-aws-s3@workspace:packages/providers/upload-aws-s3"
dependencies:
"@strapi/pack-up": "workspace:*"
"@types/jest": 29.5.2
aws-sdk: 2.1437.0
eslint-config-custom: 4.14.3
@ -8230,6 +8237,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-upload-cloudinary@workspace:packages/providers/upload-cloudinary"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
cloudinary: ^1.41.0
eslint-config-custom: 4.14.3
@ -8242,6 +8250,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@strapi/provider-upload-local@workspace:packages/providers/upload-local"
dependencies:
"@strapi/pack-up": "workspace:*"
"@strapi/utils": 4.14.3
"@types/jest": 29.5.2
eslint-config-custom: 4.14.3