Skip to content

Commit f25a27c

Browse files
author
zihang.zzh
committed
feat: add readme copy logic
1 parent 366dba1 commit f25a27c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/built-in-plugins/command-publish/plugin/run-publish.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { logFatal, logInfo, spinner, logText } from '../../../utils/log';
1717
import { getMonoAndNpmDepsOnce, DepMap } from '../../../utils/packages';
1818
import { ProjectConfig, PackageInfo } from '../../../utils/define';
1919
import { isOwner } from '../../../utils/npm';
20+
import { README_FILE } from '../../../utils/constants';
2021

2122
export const publish = async (options: PublishOption) => {
2223
const currentBranchName = options.branch ? options.branch : await getCurrentBranchName();
@@ -368,8 +369,10 @@ async function moveSourceFilesToTempFolderAndPublish(
368369
await copyDeclaration(sourceType, publishTempName);
369370
await fs.copy(path.join(targetRoot, 'package.json'), path.join(tempRoot, 'package.json'));
370371

371-
if (fs.existsSync(path.join(targetRoot, 'README.md'))) {
372-
await fs.copy(path.join(targetRoot, 'README.md'), path.join(tempRoot, 'README.md'));
372+
if (fs.existsSync(path.join(targetRoot, README_FILE))) {
373+
await fs.copy(path.join(targetRoot, README_FILE), path.join(tempRoot, README_FILE));
374+
} else if (fs.existsSync(path.join(targetRoot, README_FILE.toLowerCase()))) {
375+
await fs.copy(path.join(targetRoot, README_FILE.toLowerCase()), path.join(tempRoot, README_FILE));
373376
}
374377

375378
// Add external deps

src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const CONFIG_FILE = 'priconfig.json';
22
export const PRI_PACKAGE_NAME = 'pri';
33
export const PACKAGES_NAME = 'packages';
4+
export const README_FILE = 'README.md';

0 commit comments

Comments
 (0)