fyn 3.2.2 → 3.3.0

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/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # fyn
2
2
 
3
- [![NPM version][npm-image]][npm-url]
4
- [![Apache 2.0 License][apache-2.0-blue-image]][apache-2.0-url]
5
- [![Build Status][build-image]][build-url]
3
+ [![License][license-image]][license-url]
4
+ [![build][build-image]][build-url]
5
+
6
+ [![Downloads][downloads-image]][downloads-url]
7
+
8
+ [![npm badge][npm-badge-png]][package-url]
9
+
10
+ - [Markdown reference](docs/reference.md) - the full CLI reference and runtime behavior in one file. Also ships in the package.
11
+ - [GitHub](https://github.com/jchip/fynjs/tree/main/packages/fyn)
6
12
 
7
13
  **fyn** is a fast package manager for Node.js. It treats your disk as a registry, so you can develop and test packages using local copies. It uses hardlinks and a shared store to save disk space and speed up installs. It can link live source folders between packages, so changes show up right away. It reads your existing `.npmrc` and lockfiles, and it powers [fynpo], a zero-setup monorepo tool.
8
14
 
@@ -56,29 +62,23 @@ fyn options can be listed in help:
56
62
  fyn --help
57
63
  ```
58
64
 
59
- fyn loads config from `CWD/.fynrc`, `CWD/.npmrc`, `~/.fynrc`, and `~/.npmrc` in this specified order, from highest to lowest priority.
65
+ fyn loads config from up to 9 rc files. Later files override earlier ones, so this list goes from lowest to highest priority:
60
66
 
61
- From `.npmrc`, only fields `registry`, `@<scope>:registry`,`email`, and `_auth` are read.
67
+ 1. `$NPM_CONFIG_GLOBALCONFIG`
68
+ 2. `$PREFIX/etc/npmrc`
69
+ 3. `$NPM_CONFIG_USERCONFIG`
70
+ 4. `~/.npmrc`
71
+ 5. `~/.fynrc`
72
+ 6. `<fynpo dir>/.npmrc` (in a fynpo monorepo, when CWD is not the fynpo dir)
73
+ 7. `<fynpo dir>/.fynrc` (same as above)
74
+ 8. `CWD/.npmrc`
75
+ 9. `CWD/.fynrc`
62
76
 
63
- `.fynrc` file can be an [ini] or `YAML` format. For the `YAML` format, the first line must be `---`.
77
+ fyn merges every key from every rc file into its options, including `.npmrc` files.
64
78
 
65
- Below is an `YAML` example, with all the options set to their default values:
66
-
67
- ```yml
68
- ---
69
- registry: https://registry.npmjs.org
70
- "@scope:registry": https://registry.custom.com
71
- offline: false
72
- forceCache: false
73
- lockOnly: false
74
- progress: normal
75
- logLevel: info
76
- production: false
77
- centralStore: false
78
- hardlink: true
79
- ```
79
+ Every rc file is parsed as [ini]. YAML is not supported.
80
80
 
81
- Or as an ini:
81
+ Below is an ini example, with the options set to their default values:
82
82
 
83
83
  ```ini
84
84
  registry=https://registry.npmjs.org
@@ -89,10 +89,29 @@ lockOnly=false
89
89
  progress=normal
90
90
  logLevel=info
91
91
  production=false
92
- centralStore=false
93
92
  hardlink=true
94
93
  ```
95
94
 
95
+ `centralStore` has no fixed default. When it is unset in a non-fynpo project, fyn turns it on for macOS when @fynjs/reflink can clone dirs, and for Linux when it can hardlink or clone. It stays off on other platforms. A fynpo monorepo uses its own central store. Set `centralStore=false` to keep it off in a non-fynpo project.
96
+
97
+ ### `.fynrc` sections
98
+
99
+ A `.fynrc` file can have sections that apply only in some environments. Top level keys are the defaults, and a matching section overrides them.
100
+
101
+ - `[IS_CI]` matches when the `CI` or `BUILD_ENV` env var is set.
102
+ - `[CI:value]` matches when `CI` equals `value`. If `CI` is unset, `BUILD_ENV` is checked instead.
103
+ - `[VAR:value]` matches when env var `VAR` equals `value`.
104
+ - `[A|B:value]` matches when `A` or `B` equals `value`.
105
+
106
+ When several sections match, `[CI:value]` wins over `[IS_CI]`, and `[IS_CI]` wins over `[VAR:value]`.
107
+
108
+ ```ini
109
+ progress=normal
110
+
111
+ [IS_CI]
112
+ progress=none
113
+ ```
114
+
96
115
  ### Local source exports (`fyn.localExports`)
97
116
 
98
117
  A package can expose local development directories by declaring them in its
@@ -464,8 +483,9 @@ or per-invocation on the command line:
464
483
  fyn install --no-enforce-registry-deps
465
484
  ```
466
485
 
467
- The CLI flag takes precedence over the `package.json` setting, which takes
468
- precedence over the default (on).
486
+ Any explicitly set option takes precedence over the `package.json` setting. That
487
+ covers the CLI flag, an `enforceRegistryDeps` key in an rc file, and fynpo's
488
+ `fyn.options`. The `package.json` setting takes precedence over the default (on).
469
489
 
470
490
  This is independent of the lifecycle-script controls above: `allowScripts` /
471
491
  `allowTopLevelScripts` decide whether *scripts run*, while `enforceRegistryDeps`
@@ -498,12 +518,6 @@ Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses
498
518
  [ini]: https://www.npmjs.com/package/ini
499
519
  [node_preserve_symlinks]: https://nodejs.org/docs/latest-v8.x/api/cli.html#cli_node_preserve_symlinks_1
500
520
  [require-at]: https://www.npmjs.com/package/require-at
501
- [build-image]: https://github.com/jchip/fynjs/actions/workflows/ci.yml/badge.svg
502
- [build-url]: https://github.com/jchip/fynjs/actions/workflows/ci.yml
503
- [npm-image]: https://badge.fury.io/js/fyn.svg
504
- [npm-url]: https://npmjs.org/package/fyn
505
- [apache-2.0-blue-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
506
- [apache-2.0-url]: https://www.apache.org/licenses/LICENSE-2.0
507
521
  [npm scripts]: https://docs.npmjs.com/misc/scripts
508
522
  [node-tar]: https://www.npmjs.com/package/tar
509
523
  [semver]: https://www.npmjs.com/package/semver
@@ -517,3 +531,12 @@ Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses
517
531
  [npm link]: https://docs.npmjs.com/cli/link.html
518
532
  [@npmcli/run-script]: https://www.npmjs.com/package/@npmcli/run-script
519
533
  [npmlog]: https://www.npmjs.com/package/npmlog
534
+
535
+ [license-image]: https://img.shields.io/npm/l/fyn.svg
536
+ [license-url]: LICENSE
537
+ [build-image]: https://github.com/jchip/fynjs/actions/workflows/ci.yml/badge.svg
538
+ [build-url]: https://github.com/jchip/fynjs/actions/workflows/ci.yml
539
+ [downloads-image]: https://img.shields.io/npm/dm/fyn.svg
540
+ [downloads-url]: https://npm-stat.com/charts.html?package=fyn
541
+ [npm-badge-png]: https://nodei.co/npm/fyn.png?downloads=true&stars=true
542
+ [package-url]: https://npmjs.com/package/fyn
package/bin/fyn.mjs CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import "./check-node.mjs";
4
+ import module from "node:module";
5
+
6
+ // V8 caches the compiled bundle on disk (under the OS temp dir, or NODE_COMPILE_CACHE), which
7
+ // cuts about 25ms off every run after the first. NODE_DISABLE_COMPILE_CACHE=1 turns it off.
8
+ module.enableCompileCache?.();
4
9
 
5
10
  // dynamic so the version check above runs first - see check-node.mjs
6
11
  const { run } = await import("./index.mjs");