Repository navigation
Conversation
- Add ~/.fleetbase/config.json ({ host, registry, tokens: { "<host>": "<token>" },
defaultOrganization }) with read/write helpers; FLEETBASE_HOME overrides the dir.
- set-auth stores the token in the config file (keyed by registry host, plus the
API host when --host is given) and still writes <instance>/api/auth.json; it no
longer appends to <instance>/console/.npmrc. Token argument is optional when one
is already stored.
- bundle --upload / bundle-upload read the token from --auth-token, then the config
file; ~/.npmrc is no longer consulted. Guard error.response?.data in the catch.
- Add a global --host <url> (flag > config file > https://api.fleetbase.io) and
per-command --host on install, uninstall, bundle, bundle-upload, search,
register, verify, resend-verification, generate-token, login, set-auth. Build all
registry URLs from the host; drop the hard-coded packageLookupApi /
bundleUploadApi / extensionsListApi constants. Global options are positional so
install-fleetbase --host keeps its own meaning.
- One normalizeHost helper: keep an existing scheme; http:// for localhost,
127.0.0.1 and hosts with a port; https:// otherwise.
- scaffold: fix const reassignment crash when the target dir exists; namespace is
--namespace only (duplicate -n removed); --repo has no default so
extension.json/package.json no longer point at the starter repo.
- login: accept --host (used as the registry unless --registry is given), wrap
npm-cli-login in a promise, exit non-zero on failure.
- verify / generate-token: token is saved to the config file and masked unless
--show-token is passed.
- install / uninstall / scaffold exit 1 on failure.
- Add test/cli.test.js (plain node assert) covering host normalisation, config
read/write, token storage, host precedence and option registration; npm test
runs it.
- README updated for the config file, --host, set-auth/login/scaffold changes and
the removed -r on bundle commands.
| return host; | ||
| } | ||
|
|
||
| const value = host.trim().replace(/\/+$/, ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 0 (stabilise) of the Extensions Registry re-architecture, CLI side. Small, backwards-compatible fixes so developer accounts, the CLI and the registry are usable while the Registry Service is built.
Summary
~/.fleetbase/config.jsonholding{ host, registry, tokens: { "<host>": "<token>" }, defaultOrganization }, created with mode 0600.FLEETBASE_HOMEoverrides the directory (used by tests).set-authstores the token in the config file keyed by registry host (and by API host, plus saveshost, when--hostis given). It still writes<instance>/api/auth.jsonfor Composer and no longer appends to<instance>/console/.npmrc. The token argument is optional when one is already stored.bundle --upload/bundle-uploadread the token from--auth-token, then the config file.~/.npmrcis no longer consulted. The error handler guardserror.response?.data.--host <url>: global option plus per-command--hostoninstall,uninstall,bundle,bundle-upload,search,register,verify,resend-verification,generate-token,login,set-auth. Precedence: flag > config file >https://api.fleetbase.io. All registry URLs are built from the host; the hard-codedpackageLookupApi/bundleUploadApi/extensionsListApiconstants are removed. Global options are positional soinstall-fleetbase --hostkeeps its own meaning.http://forlocalhost,127.0.0.1and hosts with a port;https://otherwise.scaffold: fix theconstreassignment crash when the target directory exists; remove the duplicate-n(namespace is--namespaceonly);--repohas no default soextension.json/package.jsonno longer point at the starter repo.login: accepts--host(used as the registry unless--registryis given); npm-cli-login is wrapped in a promise so failures are caught and exit non-zero. The package's default export is callback based and threw from inside async callbacks.verifyandgenerate-tokensave the token to the config file and show it masked;--show-tokenprints it.install/uninstall/scaffoldexit 1 on failure.test/cli.test.js(plainnode:assert, run bynpm test) covers host normalisation, config read/write, token storage and lookup, host precedence and option registration.--host, and theset-auth/login/scaffold/ bundle changes.Behaviour changes to be aware of
~/.npmrc. A user who only ranflb loginmust runflb set-auth <token>once; the error message says so.scaffold -nnow only means--name.-h, --hostonregister/verify/searchis unchanged.Verification
npm test: 17/17 pass.verifymasks and saves the token and--show-tokenprints it;bundle-uploadsends the stored token and--auth-tokenoverrides it; a 403 is reported cleanly with exit 1;installhits the lookup URL on the given host and exits 1 whenpnpmfails;searchuses the host from the config file;loginagainst a closed port exits 1 with a clear error.