@toptal/davinci-monorepo 10.0.1-alpha-PF-add-update-picasso-command-2eb2da4f.2 → 10.0.1-alpha-PF-add-update-picasso-command-cd64a97a.5
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.
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Update Picasso Command
|
|
2
|
+
|
|
3
|
+
Updates Picasso dependencies across all packages in the monorepo.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
davinci-monorepo update-picasso [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
- `--dry-run` - Check for updates without modifying package.json files (default: false)
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
Check for available Picasso updates without making changes:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
davinci-monorepo update-picasso --dry-run
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Update all Picasso dependencies to their latest versions:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
davinci-monorepo update-picasso
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Description
|
|
30
|
+
|
|
31
|
+
The `update-picasso` command helps you manage Picasso dependencies across your monorepo. It:
|
|
32
|
+
|
|
33
|
+
1. Uses `npm-check-updates` (ncu) to find and update Picasso package versions
|
|
34
|
+
2. Updates all packages matching the pattern `@toptal/picasso/*`
|
|
35
|
+
3. Automatically runs `yarn install` after updating dependencies (unless in dry-run mode)
|
|
36
|
+
|
|
37
|
+
The command will display:
|
|
38
|
+
|
|
39
|
+
- Which packages are being checked/updated
|
|
40
|
+
- The results of the update check
|
|
41
|
+
- Installation progress and results
|
|
42
|
+
- Detailed error information if something goes wrong
|
|
43
|
+
|
|
44
|
+
## Error Handling
|
|
45
|
+
|
|
46
|
+
The command provides detailed error information including:
|
|
47
|
+
|
|
48
|
+
- The error message
|
|
49
|
+
- Command output (if available)
|
|
50
|
+
- Error details from stderr (if available)
|
|
51
|
+
|
|
52
|
+
If any part of the process fails, the command will:
|
|
53
|
+
|
|
54
|
+
1. Display all available error information
|
|
55
|
+
2. Exit with status code 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-monorepo",
|
|
3
|
-
"version": "10.0.1-alpha-PF-add-update-picasso-command-
|
|
3
|
+
"version": "10.0.1-alpha-PF-add-update-picasso-command-cd64a97a.5+cd64a97a",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"lint"
|
|
6
6
|
],
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@nodelib/fs.walk": "^1.2.6",
|
|
29
29
|
"@oclif/core": "^1.16.1",
|
|
30
|
-
"@toptal/davinci-cli-shared": "2.5.2-alpha-PF-add-update-picasso-command-
|
|
30
|
+
"@toptal/davinci-cli-shared": "2.5.2-alpha-PF-add-update-picasso-command-cd64a97a.29+cd64a97a",
|
|
31
31
|
"chalk": "^4.1.2",
|
|
32
32
|
"codeowners": "5.1.1",
|
|
33
33
|
"dependency-cruiser": "^16.3.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "cd64a97ac45a72c65e3eee778a0605cc2c1ae820"
|
|
55
55
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`createUpdatePicassoCommand creates a command with the correct structure 1`] = `
|
|
4
|
+
"{
|
|
5
|
+
"_events": {},
|
|
6
|
+
"_eventsCount": 1,
|
|
7
|
+
"commands": [],
|
|
8
|
+
"options": [
|
|
9
|
+
{
|
|
10
|
+
"flags": "--dry-run",
|
|
11
|
+
"description": "Check for updates without modifying package.json files",
|
|
12
|
+
"required": false,
|
|
13
|
+
"optional": false,
|
|
14
|
+
"variadic": false,
|
|
15
|
+
"mandatory": false,
|
|
16
|
+
"long": "--dry-run",
|
|
17
|
+
"negate": false,
|
|
18
|
+
"defaultValue": false,
|
|
19
|
+
"hidden": false,
|
|
20
|
+
"conflictsWith": []
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"parent": null,
|
|
24
|
+
"_allowUnknownOption": false,
|
|
25
|
+
"_allowExcessArguments": true,
|
|
26
|
+
"_args": [],
|
|
27
|
+
"args": [],
|
|
28
|
+
"rawArgs": [],
|
|
29
|
+
"processedArgs": [],
|
|
30
|
+
"_scriptPath": null,
|
|
31
|
+
"_name": "update-picasso",
|
|
32
|
+
"_optionValues": {
|
|
33
|
+
"dryRun": false
|
|
34
|
+
},
|
|
35
|
+
"_optionValueSources": {
|
|
36
|
+
"dryRun": "default"
|
|
37
|
+
},
|
|
38
|
+
"_storeOptionsAsProperties": false,
|
|
39
|
+
"_executableHandler": false,
|
|
40
|
+
"_executableFile": null,
|
|
41
|
+
"_executableDir": null,
|
|
42
|
+
"_defaultCommandName": null,
|
|
43
|
+
"_exitCallback": null,
|
|
44
|
+
"_aliases": [],
|
|
45
|
+
"_combineFlagAndOptionalValue": true,
|
|
46
|
+
"_description": "Updates Picasso dependencies across all packages in the monorepo",
|
|
47
|
+
"_summary": "",
|
|
48
|
+
"_enablePositionalOptions": false,
|
|
49
|
+
"_passThroughOptions": false,
|
|
50
|
+
"_lifeCycleHooks": {},
|
|
51
|
+
"_showHelpAfterError": false,
|
|
52
|
+
"_showSuggestionAfterError": true,
|
|
53
|
+
"_outputConfiguration": {},
|
|
54
|
+
"_hidden": false,
|
|
55
|
+
"_hasHelpOption": true,
|
|
56
|
+
"_helpFlags": "-h, --help",
|
|
57
|
+
"_helpDescription": "display help for command",
|
|
58
|
+
"_helpShortFlag": "-h",
|
|
59
|
+
"_helpLongFlag": "--help",
|
|
60
|
+
"_helpCommandName": "help",
|
|
61
|
+
"_helpCommandnameAndArgs": "help [command]",
|
|
62
|
+
"_helpCommandDescription": "display help for command",
|
|
63
|
+
"_helpConfiguration": {}
|
|
64
|
+
}"
|
|
65
|
+
`;
|
|
@@ -1,38 +1,66 @@
|
|
|
1
|
-
import
|
|
1
|
+
import execa from 'execa'
|
|
2
|
+
import { print } from '@toptal/davinci-cli-shared'
|
|
2
3
|
|
|
4
|
+
const updateDependencies = async dryRun => {
|
|
5
|
+
await execa(
|
|
6
|
+
'yarn',
|
|
7
|
+
[
|
|
8
|
+
'lerna',
|
|
9
|
+
'exec',
|
|
10
|
+
'--',
|
|
11
|
+
'ncu',
|
|
12
|
+
'--',
|
|
13
|
+
'--filter="/^@toptal\\/picasso/"',
|
|
14
|
+
...(dryRun ? [] : ['-u']),
|
|
15
|
+
],
|
|
16
|
+
{ stdio: 'inherit' }
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if (!dryRun) {
|
|
20
|
+
print.cyan('Installing updated dependencies...')
|
|
21
|
+
await execa('yarn', [], { stdio: 'inherit' })
|
|
22
|
+
print.success('Successfully updated Picasso packages!')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Updates Picasso dependencies across all packages in the monorepo
|
|
28
|
+
* @param {Object} options - Command options
|
|
29
|
+
* @param {boolean} options.dryRun - Whether to perform a dry run
|
|
30
|
+
*/
|
|
3
31
|
const updatePicassoCommand = async ({ dryRun }) => {
|
|
4
32
|
print.header('Updating Picasso packages')
|
|
5
33
|
|
|
6
34
|
try {
|
|
7
|
-
|
|
8
|
-
print.info(
|
|
35
|
+
print.cyan(
|
|
9
36
|
dryRun
|
|
10
37
|
? 'Checking for Picasso updates (dry run)...'
|
|
11
38
|
: 'Updating Picasso dependencies...'
|
|
12
39
|
)
|
|
13
|
-
|
|
14
|
-
'lerna',
|
|
15
|
-
'exec',
|
|
16
|
-
'--',
|
|
17
|
-
'npx',
|
|
18
|
-
'npm-check-updates',
|
|
19
|
-
'--filter="/^@toptal\\/picasso/"',
|
|
20
|
-
...(dryRun ? [] : ['-u']),
|
|
21
|
-
])
|
|
22
|
-
|
|
23
|
-
if (!dryRun) {
|
|
24
|
-
// Install updated dependencies
|
|
25
|
-
print.info('Installing updated dependencies...')
|
|
26
|
-
runSync('yarn')
|
|
27
|
-
print.success('Successfully updated Picasso packages!')
|
|
28
|
-
}
|
|
40
|
+
await updateDependencies(dryRun)
|
|
29
41
|
} catch (error) {
|
|
30
42
|
print.red('Failed to update Picasso packages:')
|
|
31
43
|
print.red(error.message || error)
|
|
44
|
+
|
|
45
|
+
if (error.stdout) {
|
|
46
|
+
print.red('Command output:')
|
|
47
|
+
print.red(error.stdout)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (error.stderr) {
|
|
51
|
+
print.red('Error details:')
|
|
52
|
+
print.red(error.stderr)
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
process.exit(1)
|
|
33
56
|
}
|
|
34
57
|
}
|
|
35
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Creates the update-picasso command
|
|
61
|
+
* @param {import('commander').Command} program - Commander program instance
|
|
62
|
+
* @returns {import('commander').Command} The created command
|
|
63
|
+
*/
|
|
36
64
|
export const createUpdatePicassoCommand = program => {
|
|
37
65
|
return program
|
|
38
66
|
.createCommand('update-picasso')
|
|
@@ -16,7 +16,13 @@ describe('createUpdatePicassoCommand', () => {
|
|
|
16
16
|
jest.clearAllMocks()
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
it('creates a command with the correct
|
|
19
|
+
it('creates a command with the correct structure', () => {
|
|
20
|
+
const command = createUpdatePicassoCommand(program)
|
|
21
|
+
|
|
22
|
+
expect(JSON.stringify(command, null, 2)).toMatchSnapshot()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('creates a command with the correct name and description', () => {
|
|
20
26
|
const command = createUpdatePicassoCommand(program)
|
|
21
27
|
|
|
22
28
|
expect(command._name).toBe('update-picasso')
|
|
@@ -25,7 +31,7 @@ describe('createUpdatePicassoCommand', () => {
|
|
|
25
31
|
)
|
|
26
32
|
})
|
|
27
33
|
|
|
28
|
-
it('has the dry-run option', () => {
|
|
34
|
+
it('has the dry-run option with correct defaults', () => {
|
|
29
35
|
const command = createUpdatePicassoCommand(program)
|
|
30
36
|
const dryRunOption = command.options.find(
|
|
31
37
|
option => option.long === '--dry-run'
|