Compare commits
2 Commits
templates/
...
feat/plugi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c3e90d5bb | ||
|
|
abec04d316 |
248
packages/plugin-import-export/.gitignore
vendored
Normal file
248
packages/plugin-import-export/.gitignore
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
dev/tmp
|
||||
dev/yarn.lock
|
||||
|
||||
# Created by https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||
|
||||
### macOS ###
|
||||
*.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# Yarn Berry
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
|
||||
### SublimeText ###
|
||||
# cache files for sublime text
|
||||
*.tmlanguage.cache
|
||||
*.tmPreferences.cache
|
||||
*.stTheme.cache
|
||||
|
||||
# workspace files are user-specific
|
||||
*.sublime-workspace
|
||||
|
||||
# project files should be checked into the repository, unless a significant
|
||||
# proportion of contributors will probably not be using SublimeText
|
||||
# *.sublime-project
|
||||
|
||||
# sftp configuration file
|
||||
sftp-config.json
|
||||
|
||||
# Package control specific files
|
||||
Package Control.last-run
|
||||
Package Control.ca-list
|
||||
Package Control.ca-bundle
|
||||
Package Control.system-ca-bundle
|
||||
Package Control.cache/
|
||||
Package Control.ca-certs/
|
||||
Package Control.merged-ca-bundle
|
||||
Package Control.user-ca-bundle
|
||||
oscrypto-ca-bundle.crt
|
||||
bh_unicode_properties.cache
|
||||
|
||||
# Sublime-github package stores a github token in this file
|
||||
# https://packagecontrol.io/packages/sublime-github
|
||||
GitHub.sublime-settings
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history
|
||||
|
||||
### WebStorm ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
.idea/*
|
||||
# User-specific stuff:
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.xml
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# CMake
|
||||
cmake-build-debug/
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Ruby plugin and RubyMine
|
||||
/.rakeTasks
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
### WebStorm Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
.idea/sonarlint
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||
|
||||
# Ignore all uploads
|
||||
demo/upload
|
||||
demo/media
|
||||
demo/files
|
||||
|
||||
# Ignore build folder
|
||||
build
|
||||
|
||||
# Ignore built components
|
||||
components/index.js
|
||||
components/styles.css
|
||||
|
||||
# Ignore generated
|
||||
demo/generated-types.ts
|
||||
demo/generated-schema.graphql
|
||||
|
||||
# Ignore dist, no need for git
|
||||
dist
|
||||
|
||||
# Ignore emulator volumes
|
||||
src/adapters/s3/emulator/.localstack/
|
||||
10
packages/plugin-import-export/.prettierignore
Normal file
10
packages/plugin-import-export/.prettierignore
Normal file
@@ -0,0 +1,10 @@
|
||||
.tmp
|
||||
**/.git
|
||||
**/.hg
|
||||
**/.pnp.*
|
||||
**/.svn
|
||||
**/.yarn/**
|
||||
**/build
|
||||
**/dist/**
|
||||
**/node_modules
|
||||
**/temp
|
||||
25
packages/plugin-import-export/.swcrc-build
Normal file
25
packages/plugin-import-export/.swcrc-build
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"sourceMaps": true,
|
||||
"exclude": ["/**/mocks", "/**/*.spec.ts"],
|
||||
"jsc": {
|
||||
"target": "esnext",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true,
|
||||
"dts": true
|
||||
},
|
||||
"transform": {
|
||||
"react": {
|
||||
"runtime": "automatic",
|
||||
"pragmaFrag": "React.Fragment",
|
||||
"throwIfNamespace": true,
|
||||
"development": false,
|
||||
"useBuiltins": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
}
|
||||
}
|
||||
22
packages/plugin-import-export/LICENSE.md
Normal file
22
packages/plugin-import-export/LICENSE.md
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2018-2022 Payload CMS, LLC <info@payloadcms.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
0
packages/plugin-import-export/README.md
Normal file
0
packages/plugin-import-export/README.md
Normal file
19
packages/plugin-import-export/eslint.config.js
Normal file
19
packages/plugin-import-export/eslint.config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { rootEslintConfig, rootParserOptions } from '../../eslint.config.js'
|
||||
|
||||
/** @typedef {import('eslint').Linter.FlatConfig} */
|
||||
let FlatConfig
|
||||
|
||||
/** @type {FlatConfig[]} */
|
||||
export const index = [
|
||||
...rootEslintConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
...rootParserOptions,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export default index
|
||||
32
packages/plugin-import-export/jest.config.js
Normal file
32
packages/plugin-import-export/jest.config.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import baseConfig from '../../jest.config.js'
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
const customJestConfig = {
|
||||
...baseConfig,
|
||||
setupFilesAfterEnv: null,
|
||||
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
||||
testTimeout: 20000,
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': [
|
||||
'@swc/jest',
|
||||
{
|
||||
$schema: 'https://json.schemastore.org/swcrc',
|
||||
sourceMaps: true,
|
||||
exclude: ['/**/mocks'],
|
||||
jsc: {
|
||||
target: 'esnext',
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
dts: true,
|
||||
},
|
||||
},
|
||||
module: {
|
||||
type: 'es6',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default customJestConfig
|
||||
58
packages/plugin-import-export/package.json
Normal file
58
packages/plugin-import-export/package.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "@payloadcms/plugin-import-export",
|
||||
"version": "3.0.0-beta.103",
|
||||
"description": "The Import/Export plugin for Payload",
|
||||
"homepage": "https://payloadcms.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/payloadcms/payload.git",
|
||||
"directory": "packages/plugin-import-export"
|
||||
},
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm build:types && pnpm build:swc",
|
||||
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build --strip-leading-paths",
|
||||
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
||||
"clean": "rimraf {dist,*.tsbuildinfo}",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"prepublishOnly": "pnpm clean && pnpm turbo build",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"archiver": "^7.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/archiver": "^6.0.2",
|
||||
"@types/jest": "29.5.12",
|
||||
"jest": "^29.7.0",
|
||||
"payload": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"payload": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { exportsCollectionSlug } from '../constants.js'
|
||||
|
||||
export const exportsCollection: CollectionConfig = {
|
||||
slug: exportsCollectionSlug,
|
||||
admin: {
|
||||
hidden: true,
|
||||
},
|
||||
endpoints: false,
|
||||
fields: [
|
||||
{
|
||||
name: 'collectionExports',
|
||||
type: 'array',
|
||||
fields: [
|
||||
{
|
||||
name: 'slug',
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'data',
|
||||
type: 'json',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
graphQL: false,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { exportsUploadsCollectionSlug } from '../constants.js'
|
||||
|
||||
export const exportsUploadsCollection: CollectionConfig = {
|
||||
slug: exportsUploadsCollectionSlug,
|
||||
admin: {
|
||||
hidden: true,
|
||||
},
|
||||
endpoints: false,
|
||||
fields: [],
|
||||
graphQL: false,
|
||||
upload: true,
|
||||
}
|
||||
3
packages/plugin-import-export/src/constants.ts
Normal file
3
packages/plugin-import-export/src/constants.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const exportsCollectionSlug = 'payload-exports'
|
||||
|
||||
export const exportsUploadsCollectionSlug = 'payload-exports-uploads'
|
||||
3
packages/plugin-import-export/src/index.ts
Normal file
3
packages/plugin-import-export/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { compress } from './lib/compress.js'
|
||||
export { exportData } from './lib/exportData.js'
|
||||
export { importExportPlugin } from './plugin.js'
|
||||
72
packages/plugin-import-export/src/lib/compress.spec.ts
Normal file
72
packages/plugin-import-export/src/lib/compress.spec.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import type { Payload } from 'payload'
|
||||
|
||||
import { jest } from '@jest/globals'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'path'
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
import { compress } from './compress.js'
|
||||
|
||||
describe('Compress', () => {
|
||||
const mockPayload = {
|
||||
find: jest.fn(() => {
|
||||
return {
|
||||
docs: [
|
||||
{
|
||||
id: '66e1fc1558f63accd6af32bb',
|
||||
collectionExports: [
|
||||
{
|
||||
slug: 'post',
|
||||
data: [
|
||||
{
|
||||
id: '66e1f8d9a53c7ca2cb8971b1',
|
||||
_status: 'published',
|
||||
createdAt: '2024-09-11T20:08:57.146Z',
|
||||
myBlocks: [],
|
||||
text: 'example post',
|
||||
updatedAt: '2024-09-11T20:08:57.146Z',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: 'users',
|
||||
data: [
|
||||
{
|
||||
id: '66e1f8d9a53c7ca2cb8971af',
|
||||
createdAt: '2024-09-11T20:08:57.140Z',
|
||||
email: 'dev@payloadcms.com',
|
||||
loginAttempts: 0,
|
||||
updatedAt: '2024-09-11T20:08:57.140Z',
|
||||
},
|
||||
],
|
||||
},
|
||||
// Global
|
||||
{
|
||||
slug: 'menu',
|
||||
data: {
|
||||
id: '66e1f8d9a53c7ca2cb8971b0',
|
||||
createdAt: '2024-09-11T20:08:57.139Z',
|
||||
globalText: 'example global text',
|
||||
updatedAt: '2024-09-11T20:08:57.139Z',
|
||||
},
|
||||
},
|
||||
],
|
||||
createdAt: '2024-09-11T20:08:57.213Z',
|
||||
updatedAt: '2024-09-11T20:08:57.213Z',
|
||||
},
|
||||
],
|
||||
}
|
||||
}),
|
||||
logger: {
|
||||
info: (args) => console.log(args),
|
||||
},
|
||||
} as unknown as Payload
|
||||
|
||||
it('should create proper file tree', async () => {
|
||||
const res = await compress({
|
||||
destination: path.resolve(dirname, 'export'),
|
||||
payload: mockPayload,
|
||||
})
|
||||
})
|
||||
})
|
||||
63
packages/plugin-import-export/src/lib/compress.ts
Normal file
63
packages/plugin-import-export/src/lib/compress.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { PaginatedDocs, Payload, PayloadRequest } from 'payload'
|
||||
|
||||
import archiver from 'archiver'
|
||||
import { createWriteStream } from 'fs'
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
|
||||
import type { CollectionExport } from '../types.js'
|
||||
|
||||
import { exportsCollectionSlug } from '../constants.js'
|
||||
|
||||
export const compress = async (args: {
|
||||
destination: string // Should this optionally accept a write stream as well?
|
||||
payload: Payload
|
||||
}): Promise<{ zipPath: string }> => {
|
||||
const { destination, payload } = args
|
||||
|
||||
const rawData: PaginatedDocs<{
|
||||
collectionExports: CollectionExport[]
|
||||
createdAt: string
|
||||
id: string
|
||||
}> = await payload.db.find({
|
||||
collection: exportsCollectionSlug,
|
||||
limit: 1,
|
||||
req: {} as PayloadRequest,
|
||||
sort: 'createdAt',
|
||||
})
|
||||
|
||||
const exportDate = rawData.docs[0].createdAt.split('T')[0]
|
||||
const exportDir = destination + `-${exportDate}`
|
||||
|
||||
await fs.mkdir(exportDir, { recursive: true })
|
||||
|
||||
for (const collectionExport of rawData.docs[0].collectionExports) {
|
||||
const collectionDir = path.join(exportDir, collectionExport.slug)
|
||||
await fs.mkdir(collectionDir, { recursive: true })
|
||||
|
||||
const filePath = path.join(collectionDir, 'index.json')
|
||||
await fs.writeFile(filePath, JSON.stringify(collectionExport, null, 2))
|
||||
}
|
||||
|
||||
// Now zip the top-level export directory
|
||||
const zipPath = `${exportDir}.zip`
|
||||
const output = createWriteStream(zipPath)
|
||||
const archive = archiver('zip', { zlib: { level: 9 } })
|
||||
|
||||
archive.on('error', (err) => {
|
||||
throw err
|
||||
})
|
||||
|
||||
// Pipe the output to the zip file
|
||||
archive.pipe(output)
|
||||
|
||||
// Append only the top-level directory (recursively adds its content)
|
||||
archive.directory(exportDir, false)
|
||||
|
||||
// Finalize the archive
|
||||
await archive.finalize()
|
||||
|
||||
console.log(`Zipped export to ${zipPath}`)
|
||||
|
||||
return { zipPath }
|
||||
}
|
||||
68
packages/plugin-import-export/src/lib/exportData.ts
Normal file
68
packages/plugin-import-export/src/lib/exportData.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import type { JsonObject, PaginatedDocs, Payload, PayloadRequest } from 'payload'
|
||||
|
||||
import { exportsCollectionSlug, exportsUploadsCollectionSlug } from '../constants.js'
|
||||
|
||||
/**
|
||||
* Export function that gets all data across all collections and writes to an exports collection
|
||||
*/
|
||||
|
||||
export const exportData = async ({ payload }: { payload: Payload }) => {
|
||||
const collectionSlugs = payload.config.collections.map((c) => c.slug)
|
||||
|
||||
if (!collectionSlugs.length) {
|
||||
payload.logger.warn('No collections found to export.')
|
||||
return
|
||||
}
|
||||
|
||||
payload.logger.info(
|
||||
`Exporting data from collections: ${collectionSlugs.filter((slug) => [exportsCollectionSlug, exportsUploadsCollectionSlug].includes(slug)).join(', ')}`,
|
||||
)
|
||||
|
||||
const promiseMap: Record<string, Promise<JsonObject | PaginatedDocs['docs']>> = {}
|
||||
|
||||
const globalSlugs = payload.config.globals.map((g) => g.slug)
|
||||
|
||||
globalSlugs.forEach((globalSlug) => {
|
||||
promiseMap[globalSlug] = payload.db.findGlobal({
|
||||
slug: globalSlug,
|
||||
req: {} as PayloadRequest,
|
||||
})
|
||||
})
|
||||
|
||||
collectionSlugs.forEach((slug) => {
|
||||
if ([exportsCollectionSlug, exportsUploadsCollectionSlug].includes(slug)) {
|
||||
return
|
||||
}
|
||||
|
||||
promiseMap[slug] = payload.db
|
||||
.find({
|
||||
collection: slug,
|
||||
limit: 1000,
|
||||
req: {} as PayloadRequest,
|
||||
})
|
||||
.then((res) => res.docs)
|
||||
})
|
||||
|
||||
const collectionExports = await Promise.all(
|
||||
Object.entries(promiseMap).map(async ([slug, promise]) => {
|
||||
const docsOrDoc = await promise
|
||||
return {
|
||||
slug,
|
||||
data: docsOrDoc,
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
payload.logger.info({ collectionExports })
|
||||
|
||||
// Convert
|
||||
|
||||
const created = await payload.create({
|
||||
collection: exportsCollectionSlug,
|
||||
data: {
|
||||
collectionExports,
|
||||
},
|
||||
})
|
||||
|
||||
payload.logger.info({ created })
|
||||
}
|
||||
35
packages/plugin-import-export/src/plugin.ts
Normal file
35
packages/plugin-import-export/src/plugin.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { Config } from 'payload'
|
||||
|
||||
import type { ImportExportPluginOptions } from './types.js'
|
||||
|
||||
import { exportsCollection } from './collections/exportsCollection.js'
|
||||
import { exportsUploadsCollection } from './collections/exportsUploadCollection.js'
|
||||
import { exportData } from './lib/exportData.js'
|
||||
|
||||
export const importExportPlugin =
|
||||
(pluginOptions?: ImportExportPluginOptions) =>
|
||||
(incomingConfig: Config): Config => {
|
||||
const config = { ...incomingConfig }
|
||||
|
||||
if (!config.collections) {
|
||||
config.collections = []
|
||||
}
|
||||
|
||||
config.collections.push(exportsCollection)
|
||||
config.collections.push(exportsUploadsCollection)
|
||||
|
||||
if (!config.endpoints) {
|
||||
config.endpoints = []
|
||||
}
|
||||
|
||||
config.endpoints.push({
|
||||
handler: async (req) => {
|
||||
await exportData({ payload: req.payload })
|
||||
return Response.json({ message: 'Export complete' })
|
||||
},
|
||||
method: 'post',
|
||||
path: '/export',
|
||||
})
|
||||
|
||||
return config
|
||||
}
|
||||
8
packages/plugin-import-export/src/types.ts
Normal file
8
packages/plugin-import-export/src/types.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { JsonObject, PaginatedDocs } from 'payload'
|
||||
|
||||
export type ImportExportPluginOptions = {}
|
||||
|
||||
export type CollectionExport = {
|
||||
data: JsonObject | PaginatedDocs['docs']
|
||||
slug: string
|
||||
}
|
||||
13
packages/plugin-import-export/tsconfig.json
Normal file
13
packages/plugin-import-export/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true, // Make sure typescript knows that this module depends on their references
|
||||
"noEmit": false /* Do not emit outputs. */,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
||||
"rootDir": "./src" /* Specify the root folder within your source files. */
|
||||
},
|
||||
"exclude": ["dist", "build", "tests", "test", "node_modules", "eslint.config.js"],
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
|
||||
"references": [{ "path": "../payload" }]
|
||||
}
|
||||
179
pnpm-lock.yaml
generated
179
pnpm-lock.yaml
generated
@@ -143,7 +143,7 @@ importers:
|
||||
version: 9.4.1(@aws-sdk/credential-providers@3.630.0(@aws-sdk/client-sso-oidc@3.629.0(@aws-sdk/client-sts@3.629.0)))
|
||||
next:
|
||||
specifier: 15.0.0-canary.104
|
||||
version: 15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
version: 15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
open:
|
||||
specifier: ^10.1.0
|
||||
version: 10.1.0
|
||||
@@ -957,7 +957,7 @@ importers:
|
||||
version: link:../payload
|
||||
ts-jest:
|
||||
specifier: ^29.1.0
|
||||
version: 29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.19.12)(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4)
|
||||
version: 29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4)
|
||||
|
||||
packages/plugin-cloud-storage:
|
||||
dependencies:
|
||||
@@ -1033,6 +1033,25 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../payload
|
||||
|
||||
packages/plugin-import-export:
|
||||
dependencies:
|
||||
archiver:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
devDependencies:
|
||||
'@types/archiver':
|
||||
specifier: ^6.0.2
|
||||
version: 6.0.2
|
||||
'@types/jest':
|
||||
specifier: 29.5.12
|
||||
version: 29.5.12
|
||||
jest:
|
||||
specifier: ^29.7.0
|
||||
version: 29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0)
|
||||
payload:
|
||||
specifier: workspace:*
|
||||
version: link:../payload
|
||||
|
||||
packages/plugin-nested-docs:
|
||||
devDependencies:
|
||||
'@payloadcms/eslint-config':
|
||||
@@ -1154,7 +1173,7 @@ importers:
|
||||
version: link:../payload
|
||||
ts-jest:
|
||||
specifier: ^29.1.0
|
||||
version: 29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.19.12)(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4)
|
||||
version: 29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4)
|
||||
|
||||
packages/plugin-seo:
|
||||
dependencies:
|
||||
@@ -1467,7 +1486,7 @@ importers:
|
||||
version: link:../plugin-cloud-storage
|
||||
uploadthing:
|
||||
specifier: ^6.10.1
|
||||
version: 6.13.2(express@4.19.2)(next@15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4))
|
||||
version: 6.13.2(express@4.19.2)(next@15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4))
|
||||
devDependencies:
|
||||
payload:
|
||||
specifier: workspace:*
|
||||
@@ -1706,6 +1725,9 @@ importers:
|
||||
'@payloadcms/plugin-form-builder':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/plugin-form-builder
|
||||
'@payloadcms/plugin-import-export':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/plugin-import-export
|
||||
'@payloadcms/plugin-nested-docs':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/plugin-nested-docs
|
||||
@@ -1757,12 +1779,18 @@ importers:
|
||||
'@sentry/react':
|
||||
specifier: ^7.77.0
|
||||
version: 7.118.0(react@19.0.0-rc-06d0b89e-20240801)
|
||||
'@types/archiver':
|
||||
specifier: ^6.0.2
|
||||
version: 6.0.2
|
||||
'@types/react':
|
||||
specifier: npm:types-react@19.0.0-rc.0
|
||||
version: types-react@19.0.0-rc.0
|
||||
'@types/react-dom':
|
||||
specifier: npm:types-react-dom@19.0.0-rc.0
|
||||
version: types-react-dom@19.0.0-rc.0
|
||||
archiver:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
babel-plugin-react-compiler:
|
||||
specifier: 0.0.0-experimental-48eb8f4-20240822
|
||||
version: 0.0.0-experimental-48eb8f4-20240822
|
||||
@@ -1798,7 +1826,7 @@ importers:
|
||||
version: 0.17.0
|
||||
next:
|
||||
specifier: 15.0.0-canary.104
|
||||
version: 15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
version: 15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
payload:
|
||||
specifier: workspace:*
|
||||
version: link:../packages/payload
|
||||
@@ -1828,7 +1856,7 @@ importers:
|
||||
version: 5.5.4
|
||||
uploadthing:
|
||||
specifier: ^6.10.1
|
||||
version: 6.13.2(express@4.19.2)(next@15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4))
|
||||
version: 6.13.2(express@4.19.2)(next@15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4))
|
||||
uuid:
|
||||
specifier: 10.0.0
|
||||
version: 10.0.0
|
||||
@@ -4326,6 +4354,9 @@ packages:
|
||||
'@tybys/wasm-util@0.9.0':
|
||||
resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==}
|
||||
|
||||
'@types/archiver@6.0.2':
|
||||
resolution: {integrity: sha512-KmROQqbQzKGuaAbmK+ZcytkJ51+YqDa7NmbXjmtC5YBLSyQYo21YaUnQ3HbaPFKL1ooo6RQ6OPYPIDyxfpDDXw==}
|
||||
|
||||
'@types/babel__core@7.20.5':
|
||||
resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
|
||||
|
||||
@@ -4485,6 +4516,9 @@ packages:
|
||||
'@types/react-transition-group@4.4.11':
|
||||
resolution: {integrity: sha512-RM05tAniPZ5DZPzzNFP+DmrcOdD0efDUxMy3145oljWSl3x9ZV5vhme98gTxFrj2lhXvmGNnUiuDyJgY9IKkNA==}
|
||||
|
||||
'@types/readdir-glob@1.1.5':
|
||||
resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==}
|
||||
|
||||
'@types/request@2.48.12':
|
||||
resolution: {integrity: sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==}
|
||||
|
||||
@@ -4730,6 +4764,14 @@ packages:
|
||||
arch@2.2.0:
|
||||
resolution: {integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==}
|
||||
|
||||
archiver-utils@5.0.2:
|
||||
resolution: {integrity: sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
archiver@7.0.1:
|
||||
resolution: {integrity: sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
arg@5.0.2:
|
||||
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
|
||||
|
||||
@@ -4971,6 +5013,10 @@ packages:
|
||||
buffer-crc32@0.2.13:
|
||||
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
|
||||
|
||||
buffer-crc32@1.0.0:
|
||||
resolution: {integrity: sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
|
||||
buffer-equal-constant-time@1.0.1:
|
||||
resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}
|
||||
|
||||
@@ -5200,6 +5246,10 @@ packages:
|
||||
commondir@1.0.1:
|
||||
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
|
||||
|
||||
compress-commons@6.0.2:
|
||||
resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
compute-scroll-into-view@1.0.20:
|
||||
resolution: {integrity: sha512-UCB0ioiyj8CRjtrvaceBLqqhZCVP+1B8+NWQhmdsm0VXOJtobBCf1dBQmebCCo34qZmUwZfIH2MZLqNHazrfjg==}
|
||||
|
||||
@@ -5261,6 +5311,15 @@ packages:
|
||||
resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
crc-32@1.2.2:
|
||||
resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==}
|
||||
engines: {node: '>=0.8'}
|
||||
hasBin: true
|
||||
|
||||
crc32-stream@6.0.0:
|
||||
resolution: {integrity: sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
create-jest@29.7.0:
|
||||
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
@@ -7148,6 +7207,10 @@ packages:
|
||||
resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
lazystream@1.0.1:
|
||||
resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==}
|
||||
engines: {node: '>= 0.6.3'}
|
||||
|
||||
leac@0.6.0:
|
||||
resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
|
||||
|
||||
@@ -7169,7 +7232,6 @@ packages:
|
||||
|
||||
libsql@0.3.19:
|
||||
resolution: {integrity: sha512-Aj5cQ5uk/6fHdmeW0TiXK42FqUlwx7ytmMLPSaUQPin5HKKKuUPD62MAbN4OEweGBBI7q1BekoEN4gPUEL6MZA==}
|
||||
cpu: [x64, arm64, wasm32]
|
||||
os: [darwin, linux, win32]
|
||||
|
||||
lie@3.1.1:
|
||||
@@ -8188,6 +8250,9 @@ packages:
|
||||
resolution: {integrity: sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
readdir-glob@1.1.3:
|
||||
resolution: {integrity: sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==}
|
||||
|
||||
readdirp@3.6.0:
|
||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||
engines: {node: '>=8.10.0'}
|
||||
@@ -9535,6 +9600,10 @@ packages:
|
||||
resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==}
|
||||
engines: {node: '>=12.20'}
|
||||
|
||||
zip-stream@6.0.1:
|
||||
resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
zod-validation-error@2.1.0:
|
||||
resolution: {integrity: sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
@@ -12899,6 +12968,10 @@ snapshots:
|
||||
tslib: 2.6.3
|
||||
optional: true
|
||||
|
||||
'@types/archiver@6.0.2':
|
||||
dependencies:
|
||||
'@types/readdir-glob': 1.1.5
|
||||
|
||||
'@types/babel__core@7.20.5':
|
||||
dependencies:
|
||||
'@babel/parser': 7.25.3
|
||||
@@ -13109,6 +13182,10 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/react': types-react@19.0.0-rc.0
|
||||
|
||||
'@types/readdir-glob@1.1.5':
|
||||
dependencies:
|
||||
'@types/node': 20.12.5
|
||||
|
||||
'@types/request@2.48.12':
|
||||
dependencies:
|
||||
'@types/caseless': 0.12.5
|
||||
@@ -13426,6 +13503,26 @@ snapshots:
|
||||
|
||||
arch@2.2.0: {}
|
||||
|
||||
archiver-utils@5.0.2:
|
||||
dependencies:
|
||||
glob: 10.4.5
|
||||
graceful-fs: 4.2.11
|
||||
is-stream: 2.0.1
|
||||
lazystream: 1.0.1
|
||||
lodash: 4.17.21
|
||||
normalize-path: 3.0.0
|
||||
readable-stream: 4.5.2
|
||||
|
||||
archiver@7.0.1:
|
||||
dependencies:
|
||||
archiver-utils: 5.0.2
|
||||
async: 3.2.5
|
||||
buffer-crc32: 1.0.0
|
||||
readable-stream: 4.5.2
|
||||
readdir-glob: 1.1.3
|
||||
tar-stream: 3.1.7
|
||||
zip-stream: 6.0.1
|
||||
|
||||
arg@5.0.2: {}
|
||||
|
||||
argparse@1.0.10:
|
||||
@@ -13744,6 +13841,8 @@ snapshots:
|
||||
|
||||
buffer-crc32@0.2.13: {}
|
||||
|
||||
buffer-crc32@1.0.0: {}
|
||||
|
||||
buffer-equal-constant-time@1.0.1: {}
|
||||
|
||||
buffer-from@1.1.2: {}
|
||||
@@ -13986,6 +14085,14 @@ snapshots:
|
||||
|
||||
commondir@1.0.1: {}
|
||||
|
||||
compress-commons@6.0.2:
|
||||
dependencies:
|
||||
crc-32: 1.2.2
|
||||
crc32-stream: 6.0.0
|
||||
is-stream: 2.0.1
|
||||
normalize-path: 3.0.0
|
||||
readable-stream: 4.5.2
|
||||
|
||||
compute-scroll-into-view@1.0.20: {}
|
||||
|
||||
concat-map@0.0.1: {}
|
||||
@@ -14049,6 +14156,13 @@ snapshots:
|
||||
path-type: 4.0.0
|
||||
yaml: 1.10.2
|
||||
|
||||
crc-32@1.2.2: {}
|
||||
|
||||
crc32-stream@6.0.0:
|
||||
dependencies:
|
||||
crc-32: 1.2.2
|
||||
readable-stream: 4.5.2
|
||||
|
||||
create-jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0):
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
@@ -16378,6 +16492,10 @@ snapshots:
|
||||
dependencies:
|
||||
language-subtag-registry: 0.3.23
|
||||
|
||||
lazystream@1.0.1:
|
||||
dependencies:
|
||||
readable-stream: 2.3.8
|
||||
|
||||
leac@0.6.0: {}
|
||||
|
||||
leven@3.1.0: {}
|
||||
@@ -16759,6 +16877,36 @@ snapshots:
|
||||
- '@babel/core'
|
||||
- babel-plugin-macros
|
||||
|
||||
next@15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4):
|
||||
dependencies:
|
||||
'@next/env': 15.0.0-canary.104
|
||||
'@swc/counter': 0.1.3
|
||||
'@swc/helpers': 0.5.12
|
||||
busboy: 1.6.0
|
||||
caniuse-lite: 1.0.30001651
|
||||
graceful-fs: 4.2.11
|
||||
postcss: 8.4.31
|
||||
react: 19.0.0-rc-06d0b89e-20240801
|
||||
react-dom: 19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801)
|
||||
styled-jsx: 5.1.6(@babel/core@7.25.2)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-06d0b89e-20240801)
|
||||
optionalDependencies:
|
||||
'@next/swc-darwin-arm64': 15.0.0-canary.104
|
||||
'@next/swc-darwin-x64': 15.0.0-canary.104
|
||||
'@next/swc-linux-arm64-gnu': 15.0.0-canary.104
|
||||
'@next/swc-linux-arm64-musl': 15.0.0-canary.104
|
||||
'@next/swc-linux-x64-gnu': 15.0.0-canary.104
|
||||
'@next/swc-linux-x64-musl': 15.0.0-canary.104
|
||||
'@next/swc-win32-arm64-msvc': 15.0.0-canary.104
|
||||
'@next/swc-win32-ia32-msvc': 15.0.0-canary.104
|
||||
'@next/swc-win32-x64-msvc': 15.0.0-canary.104
|
||||
'@playwright/test': 1.46.0
|
||||
babel-plugin-react-compiler: 0.0.0-experimental-48eb8f4-20240822
|
||||
sass: 1.77.4
|
||||
sharp: 0.33.4
|
||||
transitivePeerDependencies:
|
||||
- '@babel/core'
|
||||
- babel-plugin-macros
|
||||
|
||||
nice-napi@1.0.2:
|
||||
dependencies:
|
||||
node-addon-api: 3.2.1
|
||||
@@ -17463,6 +17611,10 @@ snapshots:
|
||||
dependencies:
|
||||
readable-stream: 3.6.2
|
||||
|
||||
readdir-glob@1.1.3:
|
||||
dependencies:
|
||||
minimatch: 5.1.6
|
||||
|
||||
readdirp@3.6.0:
|
||||
dependencies:
|
||||
picomatch: 2.3.1
|
||||
@@ -18355,7 +18507,7 @@ snapshots:
|
||||
dependencies:
|
||||
typescript: 5.5.4
|
||||
|
||||
ts-jest@29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.19.12)(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4):
|
||||
ts-jest@29.2.4(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.12.5)(babel-plugin-macros@3.1.0))(typescript@5.5.4):
|
||||
dependencies:
|
||||
bs-logger: 0.2.6
|
||||
ejs: 3.1.10
|
||||
@@ -18373,7 +18525,6 @@ snapshots:
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
babel-jest: 29.7.0(@babel/core@7.25.2)
|
||||
esbuild: 0.19.12
|
||||
|
||||
ts-pattern@5.3.1: {}
|
||||
|
||||
@@ -18541,7 +18692,7 @@ snapshots:
|
||||
escalade: 3.1.2
|
||||
picocolors: 1.0.1
|
||||
|
||||
uploadthing@6.13.2(express@4.19.2)(next@15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)):
|
||||
uploadthing@6.13.2(express@4.19.2)(next@15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)):
|
||||
dependencies:
|
||||
'@effect/schema': 0.68.12(effect@3.4.5)
|
||||
'@uploadthing/mime-types': 0.2.10
|
||||
@@ -18551,7 +18702,7 @@ snapshots:
|
||||
std-env: 3.7.0
|
||||
optionalDependencies:
|
||||
express: 4.19.2
|
||||
next: 15.0.0-canary.104(@babel/core@7.25.2)(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
next: 15.0.0-canary.104(@playwright/test@1.46.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@0.0.0-experimental-48eb8f4-20240822)(react-dom@19.0.0-rc-06d0b89e-20240801(react@19.0.0-rc-06d0b89e-20240801))(react@19.0.0-rc-06d0b89e-20240801)(sass@1.77.4)
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
@@ -18806,6 +18957,12 @@ snapshots:
|
||||
|
||||
yocto-queue@1.1.1: {}
|
||||
|
||||
zip-stream@6.0.1:
|
||||
dependencies:
|
||||
archiver-utils: 5.0.2
|
||||
compress-commons: 6.0.2
|
||||
readable-stream: 4.5.2
|
||||
|
||||
zod-validation-error@2.1.0(zod@3.23.8):
|
||||
dependencies:
|
||||
zod: 3.23.8
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"@payloadcms/plugin-cloud": "workspace:*",
|
||||
"@payloadcms/plugin-cloud-storage": "workspace:*",
|
||||
"@payloadcms/plugin-form-builder": "workspace:*",
|
||||
"@payloadcms/plugin-import-export": "workspace:*",
|
||||
"@payloadcms/plugin-nested-docs": "workspace:*",
|
||||
"@payloadcms/plugin-redirects": "workspace:*",
|
||||
"@payloadcms/plugin-relationship-object-ids": "workspace:*",
|
||||
|
||||
3
test/plugin-import-export/.gitignore
vendored
Normal file
3
test/plugin-import-export/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/media
|
||||
/media-gif
|
||||
/data
|
||||
33
test/plugin-import-export/collections/Media/index.ts
Normal file
33
test/plugin-import-export/collections/Media/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
export const mediaSlug = 'media'
|
||||
|
||||
export const MediaCollection: CollectionConfig = {
|
||||
slug: mediaSlug,
|
||||
access: {
|
||||
create: () => true,
|
||||
read: () => true,
|
||||
},
|
||||
fields: [],
|
||||
upload: {
|
||||
crop: true,
|
||||
focalPoint: true,
|
||||
imageSizes: [
|
||||
{
|
||||
name: 'thumbnail',
|
||||
height: 200,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
name: 'medium',
|
||||
height: 800,
|
||||
width: 800,
|
||||
},
|
||||
{
|
||||
name: 'large',
|
||||
height: 1200,
|
||||
width: 1200,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
17
test/plugin-import-export/collections/Posts/index.ts
Normal file
17
test/plugin-import-export/collections/Posts/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
export const postsSlug = 'posts'
|
||||
|
||||
export const PostsCollection: CollectionConfig = {
|
||||
slug: postsSlug,
|
||||
admin: {
|
||||
useAsTitle: 'text',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'text',
|
||||
label: 'Client Text Field',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
}
|
||||
53
test/plugin-import-export/config.ts
Normal file
53
test/plugin-import-export/config.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { exportData, importExportPlugin } from '@payloadcms/plugin-import-export'
|
||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'path'
|
||||
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
import { devUser } from '../credentials.js'
|
||||
import { MediaCollection } from './collections/Media/index.js'
|
||||
import { PostsCollection, postsSlug } from './collections/Posts/index.js'
|
||||
import { MenuGlobal, menuSlug } from './globals/Menu/index.js'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
export default buildConfigWithDefaults({
|
||||
// ...extend config here
|
||||
collections: [PostsCollection, MediaCollection],
|
||||
globals: [MenuGlobal],
|
||||
admin: {
|
||||
importMap: {
|
||||
baseDir: path.resolve(dirname),
|
||||
},
|
||||
},
|
||||
editor: lexicalEditor(),
|
||||
cors: ['http://localhost:3000', 'http://localhost:3001'],
|
||||
onInit: async (payload) => {
|
||||
await payload.create({
|
||||
collection: 'users',
|
||||
data: {
|
||||
email: devUser.email,
|
||||
password: devUser.password,
|
||||
},
|
||||
})
|
||||
|
||||
await payload.create({
|
||||
collection: postsSlug,
|
||||
data: {
|
||||
text: 'example post',
|
||||
},
|
||||
})
|
||||
|
||||
await payload.updateGlobal({
|
||||
data: {
|
||||
globalText: 'hello',
|
||||
},
|
||||
slug: menuSlug,
|
||||
})
|
||||
},
|
||||
plugins: [importExportPlugin()],
|
||||
typescript: {
|
||||
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
||||
},
|
||||
})
|
||||
20
test/plugin-import-export/eslint.config.js
Normal file
20
test/plugin-import-export/eslint.config.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { rootParserOptions } from '../../eslint.config.js'
|
||||
import { testEslintConfig } from '../eslint.config.js'
|
||||
|
||||
/** @typedef {import('eslint').Linter.FlatConfig} */
|
||||
let FlatConfig
|
||||
|
||||
/** @type {FlatConfig[]} */
|
||||
export const index = [
|
||||
...testEslintConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
...rootParserOptions,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export default index
|
||||
13
test/plugin-import-export/globals/Menu/index.ts
Normal file
13
test/plugin-import-export/globals/Menu/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
export const menuSlug = 'menu'
|
||||
|
||||
export const MenuGlobal: GlobalConfig = {
|
||||
slug: menuSlug,
|
||||
fields: [
|
||||
{
|
||||
name: 'globalText',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
}
|
||||
51
test/plugin-import-export/int.spec.ts
Normal file
51
test/plugin-import-export/int.spec.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { Payload } from 'payload'
|
||||
|
||||
import { compress, exportData } from '@payloadcms/plugin-import-export'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
||||
|
||||
let payload: Payload
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
const exportDir = path.join(dirname, 'data')
|
||||
|
||||
describe('@payloadcms/plugin-import-export', () => {
|
||||
beforeAll(async () => {
|
||||
const initialized = await initPayloadInt(dirname)
|
||||
;({ payload } = initialized)
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (typeof payload.db.destroy === 'function') {
|
||||
await payload.db.destroy()
|
||||
}
|
||||
|
||||
if (fs.existsSync(exportDir)) {
|
||||
fs.rmdirSync(exportDir, { recursive: true })
|
||||
}
|
||||
})
|
||||
|
||||
it('export and compress data', async () => {
|
||||
await exportData({ payload })
|
||||
|
||||
const exported = await payload.find({
|
||||
collection: 'payload-exports',
|
||||
})
|
||||
|
||||
expect(exported.docs).toHaveLength(1)
|
||||
|
||||
const { zipPath } = await compress({
|
||||
payload,
|
||||
destination: path.join(exportDir, 'export-test'),
|
||||
})
|
||||
|
||||
// TODO: Validate file structure
|
||||
|
||||
expect(fs.existsSync(zipPath)).toBe(true)
|
||||
})
|
||||
})
|
||||
220
test/plugin-import-export/payload-types.ts
Normal file
220
test/plugin-import-export/payload-types.ts
Normal file
@@ -0,0 +1,220 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by Payload.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
||||
* and re-run `payload generate:types` to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface Config {
|
||||
auth: {
|
||||
users: UserAuthOperations;
|
||||
};
|
||||
collections: {
|
||||
posts: Post;
|
||||
media: Media;
|
||||
'payload-exports': Export;
|
||||
'payload-exports-uploads': ExportsUpload;
|
||||
users: User;
|
||||
'payload-preferences': PayloadPreference;
|
||||
'payload-migrations': PayloadMigration;
|
||||
};
|
||||
db: {
|
||||
defaultIDType: string;
|
||||
};
|
||||
globals: {
|
||||
menu: Menu;
|
||||
};
|
||||
locale: null;
|
||||
user: User & {
|
||||
collection: 'users';
|
||||
};
|
||||
}
|
||||
export interface UserAuthOperations {
|
||||
forgotPassword: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
login: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
registerFirstUser: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
unlock: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "posts".
|
||||
*/
|
||||
export interface Post {
|
||||
id: string;
|
||||
text?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "media".
|
||||
*/
|
||||
export interface Media {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string | null;
|
||||
thumbnailURL?: string | null;
|
||||
filename?: string | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
focalX?: number | null;
|
||||
focalY?: number | null;
|
||||
sizes?: {
|
||||
thumbnail?: {
|
||||
url?: string | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
filename?: string | null;
|
||||
};
|
||||
medium?: {
|
||||
url?: string | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
filename?: string | null;
|
||||
};
|
||||
large?: {
|
||||
url?: string | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
filename?: string | null;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "exports".
|
||||
*/
|
||||
export interface Export {
|
||||
id: string;
|
||||
collectionExports?:
|
||||
| {
|
||||
slug: string;
|
||||
data:
|
||||
| {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
| unknown[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
id?: string | null;
|
||||
}[]
|
||||
| null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "exports-uploads".
|
||||
*/
|
||||
export interface ExportsUpload {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string | null;
|
||||
thumbnailURL?: string | null;
|
||||
filename?: string | null;
|
||||
mimeType?: string | null;
|
||||
filesize?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
focalX?: number | null;
|
||||
focalY?: number | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
email: string;
|
||||
resetPasswordToken?: string | null;
|
||||
resetPasswordExpiration?: string | null;
|
||||
salt?: string | null;
|
||||
hash?: string | null;
|
||||
loginAttempts?: number | null;
|
||||
lockUntil?: string | null;
|
||||
password?: string | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "payload-preferences".
|
||||
*/
|
||||
export interface PayloadPreference {
|
||||
id: string;
|
||||
user: {
|
||||
relationTo: 'users';
|
||||
value: string | User;
|
||||
};
|
||||
key?: string | null;
|
||||
value?:
|
||||
| {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
| unknown[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "payload-migrations".
|
||||
*/
|
||||
export interface PayloadMigration {
|
||||
id: string;
|
||||
name?: string | null;
|
||||
batch?: number | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "menu".
|
||||
*/
|
||||
export interface Menu {
|
||||
id: string;
|
||||
globalText?: string | null;
|
||||
updatedAt?: string | null;
|
||||
createdAt?: string | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "auth".
|
||||
*/
|
||||
export interface Auth {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
13
test/plugin-import-export/tsconfig.eslint.json
Normal file
13
test/plugin-import-export/tsconfig.eslint.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
// extend your base config to share compilerOptions, etc
|
||||
//"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
// ensure that nobody can accidentally use this config for a build
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
// whatever paths you intend to lint
|
||||
"./**/*.ts",
|
||||
"./**/*.tsx"
|
||||
]
|
||||
}
|
||||
3
test/plugin-import-export/tsconfig.json
Normal file
3
test/plugin-import-export/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tsconfig.json"
|
||||
}
|
||||
Reference in New Issue
Block a user