How do I add a custom script to my package.json file that runs a javascript file?

前端 未结 6 872
生来不讨喜
生来不讨喜 2020-11-29 17:01

I want to be able to execute the command script1 in a project directory that will run node script1.js.

script1.js is a file in

6条回答
  •  再見小時候
    2020-11-29 17:19

    Example:

      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build --prod",
        "build_c": "ng build --prod && del \"../../server/front-end/*.*\" /s /q & xcopy /s dist \"../../server/front-end\"",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
    

    As you can see, the script "build_c" is building the angular application, then deletes all old files from a directory, then finally copies the result build files.

提交回复
热议问题