Skip to content

Commit f2abd52

Browse files
fcollonvaljaipreet-s
authored andcommitted
Port to JupyterLab v1 (#374)
* First compilable version * Style update * Restore Jest unit tests * Remove dependency to @jupyterlab/testutils * Correct icon sizing
1 parent b2b36ff commit f2abd52

21 files changed

+2842
-2161
lines changed

babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current'
8+
}
9+
}
10+
]
11+
]
12+
};

jest.config.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
'use strict';
2-
31
module.exports = {
4-
transform: {
5-
'^.+\\.tsx?$': 'ts-jest'
6-
},
2+
automock: false,
73
moduleNameMapper: {
84
'\\.(css|less|sass|scss)$': 'identity-obj-proxy'
95
},
10-
testRegex: '/tests/test-.*/.*.spec.ts[x]?$',
6+
preset: 'ts-jest/presets/js-with-babel',
117
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8+
setupFiles: ['./setupJest.js'],
129
testPathIgnorePatterns: ['/dev_mode/', '/lib/', '/node_modules/'],
13-
automock: false,
14-
setupFiles: ['./setupJest.js']
10+
testRegex: '/tests/test-.*/.*.spec.ts[x]?$',
11+
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
12+
globals: {
13+
'ts-jest': {
14+
tsConfig: 'tsconfig.json'
15+
}
16+
}
1517
};

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.6.0",
44
"description": "A JupyterLab extension for version control using git",
55
"main": "lib/index.js",
6+
"style": "style/index.css",
67
"license": "BSD-3-Clause",
78
"author": "Git Intern Team - Jenna Landy, Noah Stapp, Alena Mueller; AWS - Jaipreet Singh, Neelam Gehlot; Quansight - Saul Shanabrook",
89
"keywords": [
@@ -38,42 +39,41 @@
3839
}
3940
},
4041
"dependencies": {
41-
"@jupyterlab/application": "^0.19.1",
42-
"@jupyterlab/apputils": "^0.19.1",
43-
"@jupyterlab/console": "^0.19.1",
44-
"@jupyterlab/coreutils": "^2.0.2",
45-
"@jupyterlab/filebrowser": "^0.19.1",
46-
"@jupyterlab/mainmenu": "^0.8.1",
47-
"@jupyterlab/services": "^3.1.0",
48-
"@jupyterlab/terminal": "^0.19.1",
49-
"@jupyterlab/theming": "^0.9.0",
50-
"@phosphor/widgets": "^1.6.0",
51-
"identity-obj-proxy": "^3.0.0",
52-
"nbdime": "^4.0.1",
53-
"react": "~16.4.2",
54-
"react-dom": "~16.4.2",
55-
"react-toggle-display": "^2.2.0",
42+
"@jupyterlab/application": "^1.0.0",
43+
"@jupyterlab/apputils": "^1.0.0",
44+
"@jupyterlab/console": "^1.0.0",
45+
"@jupyterlab/coreutils": "^3.0.0",
46+
"@jupyterlab/filebrowser": "^1.0.0",
47+
"@jupyterlab/mainmenu": "^1.0.0",
48+
"@jupyterlab/services": "^4.0.0",
49+
"@jupyterlab/terminal": "^1.0.0",
50+
"@phosphor/widgets": "^1.8.0",
51+
"react": "~16.8.4",
52+
"react-dom": "~16.8.4",
5653
"typestyle": "^2.0.1"
5754
},
5855
"devDependencies": {
56+
"@babel/core": "^7.5.0",
57+
"@babel/preset-env": "^7.5.0",
5958
"@types/enzyme": "3.1.15",
60-
"@types/jest": "^23.3.5",
61-
"@types/react": "~16.4.13",
59+
"@types/jest": "^24",
60+
"@types/react": "~16.8.13",
6261
"@types/react-dom": "~16.0.5",
6362
"enzyme": "3.7.0",
6463
"enzyme-adapter-react-16": "1.7.0",
6564
"husky": "1.3.1",
66-
"jest": "^23.6.0",
65+
"identity-obj-proxy": "^3.0.0",
66+
"jest": "^24",
6767
"jest-fetch-mock": "^1.6.6",
6868
"lint-staged": "8.1.5",
6969
"prettier": "1.16.4",
7070
"puppeteer": "^1.10.0",
7171
"rimraf": "^2.6.1",
72-
"ts-jest": "^23.10.4",
72+
"ts-jest": "^24",
7373
"tslint": "^5.11.0",
7474
"tslint-config-prettier": "1.18.0",
7575
"tslint-plugin-prettier": "^2.0.0",
76-
"typescript": "~3.1.2",
76+
"typescript": "~3.5.1",
7777
"typescript-tslint-plugin": "0.3.1"
7878
},
7979
"directories": {
@@ -102,6 +102,6 @@
102102
},
103103
"homepage": "https://github.com/jupyterlab/jupyterlab-git",
104104
"resolutions": {
105-
"@types/react": "~16.4.13"
105+
"@types/react": "~16.8.4"
106106
}
107107
}

src/components/FileItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JupyterLab } from '@jupyterlab/application';
1+
import { JupyterFrontEnd } from '@jupyterlab/application';
22

33
import {
44
changeStageButtonStyle,
@@ -34,7 +34,7 @@ export interface IFileItemProps {
3434
topRepoPath: string;
3535
file: any;
3636
stage: string;
37-
app: JupyterLab;
37+
app: JupyterFrontEnd;
3838
refresh: any;
3939
moveFile: Function;
4040
discardFile: Function;

src/components/FileList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Dialog, showDialog } from '@jupyterlab/apputils';
22

3-
import { JupyterLab } from '@jupyterlab/application';
3+
import { JupyterFrontEnd } from '@jupyterlab/application';
44

55
import { Menu } from '@phosphor/widgets';
66

@@ -75,7 +75,7 @@ export interface IFileListProps {
7575
stagedFiles: any;
7676
unstagedFiles: any;
7777
untrackedFiles: any;
78-
app: JupyterLab;
78+
app: JupyterFrontEnd;
7979
refresh: any;
8080
sideBarExpanded: boolean;
8181
display: boolean;
@@ -307,7 +307,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
307307
typeX: string,
308308
typeY: string,
309309
path: string,
310-
app: JupyterLab
310+
app: JupyterFrontEnd
311311
) {
312312
if (typeX === 'D' || typeY === 'D') {
313313
showDialog({

src/components/GitPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { JupyterLab } from '@jupyterlab/application';
3+
import { JupyterFrontEnd } from '@jupyterlab/application';
44

55
import {
66
Git,
@@ -52,7 +52,7 @@ export interface IGitSessionNodeState {
5252

5353
/** Interface for GitPanel component props */
5454
export interface IGitSessionNodeProps {
55-
app: JupyterLab;
55+
app: JupyterFrontEnd;
5656
diff: IDiffCallback;
5757
}
5858

src/components/GitStage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JupyterLab } from '@jupyterlab/application';
1+
import { JupyterFrontEnd } from '@jupyterlab/application';
22

33
import { IGitStatusFileResult } from '../git';
44

@@ -26,7 +26,7 @@ export interface IGitStageProps {
2626
heading: string;
2727
topRepoPath: string;
2828
files: any;
29-
app: JupyterLab;
29+
app: JupyterFrontEnd;
3030
refresh: any;
3131
showFiles: boolean;
3232
displayFiles: Function;

src/components/GitWidget.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Message } from '@phosphor/messaging';
88

99
import { Widget } from '@phosphor/widgets';
1010

11-
import { JupyterLab } from '@jupyterlab/application';
11+
import { JupyterFrontEnd } from '@jupyterlab/application';
1212

1313
import { ISignal, Signal } from '@phosphor/signaling';
1414

@@ -18,8 +18,6 @@ import { gitWidgetStyle } from '../componentsStyle/GitWidgetStyle';
1818

1919
import { IDiffCallback } from '../git';
2020

21-
import '../../style/variables.css';
22-
2321
/**
2422
* An options object for creating a running sessions widget.
2523
*/
@@ -68,7 +66,11 @@ export class GitWidget extends Widget {
6866
/**
6967
* Construct a new running widget.
7068
*/
71-
constructor(app: JupyterLab, options: IOptions, diffFunction: IDiffCallback) {
69+
constructor(
70+
app: JupyterFrontEnd,
71+
options: IOptions,
72+
diffFunction: IDiffCallback
73+
) {
7274
super({
7375
node: (options.renderer || defaultRenderer).createNode()
7476
});

src/components/HistorySideBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JupyterLab } from '@jupyterlab/application';
1+
import { JupyterFrontEnd } from '@jupyterlab/application';
22
import * as React from 'react';
33
import { historySideBarStyle } from '../componentsStyle/HistorySideBarStyle';
44
import { IGitBranchResult, ISingleCommitInfo, IDiffCallback } from '../git';
@@ -10,7 +10,7 @@ export interface IHistorySideBarProps {
1010
branches: IGitBranchResult['branches'];
1111
isExpanded: boolean;
1212
topRepoPath: string;
13-
app: JupyterLab;
13+
app: JupyterFrontEnd;
1414
refresh: () => void;
1515
diff: IDiffCallback;
1616
}

src/components/PastCommitNode.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JupyterLab } from '@jupyterlab/application';
1+
import { JupyterFrontEnd } from '@jupyterlab/application';
22
import * as React from 'react';
33
import { classes } from 'typestyle';
44
import {
@@ -21,7 +21,7 @@ export interface IPastCommitNodeProps {
2121
pastCommit: ISingleCommitInfo;
2222
branches: IGitBranchResult['branches'];
2323
topRepoPath: string;
24-
app: JupyterLab;
24+
app: JupyterFrontEnd;
2525
diff: IDiffCallback;
2626
refresh: () => void;
2727
}

0 commit comments

Comments
 (0)