Skip to content

Commit a920292

Browse files
author
Lukas Holzer
authored
fix: remove oclif framework and fixes an issue with sites:create (#3717)
* chore: remove oclif * chore: migrate build command * chore: migrate deploy, unlink, link, sites:create commands * chore: migrate init and watch command * chore: migrate login, logout, switch, sites * chore: further migrations * chore: migrate functions * chore: remove circluar * chore: migrate lm and make node 12 compatibility :( * chore: refactor last command * chore: fix prettier and some tests * chore: show help on base command * chore: format help output the same way as oclif did * chore: update examples management for site doc * chore: updates for doc generation * chore: updated documentation generation * chore: lint fix * chore: lintfix * chore: add completion * chore: update help snapshot * chore: fix tests on windows * chore: lintfix * chore: remove cli-ux package as it still has a dependency to oclif * chore: lintfix * docs: update documentation * chore: fix project graph tests by removing oclif commands * chore: incorporate review feedback * chore: fix the linting complains 🤪
1 parent f196c10 commit a920292

File tree

232 files changed

+15320
-22501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+15320
-22501
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { overrides } = require('@netlify/eslint-config-node')
22

33
module.exports = {
44
extends: '@netlify/eslint-config-node',
5-
plugins: ['sort-destructure-keys'],
5+
plugins: ['sort-destructure-keys', 'local-rules'],
66
rules: {
77
// Those rules from @netlify/eslint-config-node are currently disabled
88
// TODO: remove, so those rules are enabled
@@ -52,5 +52,11 @@ module.exports = {
5252
'node/no-unsupported-features/es-syntax': 0,
5353
},
5454
},
55+
{
56+
files: ['src/**/*.js'],
57+
rules: {
58+
'local-rules/no-direct-chalk-import': 2,
59+
},
60+
},
5561
],
5662
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ site-cra
2323
site/src/**/*.md
2424
!site/src/register-addon.md
2525
!site/src/register-addon-thanks.md
26-
oclif.manifest.json
2726

2827
# Local Netlify folder
2928
.netlify

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ promote a positive and inclusive environment.
1616

1717
## Development process
1818

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

2222
Run:
@@ -49,16 +49,16 @@ In watch mode:
4949
npm run watch
5050
```
5151

52-
Make sure everything is correctly setup by running those tests first.
52+
Make sure everything is correctly set up by running those tests first.
5353

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

5757
```bash
5858
npm run format
5959
```
6060

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

6363
To run the CLI locally:
6464

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

6969
## Architecture
7070

71-
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.
71+
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.
7272

7373
- Commands live in the [`src/commands`](src/commands) folder.
74-
- The base command class which provides consistent config loading and an API client lives in [`src/utils/command.js`](src/utils/command.js).
74+
- 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).
7575
- Small utilities and other functionality live in [`src/utils`](src/utils).
7676

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

115-
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.
115+
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.
116116

117117
## License
118118

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ See the [CLI command line reference](https://cli.netlify.com/commands/) to get s
2020
- [addons](#addons)
2121
- [api](#api)
2222
- [build](#build)
23+
- [completion](#completion)
2324
- [deploy](#deploy)
2425
- [dev](#dev)
2526
- [env](#env)
@@ -34,7 +35,6 @@ See the [CLI command line reference](https://cli.netlify.com/commands/) to get s
3435
- [switch](#switch)
3536
- [unlink](#unlink)
3637
- [watch](#watch)
37-
- [completion](#completion)
3838
- [Contributing](#contributing)
3939
- [Development](#development)
4040
- [License](#license)
@@ -102,6 +102,15 @@ Run any Netlify API method
102102

103103
(Beta) Build on your local machine
104104

105+
### [completion](/docs/commands/completion.md)
106+
107+
(Beta) Generate shell completion script
108+
109+
| Subcommand | description |
110+
|:--------------------------- |:-----|
111+
| [`completion:install`](/docs/commands/completion.md#completioninstall) | Generates completion script for your preferred shell |
112+
113+
105114
### [deploy](/docs/commands/deploy.md)
106115

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

163172

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

208217
Watch for site deploy to finish
209218

210-
### [completion](/docs/commands/completion.md)
211-
212-
(Beta) Generate shell completion script
213-
214-
| Subcommand | description |
215-
|:--------------------------- |:-----|
216-
| [`completion:generate:alias`](/docs/commands/completion.md#completiongeneratealias) | Generates completion script for alias |
217-
| [`completion:generate`](/docs/commands/completion.md#completiongenerate) | Generates completion script |
218-
219-
220219

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

bin/run

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
#!/usr/bin/env node
2+
/* eslint-disable promise/prefer-await-to-then,promise/prefer-await-to-callbacks,eslint-comments/disable-enable-pair */
3+
const process = require('process')
24

3-
require('..').run()
4-
.catch(require('@oclif/errors/handle'))
5+
const updateNotifier = require('update-notifier')
6+
7+
const { createMainCommand } = require('../src/commands')
8+
9+
// 12 hours
10+
const UPDATE_CHECK_INTERVAL = 432e5
11+
12+
if (require.main === module) {
13+
// eslint-disable-next-line node/global-require
14+
const pkg = require('../package.json')
15+
16+
try {
17+
updateNotifier({
18+
pkg,
19+
updateCheckInterval: UPDATE_CHECK_INTERVAL,
20+
}).notify()
21+
} catch (error) {
22+
console.log('Error checking for updates:')
23+
console.log(error)
24+
}
25+
26+
/** @type {Error} */
27+
let caughtError
28+
29+
const program = createMainCommand()
30+
31+
program.parseAsync(process.argv).catch((error) => {
32+
caughtError = error
33+
})
34+
35+
// long running commands like dev server cannot be caught by a post action hook
36+
// they are running on the main command
37+
process.on('exit', () => {
38+
program.onEnd(caughtError)
39+
})
40+
}

docs/README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ Run any Netlify API method
6060

6161
(Beta) Build on your local machine
6262

63+
### [completion](/docs/commands/completion.md)
64+
65+
(Beta) Generate shell completion script
66+
67+
| Subcommand | description |
68+
|:--------------------------- |:-----|
69+
| [`completion:install`](/docs/commands/completion.md#completioninstall) | Generates completion script for your preferred shell |
70+
71+
6372
### [deploy](/docs/commands/deploy.md)
6473

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

121130

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

166175
Watch for site deploy to finish
167176

168-
### [completion](/docs/commands/completion.md)
169-
170-
(Beta) Generate shell completion script
171-
172-
| Subcommand | description |
173-
|:--------------------------- |:-----|
174-
| [`completion:generate:alias`](/docs/commands/completion.md#completiongeneratealias) | Generates completion script for alias |
175-
| [`completion:generate`](/docs/commands/completion.md#completiongenerate) | Generates completion script |
176-
177-
178177

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

docs/commands/addons.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ For more information on add-ons see our [Netlify partner add-ons docs](https://w
1919
netlify addons
2020
```
2121

22+
**Flags**
23+
24+
- `debug` (*boolean*) - Print debugging information
25+
- `httpProxy` (*string*) - Proxy server address to route requests through.
26+
- `httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
27+
2228
| Subcommand | description |
2329
|:--------------------------- |:-----|
2430
| [`addons:auth`](/docs/commands/addons.md#addonsauth) | Login to add-on provider |
@@ -84,10 +90,8 @@ netlify addons:config
8490
## `addons:create`
8591

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

90-
9195
**Usage**
9296

9397
```bash
@@ -108,10 +112,8 @@ netlify addons:create
108112
## `addons:delete`
109113

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

114-
115117
**Usage**
116118

117119
```bash

docs/commands/api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ The `api` command will let you call any [Netlify open API methods](https://open-
88

99
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
1010
Run any Netlify API method
11-
12-
For more information on available methods checkout https://open-api.netlify.com/ or run "netlify api --list"
13-
11+
For more information on available methods checkout https://open-api.netlify.com/ or run 'netlify api --list'
1412

1513
**Usage**
1614

@@ -34,7 +32,7 @@ netlify api
3432

3533
```bash
3634
netlify api --list
37-
netlify api getSite --data '{ "site_id": "123456"}'
35+
netlify api getSite --data '{ "site_id": "123456" }'
3836
```
3937

4038

docs/commands/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ netlify build
1515

1616
**Flags**
1717

18-
- `dry` (*boolean*) - Dry run: show instructions without running them
1918
- `context` (*string*) - Build context
19+
- `dry` (*boolean*) - Dry run: show instructions without running them
2020
- `offline` (*boolean*) - disables any features that require network access
2121
- `debug` (*boolean*) - Print debugging information
2222
- `httpProxy` (*string*) - Proxy server address to route requests through.

docs/commands/completion.md

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ description: Shell completion script for netlify CLI
77

88
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
99
(Beta) Generate shell completion script
10-
1110
Run this command to see instructions for your shell.
1211

1312
**Usage**
@@ -16,75 +15,39 @@ Run this command to see instructions for your shell.
1615
netlify completion
1716
```
1817

19-
**Arguments**
20-
21-
22-
2318
**Flags**
2419

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

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

3228

3329
**Examples**
3430

3531
```bash
36-
$ netlify completion --shell zsh
37-
```
38-
39-
---
40-
## `completion:generate:alias`
41-
42-
Generates completion script for alias
43-
44-
This needs the completion script for the main command to be present.
45-
46-
Check the "completion:generate" command.
47-
48-
**Usage**
49-
50-
```bash
51-
netlify completion:generate:alias
32+
netlify completion:install
5233
```
5334

54-
**Arguments**
55-
56-
- ALIAS - name of the alias
57-
58-
**Flags**
59-
60-
- `shell` (*bash | fish*) - Name of shell
61-
6235
---
63-
## `completion:generate`
64-
65-
Generates completion script
36+
## `completion:install`
6637

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

6940
**Usage**
7041

7142
```bash
72-
netlify completion:generate
43+
netlify completion:install
7344
```
7445

75-
**Arguments**
76-
77-
78-
7946
**Flags**
8047

81-
- `shell` (*bash | fish | zsh*) - Name of shell
82-
83-
**Examples**
84-
85-
```bash
86-
$ netlify completion:generate --shell zsh
87-
```
48+
- `debug` (*boolean*) - Print debugging information
49+
- `httpProxy` (*string*) - Proxy server address to route requests through.
50+
- `httpProxyCertificateFilename` (*string*) - Certificate file to use when connecting using a proxy server
8851

8952
---
9053

0 commit comments

Comments
 (0)