Skip to content

Commit

Permalink
fix(deps): update dependency esbuild to ^0.20.2 (#271)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency esbuild to ^0.20.2
---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Luis Aveiga <luis.aveiga@gmail.com>
Co-authored-by: Sally Young <git@justa.fish>
  • Loading branch information
3 people authored Apr 12, 2024
1 parent c0097b4 commit 6afa3ec
Show file tree
Hide file tree
Showing 8 changed files with 516 additions and 401 deletions.
442 changes: 236 additions & 206 deletions .pnp.cjs

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/metapackages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Metapackages

Drainpipe comes with packages that are published to npm:
- https://www.npmjs.com/package/@lullabot/drainpipe-javascript
- https://www.npmjs.com/package/@lullabot/drainpipe-sass

## Testing Changes

- Setup the [test site](./test-script.md) which will install the metapackages
from your local checkout
- Copy the contents of `tests/fixtures/metapackages` to the site:
```
❯ pwd
/home/justafish/repos/drainpipe-test
❯ cp -R ../drainpipe/tests/fixtures/metapackages/* .
```
- Install focal trap (used by `js/mobile-nav.js`)
```
ddev yarn add focus-trap
```
- Run commands from `Taskfile.yml` e.g. `ddev task javascript`, `ddev task sass`
28 changes: 28 additions & 0 deletions docs/test-script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Test Script

A test script is available in `tests/local-test.sh` to setup a Drupal site
with Drainpipe packages installed from your local checkout.

Go to the directory above `drainpipe` and run the `tests/local-hest.sh` script
to setup a new test site e.g.
```
❯ pwd
/home/justafish/repos/drainpipe
❯ cd ../
```

If you previously created a test site, remove it:
```
❯ cd drainpipe-test
❯ ddev stop --remove-data --omit-snapshot
❯ cd ../
```

Run the test script:
```
❯ pwd
/home/justafish/repos
❯ ./drainpipe/tests/local-test.sh
cd drainpipe-test
```
12 changes: 8 additions & 4 deletions metapackages/javascript/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ catch (error) {
const yargs = require('yargs');
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv)).argv
const { build } = require('esbuild');
const { build, context } = require('esbuild');
const chokidar = require('chokidar');
const scripts = argv.files.split(' ');

Expand Down Expand Up @@ -61,7 +61,7 @@ if (uniqueFileExtension.length !== 1) {
const { pnpPlugin } = require('@yarnpkg/esbuild-plugin-pnp');
plugins = [pnpPlugin()]
}
let builder = await build({
let config = {
plugins,
entryPoints: scripts.map(script => script.split(':')[0]),
outdir: uniqueBaseDir[0],
Expand All @@ -70,9 +70,10 @@ if (uniqueFileExtension.length !== 1) {
bundle: true,
sourcemap: true,
minify: !!argv.minify,
incremental: !!argv.watch,
logLevel: 'info',
});
};
let builder = await context(config);
await build(config);

if (!!argv.watch) {
let ready = false;
Expand All @@ -99,6 +100,9 @@ if (uniqueFileExtension.length !== 1) {
}
});
}
else {
process.exit(0);
}
} catch (err) {
console.error(err);
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion metapackages/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.2",
"chokidar": "^3.6.0",
"esbuild": "^0.14.36",
"esbuild": "^0.20.2",
"yargs": "^17.7.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion tasks/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ tasks:
COMMAND="yarn drainpipe-javascript"
fi
echo "$COMMAND drainpipe-javascript --files=\"$FILES\" $ARGS"
$COMMAND drainpipe-javascript --files="$FILES" $ARGS
$COMMAND --files="$FILES" $ARGS
watch:
desc: As compile, but continues running and watching for changes
deps:
Expand Down
8 changes: 5 additions & 3 deletions tests/local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cd drainpipe-test
cp -R ../drainpipe .

ddev config --auto
ddev config --nodejs-version "18"
ddev config --nodejs-version "21"
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages '["lullabot/drainpipe-dev", "lullabot/drainpipe"]'
Expand All @@ -28,7 +28,6 @@ echo " - exec: mysql -uroot -proot -hdb -e \"CREATE DATABASE IF NOT EXISTS fi
echo " - exec: mysql -uroot -proot -hdb -e \"CREATE DATABASE IF NOT EXISTS chrome; GRANT ALL ON chrome.* TO 'db'@'%';\"" >> .ddev/config.yaml
ddev config --web-environment="NIGHTWATCH_DRUPAL_URL_FIREFOX=https://drupal_firefox,NIGHTWATCH_DRUPAL_URL_CHROME=https://drupal_chrome"
ddev config --additional-hostnames="*.drainpipe"
ddev config --nodejs-version=21
ddev restart

ddev yarn set version berry
Expand All @@ -39,9 +38,12 @@ echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
ddev yarn add nightwatch nightwatch-axe-verbose @lullabot/nightwatch-drupal-commands --dev
yarn

ddev drush --yes site:install
ddev drush --uri=https://drupal_firefox --yes site:install
ddev drush --uri=https://drupal_chrome --yes site:install
ddev drush config:export --yes

cp -R ../drainpipe/metapackages .
ddev yarn add drainpipe-javascript@file:./metapackages/javascript/
ddev yarn add drainpipe-sass@file:./metapackages/sass/
Loading

0 comments on commit 6afa3ec

Please sign in to comment.