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/packages/comm/project-configuration.ts
Views: 687
1
/*
2
Shared types and constants between frontend app and project for computing project
3
configuration information.
4
*/
5
6
import type { ConfigurationAspect } from "@cocalc/comm/websocket/types";
7
8
export type { ConfigurationAspect };
9
export const LIBRARY_INDEX_FILE = "/ext/library/cocalc-examples/index.json";
10
11
export interface MainConfiguration {
12
capabilities: MainCapabilities;
13
timestamp: string;
14
// disabled extensions, for opening/creating files
15
disabled_ext: string[];
16
}
17
18
export type Capabilities = { [key: string]: boolean };
19
20
export interface X11Configuration {
21
timestamp: string;
22
capabilities: Capabilities;
23
}
24
25
export type Configuration = MainConfiguration | X11Configuration;
26
27
export interface MainCapabilities {
28
jupyter: boolean | Capabilities;
29
formatting: Capabilities; // yapf & co.
30
hashsums: Capabilities;
31
rserver: boolean;
32
latex: boolean;
33
sage: boolean;
34
sage_version?: number[];
35
x11: boolean;
36
rmd: boolean;
37
qmd: boolean;
38
jq: boolean;
39
spellcheck: boolean;
40
library: boolean;
41
sshd: boolean;
42
html2pdf: boolean; // via chrome/chromium
43
pandoc: boolean; // e.g. for docx2md conversion
44
vscode: boolean; // "code-server"
45
julia: boolean; // julia programming language + Pluto package is installed (we assume it)
46
homeDirectory: string | null; // the home directory of the project
47
}
48
49
export interface Available {
50
jupyter_lab: boolean;
51
jupyter_notebook: boolean;
52
jupyter: boolean;
53
rserver: boolean;
54
x11: boolean;
55
latex: boolean;
56
sage: boolean;
57
rmd: boolean; // TODO besides R, what's necessary? pandoc!
58
qmd: boolean; // also depends on pandoc
59
jq: boolean;
60
spellcheck: boolean;
61
library: boolean;
62
html2pdf: boolean;
63
pandoc: boolean;
64
vscode: boolean;
65
julia: boolean;
66
formatting: Capabilities | boolean;
67
homeDirectory: string | null;
68
}
69
70
export const NO_AVAIL: Readonly<Available> = {
71
jupyter_lab: false,
72
jupyter_notebook: false,
73
jupyter: false,
74
rserver: false,
75
sage: false,
76
latex: false,
77
rmd: false,
78
qmd: false,
79
jq: false,
80
x11: false,
81
spellcheck: false,
82
library: false,
83
formatting: false,
84
html2pdf: false,
85
pandoc: false,
86
vscode: false,
87
julia: false,
88
homeDirectory: null,
89
} as const;
90
91
export const ALL_AVAIL: Readonly<Available> = {
92
jupyter_lab: true,
93
jupyter_notebook: true,
94
jupyter: true,
95
rserver: true,
96
sage: true,
97
latex: true,
98
rmd: true,
99
qmd: true,
100
jq: true,
101
x11: true,
102
spellcheck: true,
103
library: true,
104
formatting: true,
105
html2pdf: true,
106
pandoc: true,
107
vscode: true,
108
julia: true,
109
homeDirectory: "/home/user", // sane default
110
} as const;
111
112