Skip to content
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

* Fixed an issue where `nav_panel_hidden()` could create navs that were still keyboard-discoverable. (#1264)

* Copy files without inheriting read/write/execute permissions fixing issues when using bslib on immutable operating systems. (#1281)

# bslib 0.9.0

## Breaking changes
Expand Down
16 changes: 13 additions & 3 deletions R/bs-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ maybe_precompiled_css <- function(theme, sass_options, precompiled) {
}

dir.create(out_dir)
file.copy(precompiled_css, out_file)
file.copy(precompiled_css, out_file, copy.mode = FALSE)

# Usually sass() would handle file_attachments and dependencies,
# but we need to do this manually
Expand Down Expand Up @@ -176,7 +176,12 @@ sass_compile_theme <- function(theme, sass_options, sass_cache) {
bootstrap_javascript_copy_assets <- function(version, to) {
js_files <- bootstrap_javascript(version)
js_map_files <- bootstrap_javascript_map(version)
success_js_files <- file.copy(c(js_files, js_map_files), to, overwrite = TRUE)
success_js_files <- file.copy(
c(js_files, js_map_files),
to,
overwrite = TRUE,
copy.mode = FALSE
)
if (any(!success_js_files)) {
warning(
"Failed to copy over bootstrap's javascript files into the htmlDependency() directory."
Expand Down Expand Up @@ -273,7 +278,12 @@ bs_dependency <- function(
basename(outfile)
)
}
success <- file.copy(script, dirname(outfile), overwrite = TRUE)
success <- file.copy(
script,
dirname(outfile),
overwrite = TRUE,
copy.mode = FALSE
)
if (!all(success)) {
stop(
"Failed to copy the following script(s): ",
Expand Down
2 changes: 1 addition & 1 deletion tools/compile_component_sass.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dep <- component_dependency_sass_(bs_theme())
css <- file.path(dep$src, dep$stylesheet)
target_dir <- path_inst("components", "dist")
target_css <- file.path(target_dir, "components.css")
file.copy(css, target_css, overwrite = TRUE)
file.copy(css, target_css, overwrite = TRUE, copy.mode = FALSE)
27 changes: 18 additions & 9 deletions tools/yarn_install.R
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,13 @@ with_dir("inst/lib", {
Sys.glob(file.path(src, "*.css"))
)
core_files <- core_files[!grepl(theme_js_pattern, basename(core_files))]
file.copy(core_files, dest)
file.copy(core_files, dest, copy.mode = FALSE)

# Copy utils
file.copy(
Sys.glob(file.path(src, "utils", "*.js")),
file.path(dest, "utils")
file.path(dest, "utils"),
copy.mode = FALSE
)

# Copy languages (only bundled)
Expand All @@ -399,13 +400,15 @@ with_dir("inst/lib", {
bundled_languages <- bundled_languages[file.exists(bundled_languages)]
file.copy(
bundled_languages,
file.path(dest, "languages")
file.path(dest, "languages"),
copy.mode = FALSE
)

# Copy prism grammars (only bundled)
file.copy(
file.path(src, "prism", "languages", bundled_lang_files),
file.path(dest, "prism", "languages")
file.path(dest, "prism", "languages"),
copy.mode = FALSE
)

# Copy extensions
Expand All @@ -416,11 +419,12 @@ with_dir("inst/lib", {
)
# Copy top-level extension files
ext_js <- ext_files[grepl("\\.js$", ext_files)]
file.copy(ext_js, file.path(dest, "extensions"))
file.copy(ext_js, file.path(dest, "extensions"), copy.mode = FALSE)
# Copy copyButton extension folder
file.copy(
Sys.glob(file.path(src, "extensions", "copyButton", "*")),
file.path(dest, "extensions", "copyButton")
file.path(dest, "extensions", "copyButton"),
copy.mode = FALSE
)

# ============================================================================
Expand Down Expand Up @@ -506,7 +510,8 @@ with_dir("inst/lib", {
# Copy themes
file.copy(
Sys.glob(file.path(src, "themes", "*.css")),
file.path(dest, "themes")
file.path(dest, "themes"),
copy.mode = FALSE
)

# Scope theme CSS files to support multiple editors with different themes.
Expand Down Expand Up @@ -740,7 +745,7 @@ invisible(
if (!dir.exists(dest_dir)) {
dir.create(dest_dir)
}
file.copy(tmp_css, dest_dir)
file.copy(tmp_css, dest_dir, copy.mode = FALSE)

# Also save the BS5+ Sass code used to generate the pre-compiled CSS.
# This is primarily here to help Quarto more easily replicate bs_theme()'s Sass.
Expand All @@ -752,7 +757,11 @@ invisible(
)
writeLines(theme_sass, file.path(dest_dir, "bootstrap.scss"))
# Sanity check that we we can compile by moving file to home dir
file.copy(file.path(dest_dir, "bootstrap.scss"), "bootstrap.scss")
file.copy(
file.path(dest_dir, "bootstrap.scss"),
"bootstrap.scss",
copy.mode = FALSE
)
on.exit(unlink("bootstrap.scss"), add = TRUE)
testthat::expect_error(sass(sass_file("bootstrap.scss")), NA)
}
Expand Down