Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #856 from zanata/frontend
Browse files Browse the repository at this point in the history
Make frontend module more offline friendly
  • Loading branch information
Patrick Huang committed Jun 12, 2015
2 parents 4a222ec + 94b2367 commit 34954ff
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
23 changes: 23 additions & 0 deletions frontend/README.md
@@ -0,0 +1,23 @@
## This is a module to build zanata frontend javascript projects

At the moment it only contains "user profile page" bundle.

To build it, just run

```mvn install```

It will build and deploy to local maven repository a jar file containing the javascript bundle.
The jar file can be used directly under any servlet 3 compatible container and the bundle is accessible as static resources.
See [Servlet 3 static resources](http://www.webjars.org/documentation#servlet3).

The following Maven properties can be overridden on the command line with ```-Dkey=value```:

```
<node.version>v0.12.2</node.version>
<npm.version>2.7.6</npm.version>
<node.install.directory>${download.dir}/zanata-frontend/node-${node.version}-npm-${npm.version}</node.install.directory>
<npm.cli.script>${node.install.directory}/node/npm/bin/npm-cli.js</npm.cli.script>
```

By default it will try to install npm modules from npm registry (default cache TTL is 10 seconds).
If you activate profile ```-DnpmOffline``` the cache-min option will become 9999999 which means it will try to install npm modules from cache first.
20 changes: 19 additions & 1 deletion frontend/pom.xml
Expand Up @@ -17,8 +17,10 @@
<web.target>${project.build.directory}/web</web.target>
<bundle.output>${project.build.directory}/build</bundle.output>
<bundle.dest>${bundle.output}/META-INF/resources</bundle.dest>
<node.install.directory>${project.build.directory}</node.install.directory>
<node.install.directory>${download.dir}/zanata-frontend/node-${node.version}-npm-${npm.version}</node.install.directory>
<npm.cli.script>${node.install.directory}/node/npm/bin/npm-cli.js</npm.cli.script>
<!-- in seconds. 10 is the default value -->
<npm.cache.min>10</npm.cache.min>

<!-- ==== list of modules to build by npm and node ==== -->
<module.user-profile-page>user-profile-page</module.user-profile-page>
Expand Down Expand Up @@ -85,6 +87,8 @@
<arguments>
<argument>${npm.cli.script}</argument>
<argument>install</argument>
<argument>--cache-min</argument>
<argument>${npm.cache.min}</argument>
</arguments>
</configuration>
</execution>
Expand Down Expand Up @@ -125,4 +129,18 @@
</plugins>
</build>

<profiles>
<profile>
<id>npmOffline</id>
<activation>
<property>
<name>npmOffline</name>
</property>
</activation>
<properties>
<npm.cache.min>9999999</npm.cache.min>
</properties>
</profile>
</profiles>

</project>

0 comments on commit 34954ff

Please sign in to comment.