Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Construct Hub に自作ライブラリを公開しよう with projen / Publ...
Search
hayao_k
June 01, 2022
Technology
2
870
Construct Hub に自作ライブラリを公開しよう with projen / Publish your library to Construct Hub with projen
JAWS-UG CDK支部 #1 〜初回拡大版〜 の LT 資料です
hayao_k
June 01, 2022
Tweet
Share
More Decks by hayao_k
See All by hayao_k
SageMaker Lakehouse の紹介 / Introduction to SageMaker Lakehouse
hayaok3
0
400
ナレッジベースはどのようにSQLを生成するのか / Knowledge Bases supports structed data retrieval
hayaok3
2
470
クラウドネイティブなデータ連携の最新動向 / Latest trends in cloud-native data integration
hayaok3
1
940
RAG Approach on AWS
hayaok3
4
1.9k
Amazon VPC Lattice を使い始める前におさえておきたいポイント n 選 / Introduction to VPC Lattice
hayaok3
6
3.5k
アウトプットを伴走するエンジニア育成のこれまでとこれから / Training engineers through the input and output learning cycle
hayaok3
0
270
AWS Verified Access で VPN-less な世界を体験してみた / The world of VPN-less with AWS Verified Access
hayaok3
0
1.1k
AWS Trusted Advisor Priority とはどんな機能か / What is AWS Trusted Advisor Priority?
hayaok3
0
730
SWAG 大好きマンな皆さまにおくる立ち回り方 / re:Invent 2022 Standby
hayaok3
0
2.1k
Other Decks in Technology
See All in Technology
AI駆動開発に向けた新しいエンジニアマインドセット
kazue
0
300
Function Body Macros で、SwiftUI の View に Accessibility Identifier を自動付与する/Function Body Macros: Autogenerate accessibility identifiers for SwiftUI Views
miichan
2
170
生成AI時代のデータ基盤
shibuiwilliam
6
3.8k
生成AI時代のデータ基盤設計〜ペースレイヤリングで実現する高速開発と持続性〜 / Levtech Meetup_Session_2
sansan_randd
1
140
Skrub: machine-learning with dataframes
gaelvaroquaux
0
120
2025年夏 コーディングエージェントを統べる者
nwiizo
0
120
共有と分離 - Compose Multiplatform "本番導入" の設計指針
error96num
1
220
実践!カスタムインストラクション&スラッシュコマンド
puku0x
0
270
Firestore → Spanner 移行 を成功させた段階的移行プロセス
athug
1
360
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.5k
自作JSエンジンに推しプロポーザルを実装したい!
sajikix
1
160
20250910_障害注入から効率的復旧へ_カオスエンジニアリング_生成AIで考えるAWS障害対応.pdf
sh_fk2
3
170
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Documentation Writing (for coders)
carmenintech
74
5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
520
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Visualization
eitanlees
148
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Transcript
Construct Hub に 自作ライブラリを公開しよう with projen JAWS-UG CDK 支部 #1
〜初回拡大版〜 June 1st, 2022 小杉 隼人 | Hayato Kosugi
About Me • Cloud Engineer @ セゾン情報システムズ • AWS Community
Builder (Fall of 2020) • 2019 - 2022 APN AWS Top Engineers • 11x AWS Certified • CDK は個人利用がメイン 2 @hayaok3 @hayao_k
Agenda • Construct Hub って何 • projen はいいぞ 3
What is Construct Hub? • コミュニティや AWS、AWS パートナーが公開する Construct Library
を 検出・共有するためのレジストリ • 昨年 12 月 AWS CDK v2 と同日に GA • 現在 1000 以上の Construct Library が掲載 • https://constructs.dev/ 4
Construct Hub に掲載される条件 • JSII-compatible であること • 多言語対応のため • オープンソースライセンスであること
• Apache, BSD, EPL, MPL-2.0, ISC, and CDDL or MIT • CDK Keyword を使用して npm Registry に公開されていること • cdk, awscdk, aws-cdk, cdk8s, or cdktf • これらを満たすと 約 30 分で自動で掲載 5
6
難しそう? projen を使った開発がおすすめ 7
CDK で TypeScript をやっているときの私 • プロジェクト構成の管理は近年複雑化している • TypeScript プロジェクトの場合 •
package.json, tsconfig.json, .gitignore, eslint, jest, etc •ぜんぜんわからない、俺 たち は雰囲気で TypeScript をやっている… 8
What is Projen? • A new generation of project generators
• Construct の考え方をプロジェクト構成に適用 • プロジェクト構成をコードで定義し、維持するためのツール • package.json, tsconfig.json 等、通常は自分で管理する必要のある 構成ファイルを自動で管理 • プロジェクトの雛形を作るだけではなく、継続管理する • https://github.com/projen/projen 9
• node - Node.js project. • project - Base project.
• python - Python project. • react - React project without TypeScript. • react-ts - React project with TypeScript. • typescript - TypeScript project. • typescript-app - TypeScript app. Built-in Project types • awscdk-app-java - AWS CDK app in Java. • awscdk-app-py - AWS CDK app in Python. • awscdk-app-ts - AWS CDK app in TypeScript. • awscdk-construct - AWS CDK construct library project. • cdk8s-app-ts - CDK8s app in TypeScript. • cdk8s-construct - CDK8s construct library project. • cdktf-construct - CDKTF construct library project. • java - Java project. • jsii - Multi-language jsii library project. • nextjs - Next.js project without TypeScript. • nextjs-ts - Next.js project with TypeScript. 10 $ mkdir awesome-project $ cd awesome-project $ git init $ npx projen new PROJECT-TYPE 🤖 Synthesizing project...
Construct Library プロジェクトの作成 • projen new awscdk-construct • 開発に必要なファイルが生成される •
package.json, jsii によるビルドスクリプト, GitHub Actions Workflow など • .projenrc.js に必要な設定を定義 • サポートする CDK の最小バージョン • 他のライブラリとの依存関係 • 各パッケージマネージャーでのライブラリ名など 12
.projenrc.js の例 13 • projen コマンドで変更を反映 • projen が管理するファイルの多くは手動で 編集しない
(できない) • 編集した場合はビルドが Fail する • e.g., publishToPypi • package.json の jsii 設定に python が 追加 • GitHub Actions の release.yml に PyPI へ publish する Step が追加 指定可能なオプションは多岐にわたるため、API リファレンスを参照 https://projen.io/api/API.html#projen-awscdk-awscdkconstructlibrary const { awscdk } = require('projen'); const cdkVersion = '2.25.0'; const project = new awscdk.AwsCdkConstructLibrary({ author: 'hayao-k', authorAddress: '
[email protected]
', cdkVersion, defaultReleaseBranch: 'main', name: 'cdk-sample-lib', repositoryUrl: 'https://github.com/hayao-k/cdk-sample-lib.git', description: 'Sample AWS CDK Construct Library by projen', keywords: ['sample'], license: 'Apache-2.0', deps: [ `@aws-cdk/aws-apigatewayv2-alpha@${cdkVersion}-alpha.0`, `@aws-cdk/aws-apigatewayv2-integrations-alpha@${cdkVersion}-alpha.0`, 'other-useful-lib' ], publishToPypi: { distName: 'cdk-sample-lib', module: 'cdk_sample_lib', }, }); project.synth();
Release も簡単自動化 • Build workflow (.github/workflows/build.yml) • pull request 作成時に起動
• ライブラリのビルド、改ざんチェック • Release workflow (.github/workflows/release.yml) • リリースブランチへの push 時に起動 • ライブラリのビルド、改ざんチェック • Conventional Commits による Semantic Versioning • GitHub Releases, 各言語のレジストリへの公開 (要 Secrets 登録) 14
Step by Step の手順はこちら • projen ではじめる快適 AWS CDK Construct
Library 開発生活 • https://qiita.com/hayao_k/items/194dfb051f18 a38b6dbd • A Beginner's Guide to Create AWS CDK Construct Library with projen • https://dev.to/aws-builders/a-beginner-s- guide-to-create-aws-cdk-construct-library- with-projen-5eh4 • Construct Hub の Contribute ページでも 紹介いただいてます 15
Summary • Construct Hub • コミュニティや AWS、AWS パートナーが公開する Construct Library
を 検出・共有するためのレジストリ • 時間の関係で紹介できなかったが便利なライブラリがたくさん • 自作ライブラリも公開できる • projen • プロジェクト構成の管理や CI が劇的に楽になる • Developer Experience に感動 • 特別な考慮不要で自作ライブラリを Construct Hub に掲載できる 16
AWESOME Book & Posts & Slide • The CDK Book
• https://thecdkbook.com/ • CDKの成り立ちとその可能性について (The CDK Bookより) • https://qiita.com/oktomoya/items/3cf66205b8c932d252ef • CDK Construct ライブラリを開発する際のTips • https://tmokmss.hatenablog.com/entry/20220517/1652755027 • AWSアカウントの共通設定をCDK ConstructHubで公開しました • https://docs.google.com/presentation/d/1X2r7LUuijiWISgL-P2SPyVFz6l2EqZ1DFzbaAjb9SKo • 【レポート+やってみた】projen – a CDK for software project configuration #CDK Day • https://dev.classmethod.jp/articles/cdk-day-projen-try/ 17
Happy Constructing! 18