Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from google/tests
Browse files Browse the repository at this point in the history
mocha tests + travis CI support
  • Loading branch information
samthor authored Sep 28, 2017
2 parents 3905e52 + 136a01c commit 319dfb1
Show file tree
Hide file tree
Showing 9 changed files with 881 additions and 80 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js

node_js:
- stable
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# closure-compiler-js

<img src="https://travis-ci.org/google/closure-compiler-js.svg?branch=master" />

Check, compile, transpile, optimize and compress JavaScript with Closure Compiler in JS.

This repo tracks issues related to the publication to npmjs.org and associated plugins.
Expand All @@ -8,13 +10,14 @@ Any bugs not related to the plugins themselves should be reported to the [main r
Unlike other packages, this allows Closure Compiler to run entirely in JS.
*Java is not required.*

This is an experimental release - meaning some features are not available and performance may not be on-par with the Java implementation. [Details Here](#transpilation)
This is an experimental release - meaning some features are not available and performance may not be on-par with the Java implementation - [details here](#transpilation).

## Usage

First, install the latest version:

```bash
yarn add google-closure-compiler-js # or
npm install --save google-closure-compiler-js
```

Expand Down Expand Up @@ -132,9 +135,10 @@ gulp.task('script', function() {
### Languages

The Closure Compiler supports the following languages:
- `ECMASCRIPT3`, `ECMASCRIPT5` and `ECMASCRIPT5_STRICT` for input and output;
- `ECMASCRIPT6` and `ECMASCRIPT6_STRICT` for input only;
- `ECMASCRIPT6_TYPED` (experimental) for both.
- `ECMASCRIPT3`, `ECMASCRIPT5` and `ECMASCRIPT5_STRICT`
- `ECMASCRIPT6` and `ECMASCRIPT6_STRICT`
- `ECMASCRIPT6_TYPED` (experimental)
- `ECMASCRIPT_2017` (experimental)

### Source Code

Expand All @@ -143,7 +147,11 @@ Unless you're using Gulp's or Webpack's plugins, you'll need to specify code via
- Using `path` you can construct a virtual filesystem for use with ES6 or CommonJS imports &mdash; although for CommonJS you'll have to set `processCommonJsModules: true`.

## Transpilation
The JavaScript version of the Closure-Compiler is transpiled by GWT from the Java source. For more details on the differences in behavior see the [super sourced files](https://github.com/google/closure-compiler/tree/master/src/com/google/javascript/jscomp/gwt/super) in the main repo.
The JavaScript version of the Closure-Compiler is transpiled by GWT from the Java source.
For more details on the differences in behavior see the [super sourced files][1] in the main
repository.

[1]: https://github.com/google/closure-compiler/tree/master/src/com/google/javascript/jscomp/gwt/super

## Version History

Expand Down
13 changes: 9 additions & 4 deletions build.js → build_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* limitations under the License.
*/

/**
* @fileoverview Builds the Closure Compiler using Maven.
*/

'use strict';

const spawn = require('child_process').spawnSync;
Expand All @@ -23,20 +27,21 @@ const ncp = require('ncp');
const moduleName = 'com.google.javascript:closure-compiler-gwt';
const compilerBuild = spawn('mvn', ['-DskipTests', '-pl', moduleName], {
cwd: './closure-compiler',
stdio: 'inherit'
stdio: 'inherit',
});

if (compilerBuild.status !== 0) {
throw new Error('compiler build failed');
}

const pathsToCopy = ['contrib'];
const targetPath = './closure-compiler/target/closure-compiler-gwt-1.0-SNAPSHOT/jscomp/jscomp.js';
ncp(targetPath, './jscomp.js', err => {
ncp(targetPath, './jscomp.js', (err) => {
if (err) {
throw new Error(err);
}
['contrib'].forEach(name => {
ncp('./closure-compiler/' + name, './' + name, function(err) {
pathsToCopy.forEach((p) => {
ncp('./closure-compiler/' + p, './' + p, function(err) {
if (err) {
throw new Error(err);
}
Expand Down
Loading

0 comments on commit 319dfb1

Please sign in to comment.