File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,20 @@ async function main() {
1818 throw new Error ( `File ${ path . join ( dir , "package.json" ) } does not exist` ) ;
1919 }
2020 const pkg = JSON . parse ( fs . readFileSync ( path . join ( dir , "package.json" ) , "utf-8" ) ) ;
21+ if ( ! pkg . name || ! pkg . version ) {
22+ throw new Error ( `Invalid package.json in ${ dir } ` ) ;
23+ }
24+ if ( await published ( pkg . version ) ) {
25+ console . log ( `Skipping ${ pkg . name } @${ pkg . version } , already published` ) ;
26+ continue ;
27+ }
2128 console . log ( `Publishing ${ pkg . name } @${ pkg . version } ...` ) ;
2229
2330 execSync ( "npm publish" , { cwd : dir , stdio : "inherit" } ) ;
2431 }
2532}
33+
34+ async function published ( version : string ) {
35+ const res = await fetch ( `https://registry.npmjs.org/ntnu-course-list-data/${ version } ` ) ;
36+ return res . status !== 404 ;
37+ }
Original file line number Diff line number Diff line change @@ -29,6 +29,26 @@ export const targets: CourseListFetcherOptions[] = [
2929 year : 112 ,
3030 term : 1 ,
3131 } ,
32+ {
33+ year : 112 ,
34+ term : 2 ,
35+ } ,
36+ {
37+ year : 112 ,
38+ term : 3 ,
39+ } ,
40+ {
41+ year : 113 ,
42+ term : 1 ,
43+ } ,
44+ {
45+ year : 113 ,
46+ term : 2 ,
47+ } ,
48+ {
49+ year : 113 ,
50+ term : 3 ,
51+ } ,
3252] ;
3353
3454export function filter ( ) {
You can’t perform that action at this time.
0 commit comments