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: npm package root path #19

Merged
merged 5 commits into from
Aug 21, 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ Keep one of `files` or `main` keys in your `package.json` accurate depending on

If you publish, make sure to also provide a valid `NPM_TOKEN` as `.npmrc` authentication is ignored in our config!

To configure the directory for publishing, you have the option to set a path value to `NPM_PACKAGE_ROOT`. By default, it is set to `"."`.

### GitHub Actions

Unless you have an `action.yml` present in your root folder, this module is not added to the release config.
Expand Down
12 changes: 10 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const {
GIT_COMMITTER_EMAIL,
GIT_AUTHOR_NAME,
GIT_AUTHOR_EMAIL,
NPM_PACKAGE_ROOT
} = process.env;
const [owner, repo] = String(GITHUB_REPOSITORY).toLowerCase().split("/");
const addPlugin = (plugin, options) => {
Expand All @@ -56,7 +57,7 @@ try {
authorName && !GIT_AUTHOR_NAME && (process.env.GIT_AUTHOR_NAME = `${authorName}`);
authorEmail && !GIT_AUTHOR_EMAIL && (process.env.GIT_AUTHOR_EMAIL = `${authorEmail}`);
} catch (e) {
log.warn(`Unable to set GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL`);
log.warn(`Unable to set GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL`);
log.error(e);
}

Expand Down Expand Up @@ -117,8 +118,10 @@ addPlugin("@semantic-release/changelog", {
> All notable changes to this project will be documented in this file`
});

const pkgRoot = NPM_PACKAGE_ROOT || ".";
addPlugin("@semantic-release/npm", {
"tarballDir": "pack"
tarballDir: "pack",
pkgRoot,
});

const actionExists = existsSync("./action.yml");
Expand Down Expand Up @@ -170,6 +173,11 @@ addPlugin("@semantic-release/git", {
"npm-shrinkwrap.json",
"yarn.lock",
"pnpm-lock.yaml",
"**/package.json",
"**/package-lock.json",
"**/npm-shrinkwrap.json",
"**/yarn.lock",
"**/pnpm-lock.yaml",
"public/**/*",
"supabase/**/*",
"action.yml",
Expand Down
Loading