2

bowercopy是新项目的弃用工具

下面的任务(从这里bowercopy)是使用工具作为依赖项的 grunt 任务:

var JS_VENDOR_PATH = 'public/js/vendor',
    CSS_VENDOR_PATH = 'public/css/vendor';

module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-bowercopy');
  grunt.loadNpmTasks('grunt-contrib-clean');

  grunt.initConfig({
    clean: {
      'vendor-js': JS_VENDOR_PATH,
      'vendor-css': CSS_VENDOR_PATH
    },

    bowercopy: {
        options: {
        },
        js: {
          options: {
            destPrefix: JS_VENDOR_PATH
          },
          files: {
            'todomvc-common.js' : 'todomvc-common/base.js',
            'jquery.js' : 'jquery/jquery.js',
            'underscore.js' : 'underscore/underscore.js',
            'backbone.js' : 'backbone/backbone.js'
          }
        },
        css: {
          options: {
            destPrefix: CSS_VENDOR_PATH
          },
          files: {
            'todomvc-common.css':'todomvc-common/base.css'
          }
        }
      }
  });

  grunt.registerTask('default', ['clean','bowercopy']);

};

我们遇到了弃用问题,如下所示:

$ npm install
npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated coffee-script@1.3.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
audited 197 packages in 2.475s
found 29 vulnerabilities (6 low, 6 moderate, 17 high)
  run `npm audit fix` to fix them, or `npm audit` for details

npm 版本是 6.11

如何在这个 grunt 任务中删除bower和依赖?bowercopy并使用 webpack 而不是 grunt...

{
  "name": "xxx",
  "version": "1.0.0",
  "scripts": {
    "prepublish": "grunt",
    "build": "grunt",
    "start": "open index.html || sensible-browser index.html || xdg-open index.html"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/xxxx"
  },
  "bugs": {
    "url": "https://github.com/xxxx/issues"
  },
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-bowercopy": "^1.2.4",
    "grunt-contrib-clean": "^0.6.0"
  },
  "dependencies": {
    "express": "^4.13.3"
  }
}
4

0 回答 0