constructor()

in projenrc/projects/pdk-project.ts [46:144]


  constructor(parent: Project) {
    const jsiiProjects: JsiiProject[] | undefined =
      PdkProject.getJsiiProjects(parent);

    const paths = jsiiProjects?.reduce(
      (p, c) => ({
        ...p,
        ...{
          [c.name]: [`./${PdkProject.getProjectName(c)}`],
        },
      }),
      {}
    );

    super({
      parent,
      author: "AWS APJ COPE",
      authorAddress: "apj-cope@amazon.com",
      defaultReleaseBranch: "mainline",
      name: "pdk",
      eslint: false,
      jest: false,
      docgen: false,
      sampleCode: false,
      releaseToNpm: true,
      keywords: ["aws", "pdk", "jsii", "projen"],
      repositoryUrl: "https://github.com/aws/aws-pdk",
      stability: Stability.STABLE,
      excludeTypescript: ["**/samples/**/*.ts", "**/scripts/**/*.ts"],
      libdir: ".",
      srcdir: ".",
      rootdir: ".",
      tsconfigDev: {
        compilerOptions: {
          paths,
          outDir: ".",
        },
      },
      publishConfig: {
        executableFiles: ["./_scripts/pdk.sh", "./_scripts/exec-command.js"],
      },
    });
    this.manifest.main = "index.js";
    this.manifest.jsii.tsc.paths = paths;
    this.manifest.jsii.tsc.rootDir = ".";

    this.addBundledDeps("findup");
    [
      "scripts",
      "assets",
      "samples",
      "index.*",
      ...(jsiiProjects || []).map((p) => PdkProject.getProjectName(p)),
    ].forEach((s) => this.addGitIgnore(s));

    // Rewrite imports to use tsconfig paths
    this.compileTask.exec(
      NodePackageUtils.command.downloadExec(
        NodePackageManager.PNPM,
        "tsc-alias",
        "-p",
        "tsconfig.dev.json",
        "--dir",
        "."
      )
    );
    this.generateSource(jsiiProjects);

    jsiiProjects?.forEach((p) =>
      NxProject.ensure(this).addImplicitDependency(p)
    );

    this.package.addField("bin", () =>
      jsiiProjects
        ?.map((p) =>
          Object.fromEntries(
            Object.entries(p.manifest.bin() || {}).map(([k, v]) => [
              k,
              `./${v}`,
            ])
          )
        )
        .reduce((p, c) => ({ ...p, ...c }), { pdk: "./_scripts/pdk.sh" })
    );

    // Make sure this is after NxProject so targets can be updated after inference
    new PDKRelease(this, {
      executableFiles: [
        ...this.manifest.publishConfig.executableFiles,
        ...(jsiiProjects
          ?.map((p) =>
            (p.manifest.publishConfig?.executableFiles || []).map(
              (_p: string) => `./${_p}`
            )
          )
          .flatMap((x) => x) || []),
      ],
    });
  }