@cloud-copilot/iam-lens 0.1.0 → 0.1.2

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.
Files changed (57) hide show
  1. package/dist/cjs/accounts.d.ts +3 -0
  2. package/dist/cjs/accounts.d.ts.map +1 -0
  3. package/dist/cjs/accounts.js +8 -0
  4. package/dist/cjs/accounts.js.map +1 -0
  5. package/dist/cjs/collect/client.d.ts +238 -0
  6. package/dist/cjs/collect/client.d.ts.map +1 -0
  7. package/dist/cjs/collect/client.js +459 -0
  8. package/dist/cjs/collect/client.js.map +1 -0
  9. package/dist/cjs/collect/collect.d.ts +18 -0
  10. package/dist/cjs/collect/collect.d.ts.map +1 -0
  11. package/dist/cjs/collect/collect.js +26 -0
  12. package/dist/cjs/collect/collect.js.map +1 -0
  13. package/dist/cjs/principals.d.ts +40 -0
  14. package/dist/cjs/principals.d.ts.map +1 -0
  15. package/dist/cjs/principals.js +71 -0
  16. package/dist/cjs/principals.js.map +1 -0
  17. package/dist/cjs/resources.d.ts +19 -0
  18. package/dist/cjs/resources.d.ts.map +1 -0
  19. package/dist/cjs/resources.js +43 -0
  20. package/dist/cjs/resources.js.map +1 -0
  21. package/dist/cjs/util/arn.d.ts +26 -0
  22. package/dist/cjs/util/arn.d.ts.map +1 -0
  23. package/dist/cjs/util/arn.js +68 -0
  24. package/dist/cjs/util/arn.js.map +1 -0
  25. package/dist/esm/accounts.d.ts +3 -0
  26. package/dist/esm/accounts.d.ts.map +1 -0
  27. package/dist/esm/accounts.js +5 -0
  28. package/dist/esm/accounts.js.map +1 -0
  29. package/dist/esm/collect/client.d.ts +238 -0
  30. package/dist/esm/collect/client.d.ts.map +1 -0
  31. package/dist/esm/collect/client.js +454 -0
  32. package/dist/esm/collect/client.js.map +1 -0
  33. package/dist/esm/collect/collect.d.ts +18 -0
  34. package/dist/esm/collect/collect.d.ts.map +1 -0
  35. package/dist/esm/collect/collect.js +22 -0
  36. package/dist/esm/collect/collect.js.map +1 -0
  37. package/dist/esm/principals.d.ts +40 -0
  38. package/dist/esm/principals.d.ts.map +1 -0
  39. package/dist/esm/principals.js +66 -0
  40. package/dist/esm/principals.js.map +1 -0
  41. package/dist/esm/resources.d.ts +19 -0
  42. package/dist/esm/resources.d.ts.map +1 -0
  43. package/dist/esm/resources.js +39 -0
  44. package/dist/esm/resources.js.map +1 -0
  45. package/dist/esm/util/arn.d.ts +26 -0
  46. package/dist/esm/util/arn.d.ts.map +1 -0
  47. package/dist/esm/util/arn.js +64 -0
  48. package/dist/esm/util/arn.js.map +1 -0
  49. package/package.json +85 -17
  50. package/.github/workflows/guarddog.yml +0 -31
  51. package/.github/workflows/pr-checks.yml +0 -101
  52. package/.github/workflows/update-dependencies.yml +0 -16
  53. package/postbuild.sh +0 -12
  54. package/src/index.ts +0 -1
  55. package/tsconfig.cjs.json +0 -11
  56. package/tsconfig.esm.json +0 -14
  57. package/tsconfig.json +0 -22
@@ -0,0 +1,39 @@
1
+ import { splitArnParts } from './util/arn.js';
2
+ /**
3
+ * Get the account ID for a given resource ARN. Lookup index if necessary to find the account ID.
4
+ *
5
+ * @param collectClient the IAM collect client to use for retrieving the account ID
6
+ * @param resourceArn the ARN of the resource to get the account ID for
7
+ * @returns the account ID for the specified resource, or undefined if not found
8
+ */
9
+ export async function getAccountIdForResource(collectClient, resourceArn) {
10
+ const arnParts = splitArnParts(resourceArn);
11
+ let accountId = arnParts.accountId;
12
+ if (accountId) {
13
+ return accountId;
14
+ }
15
+ if (arnParts.service === 's3' && arnParts.resourceType === '') {
16
+ const bucketName = arnParts.resourcePath;
17
+ return collectClient.getAccountIdForBucket(bucketName);
18
+ }
19
+ else if (arnParts.service === 'apigateway' && arnParts.resourceType === 'restapis') {
20
+ const apiId = arnParts.resourcePath;
21
+ return collectClient.getAccountIdForRestApi(apiId);
22
+ }
23
+ return undefined;
24
+ }
25
+ /**
26
+ * Get the resource control policies (RCPs) for a given resource ARN.
27
+ *
28
+ * @param collectClient the IAM collect client to use for retrieving RCPs
29
+ * @param resourceArn the ARN of the resource to get RCPs for
30
+ * @returns an array of resource control policies for the specified resource
31
+ */
32
+ export async function getRcpsForResource(collectClient, resourceArn) {
33
+ const accountId = await getAccountIdForResource(collectClient, resourceArn);
34
+ if (!accountId) {
35
+ throw new Error(`Unable to determine account ID for resource ARN: ${resourceArn}`);
36
+ }
37
+ return collectClient.getRcpHierarchyForAccount(accountId);
38
+ }
39
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/resources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,aAA+B,EAC/B,WAAmB;IAEnB,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;IAC3C,IAAI,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;IAClC,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,IAAI,QAAQ,CAAC,YAAY,KAAK,EAAE,EAAE,CAAC;QAC9D,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAa,CAAA;QACzC,OAAO,aAAa,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;IACxD,CAAC;SAAM,IAAI,QAAQ,CAAC,OAAO,KAAK,YAAY,IAAI,QAAQ,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACrF,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAa,CAAA;QACpC,OAAO,aAAa,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,aAA+B,EAC/B,WAAmB;IAEnB,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;IAC3E,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,oDAAoD,WAAW,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,aAAa,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,26 @@
1
+ export interface ArnParts {
2
+ partition: string | undefined;
3
+ service: string | undefined;
4
+ region: string | undefined;
5
+ accountId: string | undefined;
6
+ resource: string | undefined;
7
+ resourceType: string | undefined;
8
+ resourcePath: string | undefined;
9
+ }
10
+ /**
11
+ * Split an ARN into its parts
12
+ *
13
+ * @param arn the arn to split
14
+ * @returns the parts of the ARN
15
+ */
16
+ export declare function splitArnParts(arn: string): ArnParts;
17
+ /**
18
+ * Get the product/id segments of the resource portion of an ARN.
19
+ * The first segment is the product segment and the second segment is the resource id segment.
20
+ * This could be split by a colon or a slash, so it checks for both. It also checks for S3 buckets/objects.
21
+ *
22
+ * @param resource The resource to get the resource segments. Must be an ARN resource.
23
+ * @returns a tuple with the first segment being the product segment (without the separator) and the second segment being the resource id.
24
+ */
25
+ export declare function getResourceSegments(service: string, accountId: string, region: string, resourceString: string): [string, string];
26
+ //# sourceMappingURL=arn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arn.d.ts","sourceRoot":"","sources":["../../../src/util/arn.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAkBnD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GACrB,CAAC,MAAM,EAAE,MAAM,CAAC,CA+BlB"}
@@ -0,0 +1,64 @@
1
+ // Copied from https://github.com/cloud-copilot/iam-simulate/blob/main/src/util.ts
2
+ /**
3
+ * Split an ARN into its parts
4
+ *
5
+ * @param arn the arn to split
6
+ * @returns the parts of the ARN
7
+ */
8
+ export function splitArnParts(arn) {
9
+ const parts = arn.split(':');
10
+ const partition = parts.at(1);
11
+ const service = parts.at(2);
12
+ const region = parts.at(3);
13
+ const accountId = parts.at(4);
14
+ const resource = parts.slice(5).join(':');
15
+ const [resourceType, resourcePath] = getResourceSegments(service, accountId, region, resource);
16
+ return {
17
+ partition,
18
+ service,
19
+ region,
20
+ accountId,
21
+ resource,
22
+ resourceType,
23
+ resourcePath
24
+ };
25
+ }
26
+ /**
27
+ * Get the product/id segments of the resource portion of an ARN.
28
+ * The first segment is the product segment and the second segment is the resource id segment.
29
+ * This could be split by a colon or a slash, so it checks for both. It also checks for S3 buckets/objects.
30
+ *
31
+ * @param resource The resource to get the resource segments. Must be an ARN resource.
32
+ * @returns a tuple with the first segment being the product segment (without the separator) and the second segment being the resource id.
33
+ */
34
+ export function getResourceSegments(service, accountId, region, resourceString) {
35
+ // This is terrible, and I hate it
36
+ if ((service === 's3' && accountId === '' && region === '') ||
37
+ service === 'sns' ||
38
+ service === 'sqs') {
39
+ return ['', resourceString];
40
+ }
41
+ if (resourceString.startsWith('/')) {
42
+ resourceString = resourceString.slice(1);
43
+ }
44
+ const slashIndex = resourceString.indexOf('/');
45
+ const colonIndex = resourceString.indexOf(':');
46
+ let splitIndex = slashIndex;
47
+ if (slashIndex != -1 && colonIndex != -1) {
48
+ splitIndex = Math.min(slashIndex, colonIndex) + 1;
49
+ }
50
+ else if (slashIndex == -1 && colonIndex == -1) {
51
+ splitIndex = resourceString.length + 1;
52
+ }
53
+ else if (colonIndex == -1) {
54
+ splitIndex = slashIndex + 1;
55
+ }
56
+ else if (slashIndex == -1) {
57
+ splitIndex = colonIndex + 1;
58
+ }
59
+ else {
60
+ throw new Error(`Unable to split resource ${resourceString}`);
61
+ }
62
+ return [resourceString.slice(0, splitIndex - 1), resourceString.slice(splitIndex)];
63
+ }
64
+ //# sourceMappingURL=arn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/util/arn.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAYlF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAE,CAAA;IAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAE,CAAA;IAC3B,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAE,CAAA;IAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAE9F,OAAO;QACL,SAAS;QACT,OAAO;QACP,MAAM;QACN,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,YAAY;KACb,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,SAAiB,EACjB,MAAc,EACd,cAAsB;IAEtB,kCAAkC;IAClC,IACE,CAAC,OAAO,KAAK,IAAI,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,KAAK,EAAE,CAAC;QACvD,OAAO,KAAK,KAAK;QACjB,OAAO,KAAK,KAAK,EACjB,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,cAAc,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9C,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAE9C,IAAI,UAAU,GAAG,UAAU,CAAA;IAC3B,IAAI,UAAU,IAAI,CAAC,CAAC,IAAI,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC;QACzC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAA;IACnD,CAAC;SAAM,IAAI,UAAU,IAAI,CAAC,CAAC,IAAI,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC;QAChD,UAAU,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5B,UAAU,GAAG,UAAU,GAAG,CAAC,CAAA;IAC7B,CAAC;SAAM,IAAI,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5B,UAAU,GAAG,UAAU,GAAG,CAAC,CAAA;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,4BAA4B,cAAc,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAA;AACpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-copilot/iam-lens",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Visibility in IAM in and across AWS accounts",
5
5
  "keywords": [
6
6
  "aws",
@@ -9,20 +9,16 @@
9
9
  "identity"
10
10
  ],
11
11
  "homepage": "https://github.com/cloud-copilot/iam-lens#readme",
12
- "devDependencies": {
13
- "@cloud-copilot/prettier-config": "^0.1.0",
14
- "@semantic-release/changelog": "^6.0.3",
15
- "@semantic-release/commit-analyzer": "^13.0.1",
16
- "@semantic-release/git": "^10.0.1",
17
- "@semantic-release/github": "^11.0.1",
18
- "@semantic-release/npm": "^12.0.1",
19
- "@semantic-release/release-notes-generator": "^14.0.3",
20
- "@types/node": "^22.5.0",
21
- "@vitest/coverage-v8": "^3.0.7",
22
- "semantic-release": "^24.2.1",
23
- "typescript": "^5.7.2",
24
- "vitest": "^3.0.7"
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
16
+ }
25
17
  },
18
+ "files": [
19
+ "dist/**/*"
20
+ ],
21
+ "types": "dist/cjs/index.d.ts",
26
22
  "prettier": "@cloud-copilot/prettier-config",
27
23
  "bugs": {
28
24
  "url": "https://github.com/cloud-copilot/iam-lens/issues"
@@ -32,9 +28,7 @@
32
28
  "url": "git+https://github.com/cloud-copilot/iam-lens.git"
33
29
  },
34
30
  "license": "AGPL-3.0-or-later",
35
- "author": "Cloud Copilot",
36
- "type": "commonjs",
37
- "main": "dist/esm/index.js",
31
+ "author": "David Kerber <dave@cloudcopilot.io>",
38
32
  "scripts": {
39
33
  "build": "npx tsc -p tsconfig.cjs.json && npx tsc -p tsconfig.esm.json && ./postbuild.sh",
40
34
  "clean": "rm -rf dist",
@@ -42,5 +36,79 @@
42
36
  "release": "npm install && npm run clean && npm run build && npm test && npm run format-check && npm publish",
43
37
  "format": "npx prettier --write src/",
44
38
  "format-check": "npx prettier --check src/"
39
+ },
40
+ "devDependencies": {
41
+ "@cloud-copilot/prettier-config": "^0.1.0",
42
+ "@semantic-release/changelog": "^6.0.3",
43
+ "@semantic-release/commit-analyzer": "^13.0.1",
44
+ "@semantic-release/git": "^10.0.1",
45
+ "@semantic-release/github": "^11.0.1",
46
+ "@semantic-release/npm": "^12.0.1",
47
+ "@semantic-release/release-notes-generator": "^14.0.3",
48
+ "@types/node": "^22.5.0",
49
+ "@vitest/coverage-v8": "^3.0.7",
50
+ "semantic-release": "^24.2.1",
51
+ "typescript": "^5.7.2",
52
+ "vitest": "^3.0.7"
53
+ },
54
+ "release": {
55
+ "branches": [
56
+ "main"
57
+ ],
58
+ "plugins": [
59
+ [
60
+ "@semantic-release/commit-analyzer",
61
+ {
62
+ "releaseRules": [
63
+ {
64
+ "type": "feat",
65
+ "release": "patch"
66
+ },
67
+ {
68
+ "type": "fix",
69
+ "release": "patch"
70
+ },
71
+ {
72
+ "breaking": true,
73
+ "release": "patch"
74
+ },
75
+ {
76
+ "type": "*",
77
+ "release": "patch"
78
+ }
79
+ ]
80
+ }
81
+ ],
82
+ "@semantic-release/release-notes-generator",
83
+ "@semantic-release/changelog",
84
+ [
85
+ "@semantic-release/npm",
86
+ {
87
+ "npmPublish": true
88
+ }
89
+ ],
90
+ [
91
+ "@semantic-release/git",
92
+ {
93
+ "assets": [
94
+ "package.json",
95
+ "package-lock.json",
96
+ "CHANGELOG.md"
97
+ ],
98
+ "message": "chore(release): ${nextRelease.version} [skip ci]"
99
+ }
100
+ ],
101
+ [
102
+ "@semantic-release/github",
103
+ {
104
+ "assets": []
105
+ }
106
+ ]
107
+ ]
108
+ },
109
+ "dependencies": {
110
+ "@cloud-copilot/iam-collect": "^0.1.63",
111
+ "@cloud-copilot/iam-policy": "^0.1.24",
112
+ "@cloud-copilot/iam-simulate": "^0.1.35"
45
113
  }
46
114
  }
@@ -1,31 +0,0 @@
1
- name: GuardDog
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- permissions:
10
- contents: read
11
-
12
- jobs:
13
- guarddog:
14
- permissions:
15
- contents: read
16
- name: Scan Dependencies and Source Code
17
- runs-on: ubuntu-latest
18
-
19
- steps:
20
- - uses: actions/checkout@v4
21
-
22
- - name: Set up Python
23
- uses: actions/setup-python@v5
24
- with:
25
- python-version: '3.10'
26
-
27
- - name: Install GuardDog
28
- run: pip install guarddog
29
-
30
- - run: guarddog npm scan src/ --exit-non-zero-on-finding
31
- # - run: guarddog npm verify package.json --exclude-rules empty_information --exit-non-zero-on-finding
@@ -1,101 +0,0 @@
1
- name: 'Lint PR'
2
-
3
- on:
4
- pull_request_target:
5
- types:
6
- - opened
7
- - edited
8
- - synchronize
9
- - reopened
10
-
11
- permissions:
12
- contents: read
13
-
14
- jobs:
15
- main:
16
- name: Validate PR title
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: amannn/action-semantic-pull-request@v5
20
- env:
21
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22
-
23
- lint:
24
- name: Code Formatting Check
25
- runs-on: ubuntu-latest
26
- steps:
27
- - name: Check out the repository
28
- uses: actions/checkout@v4
29
- with:
30
- ref: ${{ github.event.pull_request.head.sha }}
31
-
32
- - name: Set up Node
33
- uses: actions/setup-node@v4
34
- with:
35
- node-version: '22'
36
-
37
- - name: Install dependencies
38
- run: npm ci
39
-
40
- - name: Check Code Formatting
41
- run: npm run format-check
42
-
43
- test:
44
- name: Build and Test
45
- runs-on: ubuntu-latest
46
- steps:
47
- - name: Check out the repository
48
- uses: actions/checkout@v4
49
- with:
50
- ref: ${{ github.event.pull_request.head.sha }}
51
-
52
- - name: Set up Node
53
- uses: actions/setup-node@v4
54
- with:
55
- node-version: '22'
56
-
57
- - name: Install dependencies
58
- run: npm ci
59
-
60
- - name: Build
61
- run: npm run build
62
-
63
- - name: Check Tests
64
- run: npm test
65
-
66
- guarddog:
67
- permissions:
68
- contents: read
69
- name: GuardDog Check
70
- runs-on: ubuntu-latest
71
-
72
- steps:
73
- - name: Check out the repository
74
- uses: actions/checkout@v4
75
- with:
76
- ref: ${{ github.event.pull_request.head.sha }}
77
- fetch-depth: 0
78
-
79
- - name: Set up Python
80
- uses: actions/setup-python@v5
81
- with:
82
- python-version: '3.10'
83
-
84
- - name: Install GuardDog
85
- run: pip install guarddog
86
-
87
- - name: Run GuardDog scan on src
88
- run: guarddog npm scan src/ --exit-non-zero-on-finding
89
-
90
- # - name: Check if package.json changed
91
- # id: package_check
92
- # run: |
93
- # if git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} | grep -q '^package\.json$'; then
94
- # echo "changed=true" >> $GITHUB_OUTPUT
95
- # else
96
- # echo "changed=false" >> $GITHUB_OUTPUT
97
- # fi
98
-
99
- # - name: Conditionally run verify on package.json
100
- # if: steps.package_check.outputs.changed == 'true'
101
- # run: guarddog npm verify package.json --exclude-rules empty_information --exit-non-zero-on-finding
@@ -1,16 +0,0 @@
1
- name: Update Dependencies
2
-
3
- on:
4
- schedule:
5
- - cron: '0 12 * * 6' # Every Saturday at 12:00 PM UTC
6
- workflow_dispatch:
7
-
8
- jobs:
9
- update-dependencies:
10
- runs-on: ubuntu-latest
11
- permissions:
12
- contents: write # Push branches
13
- pull-requests: write # Create PRs
14
- steps:
15
- - name: Run dependency update
16
- uses: cloud-copilot/update-dependencies@main
package/postbuild.sh DELETED
@@ -1,12 +0,0 @@
1
- cat >dist/cjs/package.json <<!EOF
2
- {
3
- "type": "commonjs"
4
- }
5
- !EOF
6
- rm -rf dist/cjs/utils/readPackageFileEsm.*
7
-
8
- cat >dist/esm/package.json <<!EOF
9
- {
10
- "type": "module"
11
- }
12
- !EOF
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- console.log('Hello, world!')
package/tsconfig.cjs.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
-
4
- "include": ["src/**/*"],
5
- "exclude": ["**/*.test.ts"],
6
-
7
- "compilerOptions": {
8
- "rootDir": "src",
9
- "outDir": "dist/cjs",
10
- }
11
- }
package/tsconfig.esm.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
-
4
- "include": ["src/**/*"],
5
- "exclude": ["**/*.test.ts"],
6
-
7
- "compilerOptions": {
8
- "target": "ES2020",
9
- "module": "ES2020",
10
- "moduleResolution": "node",
11
- "rootDir": "src",
12
- "outDir": "dist/esm"
13
- }
14
- }
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es2022",
5
- "outDir": "dist",
6
- "rootDir": "src",
7
- "sourceMap": true,
8
- "strict": true,
9
- "declaration": true,
10
- "declarationMap": true,
11
- "lib": ["es2023", "DOM"],
12
- "noUnusedLocals": false,
13
- "noUnusedParameters": false,
14
- "noImplicitReturns": true,
15
- "noFallthroughCasesInSwitch": false,
16
- "experimentalDecorators": true,
17
- "emitDecoratorMetadata": true,
18
- "esModuleInterop": false,
19
- "forceConsistentCasingInFileNames": true,
20
- },
21
- "exclude": ["tests", "test", "dist", "bin", "**/bin", "**/dist", "node_modules", "cdk.out"]
22
- }