diff --git a/.eslintignore b/.eslintignore index 5c99ba7..445ebe7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,6 @@ dist coverage **/*.d.ts tests + +**/__tests__ +ui-tests \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a400be3..7c9b3d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,46 +11,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: '12.x' + node-version: 18 + cache: 'yarn' + cache-dependency-path: yarn.lock - name: Install Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.7' - architecture: 'x64' - - - - name: Setup pip cache - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-3.7-${{ hashFiles('package.json') }} - restore-keys: | - pip-3.7- - pip- - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Setup yarn cache - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - yarn- - - - name: Install dependencies - run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 - - name: Build the extension + python-version: 3.11 + cache: 'pip' + - name: Install the extension + run: python -m pip install . + - name: Update markupsafe + run: python -m pip install markupsafe==2.0.1 + - name: Check the extension run: | jlpm jlpm run eslint:check - python -m pip install . RED=`tput -T xterm setaf 1` GREEN=`tput -T xterm setaf 2` SERVER_EXT=`jupyter serverextension list 2>&1` @@ -60,5 +40,4 @@ jobs: echo "$SERVER_EXT" echo -n "lab extension install " grep -e "jupyterlab-slurm.*enabled.*OK" <<< $LAB_EXT && echo "${GREEN}PASS" || echo "${RED}FAIL" - echo "$LAB_EXT" - python -m jupyterlab.browser_check + echo "$LAB_EXT" \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index 6432e2b..a12698c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1 @@ -module.exports = { - presets: [ - ['@babel/preset-env', { targets: { node: 'current' } }], - '@babel/preset-typescript', - ], -}; \ No newline at end of file +module.exports = require('@jupyterlab/testutils/lib/babel.config'); \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 613daf3..eb83717 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,10 +1,38 @@ +const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config'); + +const jlabConfig = jestJupyterLab(__dirname); + +const { + moduleFileExtensions, + moduleNameMapper, + preset, + setupFilesAfterEnv, + setupFiles, + testPathIgnorePatterns, + transform +} = jlabConfig; + module.exports = { - preset: 'ts-jest/presets/js-with-babel', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'], - globals: { - 'ts-jest': { - tsConfig: 'tsconfig.json' - } - }, + moduleFileExtensions, + moduleNameMapper, + preset, + setupFilesAfterEnv, + setupFiles, + testPathIgnorePatterns, + transform, + automock: false, + collectCoverageFrom: [ + 'src/**/*.{ts,tsx}', + '!src/**/*.d.ts', + '!src/**/.ipynb_checkpoints/*' + ], + coverageDirectory: 'coverage', + coverageReporters: ['lcov', 'text'], + globals: { + 'ts-jest': { + tsconfig: 'tsconfig.json' + } + }, + testRegex: 'src/.*/.*.spec.ts[x]?$', + transformIgnorePatterns: ['/node_modules/(?!@jupyterlab/.+)'] }; diff --git a/package.json b/package.json index 180b961..640badc 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jupyterlab-slurm", - "version": "3.0.2", + "version": "3.1.0", "description": "A JupyterLab extension to interface with the Slurm workload manager.", "keywords": [ "jupyter", @@ -56,34 +56,28 @@ "watch:src": "tsc -w" }, "dependencies": { - "@jupyterlab/application": "^3.0.10", - "@jupyterlab/apputils": "^3.0.6", - "@jupyterlab/coreutils": "^5.0.4", - "@jupyterlab/filebrowser": "^3.0.8", - "@jupyterlab/launcher": "^3.0.6", - "@jupyterlab/services": "^6.0.6", - "@jupyterlab/testutils": "^2.1.2", - "@lumino/widgets": "1.19.0", - "@types/bootstrap": "^4.3.0", - "@types/lodash": "^4.14.138", - "@types/node": "^11.13.7", - "@types/react": "^17.0.4", - "@types/styled-components": "^5.1.10", - "bootstrap": "^4.2.1", + "@jupyterlab/application": "^3.0.0", + "@jupyterlab/launcher": "^3.0.0", + "@jupyterlab/filebrowser": "^3.0.0", + "@jupyterlab/ui-components": "^3.0.0", + "@jupyterlab/coreutils": "^5.0.0", + "@jupyterlab/services": "^6.0.0", "lodash": "^4.17.15", - "popper.js": "^1.15.0", - "react": "^17.0.1", - "react-bootstrap": "^1.0.1", + "react-popper": "^1.3.11", "react-data-table-component": "^6.11.7", - "react-dom": "^17.0.1", "react-icons": "^4.2.0", "react-spinners": "^0.11.0", "styled-components": "^5.3.0", - "uuid": "^8.1.0" + "uuid": "^8.1.0", + "bootstrap": "^4.6.2", + "react-bootstrap": "^1.0.1" }, "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", "@jupyterlab/builder": "^3.0.0", - "@types/jest": "^26.0.3", + "@types/lodash": "^4.14.138", + "@types/styled-components": "^5.1.10", "@types/uuid": "^8.3.0", "@typescript-eslint/eslint-plugin": "^4.28.1", "@typescript-eslint/parser": "^4.28.1", @@ -94,12 +88,10 @@ "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", - "jest": "^26.1.0", "mkdirp": "^1.0.3", "npm-run-all": "^4.1.5", "prettier": "^2.1.1", "rimraf": "^3.0.2", - "ts-jest": "^26.1.1", "typescript": "~4.1.3", "yarn-deduplicate": "^1.1.1" }, @@ -119,6 +111,7 @@ "outputDir": "jupyterlab_slurm/labextension" }, "resolutions": { - "@lumino/widgets": "~1.19.0" + "@jupyterlab/rendermime-interfaces": "^3.0.0 <= 3.6.3", + "@types/react": "^17.0.4" } } diff --git a/pyproject.toml b/pyproject.toml index ba04c53..5aa6d81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"] +requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc13,==3.*", "jupyterlab_pygments<0.3.0", "setuptools>=40.8.0", "wheel"] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 82b9fff..e9b7a53 100644 --- a/setup.py +++ b/setup.py @@ -73,21 +73,21 @@ cmdclass=cmdclass, packages=setuptools.find_packages(), install_requires=[ - "jupyterlab~=3.0", + "jupyterlab>=3.0.0rc13,==3.*", "jupyterlab_pygments<0.3.0" ], zip_safe=False, include_package_data=True, - python_requires=">=3.6", + python_requires=">=3.8", platforms="Linux, Mac OS X, Windows", keywords=["Jupyter", "JupyterLab", "JupyterLab3"], classifiers=[ "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Framework :: Jupyter", ], ) diff --git a/src/components/JobSubmitForm.tsx b/src/components/JobSubmitForm.tsx index 478c10c..eb9388d 100755 --- a/src/components/JobSubmitForm.tsx +++ b/src/components/JobSubmitForm.tsx @@ -23,7 +23,7 @@ namespace types { export type State = { filebrowser: FileBrowser; - fileitems: JSX.Element[]; + fileitems: React.JSX.Element[]; inputType: string; inputPathSelectType: string; filepath: string; @@ -56,7 +56,7 @@ export default class JobSubmitForm extends React.Component< * component was clicked on and is now visible). If changed * to true, it calls the updateFileitems() function */ - componentDidUpdate(prevProps: types.Props, prevState: types.State): void { + componentDidUpdate(prevProps: types.Props): void { if (prevProps.active !== this.props.active) { if (this.props.active) { this.updateFileitems(); @@ -69,7 +69,7 @@ export default class JobSubmitForm extends React.Component< * and creates an array of