diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4b7ce34 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x, 18.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + # YARN + - name: Yarn install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Yarn build + uses: borales/actions-yarn@v4 + with: + cmd: build + + # - name: Build + # run: | + # npm install + # npm run build diff --git a/README.md b/README.md index d2880f7..5b8348e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![build workflow](https://github.com/eckode/cli/actions/workflows/build.yml/badge.svg) + # Eckode / CLI > ⚠️ This package is intended to work in tandem with [`@eckode/webpack`](https://www.npmjs.com/package/@eckode/webpack) diff --git a/package.json b/package.json index a860abe..5fe6f49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eckode/cli", - "version": "0.0.3", + "version": "0.0.4", "description": "CLI tool, written in TypeScript, for running @eckode scoped packages.", "keywords": [ "eckode", @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/eckode/cli", "scripts": { - "tsc": "tsc", + "build": "yarn clean && tsc", "clean": "ts-node-esm ./src/clean.mts", "pkg": "tsc && ts-node-esm ./src/package.mts" }, @@ -28,7 +28,7 @@ "eckode": "./bin/eckode.mjs" }, "engines": { - "node": ">=18.11.0", + "node": ">=16", "npm": ">=8" }, "files": [ @@ -43,6 +43,7 @@ "access": "public" }, "devDependencies": { + "@types/express": "^4.17.14", "@types/node": "^18.11.9", "@types/resolve-bin": "^0.4.1", "@types/rimraf": "^3.0.2", @@ -61,5 +62,6 @@ "ts-node": "^10.9.1", "typescript": "~4.9.0" }, - "main": "./src/index.ts" + "main": "./src/index.ts", + "dependencies": {} } diff --git a/src/index.mts b/src/index.mts index cd60e97..1fca5b8 100644 --- a/src/index.mts +++ b/src/index.mts @@ -1,8 +1,7 @@ import { resolve } from 'path'; import { exit } from 'process'; -import chalk from 'chalk'; -import { spawnNodeProcess } from './utils.mjs'; +import { spawnNodeProcess, logger } from './utils.mjs'; import nodeLocalVars from './node-env-vars.mjs'; import { EckodeNpmScripts } from './types.js'; @@ -22,9 +21,7 @@ process.env.ECKO_PROJECT_PATH = process.cwd(); process.env.ECKO_COMMAND = lifecycleEvent as EckodeNpmScripts; if (!eckodeNpmCommands.includes(process.env.ECKO_COMMAND)) { - console.log( - chalk.black.bgWhiteBright(`< ECKODE-CLI; /> ⛔ ${chalk.bold(process.env.ECKO_COMMAND)} command not found!`), - ); + logger(`command not found!`, 'error', process.env.ECKO_COMMAND), exit(1); } diff --git a/yarn.lock b/yarn.lock index 9b8cb31..3dfb3e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -687,6 +687,40 @@ dependencies: "@babel/types" "^7.3.0" +"@types/body-parser@*": + version "1.19.2" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" + integrity sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.35" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" + integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ== + dependencies: + "@types/node" "*" + +"@types/express-serve-static-core@^4.17.18": + version "4.17.31" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz#a1139efeab4e7323834bb0226e62ac019f474b2f" + integrity sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + +"@types/express@^4.17.14": + version "4.17.14" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.14.tgz#143ea0557249bc1b3b54f15db4c81c3d4eb3569c" + integrity sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.18" + "@types/qs" "*" + "@types/serve-static" "*" + "@types/glob@*": version "8.0.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" @@ -731,6 +765,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/mime@*": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" + integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== + "@types/minimatch@*": version "5.1.2" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" @@ -746,6 +785,16 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== +"@types/qs@*": + version "6.9.7" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" + integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== + +"@types/range-parser@*": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" + integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== + "@types/resolve-bin@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@types/resolve-bin/-/resolve-bin-0.4.1.tgz#e5f2c2de1de8b77f2222a9e28e56ecc37028116c" @@ -764,6 +813,14 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== +"@types/serve-static@*": + version "1.15.0" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.0.tgz#c7930ff61afb334e121a9da780aac0d9b8f34155" + integrity sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg== + dependencies: + "@types/mime" "*" + "@types/node" "*" + "@types/stack-utils@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"