Skip to content

Commit 1c3b343

Browse files
committed
fix: remove dependency to @ohoareau/aws-parse
1 parent 833ea35 commit 1c3b343

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

packages/bundle-docker/src/targets/AbstractDockerTarget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {GenericTarget} from '@genjs/genjs';
2-
import {parseEcr} from "@ohoareau/aws-parse";
2+
import {parseEcr} from "../utils";
33

44
export abstract class AbstractDockerTarget extends GenericTarget {
55
abstract getCommandName(options: any): string;
@@ -55,4 +55,4 @@ export abstract class AbstractDockerTarget extends GenericTarget {
5555
}
5656
}
5757

58-
export default AbstractDockerTarget
58+
export default AbstractDockerTarget
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export type parseEcrResult = {
2+
account: string,
3+
region: string,
4+
registry: string,
5+
domain: string,
6+
name: string,
7+
tag: string,
8+
};
9+
10+
export const parseEcr = (x: any): parseEcrResult => {
11+
('string' !== typeof x) && (x = '');
12+
const r = {
13+
account: '', domain: '', region: '', registry: '', name: '', tag: '',
14+
};
15+
const matches = (<string>x).match(/^(([0-9]{12})\.dkr\.ecr\.(.+)\.amazonaws\.com)(\/([^:]+)(:.+)?)?$/);
16+
if (!matches) return r;
17+
r.domain = matches[1]
18+
r.account = matches[2];
19+
r.region = matches[3];
20+
matches[4] && (r.name = matches[4].slice(1).replace(/:.+$/, ''));
21+
matches[6] && (r.tag = matches[6].slice(1));
22+
r.name && (r.registry = `${r.domain}/${r.name}`);
23+
return r;
24+
}
25+

packages/genjs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"dump": "./bin/genjs dump"
4242
},
4343
"dependencies": {
44-
"@ohoareau/aws-parse": "^0.2.0",
4544
"@ohoareau/dir2obj": "^0.3.1",
4645
"@ohoareau/technologies-detector": "^0.3.3",
4746
"ejs": "^3.1.8",

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,11 +1658,6 @@
16581658
dependencies:
16591659
"@octokit/openapi-types" "^13.4.0"
16601660

1661-
"@ohoareau/aws-parse@^0.2.0":
1662-
version "0.2.0"
1663-
resolved "https://registry.yarnpkg.com/@ohoareau/aws-parse/-/aws-parse-0.2.0.tgz#3dcaae525dcf2da06d124b32ad8a442f96d3dc5d"
1664-
integrity sha512-mIWqp2VM7VcfDk1gEHsHfSGQ5XuJNcP5p5xE9slw/1MMPHDDUpJlJANYf1x2SCsZIAYYDRcYZEF8kpDYnP+tkA==
1665-
16661661
"@ohoareau/dir2obj@^0.3.1":
16671662
version "0.3.1"
16681663
resolved "https://registry.yarnpkg.com/@ohoareau/dir2obj/-/dir2obj-0.3.1.tgz#a76cee9c97f2facfdeeff31ee36fce59ff354925"

0 commit comments

Comments
 (0)