Giter Site home page Giter Site logo

Comments (10)

mrgrain avatar mrgrain commented on May 27, 2024 1

Yes, apologies. Here's what's happening:

  1. Your code is adding a LICENSE file
  2. Your code attempts to remove an existing license with project.tryRemoveFile("LICENSE");, but it's executed first, so this has no effect.
  3. PDK is then attempting to add a LICENSE file as part of preSynthesize. This is kind of bad, because if it is doing it there it should check if a license already exists. It kind of does that, but only on a component level, not a file level. PDK checks for instanceof projen.License but you have just added a textfile.
  4. 💥

To fix this, you need to tell PDK to not add licenses:

const monorepo = new MonorepoTsProject({
 // other options
  licenseOptions: {
    disableDefaultLicenses: true,
  },
});

This is not really a bug in projen, but the error could be much better.
You should consider re-opening this issue in the PDK repo: https://github.com/aws/aws-pdk (cc @agdimech)

from projen.

mrgrain avatar mrgrain commented on May 27, 2024

Thanks for reporting. We'll need your project type and config.

from projen.

mrgrain avatar mrgrain commented on May 27, 2024

You can probably fix this by removing your LICENSE file manually.

from projen.

raurir avatar raurir commented on May 27, 2024

You can probably fix this by removing your LICENSE file manually.

Hi, that was my first attempt... no luck. I have tried quite a few more tricks to narrow down the scope of the problem... no luck.

Re: project type (easy enough) and config, do you want the whole projenrc.ts?

from projen.

mrgrain avatar mrgrain commented on May 27, 2024

As much as you can share. I'll just need to reproduce the issue somehow.

from projen.

raurir avatar raurir commented on May 27, 2024

As much as you can share. I'll just need to reproduce the issue somehow.

This is a recently adopted project on my half, so not entirely sure for the reasoning behind this approach we are using, but I have narrowed it down to some custom license generation code:

export const licenseFile = (project: Project) => {
  project.tryRemoveFile("LICENSE");
  new TextFile(project, "LICENSE", { lines: getLongLicense() }); // line 3
};

Since we are running a monorepo with multiple projects, the license files were wanted to be added in many places. (ie licenseFile is called in multiple spots like licenseFile(api), licenseFile(website) etc. Disabling line 3 above fixes the projen synth, but then apache licenses show up everywhere in the repository :)

Created a repo which demonstrates the above. Thanks in advance!

from projen.

mrgrain avatar mrgrain commented on May 27, 2024

Thanks for the reproduction! I'll have a look.

so not entirely sure for the reasoning behind this approach we are using

My best guess is that you are using a custom/customized license (as in a license text that is not supported by projen).

from projen.

raurir avatar raurir commented on May 27, 2024

My best guess is that you are using a custom/customized license (as in a license text that is not supported by projen).

It is simply plain text, I am unsure how it could be unsupported. Anyhow thanks for looking, keen to hear your feedback. :)

from projen.

raurir avatar raurir commented on May 27, 2024

Thanks for the reproduction! I'll have a look.

Hi, were you able to reproduce this issue? Thanks in advance.

from projen.

raurir avatar raurir commented on May 27, 2024

Unfortunately we are stuck in an upgrade loop, and we need the latest version of pdk to fix this (licenseOptions does not exist...)

Referencing that upgrade issue here: aws/aws-pdk#784

from projen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.