-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix yarn pack
to always include the file in the "main" field
#3092
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,14 +68,17 @@ function addEntry(packer: any, entry: Object, buffer?: ?Buffer): Promise<void> { | |
|
||
export async function pack(config: Config, dir: string): Promise<stream$Duplex> { | ||
const pkg = await config.readRootManifest(); | ||
const {bundledDependencies, files: onlyFiles} = pkg; | ||
const {bundledDependencies, main, files: onlyFiles} = pkg; | ||
|
||
// inlude required files | ||
let filters: Array<IgnoreFilter> = NEVER_IGNORE.slice(); | ||
// include default filters unless `files` is used | ||
if (!onlyFiles) { | ||
filters = filters.concat(DEFAULT_IGNORE); | ||
} | ||
if (main) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, @josephfrazier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, still not sure I understand. In I split my changes into two commits - test first, fix second - which should help demonstrate how the new condition is covered by the test. If you run the following at each commit, you'll see how the tarball changes (this is also covered by
|
||
filters = filters.concat(ignoreLinesToRegex(['!/' + main])); | ||
} | ||
|
||
// include bundledDependencies | ||
if (bundledDependencies) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,7 @@ export type Manifest = { | |
|
||
deprecated?: string, | ||
files?: Array<string>, | ||
main?: string, | ||
}; | ||
|
||
// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add index.js to main filed?