adidas / htmplar

Templar is a React to HTML converter. It is created for developer friendly e-mail template development. By leveraging the component structure with React, it composes a reusable and maintainable pipeline for the projects.
MIT License
51 stars 10 forks source link

Error when try to execute htmplar dev #40

Open cr0hn opened 1 year ago

cr0hn commented 1 year ago

Node/npm version(s):

> npm -v
9.8.0

Package(s) version(s):

> cat package.json

{
  "name": "xxxx",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "htmplar-server": "htmplar serve",
    "htmplar-dev": "htmplar dev",
    "dev": "next dev  ",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "prepare": "husky install"
  },
  "dependencies": {
    "@fingerprintjs/fingerprintjs": "^3.4.2",
    "@headlessui/react": "^1.7.15",
    "@heroicons/react": "^2.0.18",
    "autoprefixer": "10.4.14",
    "htmplar": "^0.3.3",
    "moment": "^2.29.4",
    "next": "13.4.9",
    "next-translate": "^2.4.4",
    "postcss": "8.4.24",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "tailwindcss": "3.3.2",
    "typescript": "5.1.3"
  },
  "devDependencies": {
    "@tailwindcss/forms": "^0.5.3",
    "@types/node": "20.3.1",
    "@types/react": "18.2.12",
    "@types/react-dom": "18.2.5",
    "@typescript-eslint/eslint-plugin": "^6.1.0",
    "@typescript-eslint/parser": "^6.1.0",
    "eslint": "^8.43.0",
    "eslint-config-next": "13.4.5",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "husky": "^8.0.0",
    "next-translate-plugin": "^2.4.4",
    "prettier": "^2.8.8"
  }
}

Description of the issue observed:

When I try to execute the command htmplar-dev or htmplar dev it raises this error:

> yarn run htmplar-dev
yarn run v1.22.19
$ htmplar dev
node_modules/htmplar/src/utils/walker.js:11
  if (exclude.length <= 0 || !exclude.includes(dirPath)) {
              ^

TypeError: Cannot read properties of undefined (reading 'length')
    at walkSync (node_modules/htmplar/src/utils/walker.js:11:15)
    at Object.<anonymous> (node_modules/htmplar/src/server/page.js:70:1)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._compile (node_modules/pirates/lib/index.js:117:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Object.newLoader [as .js] (node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (node_modules/htmplar/src/server/index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._compile (node_modules/pirates/lib/index.js:117:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Object.newLoader [as .js] (node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (node_modules/htmplar/src/cli/index.js:8:13)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.5.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Some example to reproduce the issue:

AmeyDagaria007 commented 1 year ago

Hi @cr0hn I have raised a PR for this can you please review https://github.com/adidas/htmplar/pull/41.

Issue :- Exlude array was not defined in base template

cr0hn commented 1 year ago

Thank! I'll review it and tell you