Skip to content

Commit

Permalink
feat: Replace framework-info with build-info (#5816)
Browse files Browse the repository at this point in the history
* feat!: support monorepo development

BREAKING CHANGE: In monorepos it is now prompting you
to select the site you want to run the operations in.

This can be bypassed by providing a `--filter` argument
and specify a site/workspace package that should be used.

Through that config file paths are changed and toml files
are picked up accordingly out of the package folders.

* chore: fix build and dev command execution

* chore: update

* chore: adapt types

* chore: updates + remove nod 14 support

* chore: fix linting

* chore: fix

* chore: fix lining

* chore: updates

* chore: fix 11ty tests

* chore: restore snapshot

* chore: fix init test

* chore: update

* Apply suggestions from code review

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

* Update src/commands/base-command.mjs

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

* Update src/commands/base-command.mjs

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

* Update src/commands/base-command.mjs

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

* fix: fix unescaped backtick

* chore: fix the todo and other suggestions

* chore: skip as they are blocking the CI and passing locally

* chore: fix test

* chore: remove `.only`

* chore: test updates and smol fixes

* chore: remove unknown test

* chore: famous last commit

* chore: uncomment skip

---------

Co-authored-by: Lukas Holzer <lukas.holzer@netlify.com>
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
  • Loading branch information
3 people authored Aug 10, 2023
1 parent e3d2348 commit 2006b6d
Showing 96 changed files with 2,515 additions and 1,729 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@ const { overrides } = require('@netlify/eslint-config-node')

module.exports = {
extends: '@netlify/eslint-config-node',
plugins: ['sort-destructure-keys'],
plugins: [
'sort-destructure-keys',
// custom workspace lint rules found under `./tools/lint-rules`
'workspace',
],
parserOptions: {
ecmaVersion: '2020',
babelOptions: {
@@ -12,9 +16,12 @@ module.exports = {
},
},
rules: {
'workspace/no-process-cwd': 'error',
// Those rules from @netlify/eslint-config-node are currently disabled
// TODO: remove, so those rules are enabled
complexity: 0,
'no-inline-comments': 'off',
'no-underscore-dangle': 'off',
'func-style': 'off',
'max-depth': 0,
'max-lines': 0,
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: ['14.18.0', '*']
node-version: ['16.16.0', '*']
fail-fast: false

steps:
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: ['14.18.0', '*']
node-version: ['16.16.0', '*']
shard: ['1/3', '2/3', '3/3']

exclude:
- os: macOS-latest
node-version: '14.18.0'
node-version: '16.16.0'
- os: windows-latest
node-version: '14.18.0'
node-version: '16.16.0'
fail-fast: false
steps:
# Sets an output parameter if this is a release PR
6 changes: 3 additions & 3 deletions .github/workflows/legacy-tests.yml
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: ['14.18.0', '*']
node-version: ['16.16.0', '*']
machine: ['0', '1', '2', '3', '4', '5', '6']

exclude:
- os: macOS-latest
node-version: '14.18.0'
node-version: '16.16.0'
- os: windows-latest
node-version: '14.18.0'
node-version: '16.16.0'
fail-fast: false
steps:
# Sets an output parameter if this is a release PR
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: ['14.18.0', '*']
node-version: ['16.16.0', '*']
fail-fast: false
steps:
# Sets an output parameter if this is a release PR
11 changes: 6 additions & 5 deletions bin/run.mjs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import { argv } from 'process'
import updateNotifier from 'update-notifier'

import { createMainCommand } from '../src/commands/index.mjs'
import { error } from '../src/utils/command-helpers.mjs'
import getPackageJson from '../src/utils/get-package-json.mjs'

// 12 hours
@@ -15,16 +16,16 @@ try {
pkg,
updateCheckInterval: UPDATE_CHECK_INTERVAL,
}).notify()
} catch (error) {
console.log('Error checking for updates:')
console.log(error)
} catch (error_) {
error('Error checking for updates:')
error(error_)
}

const program = createMainCommand()

try {
await program.parseAsync(argv)
program.onEnd()
} catch (error) {
program.onEnd(error)
} catch (error_) {
program.onEnd(error_)
}
18 changes: 6 additions & 12 deletions docs/commands/addons.md
Original file line number Diff line number Diff line change
@@ -21,9 +21,8 @@ netlify addons

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

| Subcommand | description |
|:--------------------------- |:-----|
@@ -61,9 +60,8 @@ netlify addons:auth

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---
## `addons:config`
@@ -82,9 +80,8 @@ netlify addons:config

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---
## `addons:create`
@@ -104,9 +101,8 @@ netlify addons:create

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---
## `addons:delete`
@@ -126,10 +122,9 @@ netlify addons:delete

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `force` (*boolean*) - delete without prompting (useful for CI)
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---
## `addons:list`
@@ -144,10 +139,9 @@ netlify addons:list

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output add-on data as JSON
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---

4 changes: 1 addition & 3 deletions docs/commands/api.md
Original file line number Diff line number Diff line change
@@ -23,10 +23,8 @@ netlify api
**Flags**

- `data` (*string*) - Data to use
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `list` (*boolean*) - List out available API methods
- `debug` (*boolean*) - Print debugging information

**Examples**

3 changes: 1 addition & 2 deletions docs/commands/build.md
Original file line number Diff line number Diff line change
@@ -17,10 +17,9 @@ netlify build

- `context` (*string*) - Specify a build context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")
- `dry` (*boolean*) - Dry run: show instructions without running them
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `offline` (*boolean*) - disables any features that require network access
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

**Examples**

5 changes: 1 addition & 4 deletions docs/commands/completion.md
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@ netlify completion
**Flags**

- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

| Subcommand | description |
|:--------------------------- |:-----|
@@ -45,9 +43,8 @@ netlify completion:install

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---

5 changes: 2 additions & 3 deletions docs/commands/deploy.md
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ netlify deploy
- `build` (*boolean*) - Run build command before deploying
- `context` (*string*) - Context to use when resolving build configuration
- `dir` (*string*) - Specify a folder to deploy
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `functions` (*string*) - Specify a functions folder to deploy
- `json` (*boolean*) - Output deployment data as JSON
- `message` (*string*) - A short message to include in the deploy log
@@ -97,10 +98,8 @@ netlify deploy
- `site` (*string*) - A site name or ID to deploy to
- `skip-functions-cache` (*boolean*) - Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment
- `timeout` (*string*) - Timeout to wait for deployment to finish
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `trigger` (*boolean*) - Trigger a new build of your site on Netlify without uploading local files
- `debug` (*boolean*) - Print debugging information

**Examples**

7 changes: 3 additions & 4 deletions docs/commands/dev.md
Original file line number Diff line number Diff line change
@@ -23,17 +23,17 @@ netlify dev
- `dir` (*string*) - dir with static files
- `edge-inspect` (*string*) - enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format
- `edge-inspect-brk` (*string*) - enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `framework` (*string*) - framework to use. Defaults to #auto which automatically detects a framework
- `functions` (*string*) - specify a functions folder to serve
- `functions-port` (*string*) - port of functions server
- `geo` (*cache | mock | update*) - force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location
- `live` (*string*) - start a public live session; optionally, supply a subdomain to generate a custom URL
- `no-open` (*boolean*) - disables the automatic opening of a browser window
- `offline` (*boolean*) - disables any features that require network access
- `port` (*string*) - port of netlify dev
- `target-port` (*string*) - port of target app server
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

| Subcommand | description |
|:--------------------------- |:-----|
@@ -73,9 +73,8 @@ netlify dev:exec
**Flags**

- `context` (*string*) - Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

**Examples**

29 changes: 11 additions & 18 deletions docs/commands/env.md
Original file line number Diff line number Diff line change
@@ -16,9 +16,8 @@ netlify env

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

| Subcommand | description |
|:--------------------------- |:-----|
@@ -54,11 +53,10 @@ netlify env:clone

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `from` (*string*) - Site ID (From)
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `to` (*string*) - Site ID (To)
- `debug` (*boolean*) - Print debugging information

**Examples**

@@ -85,10 +83,9 @@ netlify env:get
**Flags**

- `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope
- `debug` (*boolean*) - Print debugging information

**Examples**

@@ -116,10 +113,9 @@ netlify env:import

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `replace-existing` (*boolean*) - Replace all existing variables instead of merging them with the current ones
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

---
## `env:list`
@@ -135,12 +131,11 @@ netlify env:list
**Flags**

- `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output environment variables as JSON
- `plain` (*boolean*) - Output environment variables as plaintext
- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope
- `debug` (*boolean*) - Print debugging information

**Examples**

@@ -171,11 +166,10 @@ netlify env:set
**Flags**

- `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts)
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `scope` (*builds | functions | post-processing | runtime*) - Specify a scope (default: all scopes)
- `secret` (*boolean*) - Indicate whether the environment variable value can be read again.
- `debug` (*boolean*) - Print debugging information

**Examples**

@@ -207,9 +201,8 @@ netlify env:unset
**Flags**

- `context` (*string*) - Specify a deploy context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev") (default: all contexts)
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `http-proxy` (*string*) - Proxy server address to route requests through.
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server

**Examples**

Loading

1 comment on commit 2006b6d

@github-actions
Copy link

Choose a reason for hiding this comment

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

📊 Benchmark results

  • Dependency count: 1,326
  • Package size: 275 MB

Please sign in to comment.