1.1.4 • Published 2 years ago

@haiyaotec/craft-client v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

craft-client ✨

craft_client Very simple to help you generate docker image

(Finally free of Gradle ^_^)

Installation 🌝

Install craft-client with npm

  npm install @imf/craft-client -D

Usage 🍉

Step 1

Configure it in package.json

In web project Config Reference 🤖

web

ParameterTypeDescriptionvalue
buildTypestringRequired build typeweb
webstringRequiredobject
distDirstringOptions your web project build directorydefalut:dist
buildCommandstringRequired your web project build commanddefalut:npm run build

package.json

  "craft": {
    "buildType": "web",
    "web": {
        "distDir": "dist",
        "buildCommand": "npm run build"
    }
}

In node project Config Reference 🤖

node

ParameterTypeDescriptionvalue
buildTypestringRequired build typenode
nodestringRequiredobject
bootCommandstringOptions your node project executable commanddefalut:node dist/Main.js
buildCommandstringOptions your node project build commanddefalut:do not execute

package.json

  "craft": {
    "buildType": "node",
    "node": {
      "bootCommand": "node app.js",
      "buildCommand": "npm run build"
    }
}

In framework project Config Reference 🤖

framework

ParameterTypeDescriptionvalue
buildTypestringRequired build typeframework
frameworkstringRequiredobject
staticPathstringOptions the static resource pathdefalut:client
webstringRequiredobject
webdirstringRequired the web project directoryapp
webbuildDirstringRequired the web project build directoryNamedist
webbuildCommandstringOptions the web project build commanddefault: npm run build
serverstringRequiredobject
serverdirstringRequired the web server directoryserver
serverbootCommandstringOptions the web server boot commanddefalut:node dist/Main.js
serverbuildCommandstringOptions the web server build commanddefalut: do not execute

package.json

  "craft": {
    "buildType": "framework",
    "framework": {
        "web":{
          "dir":"app",
          "buildDir":"dist",
          "buildCommand":"npm run build"
        }, 
        "server": {
            "dir" :"server",
            "bootCommand": "node dist/Main.js",
            "buildCommand": "npm run build"
        },
        "staticPath": "client"
    }
}

Step 2

Then just run the commands in the script

like npm run craft-docker or npm run craft-h

  • craft-docker (generate dockerImage)
  • craft-h (show help message)

Example 🐞

package.json

"scripts": {
  "craft-h": "craft -h",
  "craft-docker": "craft --docker"
},
"craft": {
  "buildType": "framework",
    "framework": {
    "staticPath": "client",
    "web":{
        "dir":"app",
        "buildDir":"dist",
        "buildCommand":"npm run build"
    },
    "server": {
        "dir" :"server",
        "bootCommand": "node dist/Main.js",
        "buildCommand": "npm run build"
    }
  }
}

shell

npm run craft-docker

tips:if you are in haiyaotec work flow you should config gaia.yml

gaia.yml

name: kalista-web
build:
  beta:
    - npm install
    - npm install --prefix kalista-browser/kalista-frontend-app
    - npm install --prefix kalista-server
    - npm run craft-docker
  prod:
      - npm install
      - npm install --prefix kalista-browser/kalista-frontend-app
      - npm install --prefix kalista-server
      - npm run craft-docker
release: mars

Authors 👨‍💻

1.1.4

2 years ago

1.1.3

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

3 years ago