From 3cc72841051809e4fd86f8db4b14215dabb4dba6 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sun, 9 Jul 2023 18:31:06 +0000 Subject: [PATCH 1/8] Updated Webpack Config Files Signed-off-by: Adithya Krishna --- webpack.common.js | 46 ++++++++++++++++++++++++++-------------------- webpack.dev.js | 10 ++++------ webpack.prod.js | 13 +++++-------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/webpack.common.js b/webpack.common.js index ef77cc90f..77bd37913 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,4 +1,3 @@ -/* eslint-disable no-undef*/ const path = require("path"); const webpack = require("webpack"); const pkg = require("./package.json"); @@ -8,41 +7,48 @@ const banner = `${pkg.name} v${pkg.version} ${pkg.description} Author: ${pkg.author}`; -module.exports = { +module.exports = { target: "web", - entry: {'3Dmol':["./src/index.ts", - "./src/SurfaceWorker.js", - "./src/exporter.js" - ], - '3Dmol.ui': [ "./src/ui/ui.js", + entry: { + '3Dmol': [ + "./src/index.ts", + "./src/SurfaceWorker.js", + "./src/exporter.js" + ], + '3Dmol.ui': [ + "./src/ui/ui.js", "./src/ui/state.js", "./src/ui/icon.js", - "./src/ui/form.js", - "./src/ui/defaultValues.js"]}, + "./src/ui/form.js", + "./src/ui/defaultValues.js" + ] + }, output: { path: path.resolve(__dirname, "build"), - globalObject: "this", + filename: "[name].js", library: '[name]', libraryTarget: "umd", + globalObject: "this" }, - resolve: { extensions: [".ts", ".tsx", ".js", ".json"], }, - module: { rules: [ - { test: /\.tsx?$/, loader: "ts-loader"}, - { test: /\.frag/, loader: "raw-loader" }, - { test: /\.vert/, loader: "raw-loader" } + { test: /\.tsx?$/, loader: "ts-loader" }, + { test: /\.frag$/, loader: "raw-loader" }, + { test: /\.vert$/, loader: "raw-loader" } ], }, - plugins: [ new webpack.ProvidePlugin({ - MMTF: path.resolve(__dirname, "./src/vendor/mmtf.js"), - $: "jquery" + MMTF: path.resolve(__dirname, "./src/vendor/mmtf.js"), + $: "jquery" }), - new webpack.BannerPlugin({ banner }), - new ESLintPlugin()], + new webpack.BannerPlugin({ banner }), + new ESLintPlugin() + ], + stats: { + errorDetails: true, + } }; diff --git a/webpack.dev.js b/webpack.dev.js index e590d9b31..c7172852f 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,12 +1,10 @@ -/* eslint-disable no-undef*/ - const { merge } = require('webpack-merge'); const common = require('./webpack.common.js'); module.exports = merge(common, { -mode: 'development', -devtool: 'inline-source-map', + mode: 'development', + devtool: 'inline-source-map', output: { - filename: `[name].js`, - } + filename: '[name].js', + }, }); diff --git a/webpack.prod.js b/webpack.prod.js index 639bb3560..29ab67233 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -1,28 +1,25 @@ -/* eslint-disable no-undef*/ - const { merge } = require('webpack-merge'); const common = require('./webpack.common.js'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = merge(common, { - mode: 'production', + mode: "production", optimization: { - usedExports: false, //essential for pulling in $3Dmol namespace + usedExports: false, minimizer: [ new TerserPlugin({ parallel: true, terserOptions: { keep_classnames: true, compress: true, - mangle: - { + mangle: { reserved: ["MarchingCube"], - } + }, }, }), ], }, output: { filename: `[name]-min.js`, - } + }, }); From 52971413ed95b35cec47490191080cf28385aa30 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sun, 9 Jul 2023 18:50:49 +0000 Subject: [PATCH 2/8] Add Citation File Signed-off-by: Adithya Krishna --- CITATION.cff | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 000000000..2b0cbe125 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,29 @@ +cff-version: 1.2.0 +title: '3Dmol.js: molecular visualization with WebGL' +message: If you use 3Dmol.js, please cite our Bioinformatics paper +type: software +authors: + - given-names: David + family-names: Koes + email: dkoes@pitt.edu + affiliation: University of Pittsburgh + orcid: 'https://orcid.org/0000-0002-6892-6614' + - given-names: Nicholas + family-names: Rego + affiliation: University of Pittsburgh + orcid: 'https://orcid.org/0000-0002-3164-6803' +identifiers: + - type: doi + value: 10.1093/bioinformatics/btu829 +repository-code: 'https://github.com/3dmol/3Dmol.js' +url: 'https://3dmol.org/' +abstract: >- + 3Dmol.js is a modern, object-oriented JavaScript library + that uses the latest web technologies to provide + interactive, hardware-accelerated three-dimensional + representations of molecular data without the need to + install browser plugins or Java. 3Dmol.js provides a full + featured API for developers as well as a straightforward + declarative interface that lets users easily share and + embed molecular data in websites. +license: BSD-3-Clause \ No newline at end of file From 4c988040304bf7c0035e799257b51f3421e9c041 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sun, 9 Jul 2023 19:04:34 +0000 Subject: [PATCH 3/8] Check and Remove Build Script Signed-off-by: Adithya Krishna --- .github/workflows/CI.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a35b1c6be..4d54b774f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,12 +19,6 @@ jobs: - name: Install Dependencies run: npm install - - - name: Build 3Dmol.js - run: | - npm run build:dev - npm run build:prod - npm run generate:tests - name: Test run: npm test From 6afa98ac9169b57896c3cd6fc28926fb8fb4732a Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sun, 9 Jul 2023 19:08:39 +0000 Subject: [PATCH 4/8] Added Change Explain Comment Signed-off-by: Adithya Krishna --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4d54b774f..3d29672fd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,7 +17,8 @@ jobs: with: node-version: 20 - - name: Install Dependencies + # As our package has a postInstall script, we dont need a explicit job for that + - name: Install & Build Dependencies run: npm install - name: Test From 91926b08dfbd40682b91b97a33f5b59ad5b748ab Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sun, 9 Jul 2023 19:15:44 +0000 Subject: [PATCH 5/8] Added EOL to Citation File Signed-off-by: Adithya Krishna --- .github/workflows/CI.yml | 2 +- CITATION.cff | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3d29672fd..63a0b0942 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,7 +17,7 @@ jobs: with: node-version: 20 - # As our package has a postInstall script, we dont need a explicit job for that + # As our package has a postInstall script, which in turn calls `npm run build`, hence we do not need a explicit job for that - name: Install & Build Dependencies run: npm install diff --git a/CITATION.cff b/CITATION.cff index 2b0cbe125..6889d5348 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -26,4 +26,4 @@ abstract: >- featured API for developers as well as a straightforward declarative interface that lets users easily share and embed molecular data in websites. -license: BSD-3-Clause \ No newline at end of file +license: BSD-3-Clause From e366b289339f5e623e22fbb6fa0ff1ddb9e323ce Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Mon, 10 Jul 2023 04:18:15 +0000 Subject: [PATCH 6/8] Updated CodeQL Workflow Signed-off-by: Adithya Krishna --- .github/workflows/CodeQL-Analysis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CodeQL-Analysis.yml b/.github/workflows/CodeQL-Analysis.yml index 48161ab09..79c62a9c3 100644 --- a/.github/workflows/CodeQL-Analysis.yml +++ b/.github/workflows/CodeQL-Analysis.yml @@ -39,14 +39,10 @@ jobs: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - - name: Install Dependencies + # As our package has a postInstall script, which in turn calls `npm run build`, hence we do not need a explicit job for that + - name: Install & Build Dependencies run: npm install - - name: Build 3dmol.js - run: | - npm run build:dev - npm run build:prod - - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: From 3c43b43a2a921f266f9bdaaeb23aa3d375b0f495 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Mon, 10 Jul 2023 07:20:35 +0000 Subject: [PATCH 7/8] Updated CodeQL Workflow - v2 Signed-off-by: Adithya Krishna --- .github/workflows/CodeQL-Analysis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CodeQL-Analysis.yml b/.github/workflows/CodeQL-Analysis.yml index 79c62a9c3..7aff36b14 100644 --- a/.github/workflows/CodeQL-Analysis.yml +++ b/.github/workflows/CodeQL-Analysis.yml @@ -39,9 +39,15 @@ jobs: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - # As our package has a postInstall script, which in turn calls `npm run build`, hence we do not need a explicit job for that - - name: Install & Build Dependencies - run: npm install + # For CodeQL, we don't need to generate tests or doc, hence running only install + - name: Install Dependencies + run: npm install --ignore-scripts + + # Build for dev and prod + - name: Build 3dmol.js + run: | + npm run build:dev + npm run build:prod - name: Initialize CodeQL uses: github/codeql-action/init@v2 From b72635908cef3550a163316c9b3d281307ca9582 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Mon, 10 Jul 2023 07:21:33 +0000 Subject: [PATCH 8/8] Updated Comments for CI Signed-off-by: Adithya Krishna --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 63a0b0942..c423c3fa8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,7 +18,7 @@ jobs: node-version: 20 # As our package has a postInstall script, which in turn calls `npm run build`, hence we do not need a explicit job for that - - name: Install & Build Dependencies + - name: Install Dependencies & Build 3dmol.js run: npm install - name: Test