Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Sep 19, 2018
0 parents commit 68c9e42
Show file tree
Hide file tree
Showing 10 changed files with 1,986 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
name: Restore npm Package Data Cache
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install Node dependencies
command: npm install
- save_cache:
name: Cache npm Package Data
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Run Tests
command: npm run test
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[*]
charset = utf-8

[*.{js,json,ts,yml}]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,ts}]
block_comment_start = /*
block_comment = *
block_comment_end = */

[*.md]
trim_trailing_whitespace = false

[*.nlf]
insert_final_newline = false
trim_trailing_whitespace = false
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# dependencies
bower_components/
node_modules/
vendor/

# package manager files
npm-debug.log*
yarn-error.log

# project specific
test.js
test.ts
todo.md
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Folders
.circleci/
.editorconfig
src/
test/
types/

# Files
.gitignore
.travis.yml
gulpfile.js
tsconfig.json
tslint.json
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# exec-appx

[![npm](https://flat.badgen.net/npm/license/exec-appx)](https://www.npmjs.org/package/exec-appx)
[![npm](https://flat.badgen.net/npm/v/exec-appx)](https://www.npmjs.org/package/exec-appx)
[![CircleCI](https://flat.badgen.net/circleci/github/idleberg/node-exec-appx)](https://circleci.com/gh/idleberg/node-exec-appx)
[![David](https://flat.badgen.net/david/dev/idleberg/node-exec-appx)](https://david-dm.org/idleberg/node-exec-appx?type=dev)

Executes a Windows Store app (Appx)

## Prerequisites

This library requires PowerShell and a Windows version with support for Windows Store apps

## Installation

`yarn add exec-appx || npm install exec-appx`

## Usage

`execAppx(appID: string, args: Array, options: Object)`

Example usage in script:

```js
const execAppx = require('exec-appx');

// Application ID
const appID = 'SpotifyAB.SpotifyMusic';

(async () => {
let pkg = await execAppx(appID);
})();

```

### Options

See [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) documentation for details

## License

This work is licensed under [The MIT License](https://opensource.org/licenses/MIT)

## Donate

You are welcome to support this project using [Flattr](https://flattr.com/submit/auto?user_id=idleberg&url=https://github.com/idleberg/node-exec-appx) or Bitcoin `17CXJuPsmhuTzFV2k4RKYwpEHVjskJktRd`
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const getAppxPath = require('get-appx-path');
const { platform } = require('os');
const { promisify } = require('util');
const { spawn } = require('child_process');

const spawnAsync = promisify(spawn);

module.exports = (appID, args = [], options = {}) => {
if (platform() !== 'win32') {
throw 'Error: Not a Windows operating system';
}

options = Object.assign({
detached: true
}, options);

return getAppxPath(appID).then(appx => {
return spawnAsync(appx.path, args, options);
});
};
Loading

0 comments on commit 68c9e42

Please sign in to comment.