-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🪟 🔧 Switch to pnpm
for package managing
#22053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
fd225c9
9b1d50b
35bf80e
0a164df
63001be
2dab133
ff69510
d361c06
07b0b0b
b3649dc
2d1698b
ca66b4c
3604bdc
99ef8d1
6d0b4e2
e08d8cf
cdf5328
31edfdc
09cb556
6c2ff39
352a21a
e851a1c
695cdb6
3791796
3bfc186
ab1d27f
8d2cc0a
a7dd7b9
9862222
d4feec3
f0e25f3
5db4ad5
bf1da86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
engine-strict=true | ||
enable-pre-post-scripts=true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ Required for |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,46 @@ | ||
plugins { | ||
id "base" | ||
id "com.github.node-gradle.node" version "3.3.0" | ||
id "com.github.node-gradle.node" version "3.4.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ Required to have |
||
} | ||
|
||
// Use the node version that's defined in the .nvmrc file | ||
def nodeVersion = new File("${projectDir}/.nvmrc").text.trim(); | ||
|
||
// Read pnpm version to use from package.json engines.pnpm entry | ||
def pnpmVer = new groovy.json.JsonSlurper().parse(new File("${projectDir}/package.json")).engines.pnpm.trim(); | ||
|
||
// This array should contain a path to all configs that are common to most build tasks and | ||
// might affect them (i.e. if any of those files change we want to rerun most tasks) | ||
def commonConfigs = [ | ||
'.env', | ||
'package.json', | ||
'package-lock.json', | ||
'pnpm-lock.yaml', | ||
'tsconfig.json', | ||
'.prettierrc.js' | ||
] | ||
|
||
node { | ||
download = true | ||
version = nodeVersion | ||
npmInstallCommand = 'ci' | ||
pnpmVersion = pnpmVer | ||
} | ||
|
||
task validateLockFiles { | ||
description "Validate only a pnpm-lock.yaml lock file exists" | ||
doLast { | ||
assert file("pnpm-lock.yaml").exists() | ||
assert !file("package-lock.json").exists() | ||
assert !file("yarn.lock").exists() | ||
} | ||
} | ||
|
||
npm_run_build { | ||
pnpmInstall.dependsOn validateLockFiles | ||
|
||
task pnpmBuild(type: PnpmTask) { | ||
dependsOn pnpmInstall | ||
|
||
args = ['build'] | ||
|
||
inputs.files commonConfigs | ||
inputs.file '.eslintrc.js' | ||
inputs.dir 'public' | ||
|
@@ -40,7 +58,7 @@ task test(type: NpmTask) { | |
} | ||
|
||
task licenseCheck(type: NpmTask) { | ||
dependsOn npmInstall | ||
dependsOn pnpmInstall | ||
|
||
args = ['run', 'license-check'] | ||
inputs.files commonConfigs | ||
|
@@ -52,7 +70,7 @@ task licenseCheck(type: NpmTask) { | |
} | ||
|
||
task validateLinks(type: NpmTask) { | ||
dependsOn npmInstall | ||
dependsOn pnpmInstall | ||
|
||
args = ['run', 'validate-links'] | ||
|
||
|
@@ -62,7 +80,7 @@ task validateLinks(type: NpmTask) { | |
} | ||
|
||
task buildStorybook(type: NpmTask) { | ||
dependsOn npmInstall | ||
dependsOn pnpmInstall | ||
args = ['run', 'build:storybook'] | ||
|
||
inputs.files commonConfigs | ||
|
@@ -78,7 +96,7 @@ task buildStorybook(type: NpmTask) { | |
} | ||
|
||
task copyBuildOutput(type: Copy) { | ||
dependsOn copyDocker, npm_run_build | ||
dependsOn copyDocker, pnpmBuild | ||
|
||
from "${project.projectDir}/build/app" | ||
into 'build/docker/bin/build' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This is with
pnpm
now conflicting with thereact
plugin already being pulled in byeslint-config-react-app
which we extend above. Since that plugin pulls in thereact
plugin also no need for us to pull it in explicitally.