@toptal/davinci-monorepo 10.0.1-alpha-PF-add-update-picasso-command-2eb2da4f.2 → 10.0.1-alpha-PF-add-update-picasso-command-8498a7ec.4

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-2eb2da4f.2+2eb2da4f",
3
+ "version": "10.0.1-alpha-PF-add-update-picasso-command-8498a7ec.4+8498a7ec",
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-2eb2da4f.26+2eb2da4f",
30
+ "@toptal/davinci-cli-shared": "2.5.2-alpha-PF-add-update-picasso-command-8498a7ec.28+8498a7ec",
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": "2eb2da4fbd6d2dc07dcd15a04c47728f7d22681b"
54
+ "gitHead": "8498a7ecb702af81884d1541abed64e24f4f3661"
55
55
  }
@@ -0,0 +1,65 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`createUpdatePicassoCommand has the correct command 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,73 @@
1
- import { print, runSync } from '@toptal/davinci-cli-shared'
1
+ import execa from 'execa'
2
+ import { print } from '@toptal/davinci-cli-shared'
2
3
 
4
+ /**
5
+ * Updates Picasso dependencies across all packages in the monorepo
6
+ * @param {Object} options - Command options
7
+ * @param {boolean} options.dryRun - Whether to perform a dry run
8
+ */
3
9
  const updatePicassoCommand = async ({ dryRun }) => {
4
10
  print.header('Updating Picasso packages')
5
11
 
6
12
  try {
7
13
  // Update Picasso dependencies using locally installed npm-check-updates
8
- print.info(
14
+ print.cyan(
9
15
  dryRun
10
16
  ? 'Checking for Picasso updates (dry run)...'
11
17
  : 'Updating Picasso dependencies...'
12
18
  )
13
- runSync('yarn', [
19
+
20
+ const { stdout: updateOutput } = await execa('yarn', [
14
21
  'lerna',
15
22
  'exec',
16
23
  '--',
17
- 'npx',
18
- 'npm-check-updates',
24
+ 'ncu',
25
+ '--',
19
26
  '--filter="/^@toptal\\/picasso/"',
20
27
  ...(dryRun ? [] : ['-u']),
21
28
  ])
22
29
 
30
+ // Log the update results
31
+ if (updateOutput) {
32
+ print.cyan('Update check results:')
33
+ print.cyan(updateOutput)
34
+ }
35
+
23
36
  if (!dryRun) {
24
37
  // Install updated dependencies
25
- print.info('Installing updated dependencies...')
26
- runSync('yarn')
38
+ print.cyan('Installing updated dependencies...')
39
+ const { stdout: installOutput } = await execa('yarn')
40
+
41
+ if (installOutput) {
42
+ print.cyan('Installation details:')
43
+ print.cyan(installOutput)
44
+ }
45
+
27
46
  print.success('Successfully updated Picasso packages!')
28
47
  }
29
48
  } catch (error) {
30
49
  print.red('Failed to update Picasso packages:')
31
50
  print.red(error.message || error)
51
+
52
+ if (error.stdout) {
53
+ print.red('Command output:')
54
+ print.red(error.stdout)
55
+ }
56
+
57
+ if (error.stderr) {
58
+ print.red('Error details:')
59
+ print.red(error.stderr)
60
+ }
61
+
32
62
  process.exit(1)
33
63
  }
34
64
  }
35
65
 
66
+ /**
67
+ * Creates the update-picasso command
68
+ * @param {import('commander').Command} program - Commander program instance
69
+ * @returns {import('commander').Command} The created command
70
+ */
36
71
  export const createUpdatePicassoCommand = program => {
37
72
  return program
38
73
  .createCommand('update-picasso')
@@ -16,6 +16,12 @@ describe('createUpdatePicassoCommand', () => {
16
16
  jest.clearAllMocks()
17
17
  })
18
18
 
19
+ it('has the correct command structure', () => {
20
+ const command = createUpdatePicassoCommand(program)
21
+
22
+ expect(JSON.stringify(command, null, 2)).toMatchSnapshot()
23
+ })
24
+
19
25
  it('creates a command with the correct parameters', () => {
20
26
  const command = createUpdatePicassoCommand(program)
21
27