Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: test release
# https://github.com/product-os/flowzone/tree/master/.github/actions
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true

# --- custom environment
NODE_VERSION:
type: string
default: "18.x"
VERBOSE:
type: string
default: "true"

runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm

- name: Test release on windows
if: runner.os == 'Windows'
shell: pwsh
run: |
npm ci
npm run build
npm run test

- name: Test release on mac
if: runner.os != 'Windows'
shell: bash
run: |
npm ci
npm run build
npm run test
33 changes: 33 additions & 0 deletions .github/workflows/flowzone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Flowzone

on:
pull_request:
types: [opened, synchronize, closed]
branches: [main, master]
# allow external contributions to use secrets within trusted code
pull_request_target:
types: [opened, synchronize, closed]
branches: [main, master]

jobs:
flowzone:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this needs some changes to continue testing on mac/windows, cc @klutchell ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Page- Flowzone still doesn't support npm tests on macos or windows, it hasn't really been a priority. It needs to be done via custom actions like we did here:

https://github.com/balena-io-modules/winusb-driver-generator/blob/master/.github/workflows/flowzone.yml
https://github.com/balena-io-modules/winusb-driver-generator/blob/master/.github/actions/test/action.yml

I would like to add multiple OS support to npm checks in Flowzone, but it complicates our testing matrix quite a bit and I don't want to slow down the pre-checks. We can open a research/project if it's worth looking into further.

name: Flowzone
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
# prevent duplicate workflow executions for pull_request and pull_request_target
if: |
(
github.event.pull_request.head.repo.full_name == github.repository &&
github.event_name == 'pull_request'
) || (
github.event.pull_request.head.repo.full_name != github.repository &&
github.event_name == 'pull_request_target'
)

# Workflows in the same org or enterprise can use the inherit keyword to implicitly pass secrets
secrets: inherit
with:
custom_test_matrix: >
{
"os": [["windows-latest"], ["macos-latest"]]
}
restrict_custom_actions: false
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

53 changes: 24 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,78 @@
mountutils
==========
# mountutils

[![npm](https://img.shields.io/npm/v/mountutils.svg?style=flat-square)](https://npmjs.com/package/mountutils)
[![npm license](https://img.shields.io/npm/l/mountutils.svg?style=flat-square)](https://npmjs.com/package/mountutils)
[![npm downloads](https://img.shields.io/npm/dm/mountutils.svg?style=flat-square)](https://npmjs.com/package/mountutils)
[![Travis CI status](https://img.shields.io/travis/resin-io-modules/mountutils/master.svg?style=flat-square&label=linux%20|%20mac)](https://travis-ci.org/resin-io-modules/mountutils/branches)
[![AppVeyor status](https://img.shields.io/appveyor/ci/resin-io/mountutils/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/resin-io/mountutils/branch/master)

> Cross platform mount related utilities

Installation
------------
## Installation

Install `mountutils` by running:

```sh
$ npm install --save mountutils
```

Debug mode
----------
## Prebuild

This project contains cross-platform prebuild for node 18.18.2 and 20.5.1.

## Debug mode

You can enable debug mode by setting the `MOUNTUTILS_DEBUG` environment
variable.

Documentation
-------------
## Documentation

<a name="module_mountutils.unmountDisk"></a>

### mountutils.unmountDisk(device, callback)

**Kind**: static method of <code>[mountutils](#module_mountutils)</code>
**Summary**: Unmount a whole disk
**Access**: public
**Access**: public

| Param | Type | Description |
| --- | --- | --- |
| device | <code>String</code> | device |
| Param | Type | Description |
| -------- | --------------------- | ---------------- |
| device | <code>String</code> | device |
| callback | <code>function</code> | callback (error) |

**Example**
**Example**

```js
// macOS
const drive = '/dev/disk2';
const drive = "/dev/disk2";

// GNU/Linux
const drive = '/dev/sdb';
const drive = "/dev/sdb";

// Windows
const drive = '\\\\.\\PHYSICALDRIVE2';
const drive = "\\\\.\\PHYSICALDRIVE2";

mountutils.unmountDisk(drive, (error) => {
if (error) {
throw error;
}

console.log('Done!');
console.log("Done!");
});
```

Support
-------
## Support

If you're having any problem, please [raise an issue][newissue] on GitHub and
the Resin.io team will be happy to help.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth updating this to say Balena instead of Resin.io 😆

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do in another PR


Tests
-----
## Tests

Run the test suite by doing:

```sh
$ npm test
```

Troubleshooting
---------------
## Troubleshooting

### `error C2373: '__pfnDliNotifyHook2': redefinition`

Expand All @@ -88,8 +85,7 @@ npm install -g npm@latest

See the [following `node-gyp` issue](https://github.com/nodejs/node-gyp/issues/972) for more details.

Contribute
----------
## Contribute

- Issue Tracker: [github.com/resin-io-modules/mountutils/issues][issues]
- Source Code: [github.com/resin-io-modules/mountutils][source]
Comment on lines 90 to 91
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I guess these URLs need updating too!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Expand All @@ -105,8 +101,7 @@ linters run without any warning:
$ npm run lint
```

License
-------
## License

The project is licensed under the Apache 2.0 license.

Expand Down
40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

3 changes: 3 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@
],
}
],
'variables' : {
'openssl_fips': '',
},
}
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @module mountutils
*/

'use strict';
"use strict";

/**
* @summary Unmount a whole disk
Expand Down Expand Up @@ -49,9 +49,8 @@
* });
*/

module.exports = require('bindings')({
bindings: 'MountUtils',
/* eslint-disable camelcase */
module_root: __dirname
/* eslint-enable camelcase */
});
// Will load a compiled build if present or a prebuild.
// If no build if found it will throw an exception
const binding = require('node-gyp-build')(__dirname);

module.exports = binding;
Loading