Skip to content

Commit f6b4e09

Browse files
committed
chore: remove oclif
1 parent 7cc74ed commit f6b4e09

File tree

314 files changed

+1412
-17762
lines changed

Some content is hidden

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

314 files changed

+1412
-17762
lines changed

.eslintrc.js

Lines changed: 2 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
@@ -29,6 +29,7 @@ module.exports = {
2929
'unicorn/consistent-destructuring': 0,
3030
// TODO: harmonize with filename snake_case in other Netlify Dev projects
3131
'unicorn/filename-case': [2, { case: 'kebabCase' }],
32+
'local-rules/no-direct-chalk-import': 2
3233
},
3334
overrides: [
3435
...overrides,

bin/run

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,82 @@
1-
#!/usr/bin/env node
1+
#!/usr/bin/env node --trace-warnings
2+
const { argv } = require('process')
23

3-
require('..').run()
4-
.catch(require('@oclif/errors/handle'))
4+
const updateNotifier = require('update-notifier')
5+
const { USER_AGENT } = require('../src/utils')
6+
7+
const { BaseCommand } = require('../src/commands/base-command')
8+
const { createAddonsCommand } = require('../src/commands/addons')
9+
const { createApiCommand } = require('../src/commands/api')
10+
const { createBuildCommand } = require('../src/commands/build')
11+
const { createCompletionCommand } = require('../src/commands/completion')
12+
const { createDeployCommand } = require('../src/commands/deploy')
13+
const { createDevCommand } = require('../src/commands/dev')
14+
const { createEnvCommand } = require('../src/commands/env')
15+
const { createFunctionsCommand } = require('../src/commands/functions')
16+
const { createInitCommand } = require('../src/commands/init')
17+
const { createLinkCommand } = require('../src/commands/link')
18+
const { createLmCommand } = require('../src/commands/lm')
19+
const { createLoginCommand } = require('../src/commands/login')
20+
const { createOpenCommand } = require('../src/commands/open')
21+
const { createPluginsCommand } = require('../src/commands/plugins')
22+
const { createSitesCommand } = require('../src/commands/sites')
23+
const { createStatusCommand } = require('../src/commands/status')
24+
const { createSwitchCommand } = require('../src/commands/switch')
25+
const { createUnlinkCommand } = require('../src/commands/unlink')
26+
const { createWatchCommand } = require('../src/commands/watch')
27+
28+
// 12 hours
29+
const UPDATE_CHECK_INTERVAL = 432e5
30+
31+
if (require.main === module) {
32+
const pkg = require('../package.json')
33+
34+
try {
35+
updateNotifier({
36+
pkg,
37+
updateCheckInterval: UPDATE_CHECK_INTERVAL,
38+
}).notify()
39+
} catch (error) {
40+
console.log('Error checking for updates:')
41+
console.log(error)
42+
}
43+
44+
const program = new BaseCommand('netlify-cli')
45+
program.version(USER_AGENT)
46+
47+
program.configureHelp({
48+
// TODO: Add custom formater to have same visual styling
49+
// formatHelp: (cmd, helper) => {
50+
// console.log(cmd, helper);
51+
// const longestFlag = Math.max(...cmd.options.map((option) => option.flags.length)) + 1;
52+
// const table = cmd.options.map(({flags, description}) => ` ${flags}${new Array(longestFlag-flags.length).fill().join(' ')} {grey ${description}} `).join('\n')
53+
// return chalk`{bold OPTIONS}
54+
// ${table}
55+
// `
56+
// }
57+
})
58+
59+
createAddonsCommand(program)
60+
createApiCommand(program)
61+
createBuildCommand(program)
62+
createCompletionCommand(program)
63+
createDeployCommand(program)
64+
createDevCommand(program)
65+
createEnvCommand(program)
66+
createFunctionsCommand(program)
67+
createInitCommand(program)
68+
createLinkCommand(program)
69+
createLmCommand(program)
70+
createLoginCommand(program)
71+
createOpenCommand(program)
72+
createPluginsCommand(program)
73+
createSitesCommand(program)
74+
createStatusCommand(program)
75+
createSwitchCommand(program)
76+
createUnlinkCommand(program)
77+
createWatchCommand(program)
78+
79+
program.parse(argv)
80+
81+
global.program = program
82+
}

npm-shrinkwrap.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"@oclif/dev-cli": "^1.23.1",
203203
"@oclif/test": "^1.2.5",
204204
"ava": "^3.15.0",
205+
"eslint-plugin-local-rules": "file:tools/eslint-rules",
205206
"eslint-plugin-sort-destructure-keys": "^1.3.5",
206207
"form-data": "^4.0.0",
207208
"from2-string": "^1.1.0",
@@ -225,6 +226,7 @@
225226
"ava": {
226227
"files": [
227228
"src/**/*.test.js",
229+
"tools/**/*.test.js",
228230
"tests/*.test.js"
229231
],
230232
"cache": true,

src/commands/addons/addons.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* The addons command
3+
* @param {import('commander').OptionValues} options
4+
* @param {import('../base-command').BaseCommand} command
5+
*/
6+
const addons = async (options, command) => {
7+
console.log('addons command with options', options)
8+
}
9+
10+
/**
11+
* Creates the `netlify addons` command
12+
* @param {import('../base-command').BaseCommand} program
13+
* @returns
14+
*/
15+
const createAddonsCommand = (program) =>
16+
program
17+
.command('addons')
18+
.description('(Beta) Manage Netlify Add-ons')
19+
.action(addons)
20+
21+
module.exports = { createAddonsCommand }

src/commands/addons/auth.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)