@platforma-sdk/r-builder 1.1.2 → 1.1.3
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/package.json +1 -1
- package/scripts/lib/util.js +21 -13
package/package.json
CHANGED
package/scripts/lib/util.js
CHANGED
|
@@ -397,29 +397,37 @@ export function buildRDependencies(
|
|
|
397
397
|
|
|
398
398
|
const lockPath = path.join(depsDir, lockFile)
|
|
399
399
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
400
|
+
const lockExists = fs.existsSync(lockPath)
|
|
401
|
+
const initExists = fs.existsSync(path.join(depsDir, initFile))
|
|
402
|
+
|
|
403
|
+
if (initExists && lockExists) {
|
|
404
|
+
throw new Error(
|
|
405
|
+
`directory ${depsDir} cannot have '${lockFile}' and '${initFile}' simultaneously.\n`+
|
|
406
|
+
`Choose either frozen dependencies state (${lockFile}) either dynamic dependencies initialization (${initFile}).\n`+
|
|
407
|
+
`Create empty '${initFile}' file if you really need empty R run environment without any preinstalled dependencies.`
|
|
408
|
+
)
|
|
409
|
+
} else if (initExists) {
|
|
410
|
+
runInRenv(logger, rRoot, ['--no-echo', `--file=${initFile}`], {
|
|
405
411
|
wd: depsDir,
|
|
406
412
|
paths: additionalPaths,
|
|
407
413
|
})
|
|
408
414
|
|
|
409
|
-
|
|
410
|
-
runInRenv(logger, rRoot, ['--no-echo',
|
|
415
|
+
// Force snapshot regeneration to put all installed packages into the lock file.
|
|
416
|
+
runInRenv(logger, rRoot, ['--no-echo', '-e', ...quote(`renv::settings$snapshot.type("all"); renv::snapshot()`)])
|
|
417
|
+
|
|
418
|
+
} else if (lockExists) {
|
|
419
|
+
runInRenv(logger, rRoot, [
|
|
420
|
+
'--no-echo',
|
|
421
|
+
'-e', ...quote(`renv::restore( clean = TRUE )`),
|
|
422
|
+
], {
|
|
411
423
|
wd: depsDir,
|
|
412
424
|
paths: additionalPaths,
|
|
413
425
|
})
|
|
414
426
|
|
|
415
|
-
if (!fs.existsSync(path.join(depsDir, lockFile))) {
|
|
416
|
-
runInRenv(logger, rRoot, ['--no-echo', '-e', ...quote(`renv::snapshot()`)])
|
|
417
|
-
}
|
|
418
|
-
|
|
419
427
|
} else {
|
|
420
428
|
throw new Error(
|
|
421
|
-
`directory ${depsDir} has no ${lockFile} or ${initFile}. No dependencies detected.\n`+
|
|
422
|
-
`Create empty
|
|
429
|
+
`directory ${depsDir} has no '${lockFile}' or '${initFile}'. No dependencies detected.\n`+
|
|
430
|
+
`Create empty '${initFile}' file if you really need empty R run environment without any preinstalled dependencies`
|
|
423
431
|
)
|
|
424
432
|
}
|
|
425
433
|
|