fynpo-cli 1.0.3 → 2.0.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,3 +1,31 @@
1
+ [![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url]
2
+
1
3
  # fynpo-cli
2
4
 
3
- Install to npm global for the `fynpo` command.
5
+ The global launcher for the `fynpo` command.
6
+
7
+ Install this package globally and you get a `fynpo` binary. It carries no logic and no dependencies of its own - it finds the [fynpo] installed in the repo you're standing in and runs that, so every repo gets the fynpo version it declares rather than whichever one happens to be installed globally.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g fynpo-cli
13
+ ```
14
+
15
+ Then, in a monorepo that has `fynpo` as a dev dependency:
16
+
17
+ ```bash
18
+ fynpo bootstrap
19
+ ```
20
+
21
+ If you'd rather not install anything globally, run the local one directly - `npx fynpo` or `fyn fynpo` - and skip this package entirely.
22
+
23
+ ## License
24
+
25
+ Licensed under the [Apache License, Version 2.0](./LICENSE).
26
+
27
+ [fynpo]: https://github.com/jchip/fynjs/tree/main/packages/fynpo
28
+ [npm-image]: https://badge.fury.io/js/fynpo-cli.svg
29
+ [npm-url]: https://npmjs.org/package/fynpo-cli
30
+ [build-image]: https://github.com/jchip/fynjs/actions/workflows/ci.yml/badge.svg
31
+ [build-url]: https://github.com/jchip/fynjs/actions/workflows/ci.yml
package/dist/fynpo.js CHANGED
@@ -1,23 +1,64 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
- const require_at_1 = (0, tslib_1.__importDefault)(require("require-at"));
6
- try {
7
- (0, require_at_1.default)(process.cwd(), "fynpo/dist/fynpo-cli");
8
- }
9
- catch (err) {
10
- if (err.code === "MODULE_NOT_FOUND") {
11
- console.error(`ERROR: Unable to find the fynpo module from dir ${process.cwd()}
2
+ import Path from "node:path";
3
+ import { createRequire } from "node:module";
4
+ import { pathToFileURL } from "node:url";
5
+ //
6
+ // fynpo-cli is a thin global launcher: `npm i -g fynpo-cli` gives you a `fynpo` command that
7
+ // finds and runs the fynpo installed in whatever monorepo you are standing in. Hence resolving
8
+ // from process.cwd() rather than from this package's own location.
9
+ //
10
+ const cwdRequire = createRequire(Path.join(process.cwd(), "_"));
11
+ const notInMonorepo = () => {
12
+ console.error(`ERROR: Unable to find the fynpo module from dir ${process.cwd()}
12
13
 
13
14
  Please make sure you are in a fynpo monorepo and you have installed fynpo
14
15
  at its top level.
15
16
  `);
17
+ return process.exit(1);
18
+ };
19
+ const failedToLoad = (err) => {
20
+ console.error(`Fail to load fynpo for your monorepo from dir ${process.cwd()}
21
+ `, err);
22
+ return process.exit(1);
23
+ };
24
+ //
25
+ // Find fynpo's entry through its package.json `bin` field, not a path inside its dist/.
26
+ //
27
+ // This used to require "fynpo/dist/fynpo-cli". That file stopped existing when fynpo's build
28
+ // changed (webpack emitting dist/fynpo-cli -> rolldown emitting only dist/bundle.mjs), so the
29
+ // require always missed and every invocation printed "not in a fynpo monorepo" - misleading,
30
+ // because fynpo was installed fine. dist/ layout is fynpo's private business; `bin` is the
31
+ // published contract, and following it means a future build change cannot break this again.
32
+ // See FJM-85.
33
+ //
34
+ let pkgJsonPath;
35
+ try {
36
+ pkgJsonPath = cwdRequire.resolve("fynpo/package.json");
37
+ }
38
+ catch {
39
+ pkgJsonPath = notInMonorepo();
40
+ }
41
+ const pkg = cwdRequire(pkgJsonPath);
42
+ const binRel = (pkg && pkg.bin && (typeof pkg.bin === "string" ? pkg.bin : pkg.bin.fynpo)) || "bin/fynpo.js";
43
+ const binPath = Path.join(Path.dirname(pkgJsonPath), binRel);
44
+ //
45
+ // fynpo's bin runs its own main() on load - it also owns the logic for reaching the ESM bundle
46
+ // and for the load-from-TypeScript-source fallback. Importing it hands over completely,
47
+ // in-process, so argv and the exit code flow through untouched. Dynamic import loads the bin
48
+ // whether it is CJS or ESM.
49
+ //
50
+ try {
51
+ await import(pathToFileURL(binPath).href);
52
+ }
53
+ catch (err) {
54
+ const code = err?.code;
55
+ // the bin file itself missing means the fynpo install is broken/absent - same guidance as
56
+ // not finding the package at all; anything else is a real load failure worth showing
57
+ if (code === "ERR_MODULE_NOT_FOUND" && String(err).includes(binRel.replace(/^\.\//, ""))) {
58
+ notInMonorepo();
16
59
  }
17
60
  else {
18
- console.error(`Fail to load fynpo for your monorepo from dir ${process.cwd()}
19
- `, err);
61
+ failedToLoad(err);
20
62
  }
21
- process.exit(1);
22
63
  }
23
64
  //# sourceMappingURL=fynpo.js.map
package/dist/fynpo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fynpo.js","sourceRoot":"","sources":["../bin/fynpo.ts"],"names":[],"mappings":";;;;AAEA,yEAAmC;AAEnC,IAAI;IACF,IAAA,oBAAS,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,sBAAsB,CAAC,CAAC;CAClD;AAAC,OAAO,GAAG,EAAE;IACZ,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,mDAAmD,OAAO,CAAC,GAAG,EAAE;;;;CAIjF,CAAC,CAAC;KACA;SAAM;QACL,OAAO,CAAC,KAAK,CACX,iDAAiD,OAAO,CAAC,GAAG,EAAE;CACnE,EACK,GAAG,CACJ,CAAC;KACH;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB"}
1
+ {"version":3,"file":"fynpo.js","sourceRoot":"","sources":["../bin/fynpo.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,EAAE;AACF,6FAA6F;AAC7F,+FAA+F;AAC/F,mEAAmE;AACnE,EAAE;AACF,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CA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AA4B;AAC5B,EAAE;AACF,IAAI,CAAC;IACH,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAAC,OAAO,GAAY,EAAE,CAAC;IACtB,MAAM,IAAI,GAAI,GAA6B,EAAE,IAAI,CAAC;IAClD,0FAA0F;IAC1F,qFAAqF;IACrF,IAAI,IAAI,KAAK,sBAAsB,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;QACzF,aAAa,EAAE,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "fynpo-cli",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "npm install globally to provide the fynpo command",
5
- "main": "index.js",
6
- "homepage": "https://www.electrode.io/fynpo/",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=22.12.0"
8
+ },
9
+ "homepage": "https://github.com/jchip/fynjs/tree/main/packages/fynpo-cli",
7
10
  "bin": {
8
11
  "fynpo": "dist/fynpo.js"
9
12
  },
10
13
  "scripts": {
11
14
  "build": "tsc",
12
- "test": "xrun xarc/test-only",
13
- "lint": "xrun xarc/lint",
14
- "coverage": "xrun xarc/test-cov",
15
- "prepublishOnly": "xrun --serial [build, xarc/check]",
16
- "docs": "xrun xarc/docs",
17
- "ci:check": "xrun xarc/check",
18
- "prepack": "publish-util-prepack",
19
- "postpack": "publish-util-postpack"
15
+ "prepublishOnly": "xrun build",
16
+ "docs": "typedoc --gitRevision $(git rev-list -1 HEAD src | cut -c1-8) --out docs src",
17
+ "ci:check": "tsc --noEmit && vitest run",
18
+ "postpack": "publish-util-postpack",
19
+ "test": "vitest run"
20
20
  },
21
21
  "files": [
22
22
  "dist"
@@ -34,12 +34,13 @@
34
34
  "Divya Vannilaparambath"
35
35
  ],
36
36
  "license": "Apache-2.0",
37
+ "bugs": {
38
+ "url": "https://github.com/jchip/fynjs/issues"
39
+ },
37
40
  "repository": {
38
41
  "type": "git",
39
- "url": "https://github.com/electrode-io/fynpo.git"
42
+ "url": "https://github.com/jchip/fynjs.git",
43
+ "directory": "packages/fynpo-cli"
40
44
  },
41
- "dependencies": {
42
- "require-at": "^1.0.6",
43
- "tslib": "^2.1.0"
44
- }
45
+ "dependencies": {}
45
46
  }