Skip to content

Commit 475958e

Browse files
authored
chore: update scripts to not use npm lifecycle commands [DX-589] (#2615)
* chore: update scripts to not use pre or post commands * chore: update package lock * chore: move check step to after build restore * chore: update formatting * chore: update installation of chrome for puppeteer * chore: update puppeteer script * chore: fix prettier * chore: add no sandbox args for puppeteer
1 parent 618a3d2 commit 475958e

File tree

8 files changed

+51
-27
lines changed

8 files changed

+51
-27
lines changed

.github/workflows/check.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ jobs:
8080
- name: Run tests
8181
run: npm test
8282

83+
- name: Run demo tests
84+
run: npm run test:demo-projects
85+
8386
test-bundle-size:
8487
runs-on: ubuntu-latest
8588

@@ -137,3 +140,6 @@ jobs:
137140

138141
- name: Test TypeScript types
139142
run: npm run test:types
143+
144+
- name: Run checks
145+
run: npm run check

.github/workflows/release.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,11 @@ jobs:
7272
env:
7373
GITHUB_TOKEN: ${{ steps.vault.outputs.GITHUB_TOKEN }}
7474
# required for browser output-integration tests
75-
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
75+
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
76+
- name: Publish Docs
77+
if: github.ref == 'refs/heads/master'
78+
run: |
79+
echo "Publishing Documentation"
80+
npm run docs:publish
81+
env:
82+
GITHUB_TOKEN: ${{ steps.vault.outputs.GITHUB_TOKEN }}

package-lock.json

Lines changed: 17 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"build": "npm run clean && npm run build:esm && npm run build:bundles && rm -rf dist/esm-raw",
5454
"build:esm": "tsc",
5555
"build:bundles": "NODE_ENV=production rollup -c",
56-
"postbuild": "npm run check && npm run test:demo-projects",
5756
"check": "npm run check:cjs && npm run check:esm && npm run check:browser && npm run check:browser-min",
5857
"check:browser": "es-check es2018 ./dist/contentful.browser.js",
5958
"check:browser-min": "es-check es2018 ./dist/contentful.browser.min.js",
@@ -73,12 +72,10 @@
7372
"test:integration:watch": "vitest ./test/integration",
7473
"test:size": "size-limit",
7574
"test:demo-projects": "npm run test:demo-node && npm run test:demo-browser",
76-
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && vitest --run ./test/output-integration/node",
77-
"test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run test",
75+
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && npm --prefix ./test/output-integration/node test",
76+
"test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run setup-test-env && npm --prefix ./test/output-integration/browser run test",
7877
"test:types": "tsd",
7978
"test:prepush": "npm run build && npm run test:unit && npm run test:types",
80-
"prepublishOnly": "export PUBLISH_RUN=true && npm run build && unset PUBLISH_RUN",
81-
"postpublish": "npm run docs:publish && npm run clean",
8279
"semantic-release": "semantic-release",
8380
"prepare": "husky",
8481
"precommit": "npm run lint && npm run prettier:check",
@@ -136,7 +133,7 @@
136133
"lint-staged": {
137134
"*.{js,jsx,ts,tsx}": [
138135
"prettier --write",
139-
"eslint"
136+
"eslint --fix"
140137
],
141138
"*.md": [
142139
"prettier --write"

test/output-integration/browser/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
"type": "module",
77
"scripts": {
88
"test": "vitest --run",
9-
"preinstall": "npm run install:browser && npm run install:bundle",
109
"install:bundle": "cp ../../../dist/contentful.browser.min.js ./public/.",
11-
"install:browser": "npx puppeteer browser install"
10+
"install:browser": "npx puppeteer browser install",
11+
"setup-puppeteer": "node ./node_modules/puppeteer/install.mjs",
12+
"setup-test-env": "npm run setup-puppeteer && npm run install:browser && npm run install:bundle"
1213
},
1314
"author": "",
1415
"license": "ISC",

test/output-integration/browser/vitest.setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ let page: Page
88

99
beforeAll(async () => {
1010
browser = await puppeteer.launch({
11-
headless: 'new',
11+
headless: true,
12+
args: ['--no-sandbox', '--disable-setuid-sandbox'],
1213
})
1314
})
1415

test/output-integration/node/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6+
"type": "module",
67
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "vitest --run"
89
},
910
"author": "",
1011
"license": "ISC",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'vitest/config'
2+
3+
export default defineConfig({
4+
test: {
5+
globals: true,
6+
dir: '.',
7+
environment: 'node',
8+
testTimeout: 10000,
9+
},
10+
})

0 commit comments

Comments
 (0)