1
+ /**
2
+ * NOTE: Alpaca uses Gulp for it's build process. Please take a look at the README.md file for instructions.
3
+ *
4
+ * This Grunt file provides official Alpaca version release and deployment assistance to the deploy.sh bash file.
5
+ * It isn't needed for local Alpaca builds and should only be used by the Alpaca release manager.
6
+ */
7
+ module . exports = function ( grunt ) {
8
+
9
+ var fs = require ( "fs" ) ;
10
+ var path = require ( "path" ) ;
11
+
12
+ grunt . loadNpmTasks ( 'grunt-jsdoc' ) ;
13
+ grunt . loadNpmTasks ( 'grunt-aws-s3' ) ;
14
+ grunt . loadNpmTasks ( 'grunt-invalidate-cloudfront' ) ;
15
+
16
+ // register one or more task lists (you should ALWAYS have a "default" task list)
17
+ grunt . registerTask ( 'publish_cdn' , [ 'aws_s3:clean' , 'aws_s3:publish' , 'invalidate_cloudfront:production' ] ) ;
18
+
19
+ var pkg = grunt . file . readJSON ( 'package.json' ) ;
20
+ var awsConfig = grunt . file . readJSON ( "../settings/__aws.json" ) ;
21
+
22
+ var name = "alpaca" ;
23
+
24
+ // config
25
+ grunt . initConfig ( {
26
+
27
+ "jsdoc" : {
28
+ "dist" : {
29
+ "src" : [
30
+ "src/js/**/*.js" ,
31
+ "README.md"
32
+ ] ,
33
+ "options" : {
34
+ "destination" : "./build/alpaca/jsdoc" ,
35
+ "template" : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template" ,
36
+ "configure" : "jsdoc.conf.json"
37
+ }
38
+ }
39
+ } ,
40
+
41
+ "aws_s3" : {
42
+ "options" : {
43
+ "accessKeyId" : awsConfig . key ,
44
+ "secretAccessKey" : awsConfig . secret ,
45
+ "region" : awsConfig . region ,
46
+ "uploadConcurrency" : 5 ,
47
+ "downloadConcurrency" : 5
48
+ } ,
49
+ "clean" : {
50
+ "options" : {
51
+ "bucket" : awsConfig . bucket
52
+ } ,
53
+ "files" : [ {
54
+ "dest" : path . join ( name , pkg . version ) ,
55
+ "action" : "delete"
56
+ } ]
57
+ } ,
58
+ "publish" : {
59
+ "options" : {
60
+ "bucket" : awsConfig . bucket
61
+ } ,
62
+ "files" : [ {
63
+ "expand" : true ,
64
+ "cwd" : "dist/" + name ,
65
+ "src" : [ '**/*' ] ,
66
+ "dest" : path . join ( name , pkg . version )
67
+ } ]
68
+ }
69
+ } ,
70
+
71
+ "invalidate_cloudfront" : {
72
+ "options" : {
73
+ "key" : awsConfig . key ,
74
+ "secret" : awsConfig . secret ,
75
+ "distribution" : awsConfig . cloudfrontDistributionIds [ name ]
76
+ } ,
77
+ "production" : {
78
+ "files" : [ {
79
+ "expand" : true ,
80
+ "cwd" : "dist/" + name ,
81
+ "src" : [ "**/*" ] ,
82
+ "filter" : "isFile" ,
83
+ "dest" : path . join ( name , pkg . version )
84
+ } ]
85
+ }
86
+ }
87
+
88
+ } ) ;
89
+ } ;
0 commit comments