@samitouri / QOS-React-2 / commits / 135c554b23

Move headers to shared location, use grunt templates

Paul O’Shannessy committed Sep 8, 2015 at 17:41 UTC 135c554b23dbe45874fe47c47f91b797347a4c4c
3 files changed +30 -20
grunt/config/browserify.js
+16 -20
@@ -13,22 +13,10 @@ var envifyDev = envify({NODE_ENV: process.env.NODE_ENV || 'development'});
13 var envifyProd = envify({NODE_ENV: process.env.NODE_ENV || 'production'});
14
15 var SIMPLE_TEMPLATE =
16 -'/**\n\
17 - * @PACKAGE@ v@VERSION@\n\
18 - */';
16 + grunt.file.read('./grunt/data/header-template-short.txt');
17
18 var LICENSE_TEMPLATE =
21 -'/**\n\
22 - * @PACKAGE@ v@VERSION@\n\
23 - *\n\
24 - * Copyright 2013-2015, Facebook, Inc.\n\
25 - * All rights reserved.\n\
26 - *\n\
27 - * This source code is licensed under the BSD-style license found in the\n\
28 - * LICENSE file in the root directory of this source tree. An additional grant\n\
29 - * of patent rights can be found in the PATENTS file in the same directory.\n\
30 - *\n\
31 - */';
19 + grunt.file.read('./grunt/data/header-template-extended.txt');
20
21 function minify(src) {
22 return UglifyJS.minify(src, {fromString: true}).code;
@@ -38,17 +26,25 @@ function minify(src) {
26 function bannerify(src) {
27 var version = grunt.config.data.pkg.version;
28 var packageName = this.data.packageName || this.data.standalone;
41 - return LICENSE_TEMPLATE.replace('@PACKAGE@', packageName)
42 - .replace('@VERSION@', version) +
43 - '\n' + src;
29 + return (
30 + grunt.template.process(
31 + LICENSE_TEMPLATE,
32 + {data: {package: packageName, version: version}}
33 + ) +
34 + src
35 + );
36 }
37
38 function simpleBannerify(src) {
39 var version = grunt.config.data.pkg.version;
40 var packageName = this.data.packageName || this.data.standalone;
49 - return SIMPLE_TEMPLATE.replace('@PACKAGE@', packageName)
50 - .replace('@VERSION@', version) +
51 - '\n' + src;
41 + return (
42 + grunt.template.process(
43 + SIMPLE_TEMPLATE,
44 + {data: {package: packageName, version: version}}
45 + ) +
46 + src
47 + );
48 }
49
50 // Our basic config which we'll add to to make our other builds
grunt/data/header-template-extended.txt new
+11
@@ -0,0 +1,11 @@
1 +/**
2 + * <%= package %> v<%= version %>
3 + *
4 + * Copyright 2013-2015, Facebook, Inc.
5 + * All rights reserved.
6 + *
7 + * This source code is licensed under the BSD-style license found in the
8 + * LICENSE file in the root directory of this source tree. An additional grant
9 + * of patent rights can be found in the PATENTS file in the same directory.
10 + *
11 + */
grunt/data/header-template-short.txt new
+3
@@ -0,0 +1,3 @@
1 + /**
2 + * <%= package %> v<%= version %>
3 + */