Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: validate build outputs against package.json #33

Merged
merged 5 commits into from
Dec 14, 2021

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Dec 10, 2021

resolves #6

Possible future steps:

  • ensure that at least one file is present in package.json
  • ensure that types are mentioned in package.json if declaration: true
  • validate exports schema - e.g. unjs/defu@f9296a5

@danielroe danielroe added the enhancement New feature or request label Dec 10, 2021
@danielroe danielroe requested a review from pi0 December 10, 2021 14:56
@danielroe danielroe self-assigned this Dec 10, 2021
src/validate.ts Outdated
import chalk from 'chalk'
import consola from 'consola'
import { resolve } from 'pathe'
import { PackageJson } from 'pkg-types'
import { extractExportFilenames } from './auto'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this to utils as is becoming shared util?

src/validate.ts Outdated Show resolved Hide resolved
src/validate.ts Outdated
@@ -32,3 +36,27 @@ export function validateDependencies (ctx: BuildContext) {
consola.warn('Potential implicit dependencies found:', Array.from(implicitDependnecies).map(id => chalk.cyan(id)).join(', '))
}
}

export function validateBuildOutputs (pkg: PackageJson, rootDir: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function validateBuildOutputs (pkg: PackageJson, rootDir: string) {
export function validatePackage (pkg: PackageJson, rootDir: string) {

@pi0 pi0 merged commit c9ce0b0 into main Dec 14, 2021
@pi0 pi0 deleted the feat/validate-build-outputs branch December 14, 2021 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validate module fields
2 participants