by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Marc Höffl
    @KeKs0r

    Hi, I am new to gitter and just recently started using nx. I have migrated my app to it over the last 2 days (500+ files). Now I am trying to reproduce my previous dev environemnt.

    I was able to run my app locally in dev as well as in prod. prod is not only a production build, but when local it also connects into the production environment to debug with production data. This is achieved with a dedicated .env file. How do i tell the node builder to run the serve command with a specific envFile? I saw that workspace run-command does have this option, but noth sure how to provide it with the node builder.

    Derek
    @derekkite
    @KeKs0r in the angular.json configuration file, in the specific app configuration section there is a filereplace setting.
    Marc Höffl
    @KeKs0r
    @derekkite I saw the filereplace setting, but does it work with .env files?
    Marc Höffl
    @KeKs0r
    As well as the @nrwl/node:execute does not seem to take that argument. I can only pass a different buildTarget which I need to do to get the production build. But I dont want the production build, but rather just a dev build with different environment variables
    Marc Höffl
    @KeKs0r
    --> I ended up doing it via a different script : env-cmd -f .production.env nx serve graph-api
    Raziel
    @rraziel
    Never understood the point of using those, I just have a config.json and a single build with empty environment.ts files
    Till
    @ruohki
    is it possible that the @nrwl/react package does not support decorators (setting the flags in the tsconfig dont help)
    Marc Höffl
    @KeKs0r

    Does anyone have a good way of just executing a script file within a lib?
    lets say I have a ts file within a lib:

    import * as _ from "lodash";
    
    run();
    function run() {
      _.map(['a'], (a) => console.log(a))
    }

    I am trying to execute it via ts-node

            "example": {
              "builder": "@nrwl/workspace:run-commands",
              "options": {
                "command": "yarn ts-node libs/admin/src/scripts/test-script.ts -s"
              }
            }

    But I am getting the following error:

    import * as _ from "lodash";
    ^^^^^^
    
    SyntaxError: Cannot use import statement outside a module
    Marc Höffl
    @KeKs0r

    Maybe I should rephrase:

    how do you folks run arbitrary scripts in your projects?

    Manuel Bojato
    @KingDarBoja
    I have the same question
    But now the second question still waiting for some insight, I read this cooment at https://github.com/nrwl/nx/issues/1089#issuecomment-484036298 but not sure how to use it and where should I put it
    I remember I asked something like that before Marc
    Luis Vargas
    @luisvt
    Hello creating a new project with Angular 10 get next error:
     create-nx-workspace 9.5.1
    ? Workspace name (e.g., org name)     simple-chat
    ? What to create in the new workspace angular-nest      [a workspace with a full stack application (Angular + Nest)]
    ? Application name                    client
    ? Default stylesheet format           SASS(.scss)  [ http://sass-lang.com   ]
    ? Use the free tier of the distributed cache provided by Nx Cloud? No  [Only use local computation cache]
    Creating a sandbox with Nx...
    new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=@nrwl/workspace
    CREATE simple-chat/nx.json (513 bytes)
    CREATE simple-chat/tsconfig.json (509 bytes)
    CREATE simple-chat/README.md (3407 bytes)
    CREATE simple-chat/.editorconfig (245 bytes)
    CREATE simple-chat/.gitignore (503 bytes)
    CREATE simple-chat/.prettierignore (74 bytes)
    CREATE simple-chat/.prettierrc (26 bytes)
    CREATE simple-chat/angular.json (96 bytes)
    CREATE simple-chat/package.json (1268 bytes)
    CREATE simple-chat/decorate-angular-cli.js (3093 bytes)
    CREATE simple-chat/tools/tsconfig.tools.json (218 bytes)
    CREATE simple-chat/tools/schematics/.gitkeep (0 bytes)
    CREATE simple-chat/apps/.gitkeep (0 bytes)
    CREATE simple-chat/libs/.gitkeep (0 bytes)
    ✔ Packages installed successfully.
    /bin/sh: 1: ./node_modules/.bin/ng: not found
    Workspace creation failed, see above.
    (node:6568) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-6568uTgi4X6nEAny/node_modules/.bin/ng" new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=/tmp/tmp-6568uTgi4X6nEAny/node_modules/@nrwl/workspace/collection.json
        at checkExecSyncError (child_process.js:616:11)
        at Object.execSync (child_process.js:652:15)
        at createApp (/home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:366:21)
        at /home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:85:25
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:6568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:6568) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    what am I doing wrong?
    Robin Van den Broeck
    @robinvdb_gitlab
    Does anybody know how to inject global scss in a Storybook (using angular 9)
    Si
    @Tatamethues
    hello, the proxy of react project doesn't work. anyone know why?
    Eran Sakal
    @esakal

    Hello
    I'm using @nrwl/web:build to build react application. I'm not sure what was the change that I did but when building to production I'm stuck on

    Starting type checking service...
    Using 2 workers with 2048MB memory limit

    Since the log is emitted only after the build ends I don't know what is causing it to hang.

    1. building without production flag works
    2. adding --verbose flag is not propagated to the actual nx build
    3. trying --memoryLimit=4096 doesn't fix it

    Please help

    Eran Sakal
    @esakal

    Setting sourceMap: false and extractCss:false fixed it but obviously i need source maps. regarding extract css, maybe it will work regardless to its value but it doesn't bother me disabling it.

    how can I debug and fix source map issue?

    Mohi 🦀
    @mohijalili_twitter
    I got this error when i want to migrate from workspace@8.8.2 to latest.
    Invalid Version: 5.2
    ~/node_modules/@nrwl/workspace/node_modules/yargs/yargs.js:1109
          else throw err
               ^
    
    Error: Command failed: ./node_modules/.bin/tao migrate @nrwl/workspace
    merry75
    @merry75
    hello
    is it possible to lazy load a react lib application to an angular application ?
    if yes could you point me to example or different ways to achieve it ?
    Christopher Dieringer
    @cdaringe
    hey friends :wave: i have a buildable library for web. it's entirely custom, built with some shell scripts :facepalm:. when my next.js builder executes (the nrwl arch), i want my built artifacts from dist/ to be resolved, as it's buildable! however, i'm not seeing configuration options to say "hey, next builder--use built stuff vs lib/<my-lib>/src".
    Christopher Dieringer
    @cdaringe
    ...or rather, what i need to do to hint to next that my custom lib is infact buildable. (i thought just having a build step was that)
    Jonas Zunker
    @JonasZ95
    Is there a way to disable the Circular dependency warning for a single typescript library(I use swagger-codegen which unfortunately generates code with circular dependencies)?
    Mark
    @bhalash
    Quick one about odd test failures. I've recently migrated an existing monorepo (seven libs, two apps) to Nx and Angular 9. I'm able to build, serve and lint all projects, as well as execute tests against libraries. However, tests against some app tests fail:
    ● NoteItemComponent › HTML › should have <core-item> element
    
        Failed: "Zone is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/zone.js"
    
          11 |   let fixture: ComponentFixture<NoteItemComponent>;
          12 |
        > 13 |   beforeEach(async(() => {
             |   ^
          14 |     TestBed.configureTestingModule({
          15 |       imports: [
          16 |         AppTestModule,
    
          at Env.beforeEach (../../node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:41:24)
          at Suite.<anonymous> (src/spec/components/note-item.component.spec.ts:13:3)
          at Object.<anonymous> (src/spec/components/note-item.component.spec.ts:9:1)

    I've done Google due diligence on this:

    • Yes, I'm including zone.js. I've followed Jest test setup per a comparative project.
    • All libs and apps have the same top-level configurations for tests.
    • I've flushed out node modules and jest cache repeatedly.

    I'm stumped about where to investigate next for a possible solution.

    Mark
    @bhalash
    To answer my own question, adding setupFilesAfterEnv: ['./src/test-setup.ts']` to jest.config.ts per this fixed it: https://github.com/nrwl/nx/pull/1467#issuecomment-567448220
    cuznerdexter
    @cuznerdexter
    Hi has anyone got Angular9+ in an NX workspace working with Storybook using Scss / Sass ?
    Are there any working guides? It is not working for me so I am probably doing something wrong.
    (new to Storybook & NX)
    The app works fine - the Sass is used with no problems, but is ignored in Storybook.
    I have followed many examples but the styles are not getting applied.
    I have a Lib with a Storybook config, works fine when running the App, but Scss style is ignored when running Lib in Storybook.
    jrisse29041408
    @jrisse29041408
    Does anyone know where to put a typeorm ormconfig.json file so that the createconnection function can find it?
    Luis Vargas
    @luisvt
    in the app root
    jrisse29041408
    @jrisse29041408
    I have it there but I am still getting No connection options were found in any orm config file
    Luis Vargas
    @luisvt
    can I see your code?
    or an example repo?
    jrisse29041408
    @jrisse29041408
    1 reply
    Ming-der Wang
    @mingderwang
    any can help? I'm new in nx, why I always get "SyntaxError: Unexpected token ..." "options: { ...options }," in my nx environment in any nx command? BTW, this error only happen in Visual Studio code plugin "Nx Console", not in command line. why? (Nx Console version v12.0.0)
    Ming-der Wang
    @mingderwang
    I think the problem is I'm normally using zsh, but the nx console force to use bash.
    Aniket
    @Aniket-Engg
    can we somehow define directory for these static assets? https://nx.dev/angular/plugins/node/builders/package#assets
    Raziel
    @rraziel
    It can be an object with more info (glob, input, output, etc)
    I mean, each element in the array can be an object
    Aniket
    @Aniket-Engg
    is there an example of that somewhere?
    Aniket
    @Aniket-Engg
    Thank you so much @rraziel
    Raziel
    @rraziel
    np
    Raziel
    @rraziel
    Hm maybe someone had that issue as well: I have a lib's code in modules/libname/src/\*, both .ts and .spec.ts, and another lib's code in modules/libname/otherlibname/src/\*
    When I run nx test libname, it picks the .spec.ts from otherlibname (since it's */.spec.ts, mostly)
    I tried setting testMatch to ./src/**/*.spec.ts or <rootDir>/modules/libname/etc... but then they don't find any files
    Oh also, I should probably open a ticket on Github, but the caching doesn't take into account changes made to jest.config.js files inherited via preset (so if I change the repo/jest.config.js it just tells me "it's ok bro we got it cached" because it doesn't see a change in repo/modules/libname/jest.config.js)
    Raziel
    @rraziel
    I get it to work with testMatch: ['**/modules/libname/src/**/*.spec.ts'] though, so maybe I'll have to just live with that one
    Also another potential bug, doing nx test xx --no-cache runs with --cache=false but it still shows me the cached output