Skip to content

Commit

Permalink
fix get_npm_package_name
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Mar 17, 2024
1 parent 177cf44 commit e4f516a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/npm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from .github_utils import create_release
from .version_utils import get_version

def get_npm_package_name(package_json_path: Path):
with open(package_json_path, 'r') as file:

def get_npm_package_name(root_path: Path):
with open(root_path / 'package.json', 'r') as file:
package_data = json.load(file)
return package_data['name']


def publish_npm_package(
*,
src: Path,
Expand All @@ -22,7 +24,7 @@ def publish_npm_package(
ignore: List[str] = [],
):
package_name = get_npm_package_name(src)

if not npm_access_token:
print('NPM access token is missing', flush=True, file=sys.stderr)
exit(1)
Expand All @@ -36,7 +38,7 @@ def publish_npm_package(

if not changed:
return

with open(src / '.npmrc', 'w') as file:
file.write(f'registry=https://registry.npmjs.org')

Expand Down

0 comments on commit e4f516a

Please sign in to comment.