X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3e82fe190f3d1fbfb7300a98ff1a3a0497d9e237..b1119bec47d2a0c5fb4803321991506bf4c4ab91:/apps/build/management/commands/build.py diff --git a/apps/build/management/commands/build.py b/apps/build/management/commands/build.py index 416893d4..d87d3b48 100644 --- a/apps/build/management/commands/build.py +++ b/apps/build/management/commands/build.py @@ -21,14 +21,26 @@ class Command(BaseCommand): type='string', default='npm', help='Path to npm binary'), + make_option('--editor-npm-env', + action='store', + dest='editor_npm_env', + type='string', + default=None, + help='Destination path of npm environment, defaults to ./node_modules'), ) def handle(self, **options): wiki_base_dir = os.path.join(os.getcwd(), 'apps', 'wiki', 'static', 'wiki') - rng_base_dir = os.path.join(wiki_base_dir, 'rng') + rng_base_dir = os.path.join(wiki_base_dir, 'editor') build_dir = os.path.join(wiki_base_dir, 'build') self.stdout.write('Installing editor dependencies') + if options['editor_npm_env']: + npm_env = os.path.join(rng_base_dir, options['editor_npm_env']) + if not os.path.exists(npm_env): + os.makedirs(npm_env) + assert os.path.isdir(npm_env) + os.symlink(npm_env, os.path.join(rng_base_dir, 'node_modules')) try: call([options['npm_bin'], 'install'], cwd = rng_base_dir) except OSError: @@ -40,4 +52,4 @@ class Command(BaseCommand): os.environ['PATH'] = '%s:%s' % (options['node_bin_path'], os.environ['PATH']) call(['./node_modules/.bin/grunt', 'build', '--output-dir=%s' % build_dir], cwd = rng_base_dir) - call_command('collectstatic', interactive = False, ignore_patterns = ['rng']) + call_command('collectstatic', interactive = False, ignore_patterns = ['editor'])