Skip to content

Commit

Permalink
Sanitize fix
Browse files Browse the repository at this point in the history
NP-637
  • Loading branch information
jellespijker committed Dec 11, 2024
1 parent afe6609 commit 5e6e7ae
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions recipes/npmpackage/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
from conan import ConanFile
from conan.tools.scm import Version

from pathlib import Path

required_conan_version = ">=2.7.0"


def sanitize_version(version: Version):
if version.pre:
return str(version)
else:
def sanitize_version(version):
# npm will otherwise 'sanitize' the version number
return str(version).replace("+", "_")
return version.replace("+", "-")


def conf_package_json(conanfile: ConanFile, **kwargs):
entry_point = [p.name for p in Path(conanfile.package_folder, "bin").rglob("*.js")][0]
package_json = {
"name": f"@{conanfile.author.lower()}/{conanfile.name.lower()}js",
"version": f"{sanitize_version(Version(conanfile.version))}",
"version": f"{sanitize_version(conanfile.version)}",
"description": f"JavaScript / TypeScript bindings for {conanfile.name}, a {conanfile.description}",
"main": f"bin/{entry_point}",
"repository": {
Expand Down

0 comments on commit 5e6e7ae

Please sign in to comment.