File tree Expand file tree Collapse file tree 4 files changed +51
-3
lines changed Expand file tree Collapse file tree 4 files changed +51
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : Build Library
2
+
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ build :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout code
14
+ uses : actions/checkout@v4
15
+
16
+ - name : Setup Node.js
17
+ uses : actions/setup-node@v4
18
+ with :
19
+ node-version : ' 22.x'
20
+ cache : ' yarn'
21
+
22
+ - name : Install deps
23
+ run : yarn
24
+
25
+ - name : Build project
26
+ run : yarn build
Original file line number Diff line number Diff line change 16
16
node-version : " 20.x"
17
17
registry-url : " https://registry.npmjs.org"
18
18
19
- - run : yarn build
20
- - run : npm publish --provenance --access public
19
+ - name : Build library
20
+ run : yarn build
21
+
22
+ - name : Publish to NPM
23
+ run : npm publish --provenance --access public
21
24
env :
22
25
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @acm-uiuc/js-shared" ,
3
- "version" : " 3.0.1 " ,
3
+ "version" : " 3.1.0 " ,
4
4
"description" : " ACM UIUC Shared JS code" ,
5
5
"main" : " dist/index.js" ,
6
6
"module" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -42,6 +42,25 @@ export type OrganizationId = keyof typeof Organizations;
42
42
export type Organization = ( typeof Organizations ) [ OrganizationId ] ;
43
43
export type OrganizationName = Organization [ "name" ] ;
44
44
45
+ // Create a reverse lookup map from name to ID
46
+ export const OrganizationsByName = Object . entries ( Organizations ) . reduce (
47
+ ( acc , [ id , org ] ) => {
48
+ if ( acc [ org . name ] ) {
49
+ throw new Error ( `Duplicate organization name: ${ org . name } ` ) ;
50
+ }
51
+ acc [ org . name ] = id as OrganizationId ;
52
+ return acc ;
53
+ } ,
54
+ { } as Record < OrganizationName , OrganizationId >
55
+ ) ;
56
+
57
+ export function getOrgByName ( name : OrganizationName ) : ( Organization & { id : OrganizationId } ) | undefined {
58
+ const id = OrganizationsByName [ name ] ;
59
+ if ( ! id ) return undefined ;
60
+
61
+ return { ...Organizations [ id ] , id } ;
62
+ }
63
+
45
64
export function getOrgsByType ( type : OrgType ) : Array < Organization & { id : OrganizationId } > {
46
65
return ( Object . entries ( Organizations ) as Array < [ OrganizationId , Organization ] > )
47
66
. filter ( ( [ _ , org ] ) => org . type === type )
You can’t perform that action at this time.
0 commit comments