Gruntfile.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. const webpackConfig = require("./webpack.config");
  2. module.exports = function (grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON("package.json"),
  6. clean: ["dist"],
  7. bump: {
  8. options: {
  9. files: ["package.json", "bower.json", "composer.json"],
  10. updateConfigs: ["pkg"],
  11. commit: false,
  12. createTag: false,
  13. push: false,
  14. prereleaseName: "beta"
  15. }
  16. },
  17. release: {
  18. options: {
  19. bump: false,
  20. commit: false,
  21. add: false
  22. }
  23. },
  24. nugetpack: {
  25. dist: {
  26. src: (function () {
  27. return "nuspecs/Inputmask.nuspec";
  28. })(),
  29. dest: "build/",
  30. options: {
  31. version: "<%= pkg.version %>"
  32. }
  33. },
  34. dist2: {
  35. src: (function () {
  36. return "nuspecs/jquery.inputmask.nuspec";
  37. })(),
  38. dest: "build/",
  39. options: {
  40. version: "<%= pkg.version %>"
  41. }
  42. }
  43. },
  44. nugetpush: {
  45. dist: {
  46. src: "build/InputMask.<%= pkg.version %>.nupkg",
  47. options: {
  48. source: "https://www.nuget.org"
  49. }
  50. },
  51. dist2: {
  52. src: "build/jquery.inputMask.<%= pkg.version %>.nupkg",
  53. options: {
  54. source: "https://www.nuget.org"
  55. }
  56. }
  57. },
  58. karma: {
  59. options: {
  60. configFile: "karma.conf.js"
  61. },
  62. unit: {
  63. singleRun: true
  64. }
  65. },
  66. eslint: {
  67. target: "lib/*.js"
  68. },
  69. availabletasks: {
  70. tasks: {
  71. options: {
  72. filter: "exclude",
  73. tasks: ["availabletasks", "default"],
  74. showTasks: ["user"]
  75. }
  76. }
  77. },
  78. webpack: {
  79. main: webpackConfig("production")[0],
  80. jquery: webpackConfig("production")[1],
  81. colormask: webpackConfig("production")[2]
  82. },
  83. copy: {
  84. extensions: {
  85. files: [
  86. {
  87. src: "lib/bindings/inputmask.binding.js",
  88. dest: "dist/bindings/inputmask.binding.js"
  89. },
  90. {
  91. src: "lib/bindings/inputmask.es6.js",
  92. dest: "dist/inputmask.es6.js"
  93. },
  94. { src: "lib/extensions/colormask.css", dest: "dist/colormask.css" },
  95. {
  96. src: "Changelog.md",
  97. dest: "inputmask-pages/src/assets/Changelog.md"
  98. }
  99. ]
  100. }
  101. }
  102. });
  103. // Load the plugin that provides the tasks.
  104. require("load-grunt-tasks")(grunt);
  105. grunt.registerTask("publish", ["release", "nugetpack", "nugetpush"]);
  106. grunt.registerTask("publishnext", function () {
  107. grunt.config("release.options.npmtag", "next");
  108. grunt.task.run("release");
  109. });
  110. grunt.registerTask("validate", ["webpack", "copy", "eslint", "karma"]);
  111. grunt.registerTask("build", ["bump:prerelease", "clean", "webpack", "copy"]);
  112. grunt.registerTask("build:patch", ["bump:patch", "clean", "webpack", "copy"]);
  113. grunt.registerTask("build:minor", ["bump:minor", "clean", "webpack", "copy"]);
  114. grunt.registerTask("build:major", ["bump:major", "clean", "webpack", "copy"]);
  115. grunt.registerTask("default", ["availabletasks"]);
  116. };