-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from kikuomax/cicd
Introduce continuous delivery
- Loading branch information
Showing
34 changed files
with
10,503 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# build artifacts | ||
/node_modules | ||
# Node artifacts | ||
node_modules | ||
|
||
# editor artifacts | ||
*.swp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# build artifacts | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[English](./README.md) / 日本語 | ||
|
||
# CDKスタックの共通ライブラリ | ||
|
||
このレポジトリのCDKスタックで共有される型や関数を提供します。 | ||
|
||
## このライブラリの使い方 | ||
|
||
このライブラリはこのレポジトリのCDKスタックからローカルにリンクすることを意図しています。 | ||
今のところ以下のスタックがこのライブラリをリンクしています。 | ||
- [`../cdk`](../cdk/README.ja.md) | ||
- [`../cdk-ops`](../cdk-ops/README.ja.md) | ||
|
||
上記のCDKスタックは`dist`フォルダの中身をインポートします。 | ||
|
||
### このライブラリを更新する | ||
|
||
このライブラリのコードを変更した際は、このフォルダで以下を実行しなければなりません。 | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
`dist`フォルダが更新されます。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
English / [日本語](./README.ja.md) | ||
|
||
# Common library for CDK stacks | ||
|
||
Provides types and functions shared among CDK stacks in this repository. | ||
|
||
## How to use this library | ||
|
||
This library is inteded to be locally linked from CDK stacks in this repository. | ||
The following stacks link this library so far, | ||
- [`../cdk`](../cdk) | ||
- [`../cdk-ops`](../cdk-ops) | ||
|
||
The above CDK stacks import the contents of the `dist` folder. | ||
|
||
### Updating this library | ||
|
||
If you change the code of this library, you have to run the following in this folder, | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
You will find the `dist` folder updated. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "cdk-common", | ||
"version": "0.1.0", | ||
"description": "Common types and functions for CDK projects", | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"files": ["dist/**/*"], | ||
"private": true, | ||
"scripts": { | ||
"build": "tsc", | ||
"prepare": "node scripts/prepare.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Kikuo Emoto ([email protected])", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"constructs": "^10.1.42", | ||
"typescript": "^3.9.10" | ||
}, | ||
"peerDependencies": { | ||
"constructs": ">=10.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// This script will circumvent the situtation where no dependencies have been | ||
// installed before running the `prepare` life cycle script. | ||
// | ||
// ## Background | ||
// | ||
// This subproject is inteded to be linked from other subprojects in the same | ||
// repository using `npm link --save ../cdk-common`. | ||
// This project transpiles TypeScript code, i.e., `npm run build`, during the | ||
// `prepare` life cycle script. | ||
// Unfortunately, `npm link` does not install dependencies of this project | ||
// before running the `prepare` script. | ||
// And the `prepare` script ends up with a "no such package" error. | ||
// | ||
// This error can be avoided by running `npm install` in this project before | ||
// resolving dependencies of other subprojects depending on this project. | ||
// However, this is not very intuitive that I want an automated solution. | ||
// | ||
// ## Workaround | ||
// | ||
// This script invokes `npm install` before running `npm run build` to make sure | ||
// that dependencies are installed. | ||
// But simply invoking `npm install` from the `prepare` script makes an infinite | ||
// loop of `prepare` → `install` → `prepare` → ... | ||
// So this script skips invoking `npm install` if a `node_module` folder already | ||
// exists in this project. | ||
|
||
const childProcess = require('child_process'); | ||
const fs = require('fs'); | ||
const process = require('process'); | ||
const util = require('util'); | ||
|
||
const promiseExec = util.promisify(childProcess.exec); | ||
|
||
const NPM_INSTALL = 'npm install'; | ||
const NPM_BUILD = 'npm run build'; | ||
|
||
console.log('preparing...', process.cwd()); | ||
|
||
fs.stat('./node_modules', (err, stats) => { | ||
if (err != null && err.code !== 'ENOENT') { | ||
console.error('failed to stat', err); | ||
process.exit(1); | ||
} | ||
let installation; | ||
if (stats != null && stats.isDirectory()) { | ||
// skips intallation because there is `node_modules` folder. | ||
installation = Promise.resolve(); | ||
} else { | ||
installation = promiseExec(NPM_INSTALL); | ||
} | ||
installation | ||
.then(() => { | ||
promiseExec(NPM_BUILD) | ||
.then(() => { | ||
process.exit(0); | ||
}) | ||
.catch(err => { | ||
console.error('failed to build', err); | ||
process.exit(1); | ||
}); | ||
}) | ||
.catch(err => { | ||
console.error('failed to install', err); | ||
process.exit(1); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './deployment-stage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2018", | ||
"module": "commonjs", | ||
"lib": [ | ||
"es2018" | ||
], | ||
"declaration": true, | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": false, | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
"experimentalDecorators": true, | ||
"strictPropertyInitialization": false, | ||
"typeRoots": [ | ||
"./node_modules/@types" | ||
], | ||
"outDir": "./dist" | ||
}, | ||
"include": ["src/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.js | ||
!jest.config.js | ||
*.d.ts | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
|
||
# AWS config | ||
/lib/github-connection-config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.ts | ||
!*.d.ts | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
Oops, something went wrong.