Skip to content

Commit

Permalink
Start using Yarn 3 (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
faultyserver authored Apr 7, 2023
1 parent f6b62e7 commit 0f376ec
Show file tree
Hide file tree
Showing 10 changed files with 19,636 additions and 13,094 deletions.
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,18 @@ node_modules/
dist/
tracker/static/gen/
geckodriver.log
yarn-error.log
test-results

# Yarn files for projects not using zero-installs,
# taken from https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored.
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
yarn-error.log

# macOS generated configuration files for Finder.
*.DS_Store
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ repos:
hooks:
- id: prettier
name: prettier
entry: ./node_modules/.bin/prettier
language: node
entry: yarn prettier
language: system
stages: [commit]
files: (.*)\.(js|jsx|ts|tsx|css)$
args: ["--write"]
Expand All @@ -33,8 +33,8 @@ repos:
pass_filenames: false
- id: typescript
name: typescript
entry: ./node_modules/.bin/tsc
language: script
entry: yarn tsc
language: system
stages: [push]
files: (.*)\.(jsx?|tsx?)$
pass_filenames: false
Expand Down
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Yarn Plug'n'Play has some compatibility issues with older versions of tools
# like Webpack that we are still using. `pnpm` mode gives us a lot of the same
# benefits of disk usage and explicit dependency enforcement without those
# compatibility problems.
nodeLinker: pnpm

yarnPath: .yarn/releases/yarn-3.5.0.cjs
14 changes: 7 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
Django40:
PYTHON_VERSION: '3.11'
DJANGO_VERSION: '4.0'
# Python37: # does not need separate testing because python 3.8 is required for Django 4.0
# Python37: # does not need separate testing because python 3.8 is required for Django 4.0
Python38:
PYTHON_VERSION: '3.8'
DJANGO_VERSION: '4.1'
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | production | yarn.lock
path: $(Build.SourcesDirectory)/node_modules
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'

- script: |
Expand All @@ -73,7 +73,7 @@ jobs:
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/TEST-*.xml'
testResultsFiles: 'test-results/TEST-*.xml'
testRunTitle: 'Python $(PYTHON_VERSION)'
condition: succeededOrFailed()

Expand All @@ -93,7 +93,7 @@ jobs:
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | production | yarn.lock
path: $(Build.SourcesDirectory)/node_modules
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'

- script: |
Expand All @@ -119,13 +119,13 @@ jobs:
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | development | yarn.lock
path: $(Build.SourcesDirectory)/node_modules
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'

- script: |
python -m pip install --upgrade pip setuptools wheel pre-commit
ss=0
yarn --frozen-lockfile || ss=1
yarn --immutable || ss=1
pre-commit run --all || ss=1
pre-commit run --hook-stage push --all || ss=1
exit $ss
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
path: $(YARN_CACHE_FOLDER)
displayName: 'Cache yarn'

- script: yarn --frozen-lockfile
- script: yarn --immutable
displayName: 'yarn install'

- script: yarn build
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ module.exports = function (config) {
noInfo: true,
poll: 1000,
},
plugins: ['karma-*'],
plugins: [require('karma-chrome-launcher'), require('karma-jasmine'), require('karma-webpack')],
});
};
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
Expand All @@ -47,6 +48,7 @@
"cssnano": "^4.1.10",
"file-loader": "^4.2.0",
"history": "^4.10.1",
"invariant": "^2.2.4",
"keymirror": "^0.1.1",
"lodash": "^4.17.15",
"luxon": "^2.4.0",
Expand Down Expand Up @@ -97,13 +99,15 @@
"@storybook/addon-links": "^5.1.3",
"@storybook/addons": "^5.1.3",
"@storybook/react": "^5.1.3",
"@testing-library/react": "^9.3.2",
"@testing-library/dom": "^9.2.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^7.1.2",
"@types/classnames": "^2.2.9",
"@types/enzyme": "^3.10.4",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/fetch-mock": "^7.3.1",
"@types/history": "^4.7.3",
"@types/invariant": "^2.2.35",
"@types/jasmine": "^3.3.13",
"@types/karma": "^3.0.3",
"@types/karma-jasmine": "^0.0.31",
Expand Down Expand Up @@ -146,5 +150,6 @@
},
"resolve": {
"@types/react": "^16.9.11"
}
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
)
except subprocess.SubprocessError:
# maybe failed because the modules aren't installed
subprocess.check_call(['yarn', '--frozen-lockfile', '--production'])
subprocess.check_call(['yarn', '--immutable'])
subprocess.check_call(
['yarn', 'build'],
env={**os.environ, 'NODE_ENV': 'development', 'NO_HMR': '1'},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def finalize_options(self):

def run(self):
subprocess.check_call(['git', 'clean', '-fxd', 'tracker'])
subprocess.check_call(['yarn', '--production'])
subprocess.check_call(['yarn'])
subprocess.check_call(['yarn', 'build'])
self.run_command('sdist')
self.run_command('bdist_wheel')
Expand Down
Loading

0 comments on commit 0f376ec

Please sign in to comment.