netlify-cli 27.8.0 → 27.8.1

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.
@@ -6,6 +6,7 @@ import { startSpinner } from '../../lib/spinner.js';
6
6
  import { chalk, logAndThrowError, exit, log, netlifyCommand } from '../../utils/command-helpers.js';
7
7
  import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
8
8
  import getRepoData from '../../utils/get-repo-data.js';
9
+ import { matchesRepoUrl } from '../../utils/match-repo-url.js';
9
10
  import { isInteractive } from '../../utils/scripted-commands.js';
10
11
  import { track } from '../../utils/telemetry/index.js';
11
12
  const findSiteByRepoUrl = async (api, repoUrl) => {
@@ -16,7 +17,8 @@ const findSiteByRepoUrl = async (api, repoUrl) => {
16
17
  spinner.error();
17
18
  return logAndThrowError(`You don't have any projects yet. Run ${chalk.cyanBright(`${netlifyCommand()} sites:create`)} to create a project.`);
18
19
  }
19
- const matchingSites = sites.filter(({ build_settings: buildSettings = {} }) => repoUrl === buildSettings.repo_url);
20
+ const matchingSites = sites.filter(({ build_settings: buildSettings = {} }) => repoUrl === buildSettings.repo_url ||
21
+ (buildSettings.provider === 'manual' && matchesRepoUrl(repoUrl, buildSettings.repo_url)));
20
22
  if (matchingSites.length === 0) {
21
23
  spinner.error();
22
24
  log(chalk.redBright.bold.underline(`No matching project found`));
@@ -0,0 +1,2 @@
1
+ export declare const matchesRepoUrl: (inputUrl: string, storedRepoUrl: string | undefined) => boolean;
2
+ //# sourceMappingURL=match-repo-url.d.ts.map
@@ -0,0 +1,23 @@
1
+ import parseGithubUrl from 'parse-github-url';
2
+ const BARE_OWNER_REPO_PATTERN = /^[^\s/]+\/[^\s/]+$/;
3
+ export const matchesRepoUrl = (inputUrl, storedRepoUrl) => {
4
+ if (!storedRepoUrl) {
5
+ return false;
6
+ }
7
+ const parsedInput = parseGithubUrl(inputUrl);
8
+ if (!parsedInput?.owner || !parsedInput.name) {
9
+ return false;
10
+ }
11
+ if (BARE_OWNER_REPO_PATTERN.test(storedRepoUrl)) {
12
+ const normalizedStoredRepoUrl = storedRepoUrl.replace(/\.git$/i, '');
13
+ return normalizedStoredRepoUrl.toLowerCase() === `${parsedInput.owner}/${parsedInput.name}`.toLowerCase();
14
+ }
15
+ const parsedStored = parseGithubUrl(storedRepoUrl);
16
+ if (!parsedStored?.owner || !parsedStored.name || !parsedStored.host) {
17
+ return false;
18
+ }
19
+ return (parsedInput.host?.toLowerCase() === parsedStored.host.toLowerCase() &&
20
+ parsedInput.owner.toLowerCase() === parsedStored.owner.toLowerCase() &&
21
+ parsedInput.name.toLowerCase() === parsedStored.name.toLowerCase());
22
+ };
23
+ //# sourceMappingURL=match-repo-url.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "27.8.0",
3
+ "version": "27.8.1",
4
4
  "description": "Netlify command line tool",
5
5
  "keywords": [
6
6
  "api",