Skip to content

Commit 870365c

Browse files
authored
Merge pull request #56 from schmidtk/feat-use-assigned-defines
feat(gcc): use goog.defines that are assigned to a value
2 parents 7c13187 + a9a9638 commit 870365c

File tree

8 files changed

+50
-3
lines changed

8 files changed

+50
-3
lines changed

plugins/gcc/defines.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const slash = require('slash');
1111
*
1212
* The nice thing about opensphere builds is that there is typically no need to re-run
1313
* the build to pick up changes to JS or HTML (just hit refresh!). To accomplish
14-
* this, each project has a goog.defines(<project>.ROOT, '../<project>/') call
14+
* this, each project has a goog.define('<project>.ROOT', '../<project>/') call
1515
* that allows you to prefix paths. e.g. an Angular directive with a template:
1616
*
1717
* {
@@ -85,7 +85,7 @@ const resolver = function(pack, projectDir, depth) {
8585
}
8686
};
8787

88-
return utils.findLines(/^goog\.define\(/, dir, /\.js$/).then(function(list) {
88+
return utils.findLines(/goog\.define\(/, dir, /\.js$/).then(function(list) {
8989
list.forEach(processItem);
9090
});
9191
}
@@ -161,7 +161,7 @@ const writer = function(thisPackage, outputDir) {
161161
Object.assign(defs, modules);
162162

163163
// write out the debug file
164-
var file = '// This file overrides goog.defines() calls for ' +
164+
var file = '// This file overrides goog.define() calls for ' +
165165
'<project>.*.ROOT defines in the debug html\nvar ' +
166166
'CLOSURE_UNCOMPILED_DEFINES = ' + JSON.stringify(defs, null, 2) +
167167
';';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["foo.ROOT='test'"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
goog.provide('foo');
2+
3+
/**
4+
* @define {string}
5+
*/
6+
foo.ROOT = goog.define('foo.ROOT', '');
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "should-use-explicitly-defined-src-directory",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"keywords": [],
7+
"build": {
8+
"type": "app"
9+
},
10+
"directories": {
11+
"src": "foo"
12+
}
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["foo.ROOT='test'"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
goog.module('foo');
2+
3+
/**
4+
* @define {string}
5+
*/
6+
const ROOT = goog.define('foo.ROOT', '');
7+
8+
exports = {ROOT};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "should-use-explicitly-defined-src-directory",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"keywords": [],
7+
"build": {
8+
"type": "app"
9+
},
10+
"directories": {
11+
"src": "foo"
12+
}
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
goog.provide('foo');
2+
3+
/**
4+
* @define {string}
5+
*/
16
goog.define('foo.ROOT', '');

0 commit comments

Comments
 (0)