Browse Source

Simplify package artifact paths in npm generator

Remove unnecessary 'dist' directory and streamline file copying process by directly placing JavaScript and TypeScript files in the generators directory. The package.json file creation path is also updated to reflect these changes, reducing path complexity and improving script efficiency.

Contribute to NP-637
NP-637_conan_v2_wasm
Jelle Spijker 1 year ago
parent
commit
a40168da07
  1. 8
      extensions/generators/npm.py

8
extensions/generators/npm.py

@ -15,13 +15,11 @@ class npm:
return
root_package = [dep for dep in self._conanfile.dependencies.direct_host.values()][0]
dist_path = Path(self._conanfile.generators_folder, "dist")
mkdir(self._conanfile, str(dist_path))
# Copy the *.js and *.d.ts
copy(self._conanfile, "*.js", src=root_package.package_folder, dst=str(dist_path))
copy(self._conanfile, "*.d.ts", src=root_package.package_folder, dst=str(dist_path))
copy(self._conanfile, "*.js", src=root_package.package_folder, dst=self._conanfile.generators_folder)
copy(self._conanfile, "*.d.ts", src=root_package.package_folder, dst=self._conanfile.generators_folder)
# Create the package.json
save(self._conanfile, str(Path(dist_path.parent, "package.json")),
save(self._conanfile, str(Path(self._conanfile.generators_folder, "package.json")),
json.dumps(root_package.conf_info.get(f"user.{root_package.ref.name.lower()}:package_json")))

Loading…
Cancel
Save