SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.26k stars 667 forks source link

Please compile sources then publish to npm #171

Closed Arteha closed 5 years ago

Arteha commented 5 years ago

Część! :smiley: Your admin-panel is so fantastic! But developing admin-bro-typeorm adapter I found one fatal mistake:

...
node_modules/admin-bro/src/frontend/components/app/index.ts(1,41): error TS6142: Module './action-button' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/action-button.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(2,41): error TS6142: Module './action-header' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/action-header.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(3,48): error TS6142: Module './base-action-component' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/base-action-component.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(4,40): error TS6142: Module './breadcrumbs' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/breadcrumbs.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(5,45): error TS6142: Module './default-dashboard' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/default-dashboard.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(6,42): error TS6142: Module './error-boundary' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/error-boundary.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(7,35): error TS6142: Module './filter' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/filter.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(8,37): error TS6142: Module './logged-in' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/logged-in.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(9,38): error TS6142: Module './no-records' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/no-records.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(10,35): error TS6142: Module './notice' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/notice.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(11,43): error TS6142: Module './property-header' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/property-header.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(12,41): error TS6142: Module './record-in-list' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/record-in-list.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(13,47): error TS6142: Module './records-table-header' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/records-table-header.tsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(14,41): error TS6142: Module './records-table' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/records-table.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(15,35): error TS6142: Module './topbar' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/topbar.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/components/app/index.ts(16,36): error TS6142: Module './version' was resolved to 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/admin-bro/src/frontend/components/app/version.jsx', but '--jsx' is not set.
node_modules/admin-bro/src/frontend/styles/variables.ts(54,16): error TS2665: Invalid module name in augmentation. Module 'styled-components' resolves to an untyped module at 'F:/Development/MyLibs/admin-bro-typeorm/node_modules/styled-components/dist/styled-components.cjs.js', which cannot be augmented.
node_modules/admin-bro/src/frontend/utils/api-client.ts(7,15): error TS2304: Cannot find name 'window'.
node_modules/admin-bro/src/frontend/utils/api-client.ts(15,21): error TS2304: Cannot find name 'window'.
node_modules/admin-bro/src/frontend/utils/api-client.ts(20,5): error TS2304: Cannot find name 'alert'.
node_modules/admin-bro/src/frontend/utils/api-client.ts(21,5): error TS2304: Cannot find name 'window'.
node_modules/admin-bro/src/frontend/utils/api-client.ts(47,21): error TS2304: Cannot find name 'window'.

8:19:03 PM - Found 66 errors. Watching for file changes.

You had published sources ./src to npm but not compilation result like ./lib with *.d.ts files.

  1. Try to edit tsconfig.json with

    • "noEmit": false
    • "declaration": true
    • "declarationDir": "./lib"
    • "outDir": "./lib"
  2. Then rename index.d.ts to index.ts and move it to ./src

  3. Of course you need to change package.json with:

    • "main": "./lib/index.js"
    • "types": "./lib/index.d.ts"

I think you understand what I mean.

You can also check, as example, how nestjs or typeorm published their build.

I really happy your moving to strict typization :rocket: But unfortunately for now your typings are impossible to be used.

P.S. If you want to feel full power of typescript then try "strictNullChecks": true :smile: it really helps.

wojtek-krysiak commented 5 years ago

Hej, there are transcompiled ./lib files (we use babel first and then Travis sends them up to npm). The problem you mentioned is caused by this index.d.ts where we reference all components.

Now I am working on making this 100% typescript (maybe without automated tests for now), then I will add strict flags.

And thanks for admin-bro-typeorm :)

wojtek-krysiak commented 5 years ago

I've fixed that in version 1.4.0

danetrata-bvsecurity commented 5 years ago

How do we do the transpiling to get the source files?

I thought it would be something like npm run build , but that's not working for me.

wojtek-krysiak commented 5 years ago

npm run build transpiles the files on the backend, and npm run bundle bundles them on the frontend.