mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
[fix] update_npm_packages, patch to install yarn (#572)
This commit is contained in:
parent
9c834bc561
commit
5d0a453ccb
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "frappe",
|
||||
"description": "Default package.json for frappe apps",
|
||||
"dependencies": {
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-preset-babili": "0.0.12",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-es2016": "^6.24.1",
|
||||
"babel-preset-es2017": "^6.24.1",
|
||||
"chokidar": "^1.7.0",
|
||||
"cookie": "^0.3.1",
|
||||
"express": "^4.15.3",
|
||||
"less": "^2.7.2",
|
||||
"redis": "^2.7.1",
|
||||
"socket.io": "^2.0.1",
|
||||
"superagent": "^3.5.2"
|
||||
}
|
||||
}
|
@ -3,4 +3,4 @@ bench.patches.v3.celery_to_rq
|
||||
bench.patches.v3.redis_bind_ip
|
||||
bench.patches.v4.update_node
|
||||
bench.patches.v4.update_socketio
|
||||
|
||||
bench.patches.v4.install_yarn
|
||||
|
4
bench/patches/v4/install_yarn.py
Normal file
4
bench/patches/v4/install_yarn.py
Normal file
@ -0,0 +1,4 @@
|
||||
import subprocess
|
||||
|
||||
def execute(bench_path):
|
||||
subprocess.check_output(['npm', 'install', '-g', 'yarn'])
|
@ -430,34 +430,11 @@ def update_requirements(bench_path='.'):
|
||||
def update_npm_packages(bench_path='.'):
|
||||
print('Updating node libraries...')
|
||||
apps_dir = os.path.join(bench_path, 'apps')
|
||||
package_json = {}
|
||||
|
||||
for app in os.listdir(apps_dir):
|
||||
package_json_path = os.path.join(apps_dir, app, 'package.json')
|
||||
app_path = os.path.join(apps_dir, app)
|
||||
exec_cmd('yarn install', cwd=app_path)
|
||||
|
||||
if os.path.exists(package_json_path):
|
||||
with open(package_json_path, "r") as f:
|
||||
app_package_json = json.loads(f.read())
|
||||
# package.json is usually a dict in a dict
|
||||
for key, value in iteritems(app_package_json):
|
||||
if not key in package_json:
|
||||
package_json[key] = value
|
||||
else:
|
||||
if isinstance(value, dict):
|
||||
package_json[key].update(value)
|
||||
elif isinstance(value, list):
|
||||
package_json[key].extend(value)
|
||||
else:
|
||||
package_json[key] = value
|
||||
|
||||
if package_json is {}:
|
||||
with open(os.path.join(os.path.dirname(__file__), 'package.json'), 'r') as f:
|
||||
package_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(bench_path, 'package.json'), 'w') as f:
|
||||
f.write(json.dumps(package_json, indent=1, sort_keys=True))
|
||||
|
||||
exec_cmd('npm install', cwd=bench_path)
|
||||
|
||||
def install_requirements(pip, req_file):
|
||||
if os.path.exists(req_file):
|
||||
@ -792,4 +769,3 @@ def run_playbook(playbook_name, extra_vars=None, tag=None):
|
||||
args.extend(['-t', tag])
|
||||
|
||||
subprocess.check_call(args, cwd=os.path.join(os.path.dirname(bench.__path__[0]), 'playbooks'))
|
||||
|
Loading…
Reference in New Issue
Block a user