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

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @toptal/davinci-monorepo
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2533](https://github.com/toptal/davinci/pull/2533) [`d79f895f`](https://github.com/toptal/davinci/commit/d79f895fbf90cf41720cea37702f4a759cea9379) Thanks [@vedrani](https://github.com/vedrani)!
8
+ Add update-picasso command:
9
+ - add command to manage Picasso dependencies across all packages
10
+
3
11
  ## 10.0.0
4
12
 
5
13
  ### Major Changes
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-8498a7ec.4+8498a7ec",
3
+ "version": "10.1.0",
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-8498a7ec.28+8498a7ec",
30
+ "@toptal/davinci-cli-shared": "^2.5.1",
31
31
  "chalk": "^4.1.2",
32
32
  "codeowners": "5.1.1",
33
33
  "dependency-cruiser": "^16.3.0",
@@ -50,6 +50,5 @@
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
53
- },
54
- "gitHead": "8498a7ecb702af81884d1541abed64e24f4f3661"
53
+ }
55
54
  }
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`createUpdatePicassoCommand has the correct command structure 1`] = `
3
+ exports[`createUpdatePicassoCommand creates a command with the correct structure 1`] = `
4
4
  "{
5
5
  "_events": {},
6
6
  "_eventsCount": 1,
@@ -1,6 +1,28 @@
1
1
  import execa from 'execa'
2
2
  import { print } from '@toptal/davinci-cli-shared'
3
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
+
4
26
  /**
5
27
  * Updates Picasso dependencies across all packages in the monorepo
6
28
  * @param {Object} options - Command options
@@ -10,41 +32,12 @@ const updatePicassoCommand = async ({ dryRun }) => {
10
32
  print.header('Updating Picasso packages')
11
33
 
12
34
  try {
13
- // Update Picasso dependencies using locally installed npm-check-updates
14
35
  print.cyan(
15
36
  dryRun
16
37
  ? 'Checking for Picasso updates (dry run)...'
17
38
  : 'Updating Picasso dependencies...'
18
39
  )
19
-
20
- const { stdout: updateOutput } = await execa('yarn', [
21
- 'lerna',
22
- 'exec',
23
- '--',
24
- 'ncu',
25
- '--',
26
- '--filter="/^@toptal\\/picasso/"',
27
- ...(dryRun ? [] : ['-u']),
28
- ])
29
-
30
- // Log the update results
31
- if (updateOutput) {
32
- print.cyan('Update check results:')
33
- print.cyan(updateOutput)
34
- }
35
-
36
- if (!dryRun) {
37
- // Install updated dependencies
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
-
46
- print.success('Successfully updated Picasso packages!')
47
- }
40
+ await updateDependencies(dryRun)
48
41
  } catch (error) {
49
42
  print.red('Failed to update Picasso packages:')
50
43
  print.red(error.message || error)
@@ -16,13 +16,13 @@ describe('createUpdatePicassoCommand', () => {
16
16
  jest.clearAllMocks()
17
17
  })
18
18
 
19
- it('has the correct command structure', () => {
19
+ it('creates a command with the correct structure', () => {
20
20
  const command = createUpdatePicassoCommand(program)
21
21
 
22
22
  expect(JSON.stringify(command, null, 2)).toMatchSnapshot()
23
23
  })
24
24
 
25
- it('creates a command with the correct parameters', () => {
25
+ it('creates a command with the correct name and description', () => {
26
26
  const command = createUpdatePicassoCommand(program)
27
27
 
28
28
  expect(command._name).toBe('update-picasso')
@@ -31,7 +31,7 @@ describe('createUpdatePicassoCommand', () => {
31
31
  )
32
32
  })
33
33
 
34
- it('has the dry-run option', () => {
34
+ it('has the dry-run option with correct defaults', () => {
35
35
  const command = createUpdatePicassoCommand(program)
36
36
  const dryRunOption = command.options.find(
37
37
  option => option.long === '--dry-run'