@akdev1l/constructs 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@akdev1l/constructs",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "CDK Constructs",
5
5
  "private": false,
6
+ "files": [
7
+ "build/dist"
8
+ ],
6
9
  "exports": {
7
10
  ".": {
8
11
  "types": "./build/dist/index.d.ts",
package/eslint.config.ts DELETED
@@ -1,17 +0,0 @@
1
- import js from "@eslint/js";
2
- import globals from "globals";
3
- import tseslint from "typescript-eslint";
4
- import { defineConfig } from "eslint/config";
5
-
6
- export default defineConfig([
7
- {
8
- files: ["{src,test}/**/*.{js,mjs,cjs,ts,mts,cts}"],
9
- plugins: { js },
10
- extends: ["js/recommended"],
11
- languageOptions: { globals: globals.browser }
12
- },
13
- {
14
- ignores: ["build/**/*.{t,j}s"],
15
- },
16
- tseslint.configs.recommended,
17
- ]);
package/jest.config.js DELETED
@@ -1,17 +0,0 @@
1
- import { createDefaultPreset } from "ts-jest";
2
-
3
- const tsJestTransformCfg = createDefaultPreset({
4
- useESM: true,
5
- }).transform;
6
-
7
- export default {
8
- testEnvironment: "node",
9
- extensionsToTreatAsEsm: [".ts"],
10
- roots: ['<rootDir>/src'],
11
- moduleNameMapper: {
12
- '^@akdev1l/constructs$': '<rootDir>/src/index.ts'
13
- },
14
- transform: {
15
- ...tsJestTransformCfg,
16
- },
17
- };
@@ -1,18 +0,0 @@
1
- import { App, Stack } from 'aws-cdk-lib';
2
- import { GithubAccessProvider } from '../access-provider';
3
- import { describe, it, expect } from '@jest/globals';
4
-
5
- describe('Github Access Provider', () => {
6
- const app = new App();
7
- const stack = new Stack(app, 'stack', {});
8
-
9
- it('can build access provider', () => {
10
- const githubProvider = new GithubAccessProvider(stack, 'GithubProvider', {
11
- repo: 'akdev1l/cdk-constructs',
12
- });
13
-
14
- expect(githubProvider).not.toBeNull();
15
- expect(githubProvider.provider).not.toBeNull();
16
- expect(githubProvider.role).not.toBeNull();
17
- });
18
- });
@@ -1,42 +0,0 @@
1
- import {
2
- Duration,
3
- aws_iam as iam,
4
- } from 'aws-cdk-lib';
5
- import { Construct } from 'constructs';
6
-
7
- export interface GithubAccessProviderProps {
8
- repo: string;
9
- }
10
-
11
- export class GithubAccessProvider extends Construct {
12
- private static GITHUB_DOMAIN = 'https://token.actions.githubusercontent.com';
13
-
14
- readonly provider: iam.OpenIdConnectProvider;
15
- readonly role: iam.Role;
16
-
17
- constructor(scope: Construct, id: string, props: GithubAccessProviderProps) {
18
- super(scope, id);
19
-
20
- this.provider = new iam.OpenIdConnectProvider(this, 'GithubActionsProvider', {
21
- url: GithubAccessProvider.GITHUB_DOMAIN,
22
- clientIds: ['sts.amazonaws.com'],
23
- });
24
-
25
- const conditions: iam.Conditions = {
26
- StringLike: {
27
- [`${GithubAccessProvider.GITHUB_DOMAIN}:sub`]: `repo:${props.repo}`,
28
- },
29
- ForAllValuesStringEquals: {
30
- 'token.actions.githubusercontent.com:iss': 'https://token.actions.githubusercontent.com',
31
- 'token.actions.githubusercontent.com:aud': 'sts.amazonaws.com',
32
- },
33
- };
34
-
35
- this.role = new iam.Role(this, 'GithubActionsRole', {
36
- roleName: 'GithubActions',
37
- assumedBy: new iam.WebIdentityPrincipal(this.provider.openIdConnectProviderArn, conditions),
38
- description: `Access for deployment from repo ${props.repo}`,
39
- maxSessionDuration: Duration.hours(2),
40
- });
41
- }
42
- }
@@ -1 +0,0 @@
1
- export * from './access-provider';
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './github';
package/tsconfig.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- // Visit https://aka.ms/tsconfig to read more about this file
3
- "compilerOptions": {
4
- // File Layout
5
- "rootDir": "./src",
6
- "outDir": "./build/dist",
7
-
8
- // Environment Settings
9
- // See also https://aka.ms/tsconfig/module
10
- "module": "esnext",
11
- "target": "esnext",
12
- "types": [],
13
- // For nodejs:
14
- // "lib": ["esnext"],
15
- // "types": ["node"],
16
- // and npm install -D @types/node
17
-
18
- // Other Outputs
19
- "sourceMap": true,
20
- "declaration": true,
21
- "declarationMap": true,
22
-
23
- // Stricter Typechecking Options
24
- "noUncheckedIndexedAccess": true,
25
- "exactOptionalPropertyTypes": true,
26
-
27
- // Style Options
28
- // "noImplicitReturns": true,
29
- // "noImplicitOverride": true,
30
- // "noUnusedLocals": true,
31
- // "noUnusedParameters": true,
32
- // "noFallthroughCasesInSwitch": true,
33
- // "noPropertyAccessFromIndexSignature": true,
34
-
35
- // Recommended Options
36
- "moduleResolution": "bundler",
37
- "strict": true,
38
- "jsx": "react-jsx",
39
- "verbatimModuleSyntax": true,
40
- "isolatedModules": true,
41
- "noUncheckedSideEffectImports": true,
42
- "moduleDetection": "force",
43
- "skipLibCheck": true,
44
- },
45
- "include": ["src"],
46
- "exclude": ["**/__tests__"]
47
- }