Fix issue installing scoped NPM packages
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
* Add mailer use event.
|
||||
* Remove the include fontawesome and download it from
|
||||
the NPMregistry.
|
||||
* Fix issue installing scoped NPM packages.
|
||||
|
||||
3.1.11 (2019-04-XX)
|
||||
===================
|
||||
@@ -120,7 +121,7 @@
|
||||
* Add DOCUMENTS_HASH_BLOCK_SIZE to control the size of the file
|
||||
block when calculating a document's checksum.
|
||||
|
||||
3.1.10 (2019-04-04)
|
||||
a3.1.10 (2019-04-04)
|
||||
===================
|
||||
* Backport test case improvements from the development branch. Add random
|
||||
primary key mixin. Split test case code into mixins. Make the view test
|
||||
|
||||
@@ -142,6 +142,7 @@ Other changes
|
||||
* Add mailer use event.
|
||||
* Remove the include fontawesome and download it from
|
||||
the NPMregistry.
|
||||
* Fix issue installing scoped NPM packages.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -18,11 +18,10 @@ from django.utils.functional import cached_property
|
||||
from mayan.apps.storage.utils import mkdtemp
|
||||
|
||||
from .exceptions import DependenciesException
|
||||
|
||||
DEFAULT_REGISTRY_URL = 'http://registry.npmjs.com'
|
||||
DEFAULT_MODULE_DIRECTORY = 'node_modules'
|
||||
DEFAULT_PACKAGE_FILENAME = 'package.json'
|
||||
DEFAULT_LOCK_FILENAME = 'package-lock.json'
|
||||
from .literals import (
|
||||
DEFAULT_LOCK_FILENAME, DEFAULT_MODULE_DIRECTORY, DEFAULT_PACKAGE_FILENAME,
|
||||
DEFAULT_REGISTRY_URL,
|
||||
)
|
||||
|
||||
|
||||
class NPMPackage(object):
|
||||
@@ -49,21 +48,25 @@ class NPMPackage(object):
|
||||
)
|
||||
|
||||
def extract(self):
|
||||
shutil.rmtree(
|
||||
path=force_text(
|
||||
Path(
|
||||
self.registry.module_directory, self.name
|
||||
)
|
||||
), ignore_errors=True
|
||||
download_path = force_text(
|
||||
Path(
|
||||
self.registry.module_directory, self.name
|
||||
)
|
||||
)
|
||||
shutil.rmtree(path=download_path, ignore_errors=True)
|
||||
|
||||
with tarfile.open(name=force_text(self.get_tar_file_path()), mode='r') as file_object:
|
||||
compressed_filepath = force_text(self.get_tar_file_path())
|
||||
with tarfile.open(name=compressed_filepath, mode='r') as file_object:
|
||||
file_object.extractall(
|
||||
path=force_text(self.registry.module_directory)
|
||||
)
|
||||
|
||||
target_path = Path(self.registry.module_directory, self.name)
|
||||
# Scoped packages are nested under a parent directory
|
||||
# create it to avoid rename errors.
|
||||
target_path.mkdir(parents=True)
|
||||
Path(self.registry.module_directory, 'package').rename(
|
||||
target=Path(self.registry.module_directory, self.name)
|
||||
target=target_path
|
||||
)
|
||||
|
||||
def get_algorithm_function(self):
|
||||
|
||||
6
mayan/apps/dependencies/literals.py
Normal file
6
mayan/apps/dependencies/literals.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
DEFAULT_LOCK_FILENAME = 'package-lock.json'
|
||||
DEFAULT_PACKAGE_FILENAME = 'package.json'
|
||||
DEFAULT_MODULE_DIRECTORY = 'node_modules'
|
||||
DEFAULT_REGISTRY_URL = 'http://registry.npmjs.com'
|
||||
Reference in New Issue
Block a user