Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat(workspaces): update configs #2836

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/content/commands/npm-adduser.md
Expand Up @@ -12,6 +12,8 @@ npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=leg
aliases: login, add-user
```

Note: This command is unaware of workspaces.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe instead of just "unaware", commands like this should be marked to indicate that it wouldn't make sense for them to be workspace-aware?

(altho in this case i can imagine wanting to log in to specific users only in specific workspaces' .npmrc files)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe instead of just "unaware", commands like this should be marked to indicate that it wouldn't make sense for them to be workspace-aware?

this is me marking them to indicate that it wouldn't make sense for them to be workspace-aware 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these do make sense for it, though :-)


### Description

Create or verify a user named `<username>` in the specified registry, and
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-bin.md
Expand Up @@ -10,6 +10,8 @@ description: Display npm bin folder
npm bin [-g|--global]
```

Note: This command is unaware of workspaces.

### Description

Print the folder where npm will install executables.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-cache.md
Expand Up @@ -18,6 +18,8 @@ aliases: npm cache clear, npm cache rm
npm cache verify
```

Note: This command is unaware of workspaces.

### Description

Used to add, list, or clean the npm cache folder.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-completion.md
Expand Up @@ -10,6 +10,8 @@ description: Tab Completion for npm
source <(npm completion)
```

Note: This command is unaware of workspaces.

### Description

Enables tab-completion in all npm commands.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-config.md
Expand Up @@ -18,6 +18,8 @@ npm get [<key> [<key> ...]]
alias: c
```
Note: This command is unaware of workspaces.
### Description
npm gets its config settings from the command line, environment
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-deprecate.md
Expand Up @@ -10,6 +10,8 @@ description: Deprecate a version of a package
npm deprecate <pkg>[@<version range>] <message>
```

Note: This command is unaware of workspaces.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this definitely should be workspace-aware, since folks will want to deprecate individual (or multiple) workspaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok yeah, this comment is a clue on how we can improve the message... the true purpose of this note is to let users aware that there's no point trying to run this command with a --workspaces or --workspace=<name> configs 🤔

Copy link
Collaborator Author

@ruyadorno ruyadorno Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course folks will be able to deprecate a package even if it's managed as a workspace somewhere

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but i mean, i might want to deprecate N packages at a time, based on workspace config.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def a valid usecase 🤔 honestly I think the confusion factor here is due to the current syntax of npm deprecate that doesn't read any info from the current dir package.json file, it only accepts a single @ argument along with a message, which makes it harder to scale to multiple pkgs or workspaces

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, it sounds more like something we're going to have to redesign later and probably in a breaking change way, so I guess for now it will still have to be marked here as a command that is unaware of the workspaces configs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened a RFC to follow through: npm/rfcs#341

thanks @ljharb 👍


### Description

This command will update the npm registry entry for a package, providing a
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-doctor.md
Expand Up @@ -10,6 +10,8 @@ description: Check your npm environment
npm doctor
```

Note: This command is unaware of workspaces.

### Description

`npm doctor` runs a set of checks to ensure that your npm installation has
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-edit.md
Expand Up @@ -10,6 +10,8 @@ description: Edit an installed package
npm edit <pkg>
```

Note: This command is unaware of workspaces.

### Description

Selects a dependency in the current project and opens the package folder in
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-explore.md
Expand Up @@ -10,6 +10,8 @@ description: Browse an installed package
npm explore <pkg> [ -- <command>]
```

Note: This command is unaware of workspaces.

### Description

Spawn a subshell in the directory of the installed package specified.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-help-search.md
Expand Up @@ -10,6 +10,8 @@ description: Search npm help documentation
npm help-search <text>
```

Note: This command is unaware of workspaces.

### Description

This command will search the npm markdown documentation files for the terms
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-help.md
Expand Up @@ -10,6 +10,8 @@ description: Get help on npm
npm help <term> [<terms..>]
```

Note: This command is unaware of workspaces.

### Description

If supplied a topic, then show the appropriate documentation page.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-hook.md
Expand Up @@ -13,6 +13,8 @@ npm hook update <id> <url> [secret]
npm hook rm <id>
```

Note: This command is unaware of workspaces.

### Description

Allows you to manage [npm
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-logout.md
Expand Up @@ -10,6 +10,8 @@ description: Log out of the registry
npm logout [--registry=<url>] [--scope=<@scope>]
```

Note: This command is unaware of workspaces.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as adduser (which, since this is called "logout", should really have "login" as the canonical name for it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well... for now there are no support to reading .npmrc files within workspaces

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems like something worth doing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or at least considered, might be waaay more work than it sounds though and probably rfc-worthy


### Description

When logged into a registry that supports token-based authentication, tell
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-org.md
Expand Up @@ -12,6 +12,8 @@ npm org rm <orgname> <username>
npm org ls <orgname> [<username>]
```

Note: This command is unaware of workspaces.

### Example

Add a new developer to an org:
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-owner.md
Expand Up @@ -14,6 +14,8 @@ npm owner ls [<@scope>/]<pkg>
aliases: author
```

Note: This command is unaware of workspaces.
ruyadorno marked this conversation as resolved.
Show resolved Hide resolved

### Description

Manage ownership of published packages.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-ping.md
Expand Up @@ -10,6 +10,8 @@ description: Ping npm registry
npm ping [--registry <registry>]
```

Note: This command is unaware of workspaces.

### Description

Ping the configured or given npm registry and verify authentication.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-prefix.md
Expand Up @@ -10,6 +10,8 @@ description: Display prefix
npm prefix [-g]
```

Note: This command is unaware of workspaces.

### Description

Print the local prefix to standard output. This is the closest parent directory
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-profile.md
Expand Up @@ -14,6 +14,8 @@ npm profile enable-2fa [auth-and-writes|auth-only]
npm profile disable-2fa
```

Note: This command is unaware of workspaces.

### Description

Change your profile information on the registry. Note that this command
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-search.md
Expand Up @@ -12,6 +12,8 @@ npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms .
aliases: s, se, find
```

Note: This command is unaware of workspaces.

### Description

Search the registry for packages matching the search terms. `npm search`
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-shrinkwrap.md
Expand Up @@ -10,6 +10,8 @@ description: Lock down dependency versions for publication
npm shrinkwrap
```

Note: This command is unaware of workspaces.

### Description

This command repurposes `package-lock.json` into a publishable
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-star.md
Expand Up @@ -10,6 +10,8 @@ description: Mark your favorite packages
npm star [<pkg>...]
```

Note: This command is unaware of workspaces.

### Description

"Starring" a package means that you have some interest in it. It's
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-stars.md
Expand Up @@ -9,6 +9,8 @@ description: View packages marked as favorites
npm stars [<user>]
```

Note: This command is unaware of workspaces.

### Description

If you have starred a lot of neat things and want to find them again
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-team.md
Expand Up @@ -16,6 +16,8 @@ npm team rm <scope:team> <user>
npm team ls <scope>|<scope:team>
```

Note: This command is unaware of workspaces.

### Description

Used to manage teams in organizations, and change team memberships. Does not
Expand Down
4 changes: 3 additions & 1 deletion docs/content/commands/npm-token.md
Expand Up @@ -9,7 +9,9 @@ description: Manage your authentication tokens
npm token list [--json|--parseable]
npm token create [--read-only] [--cidr=1.1.1.1/24,2.2.2.2/16]
npm token revoke <id|token>
```
```

Note: This command is unaware of workspaces.

### Description

Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-unstar.md
Expand Up @@ -10,6 +10,8 @@ description: Remove an item from your favorite packages
npm unstar [<pkg>...]
```

Note: This command is unaware of workspaces.

### Description

"Unstarring" a package is the opposite of [`npm star`](/commands/npm-star),
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-whoami.md
Expand Up @@ -10,6 +10,8 @@ description: Display npm username
npm whoami [--registry <registry>]
```

Note: This command is unaware of workspaces.
ruyadorno marked this conversation as resolved.
Show resolved Hide resolved

### Description

Print the `username` config to standard output.
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/config.js
Expand Up @@ -192,6 +192,8 @@ const defaults = {
version: false,
versions: false,
viewer: isWindows ? 'browser' : 'man',
workspace: [],
workspaces: false,
}

const types = {
Expand Down Expand Up @@ -348,6 +350,8 @@ const types = {
version: Boolean,
versions: Boolean,
viewer: String,
workspace: [String, Array],
workspaces: Boolean
}

const shorthands = {
Expand Down Expand Up @@ -389,6 +393,7 @@ const shorthands = {
v: ['--version'],
verbose: ['--loglevel', 'verbose'],
y: ['--yes'],
w: ['--workspace'],
}

module.exports = { defaults, types, shorthands }
20 changes: 20 additions & 0 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Expand Up @@ -149,6 +149,8 @@ Object {
"version": false,
"versions": false,
"viewer": "browser",
"workspace": Array [],
"workspaces": false,
},
"shorthands": Object {
"?": Array [
Expand Down Expand Up @@ -270,6 +272,9 @@ Object {
"--loglevel",
"verbose",
],
"w": Array [
"--workspace",
],
"y": Array [
"--yes",
],
Expand Down Expand Up @@ -552,6 +557,11 @@ Object {
"version": "{Boolean TYPE}",
"versions": "{Boolean TYPE}",
"viewer": "{String TYPE}",
"workspace": Array [
"{String TYPE}",
"{Array TYPE}",
],
"workspaces": "{Boolean TYPE}",
},
}
`
Expand Down Expand Up @@ -700,6 +710,8 @@ Object {
"version": false,
"versions": false,
"viewer": "man",
"workspace": Array [],
"workspaces": false,
},
"shorthands": Object {
"?": Array [
Expand Down Expand Up @@ -821,6 +833,9 @@ Object {
"--loglevel",
"verbose",
],
"w": Array [
"--workspace",
],
"y": Array [
"--yes",
],
Expand Down Expand Up @@ -1105,6 +1120,11 @@ Object {
"version": "{Boolean TYPE}",
"versions": "{Boolean TYPE}",
"viewer": "{String TYPE}",
"workspace": Array [
"{String TYPE}",
"{Array TYPE}",
],
"workspaces": "{Boolean TYPE}",
},
}
`