deploy.js 933 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. module.exports = function (grunt) {
  6. 'use strict';
  7. var exec = require('child_process').execSync,
  8. spawn = require('child_process').spawn,
  9. log = grunt.log.write,
  10. ok = grunt.log.ok,
  11. error = grunt.log.error;
  12. grunt.registerTask('deploy', function () {
  13. var deploy,
  14. done = this.async();
  15. log('Cleaning "pub/static"...');
  16. exec('rm -rf pub/static/*');
  17. ok('"pub/static" is empty.');
  18. log('Deploying Magento application...');
  19. deploy = spawn('php', ['bin/magento', 'setup:static-content:deploy', '-f']);
  20. deploy.stdout.on('data', function (data) {
  21. log(data);
  22. });
  23. deploy.stdin.on('data', function (data) {
  24. error(data);
  25. });
  26. deploy.on('close', done);
  27. });
  28. };