Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build hydrogen using parcel #2116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,40 @@ on:
# - master

jobs:
Build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
atom_channel:
- stable
steps:
- uses: actions/checkout@v2
- uses: atom-community/action-setup-atom@v1
with:
channel: ${{ matrix.atom_channel }}

- name: Install dependencies and build
run: |
apm install

npm run clean
npm run tsc || echo done

npm run build

- name: Upload built files
uses: actions/upload-artifact@v2
with:
path: |
./dist

Test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
needs: Build
name: ${{ matrix.os }} - Atom ${{ matrix.atom_channel }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -24,10 +56,19 @@ jobs:
with:
channel: ${{ matrix.atom_channel }}

- name: Install dependencies and build
- name: Download articats
uses: actions/download-artifact@v2
- name: Place artifacts
shell: bash
run: |
rm -rf ./dist
mkdir ./dist
cp -r ./artifact/* ./dist
rm -rf ./artifact

- name: Install dependencies
run: |
apm install
npm run build

- name: Run tests 👩🏾‍💻
run: npm run test
Expand All @@ -54,10 +95,3 @@ jobs:

- name: Lint ✨
run: npm run test.lint

Skip:
if: contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Skip CI 🚫
run: echo skip ci
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
public-hoist-pattern[]=*
package-lock=false
lockfile=true
prefer-frozen-lockfile=false
6 changes: 6 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
}
5 changes: 3 additions & 2 deletions lib/ws-kernel-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import isEmpty from "lodash/isEmpty";
import tildify from "tildify";
import { v4 } from "uuid";
import ws from "ws";
import { XMLHttpRequest as NodeXMLHttpRequest } from "xmlhttprequest"; // TODO use @aminya/xmlhttprequest
import { URL } from "url";
import { Kernel, Session, ServerConnection } from "@jupyterlab/services";
import Config from "./config";
Expand Down Expand Up @@ -198,7 +197,9 @@ export default class WSKernelPicker {
options.requestHeaders.Cookie = cookie;

options.xhrFactory = () => {
const request = new NodeXMLHttpRequest();
// we use xmlhttprequest because it allows disabling header protection
const { XMLHttpRequest } = require("xmlhttprequest"); // TODO use @aminya/xmlhttprequest
const request = new XMLHttpRequest();
// Disable protections against setting the Cookie header
request.setDisableHeaderCheck(true);
return request as XMLHttpRequest; // TODO fix the types
Expand Down
48 changes: 43 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Hydrogen",
"main": "./dist/main",
"main": "./dist/main.js",
"version": "2.16.3",
"description": "Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.",
"author": "nteract contributors",
Expand Down Expand Up @@ -43,14 +43,13 @@
"test": "echo 'test without rebuilding' && atom --test spec",
"clean": "shx rm -rf dist",
"clean.prod": "shx rm -rf ./dist/**/*.d.ts ./dist/tsconfig.tsbuildinfo",
"dev": "npm run clean && tsc -p lib/tsconfig.json --watch",
"tsc": "tsc -p lib/tsconfig.json || echo done",
"build": "npm run clean && npm run tsc && npm run clean.prod",
"dev": "npm run tsc -- --watch",
"build": "cross-env NODE_ENV=production parcel build ./lib/main.ts --detailed-report",
"build:services-docs": "markdox lib/services/index.js -o lib/services/README.md",
"build:plugin-docs": "markdox lib/plugin-api/hydrogen-provider.js lib/plugin-api/hydrogen-kernel.js -o docs/PluginAPI.md",
"build:docs": "npm run build:plugin-docs && npm run build:services-docs",
"build-commit": "build-commit -o dist",
"prepare": "npm run build"
"build-commit": "npm run clean && build-commit -o dist"
},
"atomTestRunner": "atom-jasmine3-test-runner",
"repository": "https://github.com/nteract/hydrogen",
Expand Down Expand Up @@ -113,6 +112,8 @@
}
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.14.2",
"@nteract/types": "^7.1.7",
"@types/atom": "^1.40.10",
"@types/enzyme": "^3.10.8",
Expand All @@ -128,15 +129,52 @@
"@types/ws": "^7.4.1",
"atom-jasmine3-test-runner": "^5.2.5",
"build-commit": "^0.1.4",
"cross-env": "^7.0.3",
"electron": "^6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint-config-atomic": "^1.14.4",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
"markdox": "^0.1.10",
"parcel": "^2.0.0-beta.3.1",
"prettier-config-atomic": "^2.0.5",
"react-test-renderer": "^17.0.2",
"shx": "^0.3.3",
"typescript": "^4.2.4"
},
"targets": {
"main": {
"context": "electron-renderer",
"engines": {
"electron": ">=6.x"
},
"includeNodeModules": {
"atom": false,
"electron": false,
"@aminya/zeromq": false,
"canvas": false,
"react": false,
"react-dom": false,
"react-refresh": false,
"mobx-react": false,
"@nteract/plotly": false,
"refractor": false,
"highlight.js": false,
"mathjax-electron": false,
"xmlhttprequest": false
},
"isLibrary": true
}
},
"alias": {
"async": "async/index.js",
"moment": "moment/src/moment.js",
"mobx": "mobx/lib/mobx.module.js",
"immutable": "immutable/dist/immutable.es.js",
"@emotion/stylis": "@emotion/stylis/dist/stylis.esm.js",
"re-resizable": "re-resizable/lib/index.js",
"react-syntax-highlighter": "react-syntax-highlighter/dist/esm/index.js",
"react-syntax-highlighter/dist/cjs/styles/prism/vs": "react-syntax-highlighter/dist/esm/styles/prism/vs.js",
"react-syntax-highlighter/dist/cjs/styles/prism/xonokai": "react-syntax-highlighter/dist/esm/styles/prism/xonokai.js"
}
}