CDK Serverless ClamScan 项目教程
cdk-serverless-clamscan项目地址:https://gitcode.com/gh_mirrors/cd/cdk-serverless-clamscan
1. 项目的目录结构及介绍
cdk-serverless-clamscan/
├── README.md
├── bin/
│ └── cdk-serverless-clamscan.ts
├── lib/
│ └── cdk-serverless-clamscan-stack.ts
├── test/
│ └── cdk-serverless-clamscan.test.ts
├── cdk.json
├── package.json
└── tsconfig.json
- README.md: 项目说明文档。
- bin/: 包含项目的入口文件
cdk-serverless-clamscan.ts
。 - lib/: 包含项目的主要逻辑文件
cdk-serverless-clamscan-stack.ts
。 - test/: 包含项目的测试文件
cdk-serverless-clamscan.test.ts
。 - cdk.json: CDK 配置文件。
- package.json: 项目依赖和脚本配置文件。
- tsconfig.json: TypeScript 配置文件。
2. 项目的启动文件介绍
项目的启动文件位于 bin/cdk-serverless-clamscan.ts
。该文件主要负责初始化和部署 CDK 应用。
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { CdkServerlessClamscanStack } from '../lib/cdk-serverless-clamscan-stack';
const app = new cdk.App();
new CdkServerlessClamscanStack(app, 'CdkServerlessClamscanStack', {});
3. 项目的配置文件介绍
- cdk.json: 该文件包含了 CDK 应用的配置信息,例如上下文变量、构建命令等。
{
"app": "npx ts-node --prefer-ts-exts bin/cdk-serverless-clamscan.ts",
"context": {
"@aws-cdk/core:enableStackNameDuplicates": "true",
"aws-cdk:enableDiffNoFail": "true",
"@aws-cdk/core:stackRelativeExports": "true"
}
}
- package.json: 该文件定义了项目的依赖、脚本和其他元数据。
{
"name": "cdk-serverless-clamscan",
"version": "0.1.0",
"bin": {
"cdk-serverless-clamscan": "bin/cdk-serverless-clamscan.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"@aws-cdk/assert": "latest",
"aws-cdk": "latest",
"jest": "^26.4.2",
"ts-node": "^9.0.0",
"typescript": "~3.9.7"
},
"dependencies": {
"@aws-cdk/core": "latest",
"@aws-cdk/aws-s3": "latest",
"@aws-cdk/aws-lambda": "latest",
"@aws-cdk/aws-iam": "latest",
"@aws-cdk/aws-logs": "latest",
"@aws-cdk/aws-s3-notifications": "latest"
}
}
- tsconfig.json: 该文件包含了 TypeScript 编译器的配置选项。
{
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",
"lib": ["es2018"],
"outDir": "dist",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"*": ["node_modules/*"]
}
},
"include": ["bin", "lib", "test"]
}
cdk-serverless-clamscan项目地址:https://gitcode.com/gh_mirrors/cd/cdk-serverless-clamscan