@sjcrh/proteinpaint-front 2.208.0 → 2.210.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,15 +17,9 @@ proteinpaint-client code. Standalone usage outside of a ppfull container is not
17
17
  the container, the command below is used:
18
18
 
19
19
  ```bash
20
- npx proteinpaint-front [URL_PUBLIC_PATH]
20
+ npx proteinpaint-front
21
21
  ```
22
22
 
23
- See `init.js` for details. If the URL_PUBLIC_PATH argument is omitted above, then it will default to `'.'`,
24
- which assumes that the bundle is served by the same PP server. But note that in this case, the web bundle or
25
- server host may NOT be embedded or used as host from other domains, even if CORS is allowed, since script
26
- bundles will not be sourced properly and loaded dynamically.
27
-
28
-
29
23
  ## Develop
30
24
 
31
25
  The usual dev workflow typically focuses on the client workspace development. For troubleshooting builds
package/bundles.tgz CHANGED
Binary file
package/init.js CHANGED
@@ -6,8 +6,6 @@ const ps = require('child_process')
6
6
  const fs = require('fs')
7
7
  const { execSync } = require('child_process')
8
8
 
9
- let URLPATH = process.argv[2] || '.'
10
- if (URLPATH.endsWith('/')) URLPATH = URLPATH.slice(0, -1)
11
9
  const publicBinOnly = process.argv.includes('--publicBinOnly')
12
10
 
13
11
  const CWD = process.cwd()
@@ -25,12 +23,11 @@ const PUBLIC_DIR = `${CWD}/public`
25
23
  // instances serve their CWD/bin. An older image that has no CWD/bin also still works — the server falls
26
24
  // back to serving /bin from public/bin.
27
25
  const BIN_DIR = `${CWD}/bin`
28
- // A distinctively named marker written LAST, only after the bundle is fully extracted AND its __PP_URL__
29
- // placeholder is replaced. It serves two purposes:
30
- // - completion: reuse requires it, so a container that stops mid-generation (after tar creates
31
- // proteinpaint.js but before the URL rewrite, or on a partial extraction) regenerates on its next
32
- // start instead of reusing a partial/unpatched bundle forever — which the health gate can't catch,
33
- // since an unpatched or incomplete proteinpaint.js still returns 200.
26
+ // A distinctively named marker written LAST, only after the bundle is fully extracted. It serves two
27
+ // purposes:
28
+ // - completion: reuse requires it, so a container that stops mid-generation (on a partial extraction)
29
+ // regenerates on its next start instead of reusing an incomplete bundle forever — which the health
30
+ // gate can't catch, since an incomplete proteinpaint.js still returns 200.
34
31
  // - ownership: the server publishes CWD/bin at /bin ONLY when this marker is present (see the server's
35
32
  // app.middlewares.js), so launching the server package from a consumer project never exposes an
36
33
  // unrelated CWD/bin (e.g. that project's own bin/ scripts) over HTTP. The name is distinctive so it
@@ -63,12 +60,10 @@ try {
63
60
  // created container (regenerate) — including after an image update, which always yields a new
64
61
  // container. Because CWD/bin is per-container, there is no shared directory to race on.
65
62
  //
66
- // NOTE: reuse is keyed on the completion marker (a fully extracted, URL-patched bundle), not on its
67
- // version or URL. That is correct for the normal container lifecycle (a new image, or a changed URL,
68
- // arrives with a new container and hence an empty CWD/bin). It would be stale only if the SAME
69
- // container were reused across a bundle or URL change — e.g. CWD/bin persisted via a mounted volume,
70
- // or serverconfig.json remounted with a different URL and merely restarted — uncommon, and outside
71
- // this simple scheme.
63
+ // NOTE: reuse is keyed on the completion marker (a fully extracted bundle), not on its version. That
64
+ // is correct for the normal container lifecycle (a new image arrives with a new container and hence an
65
+ // empty CWD/bin). It would be stale only if the SAME container were reused across a bundle change —
66
+ // e.g. CWD/bin persisted via a mounted volume — uncommon, and outside this simple scheme.
72
67
  if (fs.existsSync(BIN_READY)) {
73
68
  console.log(`bundle already present and complete at ${BIN_DIR}; reusing it`)
74
69
  } else {
@@ -87,21 +82,10 @@ try {
87
82
  if (tar.stderr) {
88
83
  console.warn('Tar command warnings:', tar.stderr)
89
84
  }
90
- console.log(`Setting the dynamic bundle path to ${URLPATH}`)
91
- const codeFile = `${BIN_DIR}/proteinpaint.js`
92
- // remember the modified time before setting the bundle public path
93
- const mtime = fs.statSync(codeFile).mtime
94
- const code = fs.readFileSync(codeFile, { encoding: 'utf8' })
95
- const newcode = code.replace(`__PP_URL__`, `${URLPATH}/bin/`)
96
- fs.writeFileSync(codeFile, newcode, { encoding: 'utf8' })
97
- try {
98
- // reset the atime and mtime to the original mtime before setting the bundle public path
99
- fs.utimesSync(codeFile, mtime, mtime)
100
- } catch (e) {
101
- console.log('--- !!! unable to reset the mtime for the extracted proteinpaint bundle: ', e)
102
- }
85
+ // The bundle needs no URL patching: webpack's output.publicPath is 'auto', so the client derives
86
+ // the /bin/ base path at runtime from the <script> tag it was loaded from (see front/webpack.config.js).
103
87
  // mark generation complete LAST (see BIN_READY above): a crash before this leaves no marker, so
104
- // the next start regenerates rather than reusing a partial or unpatched bundle.
88
+ // the next start regenerates rather than reusing a partial bundle.
105
89
  fs.writeFileSync(BIN_READY, '')
106
90
  }
107
91
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-front",
3
- "version": "2.208.0",
3
+ "version": "2.210.0",
4
4
  "browser": "src/app.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "init.js",
@@ -14,7 +14,7 @@
14
14
  "test:integration": "echo 'TODO: front integration tests'"
15
15
  },
16
16
  "devDependencies": {
17
- "@sjcrh/proteinpaint-client": "2.208.0",
17
+ "@sjcrh/proteinpaint-client": "2.210.0",
18
18
  "webpack": "^5.76.0",
19
19
  "webpack-cli": "^4.9.2",
20
20
  "webpack-node-externals": "^3.0.0"
@@ -32,5 +32,5 @@
32
32
  "url": "https://github.com/stjude/proteinpaint",
33
33
  "directory": "front"
34
34
  },
35
- "_buildTime": "2026-09-13T18:12:02Z"
35
+ "_buildTime": "2026-09-21T18:33:22Z"
36
36
  }