CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/scripts/export-api-doc.ts
Views: 687
1
#!/usr/bin/env ts-node-script
2
3
/*
4
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
5
* License: MS-RSL – see LICENSE.md for details
6
*/
7
8
// run this file as usual: $ export-api-doc.ts (exec in your PATH) or
9
// $ ts-node scripts/export-api-doc.ts
10
// then copy 'api.json' over to the root of cocalc-doc
11
12
import { writeFileSync } from "fs";
13
import { execSync } from "child_process";
14
15
const api_root = "/api/v1/";
16
const api_doc = require("../packages/util/dist/message").documentation;
17
api_doc.root = api_root;
18
api_doc.timestamp = new Date().toISOString();
19
const gitrev = execSync("git rev-parse HEAD");
20
api_doc.gitrev = gitrev.toString().split("\n")[0].trim();
21
22
writeFileSync("api.json", JSON.stringify(api_doc, null, 2));
23
24