Skip to content

Commit

Permalink
fix: allow disabling of compile scripts for TypescriptSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
justinm committed May 6, 2022
1 parent 21ac655 commit 6a85e67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
19 changes: 13 additions & 6 deletions packages/@pdkit/core/nodejs/tools/TypescriptSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export interface TypescriptSupportProps {
* Compiler options to use.
*/
readonly compilerOptions?: TypeScriptCompilerOptions;

/**
* Specifies if the project should disable compile/clean scripts.
*/
readonly disableCompileScripts?: boolean;
}

/**
Expand Down Expand Up @@ -406,12 +411,14 @@ export class TypescriptSupport extends XConstruct {
new PackageDependency(this, "ts-node", { type: PackageDependencyType.DEV });
new PackageDependency(this, "@types/node", { type: PackageDependencyType.DEV });

new ManifestEntry(this, "Scripts", {
scripts: {
compile: "tsc -p ./tsconfig.json",
clean: 'find . -name "*.js" -not -path "./node_modules/*" -delete && find . -name "*.d.ts" -not -path "./node_modules/*" -delete',
},
});
if (!props?.disableCompileScripts) {
new ManifestEntry(this, "Scripts", {
scripts: {
compile: "tsc -p ./tsconfig.json",
clean: 'find . -name "*.js" -not -path "./node_modules/*" -delete && find . -name "*.d.ts" -not -path "./node_modules/*" -delete',
},
});
}

new ManifestEntry(this, "Files", {
files: [path.join(project.distPath, "*.d.ts"), path.join(project.distPath, "**/*.d.ts")],
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@pdkit/cli@workspace:packages/@pdkit/cli"
dependencies:
"@pdkit/core": 2.3.0
"@pdkit/core": 2.4.0
"@types/diff": 5.0.2
"@types/glob": 7.2.0
"@types/jest": 27.4.1
Expand Down Expand Up @@ -981,13 +981,13 @@ __metadata:
typescript: 4.6.3
yargs: 17.4.1
peerDependencies:
"@pdkit/core": 2.3.0
"@pdkit/core": 2.4.0
bin:
pdkit: index.ts
languageName: unknown
linkType: soft

"@pdkit/core@2.3.0, @pdkit/core@workspace:packages/@pdkit/core":
"@pdkit/core@2.4.0, @pdkit/core@workspace:packages/@pdkit/core":
version: 0.0.0-use.local
resolution: "@pdkit/core@workspace:packages/@pdkit/core"
dependencies:
Expand Down

0 comments on commit 6a85e67

Please sign in to comment.