Skip to content

Commit

Permalink
Merge pull request #2719 from demergent-labs/experimental_decorators
Browse files Browse the repository at this point in the history
Add experimental decorator to new http servers tsconfig
  • Loading branch information
lastmjs authored Feb 18, 2025
2 parents cf06679 + 04d73ce commit 431c767
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async function handleNewCommand(): Promise<void> {
projectName
);

await runNewCommand(azleVersion, templatePath);
await runNewCommand(azleVersion, templatePath, httpServer === true);
}
}

Expand Down
20 changes: 16 additions & 4 deletions src/build/stable/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { AZLE_PACKAGE_PATH } from '../utils/global_paths';

export async function runCommand(
azleVersion: string,
templatePath: string
templatePath: string,
useExperimentalDecorators?: boolean
): Promise<void> {
if (process.argv[3] === undefined) {
throw new Error(`You must provide a name for your Azle project`);
Expand Down Expand Up @@ -37,9 +38,20 @@ export async function runCommand(
JSON.stringify(parsedPackageJson, null, 4)
);

await copy(
join(AZLE_PACKAGE_PATH, 'tsconfig.dev.json'),
join(projectName, 'tsconfig.json')
let tsConfig = JSON.parse(
await readFile(join(AZLE_PACKAGE_PATH, 'tsconfig.dev.json'), {
encoding: 'utf-8'
})
);

if (useExperimentalDecorators === true) {
tsConfig.compilerOptions.experimentalDecorators =
useExperimentalDecorators;
}

await outputFile(
join(projectName, 'tsconfig.json'),
JSON.stringify(tsConfig, null, 4)
);

console.info(`${projectName} created successfully`);
Expand Down

0 comments on commit 431c767

Please sign in to comment.