comparison libervia/server/tasks/implicit/task_js_modules.py @ 1434:2f6dac783c8e

tasks(js_modules, sass): remove support for `npm`: `npm` cause trouble during installation, and it will be resource cousuming to find the source and maintain it in addition to `yarn`, thus `yarn` is for now kept and the only supported NodeJS package manager.
author Goffi <goffi@goffi.org>
date Wed, 09 Jun 2021 16:50:07 +0200
parents 10748aa888a9
children 106bae41f5c8
comparison
equal deleted inserted replaced
1433:1a5410981c45 1434:2f6dac783c8e
14 14
15 class Task(task.Task): 15 class Task(task.Task):
16 16
17 async def prepare(self): 17 async def prepare(self):
18 if "js" not in self.resource.browser_modules: 18 if "js" not in self.resource.browser_modules:
19 raise exceptions.CancelError(f"No JS module needed") 19 raise exceptions.CancelError("No JS module needed")
20 20
21 async def start(self): 21 async def start(self):
22 js_data = self.resource.browser_modules['js'] 22 js_data = self.resource.browser_modules['js']
23 package = js_data.get('package', {}) 23 package = js_data.get('package', {})
24 package_path = self.build_path / 'package.json' 24 package_path = self.build_path / 'package.json'
25 with package_path.open('w') as f: 25 with package_path.open('w') as f:
26 json.dump(package, f) 26 json.dump(package, f)
27 27
28 cmd = self.findCommand('yarnpkg', 'yarn', 'npm') 28 cmd = self.findCommand('yarnpkg', 'yarn')
29 await self.runCommand(cmd, 'install', path=str(self.build_path)) 29 await self.runCommand(cmd, 'install', path=str(self.build_path))
30 30
31 try: 31 try:
32 brython_map = js_data['brython_map'] 32 brython_map = js_data['brython_map']
33 except KeyError: 33 except KeyError: