Skip to content

Commit 8740a47

Browse files
committed
chore: update scripts to not use pre or post commands
1 parent 618a3d2 commit 8740a47

File tree

6 files changed

+30
-10
lines changed

6 files changed

+30
-10
lines changed

.github/workflows/check.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Run linter
3030
run: npm run lint
3131

32+
- name: Run checks
33+
run: npm run check
34+
3235
prettier:
3336
runs-on: ubuntu-latest
3437

@@ -80,6 +83,9 @@ jobs:
8083
- name: Run tests
8184
run: npm test
8285

86+
- name: Run demo tests
87+
run: npm run test:demo-projects
88+
8389
test-bundle-size:
8490
runs-on: ubuntu-latest
8591

.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.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
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-test-env": "npm run install:browser && npm run install:bundle"
1212
},
1313
"author": "",
1414
"license": "ISC",

test/output-integration/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "vitest --run"
88
},
99
"author": "",
1010
"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)