create-payload-app
Advanced tools
Comparing version
@@ -10,6 +10,9 @@ import fse from 'fs-extra'; | ||
const indexTsPath = path.resolve(projectDirPath, './src/index.ts'); | ||
const devImportMapPath = path.resolve(projectDirPath, './dev/app/(payload)/admin/importMap.js'); | ||
const devPayloadConfig = fse.readFileSync(devPayloadConfigPath, 'utf8'); | ||
const devTsConfig = fse.readFileSync(devTsConfigPath, 'utf8'); | ||
const indexTs = fse.readFileSync(indexTsPath, 'utf-8'); | ||
const devImportMap = fse.readFileSync(devImportMapPath, 'utf-8'); | ||
const updatedTsConfig = devTsConfig.replaceAll('plugin-package-name-placeholder', projectName); | ||
const updatedImportMap = devImportMap.replaceAll('plugin-package-name-placeholder', projectName); | ||
let updatedIndexTs = indexTs.replaceAll('plugin-package-name-placeholder', projectName); | ||
@@ -24,4 +27,5 @@ const pluginExportVariableName = toCamelCase(projectName); | ||
fse.writeFileSync(indexTsPath, updatedIndexTs); | ||
fse.writeFileSync(devImportMapPath, updatedImportMap); | ||
}; | ||
//# sourceMappingURL=configure-plugin-project.js.map |
@@ -61,2 +61,25 @@ import { jest } from '@jest/globals'; | ||
}); | ||
it('updates project name in plugin template importMap file', async ()=>{ | ||
const projectName = 'my-custom-plugin'; | ||
const template = { | ||
name: 'plugin', | ||
type: 'plugin', | ||
description: 'Template for creating a Payload plugin', | ||
url: 'https://github.com/payloadcms/payload/templates/plugin' | ||
}; | ||
await createProject({ | ||
cliArgs: { | ||
...args, | ||
'--local-template': 'plugin' | ||
}, | ||
packageManager, | ||
projectDir, | ||
projectName, | ||
template | ||
}); | ||
const importMapPath = path.resolve(projectDir, './dev/app/(payload)/admin/importMap.js'); | ||
const importMapFile = fse.readFileSync(importMapPath, 'utf-8'); | ||
expect(importMapFile).not.toContain('plugin-package-name-placeholder'); | ||
expect(importMapFile).toContain('my-custom-plugin'); | ||
}); | ||
it('creates example', async ()=>{ | ||
@@ -63,0 +86,0 @@ const projectName = 'custom-server-example'; |
{ | ||
"name": "create-payload-app", | ||
"version": "3.40.0-canary.4", | ||
"version": "3.40.0-canary.5", | ||
"homepage": "https://payloadcms.com", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
286159
1.13%2975
0.92%