Skip to content

andrew-womeldorf/please-js-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Javascript Rules for Please.Build

This repo is a plugin that provides OpenAPI rules for the Please build system.

Follow the example set by projects in github.com/please-build, and docs.

These rules exist to fill in some gaps that I had with the JS rules in the Pleasings repo:

  • Scoped packages
  • Generating the deps to support scoped packages
  • Generating targets for scripts in packages

Basic Usage

Include this plugin in your project:

# BUILD
plugin_repo(
    name = "js",
    owner = "andrew-womeldorf",
    plugin = "please-js-rules",
    revision = "<Some git tag, commit, or other reference>",
)

Use it in a BUILD file:

# some_dir/BUILD
subinclude("///please-js//build_defs:js")

yarn_library(
    name = "@types--node",
    package_name = "node",
    scope = "@types",
    version = "17.0.23",
)

It's recommended to install packages with yarn add --flat, then use the //build_defs:yarn_to_please script to generate the BUILD file. Always use the --flat option when adding packages with yarn, so that there's only one version of a package.

Configuration

This plugin can be configured via the plugins section as follows:

[Plugin "please_js"]
SomeConfig = some-value

Other Javascript Rules

There's several existing JS rules, and I haven't seen a ton of documentation around why they each exist, so I made my own which are VERY heavily based on the existing JS rules in the Pleasings repo. See: