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

fix: remove oclif framework and fixes an issue with sites:create #3717

Merged
merged 42 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f6b4e09
chore: remove oclif
lukasholzer Nov 26, 2021
5c24a3a
chore: migrate build command
lukasholzer Nov 29, 2021
e17e6cd
chore: migrate deploy, unlink, link, sites:create commands
lukasholzer Nov 29, 2021
2a09a99
chore: migrate init and watch command
lukasholzer Nov 29, 2021
560ab31
chore: migrate login, logout, switch, sites
lukasholzer Nov 29, 2021
2fbed78
chore: further migrations
lukasholzer Nov 30, 2021
a39e710
chore: migrate functions
lukasholzer Dec 1, 2021
3fb5db7
chore: remove circluar
lukasholzer Dec 1, 2021
a00f1b7
chore: migrate lm and make node 12 compatibility :(
lukasholzer Dec 1, 2021
89ecde4
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 1, 2021
24b575f
chore: refactor last command
lukasholzer Dec 1, 2021
4f58d6e
chore: fix prettier and some tests
lukasholzer Dec 2, 2021
97808dd
chore: show help on base command
lukasholzer Dec 2, 2021
674ddbe
chore: format help output the same way as oclif did
lukasholzer Dec 2, 2021
d8a882f
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 2, 2021
c55e5d0
chore: update examples management for site doc
lukasholzer Dec 3, 2021
b82e919
chore: updates for doc generation
lukasholzer Dec 3, 2021
5abc9e8
chore: updated documentation generation
lukasholzer Dec 3, 2021
7d52fff
chore: lint fix
lukasholzer Dec 3, 2021
5d7b1cf
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 3, 2021
61069c6
chore: lintfix
lukasholzer Dec 3, 2021
f4eea6b
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 6, 2021
e57f1bb
chore: add completion
lukasholzer Dec 7, 2021
c440d71
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 7, 2021
8361b6a
chore: update help snapshot
lukasholzer Dec 7, 2021
2dfead6
chore: fix tests on windows
lukasholzer Dec 7, 2021
69bf8a3
chore: lintfix
lukasholzer Dec 7, 2021
aaa4019
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 9, 2021
26511d8
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 9, 2021
d104ab3
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 10, 2021
c206260
chore: remove cli-ux package as it still has a dependency to oclif
lukasholzer Dec 10, 2021
7f1cb56
chore: lintfix
lukasholzer Dec 10, 2021
cdb9299
docs: update documentation
lukasholzer Dec 10, 2021
02a66e7
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 13, 2021
f2a5a37
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 13, 2021
a9d27b7
chore: fix project graph tests by removing oclif commands
lukasholzer Dec 13, 2021
2cc4580
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 13, 2021
21c7102
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 13, 2021
0dfd8dc
chore: incorporate review feedback
lukasholzer Dec 14, 2021
cb69b49
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 14, 2021
2a9424f
chore: fix the linting complains 🤪
lukasholzer Dec 14, 2021
f8e9231
Merge branch 'main' into chore/remove-oclif
lukasholzer Dec 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { overrides } = require('@netlify/eslint-config-node')

module.exports = {
extends: '@netlify/eslint-config-node',
plugins: ['sort-destructure-keys'],
plugins: ['sort-destructure-keys', 'local-rules'],
rules: {
// Those rules from @netlify/eslint-config-node are currently disabled
// TODO: remove, so those rules are enabled
Expand Down Expand Up @@ -52,5 +52,11 @@ module.exports = {
'node/no-unsupported-features/es-syntax': 0,
},
},
{
files: ['src/**/*.js'],
rules: {
'local-rules/no-direct-chalk-import': 2,
},
},
],
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ site-cra
site/src/**/*.md
!site/src/register-addon.md
!site/src/register-addon-thanks.md
oclif.manifest.json

# Local Netlify folder
.netlify
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ promote a positive and inclusive environment.

## Development process

First fork and clone the repository. If you're not sure how to do this, please watch
First, fork and clone the repository. If you're not sure how to do this, please watch
[these videos](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).

Run:
Expand Down Expand Up @@ -49,16 +49,16 @@ In watch mode:
npm run watch
```

Make sure everything is correctly setup by running those tests first.
Make sure everything is correctly set up by running those tests first.

ESLint and Prettier are performed automatically on `git push`. However, we recommend you setup your IDE or text editor
ESLint and Prettier have performed automatically on `git push`. However, we recommend you set up your IDE or text editor
to run ESLint and Prettier automatically on file save. Otherwise, you should run them manually using:

```bash
npm run format
```

Alternatively you can setup your IDE to integrate with Prettier and ESLint for JavaScript and Markdown files.
Alternatively, you can set up your IDE to integrate with Prettier and ESLint for JavaScript and Markdown files.

To run the CLI locally:

Expand All @@ -68,10 +68,10 @@ To run the CLI locally:

## Architecture

The CLI is written using the [oclif](https://oclif.io/) cli framework and the [netlify/js-client](https://github.com/netlify/js-client) open-api derived API client.
The CLI is written using the [commander.js](https://github.com/tj/commander.js/) cli interface and the [netlify/js-client](https://github.com/netlify/js-client) open-api derived API client.

- Commands live in the [`src/commands`](src/commands) folder.
- The base command class which provides consistent config loading and an API client lives in [`src/utils/command.js`](src/utils/command.js).
- The base command class which provides consistent config loading and an API client lives in [`src/commands/base-command.js`](src/commands/base-command.js).
- Small utilities and other functionality live in [`src/utils`](src/utils).

A good place to start is reading the base command README and looking at the commands folder.
Expand Down Expand Up @@ -112,7 +112,7 @@ Merge the release PR
1. Create a branch named `releases/<tag>/<version>` with the version and tag you'd like to release.
2. Push the branch to the repo.

For example, a branch named `releases/rc/4.0.0` will create the version `v4.0.0-rc` and publish it under the `rc` tag.
For example, a branch named `releases/rc.0/4.0.0` will create the version `4.0.0-rc.0` and publish it under the `rc.0` tag.

## License

Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ See the [CLI command line reference](https://cli.netlify.com/commands/) to get s
- [addons](#addons)
- [api](#api)
- [build](#build)
- [completion](#completion)
- [deploy](#deploy)
- [dev](#dev)
- [env](#env)
Expand All @@ -34,7 +35,6 @@ See the [CLI command line reference](https://cli.netlify.com/commands/) to get s
- [switch](#switch)
- [unlink](#unlink)
- [watch](#watch)
- [completion](#completion)
- [Contributing](#contributing)
- [Development](#development)
- [License](#license)
Expand Down Expand Up @@ -102,6 +102,15 @@ Run any Netlify API method

(Beta) Build on your local machine

### [completion](/docs/commands/completion.md)

(Beta) Generate shell completion script

| Subcommand | description |
|:--------------------------- |:-----|
| [`completion:install`](/docs/commands/completion.md#completioninstall) | Generates completion script for your preferred shell |


### [deploy](/docs/commands/deploy.md)

Create a new deploy from the contents of a folder
Expand Down Expand Up @@ -157,8 +166,8 @@ Handle Netlify Large Media operations
| Subcommand | description |
|:--------------------------- |:-----|
| [`lm:info`](/docs/commands/lm.md#lminfo) | Show large media requirements information. |
| [`lm:install`](/docs/commands/lm.md#lminstall) | Configures your computer to use Netlify Large Media. |
| [`lm:setup`](/docs/commands/lm.md#lmsetup) | Configures your site to use Netlify Large Media. |
| [`lm:install`](/docs/commands/lm.md#lminstall) | Configures your computer to use Netlify Large Media |
| [`lm:setup`](/docs/commands/lm.md#lmsetup) | Configures your site to use Netlify Large Media |


### [login](/docs/commands/login.md)
Expand Down Expand Up @@ -207,16 +216,6 @@ Unlink a local folder from a Netlify site

Watch for site deploy to finish

### [completion](/docs/commands/completion.md)

(Beta) Generate shell completion script

| Subcommand | description |
|:--------------------------- |:-----|
| [`completion:generate:alias`](/docs/commands/completion.md#completiongeneratealias) | Generates completion script for alias |
| [`completion:generate`](/docs/commands/completion.md#completiongenerate) | Generates completion script |



<!-- AUTO-GENERATED-CONTENT:END -->

Expand Down
40 changes: 38 additions & 2 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
#!/usr/bin/env node
/* eslint-disable promise/prefer-await-to-then,promise/prefer-await-to-callbacks,eslint-comments/disable-enable-pair */
const process = require('process')

require('..').run()
.catch(require('@oclif/errors/handle'))
const updateNotifier = require('update-notifier')

const { createMainCommand } = require('../src/commands')

// 12 hours
const UPDATE_CHECK_INTERVAL = 432e5

if (require.main === module) {
// eslint-disable-next-line node/global-require
const pkg = require('../package.json')

try {
updateNotifier({
pkg,
updateCheckInterval: UPDATE_CHECK_INTERVAL,
}).notify()
} catch (error) {
console.log('Error checking for updates:')
console.log(error)
}

/** @type {Error} */
let caughtError

const program = createMainCommand()

program.parseAsync(process.argv).catch((error) => {
caughtError = error
})

// long running commands like dev server cannot be caught by a post action hook
// they are running on the main command
process.on('exit', () => {
program.onEnd(caughtError)
})
}
23 changes: 11 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ Run any Netlify API method

(Beta) Build on your local machine

### [completion](/docs/commands/completion.md)

(Beta) Generate shell completion script

| Subcommand | description |
|:--------------------------- |:-----|
| [`completion:install`](/docs/commands/completion.md#completioninstall) | Generates completion script for your preferred shell |


### [deploy](/docs/commands/deploy.md)

Create a new deploy from the contents of a folder
Expand Down Expand Up @@ -115,8 +124,8 @@ Handle Netlify Large Media operations
| Subcommand | description |
|:--------------------------- |:-----|
| [`lm:info`](/docs/commands/lm.md#lminfo) | Show large media requirements information. |
| [`lm:install`](/docs/commands/lm.md#lminstall) | Configures your computer to use Netlify Large Media. |
| [`lm:setup`](/docs/commands/lm.md#lmsetup) | Configures your site to use Netlify Large Media. |
| [`lm:install`](/docs/commands/lm.md#lminstall) | Configures your computer to use Netlify Large Media |
| [`lm:setup`](/docs/commands/lm.md#lmsetup) | Configures your site to use Netlify Large Media |


### [login](/docs/commands/login.md)
Expand Down Expand Up @@ -165,15 +174,5 @@ Unlink a local folder from a Netlify site

Watch for site deploy to finish

### [completion](/docs/commands/completion.md)

(Beta) Generate shell completion script

| Subcommand | description |
|:--------------------------- |:-----|
| [`completion:generate:alias`](/docs/commands/completion.md#completiongeneratealias) | Generates completion script for alias |
| [`completion:generate`](/docs/commands/completion.md#completiongenerate) | Generates completion script |



<!-- AUTO-GENERATED-CONTENT:END -->
10 changes: 6 additions & 4 deletions docs/commands/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ For more information on add-ons see our [Netlify partner add-ons docs](https://w
netlify addons
```

**Flags**

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

| Subcommand | description |
|:--------------------------- |:-----|
| [`addons:auth`](/docs/commands/addons.md#addonsauth) | Login to add-on provider |
Expand Down Expand Up @@ -84,10 +90,8 @@ netlify addons:config
## `addons:create`

Add an add-on extension to your site
...
Add-ons are a way to extend the functionality of your Netlify site


**Usage**

```bash
Expand All @@ -108,10 +112,8 @@ netlify addons:create
## `addons:delete`

Remove an add-on extension to your site
...
Add-ons are a way to extend the functionality of your Netlify site


**Usage**

```bash
Expand Down
6 changes: 2 additions & 4 deletions docs/commands/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ The `api` command will let you call any [Netlify open API methods](https://open-

<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
Run any Netlify API method

For more information on available methods checkout https://open-api.netlify.com/ or run "netlify api --list"

For more information on available methods checkout https://open-api.netlify.com/ or run 'netlify api --list'

**Usage**

Expand All @@ -34,7 +32,7 @@ netlify api

```bash
netlify api --list
netlify api getSite --data '{ "site_id": "123456"}'
netlify api getSite --data '{ "site_id": "123456" }'
```


Expand Down
2 changes: 1 addition & 1 deletion docs/commands/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ netlify build

**Flags**

- `dry` (*boolean*) - Dry run: show instructions without running them
- `context` (*string*) - Build context
- `dry` (*boolean*) - Dry run: show instructions without running them
- `offline` (*boolean*) - disables any features that require network access
- `debug` (*boolean*) - Print debugging information
- `httpProxy` (*string*) - Proxy server address to route requests through.
Expand Down
59 changes: 11 additions & 48 deletions docs/commands/completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ description: Shell completion script for netlify CLI

<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
(Beta) Generate shell completion script

Run this command to see instructions for your shell.

**Usage**
Expand All @@ -16,75 +15,39 @@ Run this command to see instructions for your shell.
netlify completion
```

**Arguments**



**Flags**

- `shell` (*bash | fish | zsh*) - Name of shell
- `debug` (*boolean*) - Print debugging information
- `httpProxy` (*string*) - Proxy server address to route requests through.
- `httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server

| Subcommand | description |
|:--------------------------- |:-----|
| [`completion:generate:alias`](/docs/commands/completion.md#completiongeneratealias) | Generates completion script for alias |
| [`completion:generate`](/docs/commands/completion.md#completiongenerate) | Generates completion script |
| [`completion:install`](/docs/commands/completion.md#completioninstall) | Generates completion script for your preferred shell |


**Examples**

```bash
$ netlify completion --shell zsh
```

---
## `completion:generate:alias`

Generates completion script for alias

This needs the completion script for the main command to be present.

Check the "completion:generate" command.

**Usage**

```bash
netlify completion:generate:alias
netlify completion:install
```

**Arguments**

- ALIAS - name of the alias

**Flags**

- `shell` (*bash | fish*) - Name of shell

---
## `completion:generate`

Generates completion script
## `completion:install`

Run the "completion" command to see instructions about how to use the script generated by this command.
Generates completion script for your preferred shell

**Usage**

```bash
netlify completion:generate
netlify completion:install
```

**Arguments**



**Flags**

- `shell` (*bash | fish | zsh*) - Name of shell

**Examples**

```bash
$ netlify completion:generate --shell zsh
```
- `debug` (*boolean*) - Print debugging information
- `httpProxy` (*string*) - Proxy server address to route requests through.
- `httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server

---

Expand Down
Loading