netlify-cli 8.13.1 → 8.14.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "8.13.1",
4
+ "version": "8.14.1",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@netlify/build": "^26.2.0",
81
- "@netlify/config": "^17.0.3",
81
+ "@netlify/config": "^17.0.6",
82
82
  "@netlify/framework-info": "^9.0.0",
83
83
  "@netlify/local-functions-proxy": "^1.1.1",
84
84
  "@netlify/plugin-edge-handlers": "^3.0.4",
@@ -146,7 +146,7 @@
146
146
  "multiparty": "^4.2.1",
147
147
  "netlify": "^10.1.2",
148
148
  "netlify-headers-parser": "^6.0.1",
149
- "netlify-onegraph-internal": "0.0.15",
149
+ "netlify-onegraph-internal": "0.0.16",
150
150
  "netlify-redirect-parser": "^13.0.1",
151
151
  "netlify-redirector": "^0.2.1",
152
152
  "node-fetch": "^2.6.0",
@@ -185,8 +185,8 @@
185
185
  },
186
186
  "devDependencies": {
187
187
  "@babel/preset-react": "^7.12.13",
188
- "@netlify/eslint-config-node": "^4.1.6",
189
- "ava": "^3.15.0",
188
+ "@netlify/eslint-config-node": "^4.1.7",
189
+ "ava": "^4.0.0",
190
190
  "c8": "^7.11.0",
191
191
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
192
192
  "fast-glob": "^3.2.7",
@@ -308,7 +308,7 @@ const dev = async (options, command) => {
308
308
  } else if (startNetlifyGraphWatcher) {
309
309
  const netlifyToken = await command.authenticate()
310
310
  await OneGraphCliClient.ensureAppForSite(netlifyToken, site.id)
311
- const netlifyGraphConfig = await getNetlifyGraphConfig({ command, options })
311
+ const netlifyGraphConfig = await getNetlifyGraphConfig({ command, options, settings })
312
312
 
313
313
  log(`Starting Netlify Graph session, to edit your library run \`netlify graph:edit\` in another tab`)
314
314
 
@@ -276,16 +276,13 @@ const link = async (options, command) => {
276
276
  return exit()
277
277
  }
278
278
 
279
- // If already linked to site. exit and prompt for unlink
280
279
  if (siteData) {
280
+ // If already linked to site. exit and prompt for unlink
281
281
  log(`Site already linked to "${siteData.name}"`)
282
282
  log(`Admin url: ${siteData.admin_url}`)
283
283
  log()
284
284
  log(`To unlink this site, run: ${chalk.cyanBright('netlify unlink')}`)
285
- return exit()
286
- }
287
-
288
- if (options.id) {
285
+ } else if (options.id) {
289
286
  try {
290
287
  // @ts-ignore types from API are wrong they cannot recognize `getSite` of API
291
288
  siteData = await api.getSite({ site_id: options.id })
@@ -306,11 +303,7 @@ const link = async (options, command) => {
306
303
  linkType: 'manual',
307
304
  kind: 'byId',
308
305
  })
309
-
310
- return exit()
311
- }
312
-
313
- if (options.name) {
306
+ } else if (options.name) {
314
307
  let results
315
308
  try {
316
309
  results = await listSites({
@@ -341,11 +334,9 @@ const link = async (options, command) => {
341
334
  linkType: 'manual',
342
335
  kind: 'byName',
343
336
  })
344
-
345
- return exit()
337
+ } else {
338
+ siteData = await linkPrompt(command.netlify, options)
346
339
  }
347
-
348
- siteData = await linkPrompt(command.netlify, options)
349
340
  return siteData
350
341
  }
351
342
 
@@ -9,6 +9,7 @@ const { v4: uuidv4 } = require('uuid')
9
9
 
10
10
  const { chalk, error, getRepoData, log, logJson, track, warn } = require('../../utils')
11
11
  const { configureRepo } = require('../../utils/init/config')
12
+ const { link } = require('../link')
12
13
 
13
14
  const SITE_NAME_SUGGESTION_SUFFIX_LENGTH = 5
14
15
 
@@ -159,6 +160,11 @@ const sitesCreate = async (options, command) => {
159
160
  )
160
161
  }
161
162
 
163
+ if (!options.disableLinking) {
164
+ log()
165
+ await link({ id: site.id }, command)
166
+ }
167
+
162
168
  return site
163
169
  }
164
170
 
@@ -172,15 +178,16 @@ const createSitesCreateCommand = (program) =>
172
178
  .command('sites:create')
173
179
  .description(
174
180
  `Create an empty site (advanced)
175
- Create a blank site that isn't associated with any git remote. Does not link to the current working directory.`,
181
+ Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`,
176
182
  )
177
183
  .option('-n, --name [name]', 'name of site')
178
184
  .option('-a, --account-slug [slug]', 'account slug to create the site under')
179
185
  .option('-c, --with-ci', 'initialize CI hooks during site creation')
180
186
  .option('-m, --manual', 'force manual CI setup. Used --with-ci flag')
187
+ .option('--disable-linking', 'create the site without linking it to current directory')
181
188
  .addHelpText(
182
189
  'after',
183
- `Create a blank site that isn't associated with any git remote. Does not link to the current working directory.`,
190
+ `Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`,
184
191
  )
185
192
  .action(sitesCreate)
186
193
 
@@ -29,7 +29,7 @@ const filterRelativePathItems = (items) => items.filter((part) => part !== '')
29
29
  * @param {import('../base-command').BaseCommand} command
30
30
  * @return {NetlifyGraphConfig} NetlifyGraphConfig
31
31
  */
32
- const getNetlifyGraphConfig = async ({ command, options }) => {
32
+ const getNetlifyGraphConfig = async ({ command, options, settings }) => {
33
33
  const { config, site } = command.netlify
34
34
  config.dev = { ...config.dev }
35
35
  config.build = { ...config.build }
@@ -44,11 +44,12 @@ const getNetlifyGraphConfig = async ({ command, options }) => {
44
44
  }
45
45
 
46
46
  /** @type {Partial<import('../../utils/types').ServerSettings>} */
47
- let settings = {}
48
- try {
49
- settings = await detectServerSettings(devConfig, options, site.root)
50
- } catch (detectServerSettingsError) {
51
- error(detectServerSettingsError)
47
+ if (!settings) {
48
+ try {
49
+ settings = await detectServerSettings(devConfig, options, site.root)
50
+ } catch (detectServerSettingsError) {
51
+ error(detectServerSettingsError)
52
+ }
52
53
  }
53
54
 
54
55
  const siteRoot = [path.sep, ...filterRelativePathItems(site.root.split(path.sep))]