Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incorrect Angular Package Format (APF) in @cubejs-client/ngx v1.1.2 #9140

Open
HaidarZ opened this issue Jan 26, 2025 · 0 comments
Open

Comments

@HaidarZ
Copy link
Contributor

HaidarZ commented Jan 26, 2025

Describe the bug

The @cubejs-client/ngx package's package.json contains an outdated Angular Package Format (APF) configuration referencing non-existent files or targets. This issue arises after upgrading @cubejs-client/ngx from v1.0.0 to v1.1.2.

The problem appears to be caused by a security-related dependency upgrade where Cube.js maintainers updated all Angular devDependencies from version 12 to version 13. This upgrade changed the output format/structure of the library, rendering it incompatible with the existing APF configuration in the package.json file.

To Reproduce
Steps to reproduce the behavior:

  1. Create an empty angular project
  2. Install cubejs core and cubejs angular client as documented pinning to versions for v1.0.0
  3. Add CubeJS module to the main module just to include cubejs in the output build
  4. Notice the project will be built normally
  5. Upgrade to the cube dependencies to the latest v1.1.2
  6. Notice that the build will fail mentioning that the library cube is pointing to files not included in the export
 Error: Module not found: Error: Can't resolve '@cubejs-client/ngx'
An unhandled exception occurred: Failed to resolve entry for package "@cubejs-client/ngx". The package may have incorrect main/module/exports specified in its package.json.

package.json

{
  "name": "@cubejs-client/ngx",
  "version": "1.0.0",
  "author": "Cube Dev, Inc.",
  "engines": {},
  "repository": {
    "type": "git",
    "url": "https://github.com/cube-js/cube.git",
    "directory": "packages/cubejs-client-ngx"
  },
  "description": "Cube.js client for Angular",
  "main": "dist/bundles/cubejs-client-ngx.umd.js",
  "files": [
    "dist"
  ],
  "license": "MIT",
  "watch": {
    "dev:publish": "dist/*"
  },
  "scripts": {
    "build": "./node_modules/ng-packagr/cli/main.js -c tsconfig.json -p  ng-package.json && rm dist/package.json",
    "ng:watch": "./node_modules/ng-packagr/cli/main.js -c tsconfig.json -p  ng-package.json --watch && rm dist/package.json",
    "dev": "yarn build && yalc publish --push"
  },
  "dependencies": {
    "fast-deep-equal": "^3.1.3",
    "tslib": "^2.0.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.1.2",
    "@angular/cli": "^12.1.2",
    "@angular/compiler": "^12.1.2",
    "@angular/compiler-cli": "^12.1.2",
    "@angular/core": "^12.1.2",
    "ng-packagr": "^12.1.2",
    "npm-watch": "^0.7.0",
    "tsickle": "^0.39.1",
    "typescript": "~4.3.5"
  },
  "peerDependencies": {
    "@cubejs-client/core": ">=0.28.1",
    "rxjs": ">=6.6.0"
  },
  "publishConfig": {
    "access": "public"
  },
  "module": "dist/fesm2015/cubejs-client-ngx.js",
  "es2015_ivy_ngcc": "__ivy_ngcc__/dist/fesm2015/cubejs-client-ngx.js",
  "es2015": "dist/fesm2015/cubejs-client-ngx.js",
  "esm5": "dist/esm5/cubejs-client-ngx.js",
  "esm2015": "dist/esm2015/cubejs-client-ngx.js",
  "fesm5": "dist/fesm5/cubejs-client-ngx.js",
  "fesm2015_ivy_ngcc": "__ivy_ngcc__/dist/fesm2015/cubejs-client-ngx.js",
  "fesm2015": "dist/fesm2015/cubejs-client-ngx.js",
  "typings": "dist/cubejs-client-ngx.d.ts",
  "metadata": "dist/cubejs-client-ngx.metadata.json",
  "sideEffects": false,
}

v1.0.0 Library Output: The output files for v1.0.0 include the expected bundles and file structure:

dist
├── LICENSE
├── README.md
├── bundles
│   ├── cubejs-client-ngx.umd.js
│   └── cubejs-client-ngx.umd.js.map
├── cubejs-client-ngx.d.ts
├── esm2015
│   ├── cubejs-client-ngx.js
│   ├── index.js
│   └── src
├── fesm2015
│   ├── cubejs-client-ngx.js
│   └── cubejs-client-ngx.js.map
├── index.d.ts
└── src
    ├── client.d.ts
    ├── module.d.ts
    ├── public_api.d.ts
    └── query-builder

7 directories, 13 files

v1.1.2 Library Output: The output files for v1.1.2 have a different structure:

dist
├── LICENSE
├── README.md
├── cubejs-client-ngx.d.ts
├── esm2020
│   ├── cubejs-client-ngx.mjs
│   ├── index.mjs
│   └── src
├── fesm2015
│   ├── cubejs-client-ngx.mjs
│   └── cubejs-client-ngx.mjs.map
├── fesm2020
│   ├── cubejs-client-ngx.mjs
│   └── cubejs-client-ngx.mjs.map
├── index.d.ts
└── src
    ├── client.d.ts
    ├── module.d.ts
    ├── public_api.d.ts
    └── query-builder

7 directories, 13 files

The conflict between these versions suggests that the package.json APF configuration has not been updated to reflect the new structure introduced in v1.1.2.

Version:
v1.1.2

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant