Skip to content

Commit c707c22

Browse files
committed
feat: add 113 targets
1 parent 7242a3a commit c707c22

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

packages/data/src/publish.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

packages/data/src/targets.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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

3454
export function filter() {

0 commit comments

Comments
 (0)