Skip to content

Commit

Permalink
refactor: normalize package managers & CircleCI (#2164)
Browse files Browse the repository at this point in the history
* chore: remove last hint to yarn

* build: normalize circleci images to use latest node v18 and use browsers variant only when neccesary

* build: add required minor version to circleci image

* force circleci run

* Update config.yml, add BTs

* bundle size tweak

* bump puppeteer ver

* no sandbox

* fix: axios is now transpiled to ensure all bundled code is ECMA 2017 compatible

* fix: check minified browser bundle as well for ECMA 2017 as node v18 is not 100% ECMA 2018 compatible

* fix: ensure required polyfills are properly included

* build: update pupeteer to ensure and update lockfile to ensure we are above 21.5.0

* test: try to run chrome in old shell headless mode

* test: try to run chrome in new headless mode

* test: try to run pupeteer with a fresh user for every test

* test: install chrome only

* style: make prettier/linter happy

* add missing dependenceis for unique user dir per pupeteer run

* test: switch back to new headless mode

* test: install chrome/browsers in release job

* test: install chrome/browsers for lint job as well

* test: remove custom user directory per pupeteer instance

* test: try to remove potentially old config to see if we can speed this up

* test: add recommended change of cache dir when pupeteer runs in cloud

* test: readd timeout

* test: trigger circleci

* test: checkout the repository before installing browsers so our custom cache config is taken into account

* chore: bundle sizes

* fix: test fix

---------

Co-authored-by: Mitch Goudy <mgoudy91@gmail.com>
Co-authored-by: Mitch Goudy <mitchell.goudy@contentful.com>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent c0314ab commit e7ab9a5
Show file tree
Hide file tree
Showing 11 changed files with 4,197 additions and 939 deletions.
13 changes: 8 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ version: 2.1

orbs:
vault: contentful/vault@1
node: circleci/node@5.1.0
node: circleci/node@5.2.0
browser-tools: circleci/browser-tools@1.4.8

jobs:
lint:
docker:
- image: 'cimg/node:18.17.1-browsers'
- image: cimg/node:18.19-browsers
steps:
- checkout
- vault/get-secrets: # Loads vault secrets
Expand All @@ -23,7 +24,7 @@ jobs:

unit:
docker:
- image: 'cimg/base:stable'
- image: cimg/node:18.19
steps:
- checkout
- node/install:
Expand All @@ -37,7 +38,7 @@ jobs:

integration:
docker:
- image: 'cimg/base:stable'
- image: cimg/node:18.19
steps:
- checkout
- node/install:
Expand All @@ -51,9 +52,11 @@ jobs:

release:
docker:
- image: 'cimg/node:18.17.1-browsers'
- image: cimg/node:18.19-browsers
steps:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- vault/get-secrets: # Loads vault secrets
template-preset: 'semantic-release-ecosystem'
- run: echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_WRITE_TOKEN}" > ~/.npmrc
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ gh-pages
# NPM config
.npmrc

# Avoid lock files in libraries
yarn.lock

# Created by https://www.gitignore.io/api/node,windows,osx,linux,vim

### Linux ###
Expand Down
8 changes: 8 additions & 0 deletions .puppeteerrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { join } = require('path')

/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
cacheDirectory: join(__dirname, 'node_modules', '.puppeteer_cache'),
}
3 changes: 2 additions & 1 deletion lib/make-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function create<OptionsType extends ChainOptions>(
},
options,
)
const response: any = client
const response: any = client ? client : {}

Object.defineProperty(response, 'withAllLocales', {
get: () => makeInnerClient({ ...options, withAllLocales: true }),
})
Expand Down
Loading

0 comments on commit e7ab9a5

Please sign in to comment.