chore(js): use bun instead of yarn
This commit is contained in:
parent
3f54d46f19
commit
94ecd2166e
17 changed files with 68 additions and 9033 deletions
|
@ -11,7 +11,7 @@ runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Save test reports
|
- name: Save test reports
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.results_path }}
|
path: ${{ inputs.results_path }}
|
||||||
key: tests-reports-${{ github.ref }}-${{ github.sha }}-${{ github.run_id }}
|
key: tests-reports-${{ github.ref }}-${{ github.sha }}-${{ github.run_id }}
|
||||||
|
|
6
.github/actions/ci-setup-assets/action.yml
vendored
6
.github/actions/ci-setup-assets/action.yml
vendored
|
@ -5,7 +5,7 @@ runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Assets cache
|
- name: Assets cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
public/assets
|
public/assets
|
||||||
|
@ -20,7 +20,5 @@ runs:
|
||||||
- name: Precompile assets
|
- name: Precompile assets
|
||||||
env:
|
env:
|
||||||
RAILS_ENV: test
|
RAILS_ENV: test
|
||||||
run: |
|
run: bin/rails assets:precompile --trace
|
||||||
rm bin/yarn
|
|
||||||
bin/rails assets:precompile --trace
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
12
.github/actions/ci-setup-rails/action.yml
vendored
12
.github/actions/ci-setup-rails/action.yml
vendored
|
@ -16,19 +16,17 @@ runs:
|
||||||
|
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
|
- name: Setup Bun
|
||||||
- name: Install yarn
|
uses: oven-sh/setup-bun@v1
|
||||||
run: |
|
|
||||||
npm install --global yarn
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Install Node modules
|
- name: Install Node modules
|
||||||
run: |
|
run: |
|
||||||
node --version
|
node --version
|
||||||
yarn install --frozen-lockfile
|
bun --version
|
||||||
|
bun install
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Setup environment variables
|
- name: Setup environment variables
|
||||||
|
|
|
@ -31,7 +31,7 @@ runs:
|
||||||
#
|
#
|
||||||
# The actual retrieval uses the `restore-keys` instead.
|
# The actual retrieval uses the `restore-keys` instead.
|
||||||
- name: Restore previous runs timings
|
- name: Restore previous runs timings
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.results_path }}
|
path: ${{ inputs.results_path }}
|
||||||
key: single-instance-report-${{ github.sha }}-${{ env.dummy_random_value }}
|
key: single-instance-report-${{ github.sha }}-${{ env.dummy_random_value }}
|
||||||
|
|
34
.github/workflows/ci.yml
vendored
34
.github/workflows/ci.yml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
ports: [ "5432:5432" ]
|
ports: [ "5432:5432" ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup the app code and dependancies
|
- name: Setup the app code and dependancies
|
||||||
uses: ./.github/actions/ci-setup-rails
|
uses: ./.github/actions/ci-setup-rails
|
||||||
|
@ -36,22 +36,23 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
- name: Setup Bun
|
||||||
cache: 'yarn'
|
uses: oven-sh/setup-bun@v1
|
||||||
|
|
||||||
- name: Install Node modules
|
- name: Install Node modules
|
||||||
run: |
|
run: |
|
||||||
node --version
|
node --version
|
||||||
yarn install --frozen-lockfile
|
bun --version
|
||||||
|
bun install
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
yarn test
|
bun run test
|
||||||
|
|
||||||
unit_tests:
|
unit_tests:
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
|
@ -72,7 +73,7 @@ jobs:
|
||||||
instances: [0, 1, 2, 3, 4, 5]
|
instances: [0, 1, 2, 3, 4, 5]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install build dependancies
|
- name: Install build dependancies
|
||||||
# - fonts pickable by ImageMagick
|
# - fonts pickable by ImageMagick
|
||||||
|
@ -97,9 +98,9 @@ jobs:
|
||||||
bin/rspec $SPEC_FILES --format progress --format RspecJunitFormatter --out tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
bin/rspec $SPEC_FILES --format progress --format RspecJunitFormatter --out tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
||||||
|
|
||||||
- name: Upload test results for this instance
|
- name: Upload test results for this instance
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-reports
|
name: rspec-results-${{ github.job }}-${{ strategy.job-index }}
|
||||||
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
||||||
|
|
||||||
system_tests:
|
system_tests:
|
||||||
|
@ -121,7 +122,7 @@ jobs:
|
||||||
instances: [0, 1]
|
instances: [0, 1]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup the app runtime and dependencies
|
- name: Setup the app runtime and dependencies
|
||||||
uses: ./.github/actions/ci-setup-rails
|
uses: ./.github/actions/ci-setup-rails
|
||||||
|
@ -141,9 +142,9 @@ jobs:
|
||||||
RAILS_ENV=test bin/rspec $SPEC_FILES --format progress --format RspecJunitFormatter --out tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
RAILS_ENV=test bin/rspec $SPEC_FILES --format progress --format RspecJunitFormatter --out tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
||||||
|
|
||||||
- name: Upload test results for this instance
|
- name: Upload test results for this instance
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-reports
|
name: rspec-results-${{ github.job }}-${{ strategy.job-index }}
|
||||||
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
|
||||||
|
|
||||||
save_test_reports:
|
save_test_reports:
|
||||||
|
@ -152,13 +153,14 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Collect test results from all instances
|
- name: Collect test results from all instances
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-reports
|
|
||||||
path: tmp
|
path: tmp
|
||||||
|
pattern: rspec-results-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Save test results and timing data, to better split future tests
|
- name: Save test results and timing data, to better split future tests
|
||||||
uses: ./.github/actions/ci-save-split-tests
|
uses: ./.github/actions/ci-save-split-tests
|
||||||
|
|
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
|
@ -38,11 +38,11 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
@ -53,7 +53,7 @@ jobs:
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
|
@ -67,4 +67,4 @@ jobs:
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|
2
.github/workflows/git.yml
vendored
2
.github/workflows/git.yml
vendored
|
@ -7,6 +7,6 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Block Fixup Commit Merge
|
- name: Block Fixup Commit Merge
|
||||||
uses: 13rac1/block-fixup-merge-action@v2.0.0
|
uses: 13rac1/block-fixup-merge-action@v2.0.0
|
||||||
|
|
2
.github/workflows/rails_schema_check.yml
vendored
2
.github/workflows/rails_schema_check.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2 # Fetch the last 2 commits to be able to compare with the base branch
|
fetch-depth: 2 # Fetch the last 2 commits to be able to compare with the base branch
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ Pour faire tourner sidekiq, vous aurez besoin de :
|
||||||
#### Développement
|
#### Développement
|
||||||
|
|
||||||
- rbenv : voir https://github.com/rbenv/rbenv-installer#rbenv-installer--doctor-scripts
|
- rbenv : voir https://github.com/rbenv/rbenv-installer#rbenv-installer--doctor-scripts
|
||||||
- Yarn : voir https://yarnpkg.com/en/docs/install
|
- Bun : voir https://bun.sh/docs/installation
|
||||||
|
|
||||||
#### Tests
|
#### Tests
|
||||||
|
|
||||||
|
|
15
bin/setup
15
bin/setup
|
@ -19,10 +19,21 @@ FileUtils.chdir APP_ROOT do
|
||||||
|
|
||||||
# Install JavaScript dependencies
|
# Install JavaScript dependencies
|
||||||
system! 'node --version'
|
system! 'node --version'
|
||||||
system! 'bin/yarn install'
|
system! 'bun --version'
|
||||||
|
system! 'bun install'
|
||||||
|
|
||||||
|
if ENV["UPDATE_WEBDRIVER"]
|
||||||
puts "\n== Updating webdrivers =="
|
puts "\n== Updating webdrivers =="
|
||||||
system! 'RAILS_ENV=test bin/rails webdrivers:chromedriver:update'
|
puts "\nyou must add ~/.local/bin to your path"
|
||||||
|
system! 'bunx @puppeteer/browsers clear --path ~/.local/bin/headless_browsers'
|
||||||
|
|
||||||
|
system! 'bunx @puppeteer/browsers install chromedriver --path ~/.local/bin/headless_browsers'
|
||||||
|
system! 'bunx @puppeteer/browsers install chrome --path ~/.local/bin/headless_browsers'
|
||||||
|
puts "\n if chrome and chromedriver versions are not compatible, add the version you want in the above lines. ex : chrome@121"
|
||||||
|
|
||||||
|
system! 'rm -f ~/.local/bin/chromedriver && ln -s $(find ~/.local/bin/headless_browsers -type f -name chromedriver) ~/.local/bin/chromedriver'
|
||||||
|
system! 'rm -f ~/.local/bin/chrome && ln -s $(find ~/.local/bin/headless_browsers -type f -name chrome) ~/.local/bin/chrome'
|
||||||
|
end
|
||||||
|
|
||||||
puts "\n== Copying sample files =="
|
puts "\n== Copying sample files =="
|
||||||
unless File.exist?('.env')
|
unless File.exist?('.env')
|
||||||
|
|
10
bin/update
10
bin/update
|
@ -16,16 +16,16 @@ FileUtils.chdir APP_ROOT do
|
||||||
system! 'gem install bundler --conservative'
|
system! 'gem install bundler --conservative'
|
||||||
system('bundle check') || system!('bundle install')
|
system('bundle check') || system!('bundle install')
|
||||||
system! 'node --version'
|
system! 'node --version'
|
||||||
system! 'bin/yarn install'
|
system! 'bun --version'
|
||||||
system! 'bin/yarn clean'
|
system! 'bun install'
|
||||||
|
|
||||||
if ENV["UPDATE_WEBDRIVER"]
|
if ENV["UPDATE_WEBDRIVER"]
|
||||||
puts "\n== Updating webdrivers =="
|
puts "\n== Updating webdrivers =="
|
||||||
puts "\nyou must add ~/.local/bin to your path"
|
puts "\nyou must add ~/.local/bin to your path"
|
||||||
system! 'npx @puppeteer/browsers clear --path ~/.local/bin/headless_browsers'
|
system! 'bunx @puppeteer/browsers clear --path ~/.local/bin/headless_browsers'
|
||||||
|
|
||||||
system! 'npx @puppeteer/browsers install chromedriver --path ~/.local/bin/headless_browsers'
|
system! 'bunx @puppeteer/browsers install chromedriver --path ~/.local/bin/headless_browsers'
|
||||||
system! 'npx @puppeteer/browsers install chrome --path ~/.local/bin/headless_browsers'
|
system! 'bunx @puppeteer/browsers install chrome --path ~/.local/bin/headless_browsers'
|
||||||
puts "\n if chrome and chromedriver versions are not compatible, add the version you want in the above lines. ex : chrome@121"
|
puts "\n if chrome and chromedriver versions are not compatible, add the version you want in the above lines. ex : chrome@121"
|
||||||
|
|
||||||
system! 'rm -f ~/.local/bin/chromedriver && ln -s $(find ~/.local/bin/headless_browsers -type f -name chromedriver) ~/.local/bin/chromedriver'
|
system! 'rm -f ~/.local/bin/chromedriver && ln -s $(find ~/.local/bin/headless_browsers -type f -name chromedriver) ~/.local/bin/chromedriver'
|
||||||
|
|
17
bin/yarn
17
bin/yarn
|
@ -1,17 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
APP_ROOT = File.expand_path('..', __dir__)
|
|
||||||
Dir.chdir(APP_ROOT) do
|
|
||||||
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
|
|
||||||
select { |dir| File.expand_path(dir) != __dir__ }.
|
|
||||||
product(["yarn", "yarn.cmd", "yarn.ps1"]).
|
|
||||||
map { |dir, file| File.expand_path(file, dir) }.
|
|
||||||
find { |file| File.executable?(file) }
|
|
||||||
|
|
||||||
if yarn
|
|
||||||
exec yarn, *ARGV
|
|
||||||
else
|
|
||||||
$stderr.puts "Yarn executable was not detected in the system."
|
|
||||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
end
|
|
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
|
@ -11,7 +11,7 @@ Usually, a deployment goes like this (in pseudo-code):
|
||||||
# For each server:
|
# For each server:
|
||||||
# Stop the server
|
# Stop the server
|
||||||
# Get the new code (e.g. `git clone git@github.com:betagouv/demarches-simplifiees.fr.git`)
|
# Get the new code (e.g. `git clone git@github.com:betagouv/demarches-simplifiees.fr.git`)
|
||||||
# Install new dependencies (e.g. `bundle install && yarn install`)
|
# Install new dependencies (e.g. `bundle install && bun install`)
|
||||||
# Restart the app server
|
# Restart the app server
|
||||||
# Run data migrations (e.g. `rake after_party:run`)
|
# Run data migrations (e.g. `rake after_party:run`)
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,6 +6,6 @@ task :lint do
|
||||||
sh "bundle exec i18n-tasks unused --locale en" # TODO: check for all locales
|
sh "bundle exec i18n-tasks unused --locale en" # TODO: check for all locales
|
||||||
sh "bundle exec i18n-tasks check-consistent-interpolations"
|
sh "bundle exec i18n-tasks check-consistent-interpolations"
|
||||||
sh "bundle exec brakeman --no-pager"
|
sh "bundle exec brakeman --no-pager"
|
||||||
sh "yarn lint:js"
|
sh "bun lint:js"
|
||||||
sh "yarn lint:types"
|
sh "bun lint:types"
|
||||||
end
|
end
|
||||||
|
|
13
package.json
13
package.json
|
@ -75,6 +75,12 @@
|
||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@esbuild/darwin-arm64": "=0.19.9",
|
||||||
|
"@esbuild/linux-x64": "=0.19.9",
|
||||||
|
"@esbuild/win32-x64": "=0.19.9",
|
||||||
|
"@rollup/rollup-linux-x64-gnu": "=4.9.1",
|
||||||
|
"@rollup/rollup-darwin-arm64": "=4.9.1",
|
||||||
|
"@rollup/rollup-win32-x64-msvc": "=4.9.1",
|
||||||
"@types/debounce": "^1.2.1",
|
"@types/debounce": "^1.2.1",
|
||||||
"@types/geojson": "^7946.0.10",
|
"@types/geojson": "^7946.0.10",
|
||||||
"@types/is-hotkey": "^0.1.7",
|
"@types/is-hotkey": "^0.1.7",
|
||||||
|
@ -121,5 +127,10 @@
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"string-width": "4.2.2",
|
"string-width": "4.2.2",
|
||||||
"wrap-ansi": "7.0.0"
|
"wrap-ansi": "7.0.0"
|
||||||
}
|
},
|
||||||
|
"trustedDependencies": [
|
||||||
|
"core-js",
|
||||||
|
"esbuild",
|
||||||
|
"rollup"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue