Skip to content

Commit 428edff

Browse files
Merge pull request #59 from davidmyersdev/setup-ci
Setup CI
2 parents 5fb8f7e + 0631ec6 commit 428edff

File tree

17 files changed

+1981
-190
lines changed

17 files changed

+1981
-190
lines changed

.eslintrc.cjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
extends: [
3+
'artisan',
4+
],
5+
overrides: [
6+
{
7+
files: [
8+
'./.github/**/*.yml',
9+
],
10+
rules: {
11+
'yml/no-empty-mapping-value': 'off',
12+
},
13+
},
14+
],
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Install dependencies
2+
description: Install and cache dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: actions/checkout@v3
7+
- uses: actions/setup-node@v3
8+
with:
9+
node-version: 18
10+
- uses: pnpm/[email protected]
11+
with:
12+
run_install: false
13+
version: 8
14+
- name: Get the pnpm store directory
15+
shell: bash
16+
run: |
17+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
18+
- name: Setup the pnpm cache
19+
uses: actions/cache@v3
20+
with:
21+
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
22+
path: |
23+
${{ env.STORE_PATH }}
24+
restore-keys: v1-${{ runner.os }}-pnpm-store-
25+
- name: Install dependencies
26+
shell: bash
27+
run: pnpm install

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
install-dependencies:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: ./.github/actions/install-dependencies
13+
lint:
14+
needs:
15+
- install-dependencies
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: ./.github/actions/install-dependencies
20+
- name: Run the linter
21+
run: pnpm lint
22+
test-unit:
23+
needs:
24+
- install-dependencies
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: ./.github/actions/install-dependencies
29+
- run: pnpm build:core
30+
- run: pnpm build:shims
31+
- run: pnpm build:shims:banner
32+
- run: pnpm test
33+
typecheck:
34+
needs:
35+
- install-dependencies
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: ./.github/actions/install-dependencies
40+
- run: pnpm build:core
41+
- run: pnpm build:shims
42+
- run: pnpm build:shims:banner
43+
- run: pnpm typecheck

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default defineConfig({
5555
plugins: [
5656
nodePolyfills({
5757
// To add only specific polyfills, add them here. If no option is passed, adds all polyfills
58-
include: ['path']
58+
include: ['path'],
5959
// To exclude specific polyfills, add them to this list. Note: if include is provided, this has no effect
6060
exclude: [
6161
'http', // Excludes the polyfill for `http` and `node:http`.
@@ -80,8 +80,10 @@ export default defineConfig({
8080

8181
### All polyfills
8282

83-
- If protocolImports is true, also adds node:[module]
83+
- If protocolImports is true, also adds node:[module]
84+
8485
```js
86+
[
8587
'_stream_duplex',
8688
'_stream_passthrough',
8789
'_stream_readable',
@@ -122,4 +124,5 @@ export default defineConfig({
122124
'util',
123125
'vm',
124126
'zlib',
127+
]
125128
```

examples/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"private": true,
32
"type": "module",
3+
"private": true,
44
"scripts": {
55
"build": "vite build",
66
"dev": "vite",

examples/react/src/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function App() {
1919
</button>
2020
</p>
2121
<p>
22+
{/* eslint-disable-next-line n/prefer-global/buffer */}
2223
The following text is encoded and decoded with Buffer: {Buffer.from('Hello!').toString()}
2324
</p>
2425
</div>
@@ -32,6 +33,6 @@ export const app = () => {
3233
<App />
3334
<ReactQueryDevtools initialIsOpen={true} />
3435
</QueryClientProvider>
35-
</React.StrictMode>
36+
</React.StrictMode>,
3637
)
3738
}

examples/vanilla/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"private": true,
32
"type": "module",
3+
"private": true,
44
"scripts": {
55
"build": "vite build",
66
"dev": "vite",

examples/vanilla/src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
/* eslint-disable no-console */
12
import { Buffer } from 'node:buffer'
23
import { resolve } from 'node:path'
34
import * as process from 'node:process'
4-
import fs from 'fs'
5-
import { readFileSync } from 'node:fs'
5+
import fs, { readFileSync } from 'node:fs'
66
import { cloneDeep } from 'lodash-es'
77
import { fetch } from 'ohmyfetch'
88

@@ -22,7 +22,7 @@ console.log(resolve('.'))
2222
console.log(process)
2323
console.log(process.env)
2424
console.log(globalThis.Array)
25-
console.log(Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]).readBigUInt64BE(0))
25+
console.log(Buffer.from([0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]).readBigUInt64BE(0))
2626
console.log(Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]))
2727
console.log(Array)
2828
console.log(readFileSync('./test.txt', 'utf-8'))

examples/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"private": true,
32
"type": "module",
3+
"private": true,
44
"scripts": {
55
"build": "vite build",
66
"dev": "vite",

examples/vue/src/app.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineComponent, ref } from 'vue'
33
44
export default defineComponent({
55
setup() {
6+
// eslint-disable-next-line n/prefer-global/buffer
67
const msg = ref(Buffer.from(Buffer.from('Hello, friend!').toString('base64'), 'base64').toString('ascii'))
78
89
return {

0 commit comments

Comments
 (0)