@toptal/davinci-engine 13.0.0 → 14.0.1-alpha-ff-79-27a22fcb.1

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,30 @@
1
1
  # Change Log
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#2643](https://github.com/toptal/davinci/pull/2643) [`ab9666f`](https://github.com/toptal/davinci/commit/ab9666f999e7a610f6068e0145200257d8511b46) Thanks [@rocodesign](https://github.com/rocodesign)!
8
+ Migrate package manager from Yarn to pnpm
9
+ **WHAT (breaking change):**
10
+ - switch package manager from Yarn to pnpm across the entire Davinci monorepo
11
+ - add `pnpm-workspace.yaml`, `.npmrc`, and `packageManager` field for corepack support
12
+ - convert Yarn `resolutions` to `pnpm.overrides` in root `package.json`
13
+ - update lerna `npmClient` from `yarn` to `pnpm`
14
+ - replace `yarn` with `pnpm` in root scripts (postinstall, test, test:unit:update)
15
+ **HOW to update:**
16
+ - install pnpm (`corepack enable` or `npm install -g pnpm@10.6.1`)
17
+ - replace `yarn install` with `pnpm install` in local workflows
18
+ - replace `yarn <script>` with `pnpm <script>` when running commands
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`ab9666f`](https://github.com/toptal/davinci/commit/ab9666f999e7a610f6068e0145200257d8511b46)]:
23
+ - @toptal/davinci-cli-shared@3.0.0
24
+ - @toptal/davinci-cloudflare-requests-handler@1.0.0
25
+ - @toptal/davinci-monorepo@13.0.0
26
+ - @toptal/davinci-workspace-root@2.0.0
27
+
3
28
  ## 13.0.0
4
29
 
5
30
  ### Major Changes
package/README.md CHANGED
@@ -4,7 +4,7 @@ Starts and builds your project. Under the hood, it covers webpack with the defau
4
4
 
5
5
  ### Usage
6
6
 
7
- Use it by installing `yarn add @toptal/davinci-engine` in your project.
7
+ Use it by installing `pnpm add @toptal/davinci-engine` in your project.
8
8
 
9
9
  #### Commands
10
10
 
package/docs/size.md CHANGED
@@ -52,7 +52,7 @@ After running the size command, you will see one of the following outputs:
52
52
  ```json
53
53
  "scripts": {
54
54
  "build": "davinci-engine build",
55
- "size": "yarn build && davinci-engine size --limit 500kb"
55
+ "size": "pnpm build && davinci-engine size --limit 500kb"
56
56
  }
57
57
  ```
58
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-engine",
3
- "version": "13.0.0",
3
+ "version": "14.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
4
4
  "description": "Build tool for frontend projects",
5
5
  "author": "Toptal",
6
6
  "license": "SEE LICENSE IN LICENSE.MD",
@@ -19,7 +19,7 @@
19
19
  "CHANGELOG.md"
20
20
  ],
21
21
  "scripts": {
22
- "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' yarn jest"
22
+ "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' pnpm jest"
23
23
  },
24
24
  "dependencies": {
25
25
  "@babel/cli": "^7.20.7",
@@ -43,10 +43,10 @@
43
43
  "@svgr/webpack": "^8.1.0",
44
44
  "@swc/core": "^1.13.5",
45
45
  "@swc/plugin-styled-components": "^9.1.0",
46
- "@toptal/davinci-cli-shared": "^2.6.1",
47
- "@toptal/davinci-cloudflare-requests-handler": "0.1.2",
48
- "@toptal/davinci-monorepo": "^12.1.2",
49
- "@toptal/davinci-workspace-root": "^1.0.1",
46
+ "@toptal/davinci-cli-shared": "^3.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
47
+ "@toptal/davinci-cloudflare-requests-handler": "^1.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
48
+ "@toptal/davinci-monorepo": "^13.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
49
+ "@toptal/davinci-workspace-root": "^2.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
50
50
  "autoprefixer": "^10.4.15",
51
51
  "babel-loader": "^8.2.3",
52
52
  "babel-plugin-graphql-tag": "^3.3.0",
@@ -69,6 +69,7 @@
69
69
  "graphql": "^16.8.1",
70
70
  "graphql-tag": "^2.12.4",
71
71
  "html-webpack-plugin": "^5.3.1",
72
+ "lerna": "^9.0.0",
72
73
  "lodash.throttle": "^4.1.1",
73
74
  "mini-css-extract-plugin": "^2.6.1",
74
75
  "open": "^8.3.0",
@@ -110,5 +111,6 @@
110
111
  },
111
112
  "publishConfig": {
112
113
  "access": "public"
113
- }
114
+ },
115
+ "gitHead": "27a22fcb012002a99ab87a4a996721e3ba8a92c4"
114
116
  }
@@ -1,4 +1,4 @@
1
- import { print, runSync, files } from '@toptal/davinci-cli-shared'
1
+ import { print, runSync, files, resolveBin } from '@toptal/davinci-cli-shared'
2
2
  import path from 'path'
3
3
  import { replaceTscAliasPaths } from 'tsc-alias'
4
4
  import dotProp from 'dot-prop'
@@ -8,6 +8,9 @@ import { getEnvVariables } from '../utils/index.js'
8
8
  import { copyPackageJson } from '../utils/copy-package-json.js'
9
9
  import { copyFileIfExists } from '../utils/copy-file.js'
10
10
  import { DOTENV_NONE, DIST_PACKAGE_PATH } from '../constants.cjs'
11
+
12
+ const babelBin = resolveBin('@babel/cli', import.meta.url, 'babel')
13
+
11
14
  const SOURCE_FOLDER_NAME = 'src'
12
15
  const PACKAGE_ENTRY_FILE = `./${SOURCE_FOLDER_NAME}/index.package.js`
13
16
  const DEFAULT_TSCONFIG_PATH = './tsconfig.json'
@@ -58,7 +61,7 @@ const emitTypeDeclarations = ({ tsConfigPath, outputDir }) => {
58
61
  SOURCE_FOLDER_NAME,
59
62
  ]
60
63
 
61
- runSync('yarn', tscArgs)
64
+ runSync('pnpm', tscArgs)
62
65
  replaceTscAliasPaths({
63
66
  configFile: tsConfigPath,
64
67
  })
@@ -78,9 +81,8 @@ const transpileSourceCode = ({ outputDir, envVariables, babelConfigPath }) => {
78
81
  const pathsToIgnore = getPathsToIgnoreDuringTranspilation()
79
82
 
80
83
  runSync(
81
- 'yarn',
84
+ babelBin,
82
85
  [
83
- 'babel',
84
86
  path.resolve(SOURCE_FOLDER_NAME),
85
87
  '--config-file',
86
88
  babelConfigAbsolutePath,
@@ -37,7 +37,7 @@ export const releasePackageCommand = async ({
37
37
  try {
38
38
  print.header('Building package')
39
39
  cliShared.runSync(
40
- 'yarn',
40
+ 'pnpm',
41
41
  getCompilePackageCommand({
42
42
  babelConfig,
43
43
  entry,
@@ -46,7 +46,7 @@ export const releasePackageCommand = async ({
46
46
  )
47
47
  print.green('Releasing package...\n')
48
48
  cliShared.runSync(
49
- 'yarn',
49
+ 'pnpm',
50
50
  getPublishPackageCommand({
51
51
  outputVersionFile,
52
52
  nonMonorepo,
@@ -31,14 +31,14 @@ describe('createReleasePackageCommand', () => {
31
31
  it('compiles and releases a package with default options', () => {
32
32
  action({})
33
33
 
34
- expect(runSync).toHaveBeenCalledWith('yarn', [
34
+ expect(runSync).toHaveBeenCalledWith('pnpm', [
35
35
  'davinci-engine',
36
36
  'compile-package',
37
37
  '--dotenv',
38
38
  'auto',
39
39
  ])
40
40
 
41
- expect(runSync).toHaveBeenCalledWith('yarn', [
41
+ expect(runSync).toHaveBeenCalledWith('pnpm', [
42
42
  'davinci-engine',
43
43
  'publish-package',
44
44
  ])
@@ -55,7 +55,7 @@ describe('createReleasePackageCommand', () => {
55
55
  tsConfig,
56
56
  })
57
57
 
58
- expect(runSync).toHaveBeenCalledWith('yarn', [
58
+ expect(runSync).toHaveBeenCalledWith('pnpm', [
59
59
  'davinci-engine',
60
60
  'compile-package',
61
61
  '--dotenv',
@@ -68,7 +68,7 @@ describe('createReleasePackageCommand', () => {
68
68
  tsConfig,
69
69
  ])
70
70
 
71
- expect(runSync).toHaveBeenCalledWith('yarn', [
71
+ expect(runSync).toHaveBeenCalledWith('pnpm', [
72
72
  'davinci-engine',
73
73
  'publish-package',
74
74
  ])
@@ -77,7 +77,7 @@ describe('createReleasePackageCommand', () => {
77
77
  it('passes down --outputVersion to publish-package command', () => {
78
78
  action({ outputVersion: './.version' })
79
79
 
80
- expect(runSync).toHaveBeenCalledWith('yarn', [
80
+ expect(runSync).toHaveBeenCalledWith('pnpm', [
81
81
  'davinci-engine',
82
82
  'publish-package',
83
83
  '--outputVersion',
@@ -1,16 +1,14 @@
1
- import { print, runSync } from '@toptal/davinci-cli-shared'
1
+ import { print, runSync, resolveBin } from '@toptal/davinci-cli-shared'
2
2
 
3
3
  import { paths } from '../configs/paths.js'
4
4
  import { resolveApp } from '../utils/paths-resolution.js'
5
5
 
6
+ const sentryCliBin = resolveBin('@sentry/cli', import.meta.url, 'sentry-cli')
7
+
6
8
  const getReleaseName = () => {
7
- const { stdout } = runSync(
8
- 'yarn',
9
- ['--silent', 'sentry-cli', 'releases', 'propose-version'],
10
- {
11
- stdio: undefined,
12
- }
13
- )
9
+ const { stdout } = runSync(sentryCliBin, ['releases', 'propose-version'], {
10
+ stdio: undefined,
11
+ })
14
12
 
15
13
  return stdout
16
14
  }
@@ -20,22 +18,16 @@ const uploadSourceMaps = parameters => {
20
18
  const releaseName = parameters.releaseName || getReleaseName()
21
19
 
22
20
  print.yellow('Release name:', releaseName, '\n')
23
- runSync('yarn', ['sentry-cli', 'releases', 'new', releaseName])
24
- const args = [
25
- 'sentry-cli',
26
- 'releases',
27
- 'files',
28
- releaseName,
29
- 'upload-sourcemaps',
30
- ]
21
+ runSync(sentryCliBin, ['releases', 'new', releaseName])
22
+ const args = ['releases', 'files', releaseName, 'upload-sourcemaps']
31
23
 
32
24
  args.push(appBuildDirectory ? resolveApp(appBuildDirectory) : paths.appBuild)
33
25
 
34
26
  if (urlPrefix) {
35
27
  args.push('--url-prefix', urlPrefix)
36
28
  }
37
- runSync('yarn', args)
38
- runSync('yarn', ['sentry-cli', 'releases', 'finalize', releaseName])
29
+ runSync(sentryCliBin, args)
30
+ runSync(sentryCliBin, ['releases', 'finalize', releaseName])
39
31
  }
40
32
  const failureExitIfNoEnvVariable = variableName => {
41
33
  if (!process.env[variableName]) {
@@ -7,11 +7,12 @@ import { resolveApp, resolveExtension } from '../utils/paths-resolution.js'
7
7
 
8
8
  const getWorkspacePaths = () => {
9
9
  const workspaceRoot = workspace.getWorkspaceRoot()
10
+
10
11
  const paths = globby.sync(
11
12
  [
12
13
  'hosts/*',
13
- 'namespaces/**/apps/*',
14
- 'namespaces/**/libs/*',
14
+ 'namespaces/*/apps/*',
15
+ 'namespaces/*/libs/*',
15
16
  'apps/*',
16
17
  'libs/*',
17
18
  'packages/*',
@@ -19,6 +20,10 @@ const getWorkspacePaths = () => {
19
20
  {
20
21
  onlyDirectories: true,
21
22
  cwd: workspaceRoot,
23
+ expandDirectories: false,
24
+ followSymbolicLinks: false,
25
+ ignore: ['**/node_modules/**'],
26
+ gitignore: false,
22
27
  }
23
28
  )
24
29
 
@@ -3,7 +3,7 @@ import { createRequire } from 'module'
3
3
  import path from 'path'
4
4
  import { resolveTsAliases } from 'resolve-ts-aliases'
5
5
 
6
- const appDirectory = fs.realpathSync(process.cwd())
6
+ const appDirectory = process.cwd()
7
7
  const resolveApp = relativePath => path.resolve(appDirectory, relativePath)
8
8
 
9
9
  const prepareAliases = ({ isEnvDevelopment, enableReactRefresh }) => {
@@ -29,7 +29,7 @@ const prepareAliases = ({ isEnvDevelopment, enableReactRefresh }) => {
29
29
  const localRequire = createRequire(import.meta.url)
30
30
 
31
31
  Object.assign(aliases, {
32
- // needed if you use yarn link
32
+ // needed if you use pnpm link
33
33
  'react-hot-loader/root': path.join(
34
34
  localRequire.resolve('react-hot-loader'),
35
35
  '../root'
@@ -29,6 +29,7 @@ const getExcludedFolders = () => {
29
29
  '**/*.spec.*',
30
30
  '**/*.pact.*',
31
31
  '**/*.stories.*',
32
+ '**/*.cy.*',
32
33
  '**/src/setupProxy.*',
33
34
  '**/src/setupTests.*',
34
35
  '**/dist',
@@ -3,8 +3,8 @@ import path from 'path'
3
3
 
4
4
  import { MODULE_FILE_EXTENSIONS } from '../constants.cjs'
5
5
 
6
- export const resolveApp = (relativePath, fs = osFs) =>
7
- path.resolve(fs.realpathSync(process.cwd()), relativePath)
6
+ export const resolveApp = relativePath =>
7
+ path.resolve(process.cwd(), relativePath)
8
8
 
9
9
  const findExtension = (filePath, fs) => {
10
10
  const extension = MODULE_FILE_EXTENSIONS.find(ext =>
@@ -1,16 +1,14 @@
1
1
  import { jest } from '@jest/globals'
2
2
  import fs from 'fs'
3
+ import path from 'path'
3
4
 
4
5
  import { resolveApp, resolveExtension } from './paths-resolution.js'
5
6
 
6
- const projectPath = '/project-folder'
7
-
8
7
  const existsSyncMock = jest.fn()
9
8
 
10
9
  const mockedFs = {
11
10
  ...fs,
12
11
  existsSync: existsSyncMock,
13
- realpathSync: () => projectPath,
14
12
  }
15
13
 
16
14
  describe('paths resolution utils', () => {
@@ -18,9 +16,9 @@ describe('paths resolution utils', () => {
18
16
  it('should return absolute file path', () => {
19
17
  const filePath = './some-file'
20
18
 
21
- const result = resolveApp(filePath, mockedFs)
19
+ const result = resolveApp(filePath)
22
20
 
23
- expect(result).toBe('/project-folder/some-file')
21
+ expect(result).toBe(path.resolve(process.cwd(), filePath))
24
22
  })
25
23
  })
26
24
 
@@ -1,4 +1,4 @@
1
- import cliShared from '@toptal/davinci-cli-shared'
1
+ import cliShared, { resolveBin } from '@toptal/davinci-cli-shared'
2
2
 
3
3
  import { paths } from '../../configs/paths.js'
4
4
  import {
@@ -94,8 +94,10 @@ const getMonorepoPublishLernaAlphaCommand = ({ branch, publishRootFolder }) => {
94
94
  publishRootFolder ??
95
95
  paths.appPackageBuild.slice(paths.appPackageBuild.lastIndexOf('/') + 1)
96
96
 
97
+ const lernaBin = resolveBin('lerna', import.meta.url)
98
+
97
99
  const options = [
98
- 'lerna',
100
+ lernaBin,
99
101
  'publish',
100
102
  '--canary',
101
103
  `--preid alpha-${normalizedBranchName}-${shortRef}`,
@@ -60,7 +60,7 @@ describe('publishMonorepoPackages', () => {
60
60
  // run a command
61
61
  expect(runSync).toHaveBeenCalledTimes(1)
62
62
  expect(runSync).toHaveBeenCalledWith(
63
- `lerna publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${publishRootFolder} --force-publish`,
63
+ expect.stringContaining(`publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${publishRootFolder} --force-publish`),
64
64
  [],
65
65
  {
66
66
  shell: true,
@@ -86,7 +86,7 @@ describe('publishMonorepoPackages', () => {
86
86
  // run a command
87
87
  expect(runSync).toHaveBeenCalledTimes(1)
88
88
  expect(runSync).toHaveBeenCalledWith(
89
- `lerna publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`,
89
+ expect.stringContaining(`publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`),
90
90
  [],
91
91
  {
92
92
  shell: true,
@@ -150,7 +150,7 @@ describe('publishMonorepoPackages', () => {
150
150
  // run a command
151
151
  expect(runSync).toHaveBeenCalledTimes(1)
152
152
  expect(runSync).toHaveBeenCalledWith(
153
- `lerna publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`,
153
+ expect.stringContaining(`publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`),
154
154
  [],
155
155
  {
156
156
  shell: true,
@@ -184,7 +184,7 @@ describe('publishMonorepoPackages', () => {
184
184
  // run a command
185
185
  expect(runSync).toHaveBeenCalledTimes(1)
186
186
  expect(runSync).toHaveBeenCalledWith(
187
- `lerna publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`,
187
+ expect.stringContaining(`publish --canary --preid alpha-${NORMALIZED_BRANCH_NAME}-${GIT_REF} --no-git-tag-version --exact --yes --contents ${DIST_PACKAGE_PATH} --force-publish`),
188
188
  [],
189
189
  {
190
190
  shell: true,