From 9d2b44d4c7860a80b4f6e02e54c580180cd8e42b Mon Sep 17 00:00:00 2001 From: Duc Trung LE Date: Tue, 21 Nov 2023 16:18:39 +0100 Subject: [PATCH] Simplifying occ build script --- .github/workflows/build.yml | 6 +----- packages/opencascade/.gitignore | 5 ----- packages/opencascade/build.yml | 1 + packages/opencascade/build_opencascade_wasm.js | 3 +-- packages/opencascade/package.json | 9 ++++++--- packages/opencascade/src/index.ts | 7 ++----- packages/opencascade/src/jupytercad.opencascade.d.ts | 1 + .../opencascade/src/jupytercad.opencascade.wasm.d.ts | 1 + yarn.lock | 6 ++++-- 9 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 packages/opencascade/.gitignore create mode 100644 packages/opencascade/src/jupytercad.opencascade.d.ts create mode 100644 packages/opencascade/src/jupytercad.opencascade.wasm.d.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 437b47d7..4d5234d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,9 +99,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install Python uses: actions/setup-python@v4 with: @@ -119,8 +116,7 @@ jobs: # Remove NodeJS, twice to take care of system and locally installed node versions. sudo rm -rf $(which node) sudo rm -rf $(which node) - ls jupyercad-core - ls jupyercad-core/dist + find . | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/" cp jupyercad-core/dist/jupytercad*.whl jupyercad-lab/dist/jupytercad*.whl jupyercad-app/dist/jupytercad*.whl . python -m pip install "jupyterlab>=4.0.0" jupytercad*.whl diff --git a/packages/opencascade/.gitignore b/packages/opencascade/.gitignore deleted file mode 100644 index 018d4615..00000000 --- a/packages/opencascade/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -src/*.wasm -src/*.js -src/*.d.ts -src/*.yml -src/*.version diff --git a/packages/opencascade/build.yml b/packages/opencascade/build.yml index 3227eea5..8f828464 100644 --- a/packages/opencascade/build.yml +++ b/packages/opencascade/build.yml @@ -84,6 +84,7 @@ mainBuild: - symbol: TopoDS_Face - symbol: TopoDS_Iterator - symbol: TopoDS_Shape + - symbol: TopoDS_Shell - symbol: TopoDS_Wire - symbol: TopTools_IndexedDataMapOfShapeListOfShape - symbol: TopTools_IndexedMapOfShape diff --git a/packages/opencascade/build_opencascade_wasm.js b/packages/opencascade/build_opencascade_wasm.js index 5fb95ca3..f9e28f06 100644 --- a/packages/opencascade/build_opencascade_wasm.js +++ b/packages/opencascade/build_opencascade_wasm.js @@ -11,7 +11,7 @@ const yaml = require('js-yaml'); const path = require('path'); const IMAGE_NAME = 'donalffons/opencascade.js:2.0.0-beta.b5ff984'; -const OPEN_CASCADE_DIR = 'src'; +const OPEN_CASCADE_DIR = 'lib'; const VERSION_FILE_NAME = 'jupytercad.opencascade.version'; const VERSION_FILE_PATH = path.join(OPEN_CASCADE_DIR, VERSION_FILE_NAME); const BUILD_FILE_NAME = 'build.yml'; @@ -41,7 +41,6 @@ function checkNeedsRebuild() { needsRebuild = false; } } - return needsRebuild; } diff --git a/packages/opencascade/package.json b/packages/opencascade/package.json index adfbd3fa..f022946f 100644 --- a/packages/opencascade/package.json +++ b/packages/opencascade/package.json @@ -28,12 +28,15 @@ "url": "https://github.com/jupytercad/jupytercad.git" }, "scripts": { - "build": "node build_opencascade_wasm.js && tsc && copyfiles --up 1 src/*.d.ts src/*.js src/*.wasm lib", - "build:prod": "node build_opencascade_wasm.js && tsc && copyfiles --up 1 src/*.d.ts src/*.js src/*.wasm lib" + "build": "tsc && node build_opencascade_wasm.js", + "build:prod": "tsc && node build_opencascade_wasm.js", + "clean": "rimraf tsconfig.tsbuildinfo lib" }, "devDependencies": { "copyfiles": "^2.4.1", - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "rimraf": "^3.0.2", + "typescript": "^5" }, "publishConfig": { "access": "public" diff --git a/packages/opencascade/src/index.ts b/packages/opencascade/src/index.ts index 32989ce8..51cef5fb 100644 --- a/packages/opencascade/src/index.ts +++ b/packages/opencascade/src/index.ts @@ -1,12 +1,9 @@ import initOpenCascade from 'opencascade.js'; -import opencascade from './jupytercad.opencascade.js'; -// eslint-disable-next-line no-undef -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore +import opencascade from './jupytercad.opencascade'; import opencascadeWasm from './jupytercad.opencascade.wasm'; -export * as OCC from './jupytercad.opencascade.js'; +export * as OCC from './jupytercad.opencascade'; export async function initializeOpenCascade() { return initOpenCascade({ diff --git a/packages/opencascade/src/jupytercad.opencascade.d.ts b/packages/opencascade/src/jupytercad.opencascade.d.ts new file mode 100644 index 00000000..e3dff3ef --- /dev/null +++ b/packages/opencascade/src/jupytercad.opencascade.d.ts @@ -0,0 +1 @@ +export default null as any; diff --git a/packages/opencascade/src/jupytercad.opencascade.wasm.d.ts b/packages/opencascade/src/jupytercad.opencascade.wasm.d.ts new file mode 100644 index 00000000..e3dff3ef --- /dev/null +++ b/packages/opencascade/src/jupytercad.opencascade.wasm.d.ts @@ -0,0 +1 @@ +export default null as any; diff --git a/yarn.lock b/yarn.lock index 21428cb4..3bcec052 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1101,6 +1101,8 @@ __metadata: copyfiles: ^2.4.1 js-yaml: ^4.1.0 opencascade.js: beta + rimraf: ^3.0.2 + typescript: ^5 languageName: unknown linkType: soft @@ -12072,11 +12074,11 @@ __metadata: "typescript@patch:typescript@>=3 < 6#~builtin, typescript@patch:typescript@^5#~builtin": version: 5.2.2 - resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=f3b441" + resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=85af82" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 0f4da2f15e6f1245e49db15801dbee52f2bbfb267e1c39225afdab5afee1a72839cd86000e65ee9d7e4dfaff12239d28beaf5ee431357fcced15fb08583d72ca + checksum: 07106822b4305de3f22835cbba949a2b35451cad50888759b6818421290ff95d522b38ef7919e70fb381c5fe9c1c643d7dea22c8b31652a717ddbd57b7f4d554 languageName: node linkType: hard