Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Elad Ben-Israel
    @eladb
    Hello!
    Simon
    @stowns
    hi all, I just began using jsii to try and build a cdk lib. I'm having an issue when trying to add a non @aws-cdk dependency. I'm able to add additional aws deps like @aws-cdk/aws-codepipeline but if I add js-yaml lodash etc project-info.js throws an Error: Error: Unable to locate module:
    Error: Error: Unable to locate module: lodash
        at _tryResolveAssembly (/Users/townsimo/dev/cdk-ml-pipeline/ml-ops-lib/node_modules/jsii/lib/project-info.js:201:15)
        at _loadDependencies (/Users/townsimo/dev/cdk-ml-pipeline/ml-ops-lib/node_modules/jsii/lib/project-info.js:126:21)
    i can confirm that the module is listed in both dependencies and peerDependencies as well as installed to the node_modules dir
    any idea why it may be unable to locate it?
    cdk 1.21.1 with "jsii": "^0.21.1" and node v10.16.3
    Elad Ben-Israel
    @eladb
    You will need to bundle it by specifying “bundledDependnecies” in your package.json
    @RomainMuller is this documented somewhere?
    Romain Marcadier-Muller
    @RomainMuller
    I think it is but let me double check that
    Simon
    @stowns
    ah yes that is here https://github.com/aws/jsii/blob/fc366d0a461473e1e6caeb85117098c708d191da/docs/configuration.md under 'Dependencies that are not jsii modules'
    Simon
    @stowns
    are there any jsii-pacmak rules against re-exporting an interface from the main index.ts class? I have a cfg.ts where i define various interfaces and i'd like it to be available for import from my library ie import { SomeCfg } from 'my-lib' but I'm getting a pacmak error on npm run package
    Error: Cannot find type 'aws-ml-ops.MLOpsCfg' either as internal or external type at PythonGenerator.findType (.../aws-ml-ops/node_modules/jsii-pacmak/lib/generator.js:391:19)
    my index.ts has
    import { MLOpsCfg } from './cfg';
    export { MLOpsCfg } from './cfg';
    Simon
    @stowns
    i refactored and pulled all of the .cfg interfaces into index.ts and exported them directly and it seems to be happy w/ that
    Matthew Bonig
    @mbonig
    I'm trying to create a JSII construct that has an interface like this:
    export interface CicdSpaWebsiteProps extends StackProps {
        /**
         * a limited schema version of GitHubSourceActionProps
         */
        readonly githubSource: {
            /**
             * The GitHub account/user that owns the repo.
             */
            "owner": string;
            /**
             * The name of the repo, without the username.
             */
            "repo": string;
            /**
             * The branch to use.
             *
             * @default "master"
             */
            "branch"?: string;
            /**
             * A GitHub OAuth token to use for authentication.
             *
             * It is recommended to use a Secrets Manager `Secret` to obtain the token:
             *
             *   const oauth = cdk.SecretValue.secretsManager('my-github-token');
             *   new GitHubSource(this, 'GitHubAction', { oauthToken: oauth, ... });
             */
            "oauthToken": SecretValue;
        }
    
    }
    however, when I jsii build the package I get this error:
    error TS9999: JSII: Only string index maps are supported
    Is there a simple change I can make to support this shape of my interface or would I need to flatten those fields?
    Elad Ben-Israel
    @eladb
    You’ll have to define the inner type as a separate interface
    Matthew Bonig
    @mbonig
    @eladb :thumbsup:
    Daniel Schroeder
    @udondan
    i could use a pointer how to add js assets to my jsii package. i have a lambda/index.ts which i would like to include in the package. the built packages though do not include the lambda directory. i looked at the cdk packages and found examples there, e.g. https://github.com/aws/aws-cdk/tree/c7197c0048474f69e253b752e289abad6e72554f/packages/%40aws-cdk/aws-s3-deployment - this seems to only work because the lambda function is written in python. how can i add a ts/js based lambda to my package?
    7 replies
    i guess i could add a build step and zip the content up and then use the zip as my lambda source instead of the directory
    Mitch McKenzie
    @mitchmckenzie
    Has anyone used TypeScript decorators with aws constructs and successfully generated the consumer libs for all of the supported languages?
    Will
    @LMJW
    Hi Guys. Is there anyway that I can use jsii to compile code with "ts-polyfill": "3.8.2" dependency? I was trying to use ES2019 Array in my code and it doesn't compile.
    ChrisC413
    @ChrisC413
    Hello, I am having some trouble importing the python module generated by the example on the jsii git homepage. I am using a virtual env and ran python setup.py install. I'm using pycharm and can see the package acme.hello-jsii in the interpreter but cannot get my import statement to resolve. I do see the .egg file in .virtualenvs/myenv/lib/python3.6/site-packages . What exactly should my import statement be?
    2 replies
    Maksim Terekhin
    @Neurostep

    Hi All, I am currently experimenting with jsii. My basic idea is to provide interop for Golang and NodeJs in order to call functions form Readability JS library (https://github.com/mozilla/readability) via Golang. To do that, I wrapped Readability JS into tiny Typescript file. Currently, when I run npx jsii I got compilation errors

    node_modules/@mozilla/readability/index.d.ts:6:13 - error TS2304: Cannot find name 'Document'.
    
    6   document: Document,

    The same goes for jsdom library. I am fairly new to modern Javascript/Typescript setup I might be doing something wrong regarding this. Or maybe my idea is even impossible to cover with jsii. Could someone help me understand that? Thanks a lot 🙏

    Cybergoof
    @cybergoof
    HI, I am just starting to use projen and jsii, and I found an artifact that is breaking our flow. The jsii-release overwrites the ~/.npmrc file, but that file has other registries in there that we need. is there a way to get projen publish (calling jsii-release-npm) to not overwrite that file?
    Abhishek Choudhary
    @innoavator
    Hi, I am trying to generate python code using jsii-srcmak - however its throwing an error when I import external libraries like aws-sdk. Packaging using jsii-pacmak is working fine.
    Kyle T
    @KyleTryon

    Noticing it doesnt look like there are many responses around here.. but going to shoot my question out there with some hope anyway.

    I am trying to convert an existing TS lib to JSII. The lib is an SDK for a YAML schema model. There was a base abstract class component which is now a behavioral interface IComponent.

    All "components" will have a generate() function which will return an object with some schema specific to that object. The issue is JSII will not allow me to override this function in extending classes.

    export interface IComponent {
      generate(): unknown
    }
    
    export interface ICommand extends IComponent {
      name: string;
      generate(): {
        someValue: string
      }
    }
    
    export class MyCommand implements ICommand {
      name = "MyCommand"
      generate() {
        return {someValue: "test"}
      }
    }
    
    const ComponentArray: IComponent[] = []

    This will result in:

    Interface "jsii-testing.ICommand" re-declares member "generate". This is not supported as it results in invalid C#.

    What is the proper way to approach this?

    Kyle T
    @KyleTryon
    Coming back to report I found out abstract classes are in fact supported
    Kyle T
    @KyleTryon
    However, overriding types to be more specific I have not yet found how to implement