Skip to content

Commit

Permalink
Merge pull request #19 from Anush008/Anush008-patch-1
Browse files Browse the repository at this point in the history
feat: npm package root path
  • Loading branch information
bdougie authored Aug 21, 2023
2 parents 4d26cd0 + 73b8c0d commit e62fc8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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

0 comments on commit e62fc8a

Please sign in to comment.