-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
128 changed files
with
44,100 additions
and
44 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
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
BUNDLE_GEMFILE: "../dependabot-updater/Gemfile" |
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,7 @@ | ||
/.bundle/* | ||
!.bundle/config | ||
/.env | ||
/tmp | ||
/dependabot-*.gem | ||
/helpers/node_modules | ||
/helpers/install-dir |
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 @@ | ||
inherit_from: ../.rubocop.yml |
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,66 @@ | ||
FROM ghcr.io/dependabot/dependabot-updater-core | ||
|
||
# Check for updates at https://github.com/nodejs/corepack/releases | ||
ARG COREPACK_VERSION=0.31.0 | ||
|
||
# Check for updates at https://github.com/pnpm/pnpm/releases | ||
ARG PNPM_VERSION=9.15.5 | ||
|
||
# Check for updates at https://github.com/yarnpkg/berry/releases | ||
ARG YARN_VERSION=4.5.3 | ||
|
||
# Check for updates at https://github.com/oven-sh/bun/releases | ||
ARG BUN_VERSION=1.2 | ||
|
||
# See https://github.com/nodesource/distributions#installation-instructions | ||
ARG NODEJS_VERSION=20 | ||
|
||
# Check for updates at https://github.com/npm/cli/releases | ||
# This version should be compatible with the Node.js version declared above. See https://nodejs.org/en/download/releases as well | ||
# TODO: Upgrade to 9.6.7 depending on the outcome of https://github.com/npm/cli/issues/6742 | ||
ARG NPM_VERSION=9.6.5 | ||
|
||
# Install Node and npm | ||
RUN mkdir -p /etc/apt/keyrings \ | ||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ | ||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
nodejs \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& npm install -g corepack@$COREPACK_VERSION \ | ||
&& npm install -g corepack@$COREPACK_VERSION bun@$BUN_VERSION \ | ||
&& rm -rf ~/.npm | ||
|
||
USER dependabot | ||
|
||
# Install pnpm and set it to a stable version | ||
RUN corepack install pnpm@$PNPM_VERSION --global | ||
|
||
# Install yarn berry and set it to a stable version | ||
RUN corepack install yarn@$YARN_VERSION --global | ||
|
||
# Install npm and set it to a stable version | ||
RUN corepack install npm@$NPM_VERSION --global | ||
|
||
ENV DEPENDABOT_NATIVE_HELPERS_PATH="/opt" | ||
COPY --chown=dependabot:dependabot bun/helpers /opt/bun/helpers | ||
RUN bash /opt/bun/helpers/build | ||
|
||
# START: HACKY WORKAROUND FOR NPM GIT INSTALLS SPAWNING CHILD PROCESS | ||
|
||
# TODO: Remove these hacks once we've deprecated npm 6 support as it no longer | ||
# spawns a child process to npm install git dependencies. | ||
|
||
# Create the config file manually instead of using yarn/npm config set as this | ||
# executes the package manager outputs to every job log | ||
COPY --chown=dependabot:dependabot updater/config/.yarnrc updater/config/.npmrc $DEPENDABOT_HOME/ | ||
|
||
# For Yarn Berry we can set this via an environment variable | ||
ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt | ||
|
||
# END: HACKY WORKAROUND FOR NPM GIT INSTALLS SPAWNING CHILD PROCESS | ||
|
||
COPY --chown=dependabot:dependabot bun $DEPENDABOT_HOME/bun | ||
COPY --chown=dependabot:dependabot common $DEPENDABOT_HOME/common | ||
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater |
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,18 @@ | ||
## `dependabot-bun` | ||
|
||
Bun support for [`dependabot-core`][core-repo]. | ||
|
||
### Running locally | ||
|
||
1. Start a development shell | ||
|
||
``` | ||
$ bin/docker-dev-shell bun | ||
``` | ||
|
||
2. Run tests | ||
``` | ||
[dependabot-core-dev] ~ $ cd bun && rspec | ||
``` | ||
|
||
[core-repo]: https://github.com/dependabot/dependabot-core |
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,40 @@ | ||
# frozen_string_literal: true | ||
|
||
Gem::Specification.new do |spec| | ||
common_gemspec = | ||
Bundler.load_gemspec_uncached("../common/dependabot-common.gemspec") | ||
|
||
spec.name = "dependabot-bun" | ||
spec.summary = "Provides Dependabot support for Javascript" | ||
spec.description = "Dependabot-BUN provides support for bumping Javascript libraries via " \ | ||
"Dependabot. " \ | ||
"If you want support for multiple package managers, you probably want the meta-gem " \ | ||
"dependabot-omnibus." | ||
|
||
spec.author = common_gemspec.author | ||
spec.email = common_gemspec.email | ||
spec.homepage = common_gemspec.homepage | ||
spec.license = common_gemspec.license | ||
|
||
spec.metadata = { | ||
"bug_tracker_uri" => common_gemspec.metadata["bug_tracker_uri"], | ||
"changelog_uri" => common_gemspec.metadata["changelog_uri"] | ||
} | ||
|
||
spec.version = common_gemspec.version | ||
spec.required_ruby_version = common_gemspec.required_ruby_version | ||
spec.required_rubygems_version = common_gemspec.required_ruby_version | ||
|
||
spec.require_path = "lib" | ||
spec.files = [] | ||
|
||
spec.add_dependency "dependabot-common", Dependabot::VERSION | ||
|
||
common_gemspec.development_dependencies.each do |dep| | ||
spec.add_development_dependency dep.name, *dep.requirement.as_list | ||
end | ||
|
||
next unless File.exist?("../.gitignore") | ||
|
||
spec.files += `git -C #{__dir__} ls-files lib helpers -z`.split("\x0") | ||
end |
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,11 @@ | ||
{ | ||
"extends": [ | ||
"prettier" | ||
], | ||
"env": { | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
} | ||
} |
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,29 @@ | ||
Native JavaScript helpers | ||
------------------------- | ||
|
||
This directory contains helper functions for npm and yarn, natively written in | ||
Javascript so that we can utilize the package managers internal APIs and other | ||
native tooling for these ecosystems. | ||
|
||
These helpers are called from the Ruby code via `run.js`, they are passed | ||
arguments via stdin and return JSON data to stdout. | ||
|
||
## Testing | ||
|
||
When working on these helpers, it's convenient to write some high level tests in | ||
JavaScript to make it easier to debug the code. | ||
|
||
You can now run the tests from this directory by running: | ||
|
||
``` | ||
yarn test path/to/test.js | ||
``` | ||
|
||
### Debugging | ||
|
||
In order to run an interactive debugger: | ||
|
||
- `node --inspect-brk node_modules/.bin/jest --runInBand path/to/test/test.js` | ||
- In Chrome, navigate to `chrome://inspect` | ||
- Click `Open dedicated DevTools for Node` | ||
- You'll now be able to interactively debug using the Chrome dev tools. |
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,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -z "$DEPENDABOT_NATIVE_HELPERS_PATH" ]; then | ||
echo "Unable to build, DEPENDABOT_NATIVE_HELPERS_PATH is not set" | ||
exit 1 | ||
fi | ||
|
||
install_dir="$DEPENDABOT_NATIVE_HELPERS_PATH/bun" | ||
mkdir -p "$install_dir" | ||
|
||
helpers_dir="$(dirname "${BASH_SOURCE[0]}")" | ||
cp -r \ | ||
"$helpers_dir/lib" \ | ||
"$helpers_dir/test" \ | ||
"$helpers_dir/run.js" \ | ||
"$helpers_dir/.eslintrc" \ | ||
"$helpers_dir/jest.config.js" \ | ||
"$helpers_dir/package.json" \ | ||
"$helpers_dir/package-lock.json" \ | ||
"$helpers_dir/patches" \ | ||
"$install_dir" | ||
|
||
cd "$install_dir" | ||
npm ci --no-audit --fetch-timeout=600000 --fetch-retries=5 --no-dry-run --no-ignore-scripts |
Oops, something went wrong.