diff --git a/src/check-project/index.js b/src/check-project/index.js index ecb0f652e..94f31da29 100755 --- a/src/check-project/index.js +++ b/src/check-project/index.js @@ -24,6 +24,9 @@ import semver from 'semver' import Listr from 'listr' import yargsParser from 'yargs-parser' import { fileURLToPath } from 'url' +import { + isMonorepoProject +} from '../utils.js' const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -128,9 +131,13 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl) { proposedManifest = sortManifest(proposedManifest) await ensureFileHasContents(projectDir, 'package.json', JSON.stringify(proposedManifest, null, 2)) - await ensureFileHasContents(projectDir, '.gitignore', fs.readFileSync(path.join(__dirname, 'files', 'gitignore'), { - encoding: 'utf-8' - })) + + if (!isMonorepoProject) { + await ensureFileHasContents(projectDir, '.gitignore', fs.readFileSync(path.join(__dirname, 'files', 'gitignore'), { + encoding: 'utf-8' + })) + } + await checkLicenseFiles(projectDir) await checkBuildFiles(projectDir, branchName, repoUrl) await checkMonorepoReadme(projectDir, repoUrl, branchName, projectDirs) @@ -388,9 +395,13 @@ async function processModule (projectDir, manifest, branchName, repoUrl, homePag proposedManifest = sortManifest(proposedManifest) await ensureFileHasContents(projectDir, 'package.json', JSON.stringify(proposedManifest, null, 2)) - await ensureFileHasContents(projectDir, '.gitignore', fs.readFileSync(path.join(__dirname, 'files', 'gitignore'), { - encoding: 'utf-8' - })) + + if (!isMonorepoProject) { + await ensureFileHasContents(projectDir, '.gitignore', fs.readFileSync(path.join(__dirname, 'files', 'gitignore'), { + encoding: 'utf-8' + })) + } + await checkLicenseFiles(projectDir) await checkReadme(projectDir, repoUrl, branchName, rootManifest) } diff --git a/src/check-project/utils.js b/src/check-project/utils.js index 16415e099..de8cf0ff1 100644 --- a/src/check-project/utils.js +++ b/src/check-project/utils.js @@ -60,7 +60,8 @@ export async function ensureFileHasContents (projectDir, filePath, expectedConte }) if (!createFile) { - throw new Error(`Not creating ${filePath} file`) + console.warn(kleur.yellow(`${filePath} did not exist`)) + return } fs.mkdirSync(path.dirname(path.join(projectDir, filePath)), {