Giter Club home page Giter Club logo

ojkelly / yarn.build Goto Github PK

View Code? Open in Web Editor NEW
318.0 5.0 28.0 474.16 MB

Build 🛠 and Bundle 📦 your local workspaces. Like Bazel, Buck, Pants and Please but for Yarn Berry. Build any language, mix javascript, typescript, golang and more in one polyglot repo. Ship your bundles to AWS Lambda, Docker, or any nodejs runtime.

Home Page: https://yarn.BUILD

License: MIT License

JavaScript 6.08% TypeScript 93.12% Dockerfile 0.17% Shell 0.63%
yarn build build-system monorepo yarn-plugin javascript typescript script-runner yarn2 build-tool

yarn.build's Introduction

yarn.build

Netlify Status

yarn.BUILD is a plugin for Yarn 4 (berry). It uses your dependency graph to build just whats needed, when it's needed. You can setup a monorepo with a few backend packages, a server package, maybe a graphQL schema package, and a frontend package. And build it all, in the order it's needed. Then, only rebuild when something changes.

See the full docs at yarn.BUILD

To install for Yarn 4:

yarn plugin import https://yarn.build/latest

Or install any of the commands individually with

yarn plugin import https://yarn.build/latest/build
yarn plugin import https://yarn.build/latest/test
yarn plugin import https://yarn.build/latest/bundle

If you're upgrading the plugin the install location has changed to be under the @yarn.build namespace. If you have any yarn.build plugin previously installed you may need to remove the old one manually from .yarnrc.yml:

plugins:
  - checksum: ...                                 <-- remove this entry if both exist
    path: .yarn/plugins/@ojkelly/plugin-all.cjs   <--  
    spec: 'https://yarn.build/latest'             <--
  - checksum: ...
    path: .yarn/plugins/@yarn.build/plugin-all.cjs
    spec: 'https://yarn.build/latest'

OpenTelemetry Support

yarn.build's build, test and bundle commands now come with optional OpenTelemetry (OTEL) instrumentation.

To use it, you need to run an OTEL Collector with a http receiver:
receivers:
  otlp:
    protocols:
      grpc:
      http: # this is the one we need, it defaults to port 4318

And set the appropirate envar for example OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 if you are running the collector on the same host as you're running yarn.build.

NOTE: yarn.build doesn't currently support the grpc endpoint, becuase bundling the required .proto files might need a rework of the yarn plugin bundler, which is out of scope of the intial yarn.build OTEL integration.

Commands

build

Build your package and all dependencies.

Run in the root of your project, or in a non-workspace folder to build everything.

Run in a specific workspace to build that workspace and all of its dependencies in the correct order, only rebuidling what's changed.

My builds are never cached?

Yarn build tries to guess your input and output folders based on common conventions.

If they're different you can specify them explicitly in package.json:

  "yarn.build": {
    "input": "src",
    "output": "dist"
  }

If that still doesn't work, check to see if your build script is modifying any files in your input folder. Some build tools like to mess with files like tsconfig.json and others.

The most ideal state is that your input folder is never modified by your build step. If this continues to happen, you should try to adjust the build scripts, or workspace layout to avoid it.

As this is fundemental to ensuring sound builds, yarn build will never cache the input folder if it's changed.

Exclude

Pass --exclude or --exclude-current to selectively exclude packages from being built.

Pass -v for verbose to get a print out of which packages were skipped or excluded.

yarn build --exclude packages/example/lorem-ipsum
yarn build --exclude packages/example/*

# Globs for package names work too, but you need to quote them so your shell doesn't try to substitute it
yarn build --exclude "@internal*"


# For Dev
# this one is really useful at the start of a dev command or similar where you
# are watching for changes in the current workspace but need to ensure your
# dependencies are built
yarn build --exclude-current

NOTE: if you explicitly exclude a workspace that another workspace depends on, and that workspace is being built the command may fail.

Git / CI integration

Use the flag --changes, to ignore the build cache, and build everything with changes staged or in the last commit.

Use --since-branch main to ignore the build cache, and build everything with changes based on what git says is different between the current branch and main (or another branch of your choosing).

Use --since ${COMMIT_HASH} to ignore the build cache, and build everything with changes between the current commit and the provided one.

query

Run yarn build query from within a package to see the dependency graph of what might be built.

Query doesn't currently show what's cached / needs to be rebuilt.

bundle

Bundle a package and its local dependencies, designed for containers and AWS lambda.

A file entrypoint.js is added to the project root, that reexports the file you specify as main in package.json.

Output bundle.zip to a specific folder

# or any path you want to put it in
yarn bundle --output-directory ../tmp

Bundle but don't zip

This is useful when you're building inside a docker container.

Choose an output directory outside your project and pass --no-compress.

# or any path you want to put it in that's outside your project root
yarn bundle --no-compress --output-directory /srv/app

See this Dockerfile and build script for an example of how you can bundle into a container image.

.bundleignore

You can set files to be ignored when bundling for even smaller bundles.

Add a .bundleignore file with the same format as .gitignore next to the package.json you are bundling.

Optionally put one next to your root package.json to apply to all bundles.

You can pass --ignore-file to specify a different ignore file.

Or decide at bundle time what to ignore by passing --exclude along with the file path to ignore.

See #112 for the original PR.

test

Test your package and it's dependencies.

Config

By default yarn.build looks at your package.json and chooses some reasonable defaults.

{
  "name": "@internal/lorem-ipsum",
  "version": "1.0.0",
  "main": "build/index.js",
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "build": "tsc",
    "test": "jest"
  }
}

When you specify main yarn.build will exclude that folder from the build tracker, and use the package root (the same directory as the package.json) as the input folder to track.

If you want to customise the input and output folders per package you can setup a package.json as follows:

{
  "name": "@internal/lorem-ipsum",
  "version": "1.0.0",
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "build": "tsc -outDir dist",
    "test": "jest"
  },
  "yarn.build": {
    "input": ".",
    "output": "dist"
  }
}

Troubleshooting

**The output is interlaced, or mangled, or not useful in CI**

yarn.build uses is-ci to check if it's running in a CI environment, and will not print progress in the same way it does when run locally (or with an interactive tty).

Typically is-ci is really good at detecting a CI environment. It does this by checking a for one of many known environment variables set by CI tools. Including the most common and most useful fallback CI=true.

If you run yarn build or yarn test wrapped inside another execution environment inside your CI pipeline, you might need to pass an environment variable (ENV) to let yarn.build know it's being run in CI.

Depending on how your script is run, you can do something like the following:

CI=true yarn build

Adapted for Docker / BuildKit, the following will set CI for the script, but not the whole container. See issue #5 for more information

RUN env CI=true yarn build

plugin-package-yaml

Have you ever wanted to write you package.json as package.yaml or even package.yml?

Well now you can!

To install:

yarn plugin import https://yarn.build/yaml
How to use `plugin-package-yaml`

Once installed, any folder with a package.yaml and without a package.json will run through this plugin. This lets you opt-in packages that don't have any tooling that requires package.json to be present on disk.

Swap an existing package.json over to a package.yaml by converting it's contents to YAML, and renaming the file.

This plugin will transparently convert your package.yaml back into json for all of Yarn's tooling, meaning Yarn has no idea it's not writing to a package.json.

name: "@internal/lorem-ipsum"
version: 1.0.0
main: dist/index.js

# license, none for the example
license: UNLICENSED
private: true

# scripts comment
scripts:
  build: tsc
  test: jest
  dev: ts-node ./src/index.ts

dependencies:
  "@internal/phrase-lorem-ipsum": "workspace:*"
  jest: "^26"
  ts-jest: "^26.4.4"
  typescript: ^4.3.5

devDependencies:
  "@types/node": ^16.4.1
  ts-node: ^10.1.0
  "@types/jest": ^26.0.24

jest:
  preset: ts-jest

# here we define our input and output
# as we defined main above, we don't need this
# if your output directory is different or not easily definable in main
# specify it here
yarn.build:
  input: .
  output: dist

Caveats

Existing tooling that wants to read from your package.json will break, unless it reads it via Yarn.

Troubleshooting

If it breaks, convert your yaml package file back to json, and comment the plugin out from .yarnrc.yml.

Please also make an issue describing you problem, so we can hopefully fix it.

Example

The initial usecase for this is for non-javascript packages in a polyglot yarn.build repository. As an example this is how you can build a go app, leveraging yarn and yarn.build but with a yaml file as your build specification (ie package.yaml).

In this example we have a graphql schema defined in typescript that generates type files we can consume in our go binary.

name: "@internal/server"
version: 1.0.0
main: cmd/main.go

# license, none for the example
license: UNLICENSED
private: true

# scripts comment
scripts:
  build: GOOS=linux GOARCH=amd64 go build -o .build/main cmd/main.go
  test: go test ./...
  dev: go run cmd/main.go

dependencies:
  "@internal/graphql-schema": "workspace:*"

yarn.build:
  input: .
  output: .build
---

For developing on this repository see packages/plugins/readme.md

yarn.build's People

Contributors

borekb avatar cem2ran avatar dependabot[bot] avatar github-actions[bot] avatar icereval avatar lodmfjord avatar misterjoshua avatar noxharmonium avatar ojkelly avatar oliversalzburg avatar samantha-uk avatar scottyeck avatar sjayach avatar skoging avatar ulrik-s avatar zinserjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yarn.build's Issues

Improvement on yarn test

Describe the solution you'd like
Would be nice to have full log on successful yarn test run using jest and other test runners to feel more like native yarn test. Also would be great to have real stdout colours what jest is colouring.

Plugin missing - 404

Describe the bug
When running yarn plugin import https://yarn.build/v2 get a: YN0001: HTTPError: Response code 404 (Not Found)

To Reproduce
Steps to reproduce the behavior:

  1. Run command yarn plugin import https://yarn.build/v2
  2. See error

Expected behavior
I'd be able to download the plugin

Screenshots
Screen Shot 2021-07-29 at 11 40 23 am

Desktop (please complete the following information):

  • OS: macOS

configuration.format is deprecated and removed in latest version

Describe the bug
The configuration.format calls all no longer work in the latest yarn builds.

To Reproduce
Steps to reproduce the behavior:

  1. Run yarn build with a yarn version built from sources yarn set version from sources

Expected behavior
yarn build works.

Additional context

➤ YN0001: TypeError: this.configuration.format is not a function
    at L.generateHeaderString (/tmp/stage/.yarn/plugins/@ojkelly/plugin-build.cjs:5:22464)
    at L.run (/tmp/stage/.yarn/plugins/@ojkelly/plugin-build.cjs:5:14046)
    at /tmp/stage/.yarn/plugins/@ojkelly/plugin-build.cjs:5:26168
    at async Function.start (/tmp/stage/.yarn/releases/yarn-sources.cjs:2:388418)
    at async A.execute (/tmp/stage/.yarn/plugins/@ojkelly/plugin-build.cjs:5:25214)
    at async A.validateAndExecute (/tmp/stage/.yarn/releases/yarn-sources.cjs:2:649406)
    at async Y.run (/tmp/stage/.yarn/releases/yarn-sources.cjs:17:3854)
    at async Y.runExit (/tmp/stage/.yarn/releases/yarn-sources.cjs:17:4021)
    at async u (/tmp/stage/.yarn/releases/yarn-sources.cjs:2:283982)
    at async r (/tmp/stage/.yarn/releases/yarn-sources.cjs:2:282575)

The calls need to be replaced with calls to formatUtils.pretty instead.

Build failures are not passed through

When yarn build encounters build errors in a project, the exit status will still be 0.

This can be observed with the example projects in this repo:

rm .yarn/local-build-cache.json # in case it exists
╰─ yarn build && echo $?          
➤ YN0000: ┌ Building All
➤ YN0009: │ ┌ Errors for packages/examples/words/sit
➤ YN0009: │ │ src/index.ts:1:14 - error TS1005: ';' expected.
➤ YN0009: │ │ 1 ftygukjhu +c asda
➤ YN0009: │ │                ~~~~
➤ YN0009: │ │ Found 1 error.
➤ YN0009: │ └ End packages/examples/words/sit
➤ YN0000: └ Build finished with 2 errors
➤ YN0000: [11:2/13]
➤ YN0000: Done in 11s 899ms
0

As we can see, the exit status is 0 and the build failure will not fail consecutive processes.

Projects are not rebuilt if their build failed in a previous run

In this repo, when building the examples, they will fail, as there is a syntax error in one file:

rm .yarn/local-build-cache.json # in case it exists
╰─ yarn build && echo $?          
➤ YN0000: ┌ Building All
➤ YN0009: │ ┌ Errors for packages/examples/words/sit
➤ YN0009: │ │ src/index.ts:1:14 - error TS1005: ';' expected.
➤ YN0009: │ │ 1 ftygukjhu +c asda
➤ YN0009: │ │                ~~~~
➤ YN0009: │ │ Found 1 error.
➤ YN0009: │ └ End packages/examples/words/sit
➤ YN0000: └ Build finished with 2 errors
➤ YN0000: [11:2/13]
➤ YN0000: Done in 11s 899ms
0

If you build the projects again right after, packages/examples/words/sit is not built again:

╰─ yarn build && echo $?
➤ YN0000: └ Build finished
➤ YN0000: [0:0/0]
➤ YN0000: Done in 0s 167ms
0

Add integration tests

We need some integration tests to run after building the plugin, that can confirm it works as intended.

Unable to build repo with co-dependent workspaces

Describe the bug
When I run yarn build, I get no output and at some point Node crashes due to OOM.

╰─ time yarn build                           

<--- Last few GCs --->

[322:0x609d110]   892070 ms: Scavenge (reduce) 4090.3 (4095.9) -> 4089.3 (4096.9) MB, 7.0 / 0.0 ms  (average mu = 0.294, current mu = 0.276) allocation failure 
[322:0x609d110]   892078 ms: Scavenge (reduce) 4090.3 (4095.9) -> 4089.3 (4096.9) MB, 6.6 / 0.0 ms  (average mu = 0.294, current mu = 0.276) allocation failure 
[322:0x609d110]   892141 ms: Scavenge (reduce) 4090.3 (4095.9) -> 4089.3 (4096.9) MB, 7.1 / 0.0 ms  (average mu = 0.294, current mu = 0.276) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa04200 node::Abort() [/usr/bin/node]
 2: 0x94e4e9 node::FatalError(char const*, char const*) [/usr/bin/node]
 3: 0xb7860e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0xb78987 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0xd33215  [/usr/bin/node]
 6: 0xd33d9f  [/usr/bin/node]
 7: 0xd41e2b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 8: 0xd444e5 v8::internal::Heap::HandleGCRequest() [/usr/bin/node]
 9: 0xceab27 v8::internal::StackGuard::HandleInterrupts() [/usr/bin/node]
10: 0x1059cca v8::internal::Runtime_StackGuardWithGap(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
11: 0x1400039  [/usr/bin/node]
yarn build  930.00s user 22.41s system 106% cpu 14:55.61 total

To Reproduce
I'm currently assuming this is due to workspace A depending on workspace B and vice versa.

I assume this could be reproduced in the example in this repo. I haven't had time to try that yet.

Expected behavior
In circular dependencies, projects still only be built once.

In my case, I don't even need projects to be built according to their topology at all. I only compile TS in my builds and all builds access only the current source of any other workspace. The build artifacts are only relevant at runtime.

So it would be fine to just run a build in all "dirty" workspaces at the same time.

Desktop (please complete the following information):

  • OS: Windows/WSL

Missing @yarnpkg/libzip

After adding plugin, any yarn command produces this:

$ yarn bundle
Usage Error: This plugin cannot access the package referenced via @yarnpkg/libzip which is neither a builtin, nor an exposed entry (when initializing @ojkelly/plugin-build, defined in /Users/n8/dish/.yarnrc.yml)

Yarn Package Manager - 2.0.0-rc.27

Desktop (please complete the following information):

  • OS: macOS Big Sur

Additional context

Yarn global is 2.0.0-rc.27 but I've run yarn set version latest and that shows 2.4.2.

I tried adding it as a package.json but it doesn't seem to pick it up.

Unable to use exclude option with bundle

Thanks for this great plugin!

While I was able to bundle my code for AWS Lambda using this plugin, I wanted to exclude some files and directories (such as configuration files, sources - which use Typescript and are bundled/minified by webpack; etc.).

Having a look at the sources I found the undocumented exclude option:

@Command.Array(`--exclude`)
exclude: Array<PortablePath> = [];

Unfortunately I am not sure to understand how it works. After adding a couple of console.log:

diff --git a/packages/plugins/plugin-build/src/commands/bundle/index.ts b/packages/plugins/plugin-build/src/commands/bundle/index.ts
index 00a065d..570521a 100644
--- a/packages/plugins/plugin-build/src/commands/bundle/index.ts
+++ b/packages/plugins/plugin-build/src/commands/bundle/index.ts
@@ -106,22 +106,26 @@ export default class Bundler extends BaseCommand {

   async removeExcluded(tmpDir: PortablePath, excluded: PortablePath[]) {
     const gitDir = `${tmpDir}/.git` as PortablePath;

     try {
       if (await xfs.lstatPromise(gitDir)) {
         await xfs.removePromise(gitDir);
       }
     } catch (e) {}

     await excluded.map(async (p) => {
+      console.log('****');
+      console.log(p);
+      console.log(tmpDir);
+
       if (!p.startsWith(tmpDir)) {
         // Don't remove anything not in the tmp directory
         return;
       }

       if (await xfs.lstatPromise(p)) {
         await xfs.removePromise(p);
       }
     });
   }

and running yarn bundle --exclude aaa --exclude bbb we can see the following output:

****
aaa
/private/var/folders/3s/_2m5qbkj6czcwc8xsvwbg4n40000gn/T/xfs-d6e54876
****
bbb
/private/var/folders/3s/_2m5qbkj6czcwc8xsvwbg4n40000gn/T/xfs-d6e54876
****
/private/var/folders/3s/_2m5qbkj6czcwc8xsvwbg4n40000gn/T/xfs-d6e54876/packages/lambda-api/bundle.zip
/private/var/folders/3s/_2m5qbkj6czcwc8xsvwbg4n40000gn/T/xfs-d6e54876

The last trace is the output artefact excluded by default. But, as you can see, to use the exclude option you need to prefix each path by the tmp. directory - which does not exist yet at invocation time 😬

Here are my thoughts:

  • I understand the exclude option is not yet public (not mentioned in CLI help text, README.md, config.js, etc.) and may not yet be ready for usage;
  • The plugin could certainly prefixes all paths from exclude with the tmp. dir. (as it already does with the artefact);
  • Given my usage, a include option may be better (I just want to ship dist directories);
  • Currently exclude accepts a list of strings, we could also accept regex in .yarnbuildrc.yml.

I would love to get some feedbacks. And of course I am willing to create a PR if maintainers are interested 🚀

Calling custom actions

Is your feature request related to a problem? Please describe.
Sometimes it is great to check dependency and everyone that depends on it – typecheck, linter etc.

Describe the solution you'd like
Being able to create custom actions.

Describe alternatives you've considered
Using wsrun — which is the current way I am doing it.

Bail out early on error

Is your feature request related to a problem? Please describe.

My mono repo takes a while to build, and if the root level packages that are shared fail to build, it isn't really worth building the other packages because I know they will fail.

Describe the solution you'd like

I'd like the entire process to terminate and show the log output as soon as one package fails to build.

A good example of this is the --bail switch for Jest (https://jestjs.io/docs/cli#--bail)

Describe alternatives you've considered

Mashing CTRL+C multiple times to kill all the processes 😉

Additional context

If you think adding a --bail option is a reasonable idea, I'm happy to make the change and put up a PR when I get a chance.

[FEAT] Write a VS Code Problem Matcher for yarn.build output

Is your feature request related to a problem? Please describe.
When using yarn.build as the default build tool, the $tsc problem watcher doesn't work correctly, as the filename is not correctly matched.

Describe the solution you'd like
A new problem matcher (maybe in an extension) that handles this output.

Describe alternatives you've considered
Maybe the output of yarn.build can be adjusted to use the existing matchers?

Additional context
https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher

I've been trying to handle this myself the past few days, but didn't get around to it. There are likely a myriad of matchers needed, depending on tool used.

[BUG] Runaway output in yarn build

Describe the bug
I am sometimes (the worst possible situation) seeing extraneous output (I think) in yarn build.

To Reproduce
Steps to reproduce the behavior:

  1. Run command 'yarn build'

Expected behavior
Output like this

➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.94s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zigzag-plugin-data-file (builder) 1.94s
➤ YN0000: │ [3] home-assistant/zigzag/modules/data/plugins/gen@samantha-uk/zigzag-data-plugin-gen (builder) 1.94s
➤ YN0000: │ [4] home-assistant/zigzag/modules/layout/plugins/d3@samantha-uk/zigzag-plugin-layout-d3 (builder) 2.21s
➤ YN0000: └ [3:0/9] 6.15s

What I see from time to time

➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/data/core@samantha-uk/zigzag-data
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.14s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.39s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.47s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.61s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.70s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.79s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.88s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 0.97s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.06s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.15s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.24s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.33s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.42s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.51s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.60s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.69s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.78s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.87s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 1.96s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.05s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.15s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.24s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.33s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.42s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.51s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.60s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.69s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.78s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.87s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 2.97s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.06s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.15s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.24s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.33s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.42s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.51s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/file@samantha-uk/zig
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.66s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/gen@samantha-uk/zigz
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-grapher (builder) 3.76s
➤ YN0000: │ [2] home-assistant/zigzag/modules/data/plugins/gen@samantha-uk/zigz
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/modules/grapher@samantha-uk/zigzag-graphe
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: │ [1] home-assistant/zigzag/components/zigzag-wc@samantha-uk/zigzag-w
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ┌ Run build for All
➤ YN0000: ➤ Run [ build finished ]
➤ YN0000: [9:0/9]
➤ YN0000: Done in 18s 311ms
  ~/github/one on   main *1 +1325 !121 ?111                                                         took  19s with samantha@svr-development at  15:03:04
❯

Desktop (please complete the following information):
OS: Debian Buster
Yarn: v2.4.0-git.20201213.364c3992
Yarn Build: v0.9.1
Node: 14.15.1

Additional context
Happy to try to track this down and PR a fix ... if you can give me some guidance as to where I might start looking ...

Add configuration options to build

Per package config in package.json and repo wide in the root package.json.

  • ability to define folders to include/exclude when running yarn build.

[BUG] Usage Error: Unrecognized or legacy configuration settings found

Describe the bug
When I run yarn build, I receive the following error:

Usage Error: Unrecognized or legacy configuration settings found: npmScopes - run "yarn config -v" to see the list of settings supported in Yarn (in /home/oliver/.yarnrc.yml)

The key is present in that configuration file, but I don't understand why that is a problem. The key behaves in the configuration as expected and is also listed in the yarn config -v output.

I believe this was introduced by the change that added configuration options, but I don't see how any of the code is problematic.

To Reproduce
Steps to reproduce the behavior:

  1. I assume creating a .yarnrc.yml in your home directory with some npmScopes settings would trigger this.
  2. Run yarn build

Expected behavior
No error.

Desktop (please complete the following information):

  • OS: Windows/WSL

Distributed builds

I have two different web apps and their dependencies in a yarn monorepo. Many of the dependencies are used by both apps so I wanted a way to reuse the build output of dependencies for app builds in different CI jobs.

I'm willing to work on it too if you think it's a good idea :)

Current setup

  • Job 1: run yarn workspace app-1 build, which builds deps first and then bundles app-1
  • Job 2: run yarn workspace app-2 build, which builds deps first and then bundles app-2

Ideal setup

  • Job 1: run yarn workspace dep-x build, which builds dep-x and its dependencies
  • Job 2: run yarn workspace dep-y build, which builds dep-y and its dependencies
  • Job 3 (after 1 & 2 finish): run yarn workspace app-1 build which would not have to build dep-x or dep-y.
  • Job 4 (after 1 & 2 finish): run yarn workspace app-2 build which would not have to build dep-x or dep-y either.

I could build all dependencies in one job and then run separate app build jobs in parallel if I pass build artifacts and yarn.build.json, but I have no way of merging the build cache automatically as in the explained ideal setup.

Easy solution

Splitting the build cache into separate per-package status files (instead of using just one) would allow me to pass success status to following pipeline steps.

Instead of having .yarn/yarn.build.json, we'd have something like .yarn/yarn.build/dep-x.json, dep-y.json, app-1.json, etc., describing the status of each package individually.

Alternate solution

Being able to configure custom checks for the plugin in .yarnrc.yml, so I could skip the build from subsequent jobs if output artifacts exist or any other condition I could use to detect if the build exists based on directory state.

This approach could also allow for "force rebuild" conditions as well (if we depend on something external).

Hacky solution

Write to .yarn/yarn.build.json directly on the pipeline jobs to update its state based on checking which files are there before running build. This isn't really a suggestion for yarn.build but a hacky workaround to get what I need working. I don't really think it's ok to manipulate your plugin's internal state from outside or if it's schema could change in future versions.

Guidance on star exports from entrypoint.js

Is your feature request related to a problem? Please describe.
Unable to load the handler function from entrypoint.js in AWS Lambda.

Describe the solution you'd like
When loading the bundle.zip into AWS Lambda and referencing its handler function via bundle/entrypoint.js, it would be ideal if the entrypoint.js was re-exporting module functions.

Describe alternatives you've considered
Leveraging typescript, we can convert a simple export within the existing project, and thus copy its transpiled __exportStar polyfill to a custom app.js (nearly equivalent to entrypoint.js).

https://github.com/ojkelly/yarn.build/blob/trunk/packages/plugins/plugin-build/src/commands/bundle/index.ts#L274-L284

app.js

'use strict';
require('./.pnp.js').setup();
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  if (k2 === undefined) k2 = k;
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
  if (k2 === undefined) k2 = k;
  o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
  for (var p in m) if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, '__esModule', { value: true });
__exportStar(require(`./packages/${process.env.PACKAGE_NAME}/dist/index.js`), exports);

Additional context
This would depend on the project's tsconfig.json target polyfills, and would likely be best to perform this step in the yarn bundle command itself, with a call to tsc and an entrypoint.ts file.

Add `build query`

A new command that can print out the dependency graph for the current package.

failed to install yarn.build plugin

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. npm install -g yarn@berry
  2. yarn plugin import https://yarn.build/latest
  3. See error

Expected behavior
Okay to install yarn.build plugin

Screenshots

yarn plugin import https://yarn.build/latest
➤ YN0001: ReferenceError: name is not defined
    at /usr/local/lib/node_modules/yarn/bin/yarn.js:58:32838
    at async Function.start (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:44856)
    at async u.execute (/usr/local/lib/node_modules/yarn/bin/yarn.js:58:32187)
    at async u.validateAndExecute (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:40434)
    at async c.run (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533800)
    at async c.runExit (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533934)
➤ YN0000: Failed with errors in 0.12s

 yarn -v
2.0.0-rc.27

image

Desktop:

  • OS: macOS and Windows

Build command option not used

When running the following command yarn build -c test, yarn.build still runs the build command script rather than test as expected.

The issue appears to be in this line where it is not using the input command argument

Proposed solution

Use the command argument as follows:

(await this.cli.run(["run", command || "build"], {

Happy to submit a PR for this :)

When skipping builds, show how many were skipped

Describe the bug
When skipping builds, show how many were skipped, otherwise if nothing builds it could be confused as a configuration error.

To Reproduce
Steps to reproduce the behavior:

Run yarn build twice.

Compatibility with yarn v3

Yarn v3 RC is out, and can be tested by using the command yarn set version
yarn set version 3.0.0-rc.2 for latest v3 RC
yarn set version from sources for current development version
This issue tracks it's breaking changes, and here's the changelog.

Unfortunately, yarn.build seems to be incompatible with it.

On versions 3.0.0-rc.1 and 3.0.0-rc.2, yarn.build plugin prevents any yarn commands at all as it uses yup, while yarn v3 has migrated to typanion.

Current development version enables yup back to ease migration, but both yarn build and yarn bundle fail :

yarn build

Type Error: e.every is not a function
    at test (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:9:12254)
    at z.validateAndExecute (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:198:525)
    at async jn.run (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:210:1845)
    at async jn.runExit (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:210:2012)
    at async i (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:302:12367)
    at async r (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:302:10721)

yarn bundle

Type Error: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:363:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1176:7)
    at /path/to/my/repo/.yarn/plugins/@ojkelly/plugin-build.cjs:5:1442
    at It.mktempPromise (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:178:62552)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async d.execute (/path/to/my/repo/.yarn/plugins/@ojkelly/plugin-build.cjs:5:1356)
    at async d.validateAndExecute (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:198:618)
    at async jn.run (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:210:1845)
    at async jn.runExit (/path/to/my/repo/.yarn/releases/yarn-sources.cjs:210:2012)

[BUG] bundle.tgz becomes corrupted while using docker

Describe the bug
Bundling or adding bundle file to Dockerfile

To Reproduce


# First stage
FROM node:14.15.1-alpine as bundler
WORKDIR usr/src/app

ADD . .

RUN yarn install
RUN yarn workspace @services/service bundle

WORKDIR services/service 
RUN yarn bundle
RUN apk update
RUN apk add tar
RUN ls -la ./
RUN tar xvf bundle.tgz

Step 9/14 : RUN tar xvf bundle.tgz
---> Running in 93349fea266e
gzip: invalid magic
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c tar xvf bundle.tgz' returned a non-zero code: 2

Expected behavior
Extract files

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • yarn 2.4.0
  • yarn.build latest

Additional context
Able to extract it in terminal. Either mounted or bundled, bundle.tgz is corrupted.

Couldn't find a script named "build"

Describe the bug
Just added the plugin to a new project via yarn plugin import https://yarn.build/latest.
Executing yarn build results only in the error

Usage Error: Couldn't find a script named "build".

This workflow did work a few day ago on different projects. I assume the problem was introduced in the recently published version 3.0.0.

To Reproduce
Steps to reproduce the behavior:

  1. run yarn plugin import https://yarn.build/latest
  2. run yarn build
  3. See error

Expected behavior
All build scripts should be executed

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • yarn 2.4.2
  • node 14.17.2

read .gitignore and other .ignore files when running `bundle`

Is your feature request related to a problem? Please describe.
As noted in #95 if you have built other packages, their release artefacts could be collected and inflate the bundle size.

Describe the solution you'd like
The ability to read .gitignore and .ignore files, as well as a config property in the root package.json for setting paths to ignore when bundling.

Additional context
#95

[BUG] Targetted builds destroy valid cache entries

Describe the bug
Targetted builds cause previously valid builds to be evicted from teh build cache.

To Reproduce
Steps to reproduce the behavior:

  1. Run yarn build
  2. Run yarn build in packages/examples/lorem-ipsum
  3. Inspect local-build-cache.json

Expected behavior
All previously built projects remain in the build cache, so they aren't needlessly rebuilt.

Desktop (please complete the following information):

  • OS: Windows/WSL

bundle -o is not implemented

Describe the bug

I ran the command yarn bundle ../../release from the folder of a workspace which I wanted to bundle. The resulting bundle.zip file was placed in the directory in which the yarn bundle command was executed.

To Reproduce

Steps to reproduce the behavior:

PS C:\My Project> cd packages/project-to-bundle
PS C:\My Project\packages\project-to-bundle> yarn bundle -o ../../release
# ... Some time later....
PS C:\My Project\packages\project-to-bundle> ls
# .... lots of dirs and files...
bundle.zip
PS C:\My Project\packages\project-to-bundle>

Expected behavior

Since the default name of the zip file if none is provided by the -a option is bundle.zip, I expected the bundle to be placed in ../../release as specified via -o, i.e. the file path of the bundle should be, relative to the location where I executed the bundle command, ../../release/bundle.zip, but instead, it was ./bundle.zip.

Desktop :

  • OS: Windows 10, no WSL

How does the file supervisor work?

After reading the docs, I think I have an idea of how this package should work. Please correct any wrong assumptions.

What I'm thinking this package will achieve is reduced build times locally due to yarn build understanding what has been modified. What parameters does this package consider for a module to be modified?

For example, if I have a workspace with the package user, I run yarn build and get 10 seconds (it built from scratch). But when I run it again with no code changed, I see it runs the entire build from scratch again (10 seconds). Is there a file supervisor seeing if there are any changes between the last two runs?

[BUG] build does not recognise previous build and rebuilds whole repo

Describe the bug & reproduction

  1. Running yarn build in root builds the entire repo.
  2. .yarn/yarn.build.json is created.
  3. Running yarn build in the root builds the entire repo again.

Expected behavior
I would expect that the second invocation would build nothing (as none of the inputs have changed)

Screenshots
n/a

Desktop (please complete the following information):
OS: Debian Buster
Yarn: v2.4.0-git.20201213.364c3992
Yarn Build: v0.9.1
Node: 14.15.1

Additional context
.yarn/yarn.build.json contains many entries such as

    "utils/logger#build": {
      "lastModified": 1607973614163.1296,
      "status": "succeeded",
      "haveCheckedForRerun": true,
      "rerun": false,
      "command": "build"
    },

Add entrypoint.js file for aws lambda/etc

yarn bundle is working, but it would be really helpful to have a simple consistent entrypoint for lambda.

A js file in the root dir, that re-exports the target packages pkg.json.main script.

Support targetted builds

A problem I'm often running into with yarn.build is builds I don't care about in the current debug cycle.

I have a workspace with a few core dependencies and then several, much larger applications that consume them. I usually focus work on one of the larger applications.
When I make changes to a core library, it causes the entire workspace, with all large applications, to be rebuilt, as they depend on the changed core module.

It would be really useful to tell yarn.build that I want to target a specific workspace and have only that workspace and its dependencies built as needed.

This would allow to construct highly optimized build workflows for local development.

Specify max concurrency from command line

Is your feature request related to a problem? Please describe.

I have a large project with heavy weight build processes.

At one point of our build, eight builds are running at once, and our build server falls over due to lack of memory.

Describe the solution you'd like

For a basic solution, specifying the maximum concurrency of a build from the command line would suffice.

However, it might be even better to be able to specify it in config as well.

Describe alternatives you've considered

Creating a fake dependency graph to force the builds to run in specific groups

Additional context

I have been working on a solution and should be able to open a PR to solve this issue shortly.

Improve stdout in CI

Need to check and ensure the output in CI is helpful, and not missing anything.

Dependency tracking and Docker build cache

Describe the bug

At least when using Yarn 2.x and workspaces (but possibly also when using Yarn 1.x?) the dependency resolution doesn't seem to be precise enough, preventing full use of the Docker build cache.

To Reproduce

See https://github.com/jscheid/yarn-build-docker-test

Expected behavior

It shouldn't try to build packageB or packageC in line 23 of the Dockerfile since packageA doesn't depend on these packages.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Additional context
N/A

v2 import econnreset error

Getting error like this while importing yarn v2

yarn plugin import https://yarn.build/v2
➤ YN0000: Downloading https://yarn.build/v2
➤ YN0001: RequestError: read ECONNRESET
at ClientRequest. (/Users/x/Projects/a/a/.yarn/releases/yarn-2.4.0.cjs:23:31294)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:327:22)
at ClientRequest.e.emit (/Users/x/Projects/a/a/.yarn/releases/yarn-2.4.0.cjs:2:583004)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)

Add test command

Same concept as build, but running the test command in each package.

Depends on packages already being built. So it would need to build them if they had changes.

yarn dev - development mode

New command for development mode.

Have some config to define an allowed range of ports.

then, when you run yarn dev go and run package.json#scripts.dev in every package, or just the current package and its dependencies.

For each run add the following ENV PORT=XXXX and PORTMAP={"packageRelativeURL":PORT}.

this will let us run multiple packages ie, server, client, on different ports, with a map provided to each, but without manual co-ordination.

Additionally, work could be done to enable viewing of the stdout/stderr of each dev command. Possibly with tabs to switch between, or inline muxing of each - or both.

Is it possible to bundle a single workspace of a monorepo?

Hi, does it work to bundle just one workspace of a monorepo? I have a monorepo with multiple applications. An API server, a client, a browser extension. I would like to cd into the api/ workspace subdirectory and run yarn bundle to bundle only that source and its dependencies. Is that supported?

When I try that now, I got a strange error relating to one of the other sub-folders. infra is a top-level directory in my monrepo, but it contains only terraform code. So I'm not sure what the error is. I would have expected yarn.build to ignore this directory.

Internal Error: ENOENT: no such file or directory, chmod '/private/var/folders/by/tbsr_6z13g37l2zld8xrg4hw0000gn/T/xfs-c8cbed0c/infra/.terraform/modules/295b6bd40c1b71e9361d2aebc0842ff5'
Error: ENOENT: no such file or directory, chmod '/private/var/folders/by/tbsr_6z13g37l2zld8xrg4hw0000gn/T/xfs-c8cbed0c/infra/.terraform/modules/295b6bd40c1b71e9361d2aebc0842ff5'

Failing to run on windows

Reports of yarn build` not working on Windows.

If you have this issue please comment below with some more information.

If you know the fix already a PR is welcome.

[BUG] Missing source directory fails silently

Describe the bug
When the source directory cannot be found, yarn.build will fail silently.

To Reproduce
Steps to reproduce the behavior:

  1. Rename any of the example projects src to source
  2. Run yarn build
  3. The build completes apparently without errors.

Expected behavior
There should be an error message that the expected src directory does not exist. This is visible when running with --verbose, but I don't think that's enough.

Ideally, it should also be checked if yarn.build has been configured in the manifest to print some guidance for the user, for example:

The default source directory src could not be found and no other directory has been specified through yarn.build in the workspace manifest.
and
The source directory configured through yarn.build in the project manifest does not exist.

Additional context
The zero-configuration approach worked really well for me before. It's a bit sad that more configuration is required now.

I'm also assuming the source directory is used to detect changes, which isn't ideal, as a lot of externous files in the project can have an impact on the compilation result (like package.json, tsconfig.json, ...). This would make me a lot less worried if we had #42 though 😀

Long build durations are not rendered nicely

Describe the bug
Builds that take longer than a minute create weird output. See screenshot.

To Reproduce
Steps to reproduce the behavior:

  1. Run a build that takes longer than 1 minute.

Expected behavior
The minutes need to be rounded.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows/WSL

Why does bundle include source files and other non-runtime dependent files in the project?

Describe the bug

I'm a bit new to the whole JavaScript ecosystem and packaging and bundling in general. I know enough to be dangerous 😛

At first, in my project, I was trying to put my "production build' outputs into their own folder hierarchy. Long story short, it somewhat worked—though with using Yarn PnP, I needed to mimic some of the actual project hierarchy (so that PnP path resolution worked, because there's no (good) way to "re-run" yarn install on a production output (unless you copy the package.json files???—and if you're output hierarchy is different from development hierarchy, this still doesn't work anyway). Anyway, my original "production build" looked like:

  1. Run a build and put the resulting files in a separate location, say ./releases, which mimicked my project folder hierarchy to the point where the production built files could be resolved via .pnp.js.
  2. Copy yarn's .pnp.js file to this folder
  3. Copy the .yarn/cache folder
  4. Create a .env file at the root (currently done by a PowerShell script for now.)

And this worked. The biggest drawback is that I'm bringing over all the development dependencies (because I wasn't about to try and figure out what was needed and what is not).

And now I come to the point: I find yarn.build. This sounds promising. I didn't necessarily want to resort to using webpack or something.

So I've been doing a LOT of build testing (prior to using yarn.build), and have several files "polluting" my repo, e.g. previous release builds, and self-extracting zips of those builds, etc. When I ran yarn bundle, it did exactly what I expected it NOT to do: grabbed everything in the repo except .git (though, it did slim down the .yarn/cache to just those things needed by my app—I think, I haven't actually tested that the bundle works yet).

I thought yarn bundle was only supposed to package up only those things which are needed to run the project in production? So why are the various ./src directories for the monorepo packages being included? Why are non-project files being included (e.g. previous release builds in the root monorepo directory)? The bundle came out to a WHOPPING 89MB - 920MB!!! When I manually went into the generated bundle.zip and deleted everything NOT related to running the project, the bundle.zip file size was 5MB. That's more what I expected (actually, I expected 20MB - 30MB, but that just shows you how much weight development dependencies add to a project--in my case, 75MB).

To Reproduce

Steps to reproduce the behavior:

  1. Run command yarn bundle in a distributable package in a dirty (😉) repo

Expected behavior

I expected that only the output folders from the build (i.e. the folder listed in the package.json#directories, package.json#files, or inferred files/directories based on package.json#main to be included in the bundled output.

Screenshots

I'm in the middle of trying to get my build working the way I want it to--so there's lots of cruft in my project workspace at the moment. Once I have good, stable production builds being packaged correctly, I intend on cleaning all of this up. But for now, this is what I've got. And this is being packaged in the bundle.zip, inflating its size from 5MB to 890MB!!!!!
image

image

And here's what's contained in the bundle.zip:

image

Even yarn PnP specific stuff, like yarn sdks and plugins are included in the bundle!! But these aren't necessary at runtime, are they?? I never included them in my hodge-podge builds/packages I was creating before and this app is running in production just fine.

After deleting all the unnecessary cruft, here's what the bundle looks like, along with its size:

image

image

Qutie a difference!!!!

Desktop:

  • OS: Windows 10, no WSL
  • Yarn: v2.4.2
  • Node: v14.17.1

Additional Context

I did not use yarn build because the build scripts in my various package.json files are not simply named build and are not the same for all packages—e.g. for a react website, the command is simply build, but for other packages, the command could be either build:dev or build:prod. The simplistic option of specifying a command via -c is not sophisticated enough for my project. In addition, for the react web site, I need to pass different environment variables to Node depending on the environment I'm building for so that the right .env.* files are used. (Perhaps it's possible to do this with yarn.build, e.g. NODE_ENV=MyEnv yarn build?? But I didn't see any documentation suggesting this would work.)

Add fast-fail option

Add an option (likely a default) to immediately fail and bail. Current behaviour, it will just keep on going.

[FEAT] Rebuild command that ignores build state

Is your feature request related to a problem? Please describe.
Sometimes my projects need to be rebuilt even though yarn.build doesn't recognize it. Sometimes external factors changed that have an outcome on the build, that are not easily deduced.

Describe the solution you'd like
A command like yarn rebuild that ignores the build cache and just builds the target.

Describe alternatives you've considered
Deleting the build cache before running yarn build, but that deletes the cache for all modules, not just the target. And it's not as nice as a purpose-built command.

[BUG] build not working in docker

Describe the bug
I expect yarn build works the same in my terminal and docker socket, seems that it is not.

To Reproduce
From monorepo, running docker build -f services/service/Dockerfile . -t service

FROM node:14.15.1-alpine as bundler
WORKDIR usr/src/app

ADD . .

RUN yarn install
RUN yarn workspace @packages/service build

error:

/usr/src/app/.yarn/plugins/@ojkelly/plugin-build.cjs:5
TypeError: process.stdout.cursorTo is not a function
    at L.waitUntilDone (/usr/src/app/.yarn/plugins/@ojkelly/plugin-build.cjs:5:13205)
    at Immediate.<anonymous> (/usr/src/app/.yarn/plugins/@ojkelly/plugin-build.cjs:5:13009)
    at processImmediate (internal/timers.js:461:21)

Expected behavior
Successfully build

Desktop (please complete the following information):

  • OS: macOS
  • yarn 2.4.0
  • yarn.build latest

related to #12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.