Browse Source

Add build script

brantje 2 years ago
parent
commit
cf35ea5b24
No account linked to committer's email address
3 changed files with 56 additions and 3 deletions
  1. 2
    1
      .gitignore
  2. 53
    2
      Gruntfile.js
  3. 1
    0
      package.json

+ 2
- 1
.gitignore View File

@@ -1,4 +1,5 @@
1 1
 .idea
2 2
 .DS_Storecss/*.map
3 3
 node_modules
4
-dist
4
+dist
5
+extension.zip

+ 53
- 2
Gruntfile.js View File

@@ -29,16 +29,67 @@ module.exports = function (grunt) {
29 29
                     "oc_requesttoken": true
30 30
                 }
31 31
             },
32
-            all: ['js/*','!js/vendor']
32
+            all: ['js/*', '!js/vendor']
33
+        },
34
+        mkdir: {
35
+            dist: {
36
+                options: {
37
+                    mode: 0700,
38
+                    create: ['dist']
39
+                }
40
+            }
41
+        },
42
+        copy: {
43
+            dist: {
44
+                src: [
45
+                    '**',
46
+                    '!style/*/**/*',
47
+                    '!style/*',
48
+                    '!style',
49
+                    '!node_modules/*',
50
+                    '!node_modules/**',
51
+                    '!dist/**',
52
+                    '!dist/*',
53
+                    '!.drone.yml',
54
+                    '!.gitignore',
55
+                    '!.jshintrc',
56
+                    '!.scrutinizer.yml',
57
+                    '!.travis.yml',
58
+                    '!Gruntfile.js',
59
+                    '!karma.conf.js',
60
+                    '!launch_phpunit.sh',
61
+                    '!Makefile',
62
+                    '!package.json',
63
+                    '!phpunit.*',
64
+                    '!Dockerfile',
65
+                    '!*.md',
66
+                    '!*.zip',
67
+                    '!swagger.yaml'
68
+                ],
69
+                dest: 'dist/'
70
+            }
71
+        },
72
+        compress: {
73
+            dist: {
74
+                options: {
75
+                    archive: 'extension.zip'
76
+                },
77
+                files: [
78
+                    {src: ['**'], dest: '.', cwd: 'dist/'}, // includes files in path
79
+                ]
80
+            }
33 81
         }
34
-
35 82
     });
36 83
 
84
+    grunt.loadNpmTasks('grunt-mkdir');
85
+    grunt.loadNpmTasks('grunt-contrib-compress');
86
+    grunt.loadNpmTasks('grunt-contrib-copy');
37 87
     grunt.loadNpmTasks('grunt-contrib-jshint');
38 88
 
39 89
 
40 90
     // Default task(s).
41 91
 
42 92
     grunt.registerTask('hint', ['jshint']);
93
+    grunt.registerTask('dist', ['jshint', 'mkdir:dist', 'copy:dist', 'compress:dist']);
43 94
 
44 95
 };

+ 1
- 0
package.json View File

@@ -10,6 +10,7 @@
10 10
     "jshint-stylish": "^2.2.1"
11 11
   },
12 12
   "devDependencies": {
13
+    "grunt-contrib-compress": "^1.4.1",
13 14
     "grunt-contrib-copy": "^1.0.0",
14 15
     "grunt-mkdir": "^1.0.0"
15 16
   },