forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force manual build to run lint to avoid unnecessary rebuilds (strapi#…
- Loading branch information
1 parent
7bbc3b8
commit dceea72
Showing
47 changed files
with
829 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
preset: '../../../jest-preset.unit.js', | ||
displayName: 'Github action check-pr-status', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
backend: | ||
- 'packages/**/package.json' | ||
- 'packages/**/server/**/*.(js|ts)' | ||
- 'packages/**/strapi-server.js' | ||
- 'packages/{utils,generators,cli,providers}/**' | ||
- 'packages/core/*/{lib,bin,ee}/**' | ||
- 'api-tests/**' | ||
frontend: | ||
- 'packages/**/package.json' | ||
- 'packages/**/admin/src/**' | ||
- 'packages/**/admin/ee/admin/**' | ||
- 'packages/**/strapi-admin.js' | ||
- 'packages/core/helper-plugin/**' | ||
- 'packages/admin-test-utils/**' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint-staged | ||
yarn nx affected:lint --uncommitted --nx-ignore-cycles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
/** @type {import('jest').Config} */ | ||
const config = { | ||
projects: [ | ||
'<rootDir>/packages/plugins/*/jest.config.front.js', | ||
'<rootDir>/packages/core/*/jest.config.front.js', | ||
'<rootDir>/scripts/*/jest.config.front.js', | ||
], | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
/** @type {import('jest').Config} */ | ||
const config = { | ||
projects: [ | ||
'<rootDir>/packages/plugins/*/jest.config.js', | ||
'<rootDir>/packages/utils/*/jest.config.js', | ||
'<rootDir>/packages/generators/*/jest.config.js', | ||
'<rootDir>/packages/core/*/jest.config.js', | ||
'<rootDir>/packages/providers/*/jest.config.js', | ||
'<rootDir>/.github/actions/*/jest.config.js', | ||
], | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
const findUp = require('find-up'); | ||
|
||
const includes = ['packages', '.github']; | ||
|
||
const root = path.resolve(__dirname); | ||
|
||
function extractPackageName(pkgJsonPath) { | ||
return JSON.parse(fs.readFileSync(pkgJsonPath).toString()).name; | ||
} | ||
|
||
function getLintCommand(files) { | ||
const affectedFolders = new Set(); | ||
|
||
for (const file of files) { | ||
const r = findUp.sync('package.json', { cwd: file }); | ||
const relPath = path.relative(root, r); | ||
|
||
if (includes.some((incl) => relPath.startsWith(incl))) { | ||
affectedFolders.add(r); | ||
} | ||
} | ||
|
||
const affectedPackages = [...affectedFolders].map(extractPackageName); | ||
|
||
if (affectedPackages.length === 0) { | ||
return null; | ||
} | ||
return `nx run-many -t lint -p ${affectedPackages.join()}`; | ||
} | ||
|
||
function getCodeCommands(files) { | ||
const lintCmd = getLintCommand(files); | ||
|
||
const prettierCmd = `prettier --write ${files.join(' ')}`; | ||
|
||
if (lintCmd) { | ||
return [lintCmd, prettierCmd]; | ||
} | ||
|
||
return [prettierCmd]; | ||
} | ||
|
||
module.exports = { | ||
'*.{js,ts}': getCodeCommands, | ||
'*.{md,css,scss,yaml,yml}': ['prettier --write'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
module.exports = { | ||
preset: '../../../jest-preset.unit.js', | ||
displayName: 'Core admin', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
module.exports = { | ||
preset: '../../../jest-preset.unit.js', | ||
displayName: 'Core content-manager', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
module.exports = { | ||
preset: '../../../jest-preset.front.js', | ||
displayName: 'Core content-type-builder', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
module.exports = { | ||
preset: '../../../jest-preset.unit.js', | ||
displayName: 'Core content-type-builder', | ||
}; |
Oops, something went wrong.