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

Update package.json with homepage URL #415

Merged
merged 2 commits into from
Dec 20, 2023
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
7 changes: 5 additions & 2 deletions packages/action/dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34106,11 +34106,15 @@ var updatePackageJson = ({
core_exports.info(`[${packageJsonPath}]: No name found.`);
return false;
}
const isRepoRoot = import_node_path2.default.relative(process.cwd(), packageJsonPath) === "package.json";
const relative = import_node_path2.default.relative(process.cwd(), packageJsonPath);
const relativeDir = import_node_path2.default.dirname(relative);
const isRepoRoot = relative === "package.json";
const homepage = `${repository.html_url}${relativeDir === "." ? "" : relativeDir}#readme`;
const publishConfig = packageJson.name?.startsWith("@") ? { publishConfig: { access: "public" } } : {};
const description = isRepoRoot ? { description: repository.description } : {};
const keywords = isRepoRoot ? { keywords: repository.topics ?? [] } : {};
const repoInfo = {
homepage,
...repoLevelConfig,
...description,
...publishConfig,
Expand Down Expand Up @@ -34150,7 +34154,6 @@ var updatePackageJsonList = async ({
const repoLevelConfig = {
...license,
bugs: `${repository.html_url}/issues`,
homepage: `${repository.html_url}#readme`,
author: {
name: owner.login,
email: owner.email ?? "intents.turrets0h@icloud.com",
Expand Down
10 changes: 8 additions & 2 deletions packages/action/src/ghosts/docs/updatePackageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
return false
}

const isRepoRoot =
path.relative(process.cwd(), packageJsonPath) === 'package.json'
const relative = path.relative(process.cwd(), packageJsonPath)
const relativeDir = path.dirname(relative)
const isRepoRoot = relative === 'package.json'

const homepage = `${repository.html_url}${
relativeDir === '.' ? '' : relativeDir
}#readme`

Check warning on line 40 in packages/action/src/ghosts/docs/updatePackageJson.ts

View check run for this annotation

Codecov / codecov/patch

packages/action/src/ghosts/docs/updatePackageJson.ts#L34-L40

Added lines #L34 - L40 were not covered by tests

const publishConfig = packageJson.name?.startsWith('@')
? { publishConfig: { access: 'public' } }
Expand All @@ -45,6 +50,7 @@
const keywords = isRepoRoot ? { keywords: repository.topics ?? [] } : {}

const repoInfo = {
homepage,

Check warning on line 53 in packages/action/src/ghosts/docs/updatePackageJson.ts

View check run for this annotation

Codecov / codecov/patch

packages/action/src/ghosts/docs/updatePackageJson.ts#L53

Added line #L53 was not covered by tests
...repoLevelConfig,
...description,
...publishConfig,
Expand Down
1 change: 0 additions & 1 deletion packages/action/src/ghosts/docs/updatePackageJsonList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const updatePackageJsonList = async ({
const repoLevelConfig = {
...license,
bugs: `${repository.html_url}/issues`,
homepage: `${repository.html_url}#readme`,
author: {
name: owner.login,
email: owner.email ?? 'intents.turrets0h@icloud.com',
Expand Down
Loading