Skip to content

fix: Fail use widget-cli to init the custom widget repo #717

@zsnmwy

Description

@zsnmwy

Describe the bug

I use the custom widget in the latest version.

REPOSITORY                                               TAG                            IMAGE ID       CREATED         SIZE
apitable/room-server                                     latest                         1b0cb20ea0e5   15 hours ago    1.87GB
apitable/web-server                                      latest                         9aa497b68739   15 hours ago    580MB
apitable/backend-server                                  latest                         debe95640055   15 hours ago    514MB
apitable/init-db                                         latest                         0a5a205116ee   15 hours ago    367MB
apitable/openresty                                       latest                         714020cb0247   15 hours ago    136MB

image

Follow the tutorial to exec the after the command.

widget-cli init -t uskxdRs9sLN8NnlKaa3vEZS -s spcQMsGUFHSav -h http://192.168.31.221 -c todo-mvc -p wpkzv5Gu5a5xk -u /assets/widget/wpkP54M0LMh9U/0.0.14/3aa2ab17704d4b64bcfdcdc9eb91b486.zip

Then got some error.

$ widget-cli init -t uskxdRs9sLN8NnlKaa3vEZS -s spcQMsGUFHSav -h http://192.168.31.221 -c todo-mvc -p wpkzv5Gu5a5xk -u /assets/widget/wpkP54M0LMh9U/0.0.14/3aa2ab17704d4b64bcfdcdc9eb91b486.zip
Response Error:
{
  config: {
    url: '/assets/widget/wpkP54M0LMh9U/0.0.14/3aa2ab17704d4b64bcfdcdc9eb91b486.zip',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'X-Internal-Request': 'yes',
      'User-Agent': 'axios/0.21.4'
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    adapter: [Function: httpAdapter],
    responseType: 'arraybuffer',
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    data: undefined
  },
  responseData: undefined
}
fetching template from /assets/widget/wpkP54M0LMh9U/0.0.14/3aa2ab17704d4b64bcfdcdc9eb91b486.zip... !
    Error: connect ECONNREFUSED ::1:80
    Code: ECONNREFUSED

I try to direct to access the URL.
http://192.168.31.221/assets/widget/wpkP54M0LMh9U/0.0.14/3aa2ab17704d4b64bcfdcdc9eb91b486.zip
It can get the template repo.


When I try to start up the widget in dev mode, it got some ts error.

$ widget-cli start -p 9002                                                                             
[tsl] ERROR
      TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["./"]' and 'exclude' paths were '["node_modules"]'.
Module build failed (from ../node_modules/ts-loader/index.js):
Error: error while parsing tsconfig.json
    at Object.loader (/Users/zsnmwy/.nvm/versions/node/v16.17.0/lib/node_modules/@apitable/widget-cli/node_modules/ts-loader/dist/index.js:17:18)
{
  "compilerOptions": {
    "target": "ES5",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "declaration": true,
    "declarationMap": true,
    "forceConsistentCasingInFileNames": true,
    "strictNullChecks": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "module": "ES6",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "jsx": "react",
    "outDir": "dist",
    "baseUrl": "src",
    "lib": ["dom", "dom.iterable", "esnext"],
    "plugins": [
      { "transform": "@zerollup/ts-transform-paths" }, // 修复绝对路径引用,在 build 成 js 后,没有转化成相对路径。
      {
        "transform": "typescript-plugin-styled-components",
        "type": "config"
      }
    ]
  },
  "include": ["./"],
  "exclude": ["node_modules"]
}

I try to fix it.
Make "include": ["./"] to "include": ["./src/index.ts"],.
It works.


Got some error when I try to release it.
Similar #716

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions