Skip to content

Commit 54d52be

Browse files
committed
update typings
1 parent 913575e commit 54d52be

File tree

8 files changed

+275
-0
lines changed

8 files changed

+275
-0
lines changed

src/typings/cr/cli.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare module 'coderoad-cli' {
2+
export function build(
3+
dir: string, filePath: string, output?: string
4+
): boolean;
5+
export function create(
6+
dir: string, name: string
7+
): boolean | Promise<boolean>;
8+
export function tutorials(
9+
dir: string
10+
): Tutorial.Info[];
11+
}

src/typings/cr/core.d.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
declare module 'core-coderoad/lib/alert' {
2+
export function reducer(open: boolean, action: Action): boolean;
3+
export function alertOpen(alert: Object);
4+
export function alertReplay();
5+
export function alertClose();
6+
}
7+
8+
declare module 'core-coderoad/lib/editor' {
9+
export function dir(name: string): string;
10+
export function reducer(name: string, action: Action): string;
11+
export function editorDevToolsToggle();
12+
export function editorOpen(file: string);
13+
export function editorInsert(content: string);
14+
export function editorSet(content: string);
15+
export function editorSave();
16+
export function save();
17+
export function open(file: string);
18+
export function openFolder();
19+
export function set(content: string);
20+
export function insert(content: string);
21+
export function openDevTools();
22+
export function toggleDevTools();
23+
export function clearConsole();
24+
export function openTerminal();
25+
export function closeAllPanels();
26+
export function quit();
27+
}
28+
29+
declare module 'core-coderoad/lib/polyfills' {
30+
export default function loadPolyfills(): void;
31+
}
32+
33+
declare module 'core-coderoad/lib/route' {
34+
export function reducer(route: string, action: Action): string;
35+
export function routeSet(route: string);
36+
}
37+
38+
declare module 'core-coderoad/lib/setup' {
39+
export function checks(checks: CR.Checks, action: Action): CR.Checks;
40+
export function packageJson(pj: PackageJson, action: Action): PackageJson;
41+
export function setupVerify();
42+
export function setupPackage();
43+
}
44+
45+
declare module 'core-coderoad/lib/tutorial' {
46+
export function reducer(tutorial: CR.Tutorial, action: Action): CR.Tutorial;
47+
export function tutorialSet(name: string);
48+
}
49+
50+
declare module 'core-coderoad/lib/tutorials' {
51+
export function reducer(tutorials: Tutorial.Info[], action: Action): Tutorial.Info[];
52+
export function tutorialsFind();
53+
export function tutorialUpdate(name: string);
54+
}
55+
56+
declare module 'core-coderoad/lib/window' {
57+
export function windowToggle();
58+
export function reducer(open: boolean, action: Action): boolean;
59+
}

src/typings/cr/cr.d.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
declare namespace CR {
2+
3+
interface Info {
4+
title: string;
5+
description: string;
6+
}
7+
8+
interface Page extends Info {
9+
tasks?: Task[];
10+
onPageComplete?: string;
11+
}
12+
interface Task {
13+
description: string;
14+
tests?: string[];
15+
hints?: string[];
16+
actions?: string[];
17+
completed?: boolean;
18+
}
19+
20+
interface State {
21+
dir: string;
22+
route: string;
23+
tutorialInfo: Tutorial.Info;
24+
windowToggle: boolean;
25+
pagePosition: PagePosition;
26+
package: PackageJson;
27+
page: Page;
28+
progress: Progress;
29+
tasks: Task[];
30+
taskTests: string[];
31+
taskPosition: number;
32+
hintPosition: number;
33+
taskActions: string[];
34+
alert: Alert;
35+
tutorial: Tutorial;
36+
tutorials: Tutorial.Info[];
37+
testRun: boolean;
38+
checks: Checks;
39+
}
40+
41+
interface Tutorial {
42+
name: string;
43+
info: Tutorial.Info;
44+
pages: CR.Page[];
45+
packageJson: PackageJson;
46+
config: Tutorial.Config;
47+
}
48+
49+
type PagePosition = number;
50+
51+
interface Progress {
52+
completed: boolean;
53+
pages: boolean[];
54+
}
55+
56+
type TaskTest = string[];
57+
58+
interface Alert {
59+
message: string;
60+
action: string;
61+
open?: boolean;
62+
duration?: number;
63+
color: string;
64+
}
65+
66+
interface Checks {
67+
passed?: boolean;
68+
system: {
69+
passed?: boolean;
70+
node: boolean;
71+
npm: boolean;
72+
xcode: boolean;
73+
};
74+
setup: {
75+
passed?: boolean;
76+
hasDir: boolean;
77+
hasPackageJson: boolean;
78+
hasTutorial: boolean;
79+
};
80+
}
81+
82+
}

src/typings/cr/globals.d.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
interface Action {
2+
type: string;
3+
payload?;
4+
error?: boolean;
5+
meta?;
6+
filter?: string;
7+
}
8+
9+
interface PackageJson {
10+
name: string;
11+
main: string;
12+
version: string;
13+
dependencies?: Object;
14+
devDependencies?: Object;
15+
config: Tutorial.Config;
16+
bugs?: {
17+
url: string;
18+
};
19+
repo?: {
20+
url: string;
21+
};
22+
}
23+
24+
interface ObjectConstructor {
25+
assign(target: any, ...sources: any[]): any;
26+
values(obj: Object): any[];
27+
}
28+
29+
interface IntrinsicAttributes {
30+
index: number;
31+
style: Object;
32+
className: string;
33+
targetOrigin: string;
34+
anchorOrigin: string;
35+
onClick: () => any;
36+
primaryText: string;
37+
primaryTogglesNestedList: any;
38+
}
39+
40+
type fileType = 'js'|'jsx'|'ts'|'py';
41+
42+
interface Process {
43+
resourcesPath: string;
44+
}

src/typings/cr/test.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
declare namespace Test {
2+
interface Result {
3+
pass: boolean;
4+
taskPosition: number;
5+
msg?: string;
6+
timedOut?: boolean;
7+
change: number;
8+
completed: boolean;
9+
}
10+
11+
interface Config {
12+
dir: string;
13+
tutorialDir: string;
14+
taskPosition: number;
15+
}
16+
17+
interface Log {
18+
type: string;
19+
output: any;
20+
}
21+
}

src/typings/cr/tutorial.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
declare namespace Tutorial {
2+
interface Info {
3+
name: string;
4+
version: string;
5+
latest?: boolean;
6+
description?: string;
7+
keywords?: string[];
8+
}
9+
10+
interface Config {
11+
language: string;
12+
dir: string;
13+
runner: string;
14+
runnerOptions?: Object;
15+
run: any;
16+
testSuffix?: string;
17+
issuesPath?: string;
18+
repo?: string;
19+
edit?: boolean;
20+
}
21+
22+
interface PJ {
23+
name: string;
24+
repository?: Object;
25+
bugs?: Object;
26+
config: {
27+
language: string;
28+
runner: string;
29+
runnerOptions: RunnerOptions;
30+
};
31+
engines: Object;
32+
keywords: string[];
33+
files: string[];
34+
main: string;
35+
description: string;
36+
version: string;
37+
author?: string;
38+
authors?: string;
39+
dependencies?: Object;
40+
devDependencies?: Object;
41+
peerDependencies?: Object;
42+
license?: string;
43+
contributers?: string[];
44+
}
45+
46+
interface RunnerOptions { }
47+
48+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module 'sort-package-json' {
2+
export function sortPackageJson(package: string): string;
3+
}

tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,18 @@
4444
"src/typings/chalk/chalk.d.ts",
4545
"src/typings/commander/commander.d.ts",
4646
"src/typings/cr.d.ts",
47+
"src/typings/cr/cli.d.ts",
48+
"src/typings/cr/core.d.ts",
49+
"src/typings/cr/cr.d.ts",
50+
"src/typings/cr/globals.d.ts",
51+
"src/typings/cr/test.d.ts",
52+
"src/typings/cr/tutorial.d.ts",
4753
"src/typings/es6-promise/es6-promise.d.ts",
4854
"src/typings/globals.d.ts",
4955
"src/typings/node-file-exists/index.d.ts",
5056
"src/typings/node/node.d.ts",
5157
"src/typings/prompt/prompt.d.ts",
58+
"src/typings/sort-package-json/index.d.ts",
5259
"src/typings/tsd.d.ts",
5360
"src/update/index.ts"
5461
],

0 commit comments

Comments
 (0)