@toptal/davinci-engine 11.0.1 → 11.0.2

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,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2251](https://github.com/toptal/davinci/pull/2251) [`31681868`](https://github.com/toptal/davinci/commit/31681868107b0a1267bb43af13ffe1f32374143a) Thanks [@TomasSlama](https://github.com/TomasSlama)!
8
+ - check for the TailwindCSS config in the root of the workspace
9
+
3
10
  ## 11.0.1
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-engine",
3
- "version": "11.0.1",
3
+ "version": "11.0.2",
4
4
  "description": "Build tool for frontend projects",
5
5
  "author": "Toptal",
6
6
  "license": "SEE LICENSE IN LICENSE.MD",
@@ -60,6 +60,7 @@
60
60
  "dot-prop": "^6.0.1",
61
61
  "dotenv": "^16.0.3",
62
62
  "execa": "^5.1.1",
63
+ "find-up": "^5.0.0",
63
64
  "find-yarn-workspace-root": "^2.0.0",
64
65
  "fork-ts-checker-webpack-plugin": "^9.0.2",
65
66
  "fs-extra": "^11.1.1",
@@ -1,14 +1,15 @@
1
1
  import MiniCssExtractPlugin from 'mini-css-extract-plugin'
2
2
  import { createRequire } from 'module'
3
- import fs from 'fs'
3
+ import findUp from 'find-up'
4
4
 
5
- import { resolveApp } from '../../../utils/paths-resolution.js'
5
+ import { getWorkspaceRoot } from '../../../utils/workspace.js'
6
6
 
7
7
  const localRequire = createRequire(import.meta.url)
8
8
 
9
9
  const getCSSLoaders = ({ isEnvDevelopment, isEnvProduction }) => {
10
- const tailwindConfigPath = resolveApp('tailwind.config.js')
11
- const tailwindConfigExists = fs.existsSync(tailwindConfigPath)
10
+ const tailwindPath = findUp.sync('tailwind.config.js', {
11
+ stopAt: getWorkspaceRoot(),
12
+ })
12
13
 
13
14
  return [
14
15
  {
@@ -21,14 +22,14 @@ const getCSSLoaders = ({ isEnvDevelopment, isEnvProduction }) => {
21
22
  {
22
23
  loader: localRequire.resolve('css-loader'),
23
24
  },
24
- tailwindConfigExists && {
25
+ tailwindPath && {
25
26
  loader: 'postcss-loader',
26
27
  options: {
27
28
  postcssOptions: {
28
29
  config: false,
29
30
  plugins: {
30
31
  tailwindcss: {
31
- config: tailwindConfigPath,
32
+ config: tailwindPath,
32
33
  },
33
34
  autoprefixer: {},
34
35
  },
@@ -1,15 +1,10 @@
1
1
  import { describe, jest } from '@jest/globals'
2
- import fs from 'fs'
2
+ import findUp from 'find-up'
3
3
 
4
- const mockedGetResolveApp = jest.fn(() => 'tailwind.config.js')
5
4
  const mockedCreateRequire = jest.fn(() => ({
6
5
  resolve: pathname => pathname,
7
6
  }))
8
7
 
9
- jest.unstable_mockModule('../../../utils/paths-resolution.js', () => ({
10
- resolveApp: mockedGetResolveApp,
11
- }))
12
-
13
8
  jest.unstable_mockModule('module', () => ({
14
9
  createRequire: mockedCreateRequire,
15
10
  }))
@@ -30,11 +25,9 @@ const options = {
30
25
 
31
26
  describe('getCSSLoaders', () => {
32
27
  beforeEach(() => {
33
- mockedGetResolveApp.mockReturnValue('tailwind.config.js')
34
28
  mockedCreateRequire.mockReturnValue({
35
29
  resolve: pathname => pathname,
36
30
  })
37
- jest.spyOn(fs, 'existsSync').mockReturnValue(false)
38
31
  })
39
32
 
40
33
  afterEach(() => {
@@ -67,7 +60,7 @@ describe('getCSSLoaders', () => {
67
60
 
68
61
  describe('when tailwind.config.js exists', () => {
69
62
  it('returns an array with css-loader and postcss-loader', async () => {
70
- jest.spyOn(fs, 'existsSync').mockReturnValue(true)
63
+ jest.spyOn(findUp, 'sync').mockReturnValue('tailwind.config.js')
71
64
 
72
65
  const result = getCSSLoaders({
73
66
  ...options,