Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions .github/workflows/build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/pull-request-lint.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/upgrade-main.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const project = new cdk.JsiiProject({
defaultReleaseBranch: "main",
name: "@functionless/projen",
description: "Projen templates for Functionless projects",
author: "brendan@functionless.org",
author: "sam@functionless.org",
repository: "https://github.com/functionless/projen.git",

releaseToNpm: true,
Expand Down
35 changes: 35 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 47 additions & 15 deletions src/component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from "projen";
import { Component, JsonFile } from "projen";
import {
TypescriptConfig,
TypeScriptCompilerOptions,
Expand Down Expand Up @@ -81,36 +81,72 @@ export interface TypeScriptPlugin {
*/
export class Functionless extends Component {
static readonly coreDependency = "functionless";
static readonly astReflectionDependency = "@functionless/ast-reflection";
static readonly languageServiceDependency = "@functionless/language-service";
static readonly dependencies = [
Functionless.coreDependency,
"@aws-cdk/aws-appsync-alpha",
"typesafe-dynamodb",
];
static readonly devDependencies = [
"ts-patch",
"@swc/cli",
"@swc/core@1.2.218",
"@swc/register",
"@swc/jest",
Functionless.astReflectionDependency,
Functionless.languageServiceDependency,
];

readonly swcrc: JsonFile;

constructor(readonly tsProject: TypeScriptProject) {
super(tsProject);

this.swcrc = new JsonFile(tsProject, ".swcrc", {
marker: false,
obj: {
jsc: {
parser: {
syntax: "typescript",
dynamicImport: false,
decorators: false,
hidden: {
jest: true,
},
},
transform: null,
target: "es2021",
loose: false,
externalHelpers: false,
experimental: {
plugins: [["@functionless/ast-reflection", {}]],
},
},
minify: false,
sourceMaps: "inline",
module: {
type: "commonjs",
},
},
});

if (this.tsProject.jest) {
this.tsProject.jest.config.transform = {
"^.+\\.(t|j)sx?$": ["@swc/jest", {}],
};
delete this.tsProject.jest.config.globals;
delete this.tsProject.jest.config.preset;
}

this.tsProject.addDevDeps(...Functionless.devDependencies);
this.tsProject.addDeps(...Functionless.dependencies);

const transformerPlugin = {
transform: `${Functionless.coreDependency}/lib/compile`,
};

const languageServicePlugin = {
name: Functionless.languageServiceDependency,
};

configureTsConfig(this.tsProject.tsconfig, [
transformerPlugin,
languageServicePlugin,
]);
configureTsConfig(this.tsProject.tsconfigDev, [transformerPlugin]);
configureTsConfig(this.tsProject.tsconfig, [languageServicePlugin]);
configureTsConfig(this.tsProject.tsconfigDev, []);

function configureTsConfig(
config:
Expand All @@ -130,9 +166,5 @@ export class Functionless extends Component {
: [...plugins];
}
}

this.tsProject.addTask("prepare", {
exec: "ts-patch install -s",
});
}
}
Loading