kopia lustrzana https://github.com/piku/piku
Stop npm complaining about the node_modules symlink.
This fixes #228 whilst retaining the existing behaviour of symlinking node_modules to the actual location in envs/APPNAME.pull/230/head
rodzic
547d3b3dae
commit
2f248d0852
12
piku.py
12
piku.py
|
@ -537,7 +537,8 @@ def deploy_node(app, deltas={}):
|
||||||
|
|
||||||
virtualenv_path = join(ENV_ROOT, app)
|
virtualenv_path = join(ENV_ROOT, app)
|
||||||
node_path = join(ENV_ROOT, app, "node_modules")
|
node_path = join(ENV_ROOT, app, "node_modules")
|
||||||
node_path_tmp = join(APP_ROOT, app, "node_modules")
|
node_modules_symlink = join(APP_ROOT, app, "node_modules")
|
||||||
|
npm_prefix = abspath(join(node_path, ".."))
|
||||||
env_file = join(APP_ROOT, app, 'ENV')
|
env_file = join(APP_ROOT, app, 'ENV')
|
||||||
deps = join(APP_ROOT, app, 'package.json')
|
deps = join(APP_ROOT, app, 'package.json')
|
||||||
|
|
||||||
|
@ -550,7 +551,7 @@ def deploy_node(app, deltas={}):
|
||||||
env = {
|
env = {
|
||||||
'VIRTUAL_ENV': virtualenv_path,
|
'VIRTUAL_ENV': virtualenv_path,
|
||||||
'NODE_PATH': node_path,
|
'NODE_PATH': node_path,
|
||||||
'NPM_CONFIG_PREFIX': abspath(join(node_path, "..")),
|
'NPM_CONFIG_PREFIX': npm_prefix,
|
||||||
"PATH": ':'.join([join(virtualenv_path, "bin"), join(node_path, ".bin"), environ['PATH']])
|
"PATH": ':'.join([join(virtualenv_path, "bin"), join(node_path, ".bin"), environ['PATH']])
|
||||||
}
|
}
|
||||||
if exists(env_file):
|
if exists(env_file):
|
||||||
|
@ -578,10 +579,11 @@ def deploy_node(app, deltas={}):
|
||||||
|
|
||||||
if exists(deps) and check_requirements(['npm']):
|
if exists(deps) and check_requirements(['npm']):
|
||||||
if first_time or getmtime(deps) > getmtime(node_path):
|
if first_time or getmtime(deps) > getmtime(node_path):
|
||||||
|
copyfile(join(APP_ROOT, app, 'package.json'), join(ENV_ROOT, app, 'package.json'))
|
||||||
|
if not exists(node_modules_symlink):
|
||||||
|
symlink(node_path, node_modules_symlink)
|
||||||
echo("-----> Running npm for '{}'".format(app), fg='green')
|
echo("-----> Running npm for '{}'".format(app), fg='green')
|
||||||
symlink(node_path, node_path_tmp)
|
call('npm install --prefix {} --package-lock=false'.format(npm_prefix), cwd=join(APP_ROOT, app), env=env, shell=True)
|
||||||
call('npm install', cwd=join(APP_ROOT, app), env=env, shell=True)
|
|
||||||
unlink(node_path_tmp)
|
|
||||||
return spawn_app(app, deltas)
|
return spawn_app(app, deltas)
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue