为构建文件创建路径

时间:2019-08-14 03:57:33

标签: node.js npm cmd package.json

我有以下package.json脚本

  "scripts": {
    "start": "node ./build/app/main.js",
    "build": "tsc",
    "test": "./node_modules/.bin/env-cmd -f ./config/test.env jest --watch --runInBand",
    "postinstall": "npm run build",
    "hbs": "handlebars -m ./public/templates/views -f ./public/templates/view.js -k customhelpers.js --extension hbs  && handlebars -m ./public/templates/partials -f ./public/templates/partials.js -k customhelpers.js --extension hbs",
    "local": "./node_modules/.bin/env-cmd -f ./config/dev.env tsnd --respawn app/main.ts --experimental-modules"
  },

当我在heroku上部署时,它可以正确构建,但是我还需要构建在使用run hbs时构建的模板

我尝试了以下

"build": "tsc && handlebars -m ./public/templates/views -f ./build/public/templates/view.js -k customhelpers.js --extension hbs  && handlebars -m ./public/templates/partials -f ./build/public/templates/partials.js -k customhelpers.js --extension hbs",

问题是路径./build/public/templates/不存在。我想找到一条注释来创建路径(如果该路径不存在),然后执行命令以运行构建模板化的路径。

我可以将它们构建在根文件夹./build中,但是我想将它们放置在公共文件夹中。

如果该文件夹不存在,如何创建。

0 个答案:

没有答案