inst/doc/manifesto.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = '#>'
)

## -----------------------------------------------------------------------------
library(manifesto)

## ----eval = FALSE-------------------------------------------------------------
# pak::pak('manifesto')

## ----eval = FALSE-------------------------------------------------------------
# pak::pak('christopherkenny/manifesto')

## -----------------------------------------------------------------------------
manifest_path <- system.file('complex.toml', package = 'manifesto')

## ----eval = FALSE-------------------------------------------------------------
# manifest_install(manifest_path)

## ----eval = FALSE-------------------------------------------------------------
# manifest_install(manifest_path, groups = 'dev')
# manifest_install(manifest_path, groups = c('dev', 'ci'))

## -----------------------------------------------------------------------------
manifest_install(manifest_path, dry_run = TRUE)

## -----------------------------------------------------------------------------
path <- manifest_create()
path

## ----echo = FALSE-------------------------------------------------------------
path |>
  readLines() |>
  cat(sep = '\n')

## -----------------------------------------------------------------------------
manifest_create(
  path = tempfile(fileext = '.toml'),
  name = 'myproject',
  r_version = '>= 4.2.0',
  dependencies = list(
    dplyr = '>= 1.0.0',
    ggplot2 = '*'
  )
)

## -----------------------------------------------------------------------------
manifest_create(
  path = tempfile(fileext = '.toml'),
  name = 'myproject',
  r_version = '>= 4.2.0',
  dependencies = list(
    dplyr = '>= 1.0.0',
    ggplot2 = '*'
  ),
  'dev-dependencies' = list(
    testthat = '>= 3.1.0',
    lintr = '*'
  ),
  'ci-dependencies' = list(
    pkgdown = '*'
  )
)

## -----------------------------------------------------------------------------
manifest_create(
  path = tempfile(fileext = '.toml'),
  name = 'myproject',
  r_version = '>= 4.2.0',
  dependencies = list(
    dplyr = '>= 1.0.0',
    ggplot2 = '*',
    cli = '*'
  ),
  'dev-dependencies' = list(
    gh = list(source = 'github', repo = 'r-lib/gh', ref = 'v1.4.0')
  )
)

## -----------------------------------------------------------------------------
manifest_create(
  path = tempfile(fileext = '.toml'),
  name = 'myproject',
  r_version = '>= 4.2.0',
  dependencies = list(
    dplyr = '>= 1.0.0'
  ),
  'dev-dependencies' = list(
    mydevpkg = list(source = 'local', path = '../mydevpkg')
  )
)

## -----------------------------------------------------------------------------
manifest_validate(path = manifest_path)

## -----------------------------------------------------------------------------
manifest <- manifest_create(
  path = tempfile(fileext = '.toml'),
  name = 'myproject',
  version = '0.1.0',
  r_version = '>= 4.2.0',
  dependencies = list(
    dplyr = '>= 1.0.0',
    ggplot2 = '*',
    glue = '*'
  ),
  'dev-dependencies' = list(
    testthat = '>= 3.1.0',
    lintr = '*'
  )
)

## -----------------------------------------------------------------------------
manifest_install(manifest, groups = 'dev', dry_run = TRUE)

## -----------------------------------------------------------------------------
manifest_install(manifest, groups = 'all', dry_run = TRUE)

## -----------------------------------------------------------------------------
manifest_desc <- tempfile(fileext = '.toml')
manifest_from_description(
  system.file(package = 'cli', 'DESCRIPTION'),
  path = manifest_desc
)

## ----echo = FALSE-------------------------------------------------------------
readLines(manifest_desc) |>
  cat(sep = '\n')

## -----------------------------------------------------------------------------
description_path <- tempfile(pattern = 'DESCRIPTION')
manifest_to_description(manifest_desc, out = description_path)

## ----echo = FALSE-------------------------------------------------------------
readLines(description_path) |>
  cat(sep = '\n')

Try the manifesto package in your browser

Any scripts or data that you put into this service are public.

manifesto documentation built on May 6, 2026, 1:06 a.m.