Skip to content

Commit

Permalink
Switch to Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Nov 28, 2024
1 parent b2e0d50 commit ebbe43e
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 96 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
128 changes: 64 additions & 64 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,74 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-22.04
platform: linux
arch: x64
- os: ubuntu-22.04-arm64
platform: linux
arch: arm64
- os: ubuntu-22.04
platform: android
arch: x64
- os: ubuntu-22.04
platform: android
arch: ia32
- os: ubuntu-22.04
platform: android
arch: arm64
- os: ubuntu-22.04
platform: android
arch: arm
- os: macos-14
platform: darwin
arch: x64
- os: macos-14
platform: darwin
arch: arm64
- os: macos-14
platform: ios
arch: arm64
- os: macos-14
platform: ios
arch: arm64
tags: -simulator
flags: --simulator
- os: macos-14
platform: ios
arch: x64
tags: -simulator
flags: --simulator
- os: windows-2022
platform: win32
arch: x64
- os: windows-2022
platform: win32
arch: arm64
- os: ubuntu-22.04
platform: linux
arch: x64
- os: ubuntu-22.04-arm64
platform: linux
arch: arm64
- os: ubuntu-22.04
platform: android
arch: x64
- os: ubuntu-22.04
platform: android
arch: ia32
- os: ubuntu-22.04
platform: android
arch: arm64
- os: ubuntu-22.04
platform: android
arch: arm
- os: macos-14
platform: darwin
arch: x64
- os: macos-14
platform: darwin
arch: arm64
- os: macos-14
platform: ios
arch: arm64
- os: macos-14
platform: ios
arch: arm64
tags: -simulator
flags: --simulator
- os: macos-14
platform: ios
arch: x64
tags: -simulator
flags: --simulator
- os: windows-2022
platform: win32
arch: x64
- os: windows-2022
platform: win32
arch: arm64
runs-on: ${{ matrix.os }}
name: ${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.tags }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} ${{ matrix.flags }}
- run: bare-make build
- run: bare-make install
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.tags }}
path: prebuilds/*
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} ${{ matrix.flags }}
- run: bare-make build
- run: bare-make install
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}${{ matrix.tags }}
path: prebuilds/*
merge:
runs-on: ubuntu-latest
needs: prebuild
steps:
- uses: actions/download-artifact@v4
with:
path: prebuilds
merge-multiple: true
- uses: actions/upload-artifact@v4
with:
name: prebuilds
path: prebuilds
- uses: actions/download-artifact@v4
with:
path: prebuilds
merge-multiple: true
- uses: actions/upload-artifact@v4
with:
name: prebuilds
path: prebuilds
38 changes: 19 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
- os: macos-latest
platform: darwin
arch: arm64
- os: windows-latest
platform: win32
arch: x64
- os: ubuntu-latest
platform: linux
arch: x64
- os: macos-latest
platform: darwin
arch: arm64
- os: windows-latest
platform: win32
arch: x64
runs-on: ${{ matrix.os }}
name: ${{ matrix.platform }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} --debug
- run: bare-make build
- run: bare-make install
- run: npm test
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} --debug
- run: bare-make build
- run: bare-make install
- run: npm test
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"prettier-config-standard"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Options include:
filename: '<anonymous>',
offset: 0
}
````
```

## License

Expand Down
11 changes: 4 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@ const binding = require('./binding')
const errors = require('./lib/errors')

module.exports = class Realm {
constructor () {
constructor() {
this._handle = binding.create()
}

destroy () {
destroy() {
if (this._handle === null) return

binding.destroy(this._handle)

this._handle = null
}

evaluate (code, opts = {}) {
evaluate(code, opts = {}) {
if (this._handle === null) throw errors.REALM_DESTROYED()

const {
filename = '<anonymous>',
offset = 0
} = opts
const { filename = '<anonymous>', offset = 0 } = opts

return binding.evaluate(this._handle, code, filename, offset)
}
Expand Down
6 changes: 3 additions & 3 deletions lib/errors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = class RealmError extends Error {
constructor (msg, code, fn = RealmError) {
constructor(msg, code, fn = RealmError) {
super(`${code}: ${msg}`)
this.code = code

Expand All @@ -8,11 +8,11 @@ module.exports = class RealmError extends Error {
}
}

get name () {
get name() {
return 'RealmError'
}

static REALM_DESTROYED (msg = 'Realm has been destroyed') {
static REALM_DESTROYED(msg = 'Realm has been destroyed') {
return new RealmError(msg, 'REALM_DESTROYED', RealmError.REALM_DESTROYED)
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"addon": true,
"scripts": {
"test": "standard && bare test.js"
"test": "prettier . --check && bare test.js"
},
"repository": {
"type": "git",
Expand All @@ -35,6 +35,7 @@
"devDependencies": {
"brittle": "^3.3.2",
"cmake-bare": "^1.1.7",
"standard": "^17.0.0"
"prettier": "^3.4.1",
"prettier-config-standard": "^7.0.0"
}
}

0 comments on commit ebbe43e

Please sign in to comment.