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

fix: correct link to issues page for ipfs readmes #1049

Merged
merged 2 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/check-project/check-monorepo-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function checkMonorepoReadme (projectDir, repoUrl, defaultBranch, p
parsedReadme.children.push(child)
})

const license = parseMarkdown(LICENSE[repoOwner] ?? LICENSE.default)
const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, defaultBranch))
const structure = parseMarkdown(STRUCTURE(projectDir, projectDirs))

parsedReadme.children = [
Expand Down
2 changes: 1 addition & 1 deletion src/check-project/check-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function checkReadme (projectDir, repoUrl, defaultBranch) {
})

const installation = parseMarkdown(INSTALL(pkg))
const license = parseMarkdown(LICENSE[repoOwner] ?? LICENSE.default)
const license = parseMarkdown(LICENSE(pkg, repoOwner, repoName, defaultBranch))

parsedReadme.children = [
...installation.children,
Expand Down
31 changes: 23 additions & 8 deletions src/check-project/readme/license.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

/** @type {Record<string, string>} */
export const LICENSE = {
ipfs: `
/**
* @type {Record<string, (repoOwner: string, repoName: string, defaultBranch: string) => string>}
*/
const licenses = {
ipfs: (repoOwner, repoName, defaultBranch) => `
## License

Licensed under either of
Expand All @@ -11,22 +12,36 @@ Licensed under either of

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)!
Contributions welcome! Please check out [the issues](https://github.com/${repoOwner}/${repoName}/issues).

Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.

This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
`,
default: `
default: (repoOwner, repoName, defaultBranch) => `
## License

Licensed under either of

* Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)

## Contribution
## Contribute

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
`
}

/**
* @param {*} pkg
* @param {string} repoOwner
* @param {string} repoName
* @param {string} defaultBranch
*/
export const LICENSE = (pkg, repoOwner, repoName, defaultBranch) => {
return (licenses[repoOwner] ?? licenses.default)(repoOwner, repoName, defaultBranch)
}