Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

user-startup

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

user-startup - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

9

lib/startup/darwin.js

@@ -7,2 +7,3 @@ 'use strict';

exports.getFile = getFile;
exports.add = add;
exports.create = create;

@@ -20,6 +21,6 @@ exports.remove = remove;

function getFile(name) {
return '' + dir + '/' + name + '.plist';
return dir + '/' + name + '.plist';
}
function create(name, cmd, args, out) {
function add(name, cmd, args, out) {
var array = [cmd].concat(args).map(function (a) {

@@ -35,3 +36,7 @@ return ' <string>' + a + '</string>';

fs.writeFileSync(file, data);
return file;
}
function create(name, cmd, args, out) {
var file = add(name, cmd, args, out);
cp.execSync('launchctl load ' + file);

@@ -38,0 +43,0 @@ }

@@ -7,2 +7,3 @@ 'use strict';

exports.getFile = getFile;
exports.add = add;
exports.create = create;

@@ -27,6 +28,6 @@ exports.remove = remove;

function getFile(name) {
return '' + dir + '/' + name + '.desktop';
return dir + '/' + name + '.desktop';
}
function create(name, cmd, args, out) {
function add(name, cmd, args, out) {
var file = getFile(name);

@@ -38,3 +39,7 @@

fs.writeFileSync(file, data);
return file;
}
function create(name, cmd, args, out) {
add(name, cmd, args, out);
spawn(cmd, args, out);

@@ -41,0 +46,0 @@ }

@@ -7,2 +7,3 @@ 'use strict';

exports.getFile = getFile;
exports.add = add;
exports.create = create;

@@ -20,6 +21,6 @@ exports.remove = remove;

function getFile(name) {
return '' + dir + '\\' + name + '.vbs';
return dir + '\\' + name + '.vbs';
}
function create(name, cmd, args, out) {
function add(name, cmd, args, out) {
var file = getFile(name);

@@ -39,3 +40,8 @@

fs.writeFileSync(file, data);
return file;
}
function create(name, cmd, args, out) {
var file = add(name, cmd, args, out);
// Spawn vbscript

@@ -42,0 +48,0 @@ cp.spawn('cmd', ['/c', file], {

{
"name": "user-startup",
"version": "0.1.1",
"version": "0.2.0",
"description": "Automatically run commands when the user logs in (cross-platform)",

@@ -9,3 +9,3 @@ "main": "lib/index.js",

"build": "babel src --out-dir lib",
"test": "babel-node test"
"test": "standard && babel-node test"
},

@@ -32,3 +32,4 @@ "repository": {

"devDependencies": {
"babel": "^5.8.3"
"babel": "^5.8.3",
"standard": "^5.3.1"
},

@@ -35,0 +36,0 @@ "dependencies": {

# user-startup [![Build Status](https://travis-ci.org/typicode/user-startup.svg)](https://travis-ci.org/typicode/user-startup) [![npm version](https://badge.fury.io/js/user-startup.svg)](https://www.npmjs.com/package/user-startup)
> Automatically run commands when you log in. Used in [hotel](https://github.com/typicode/hotel).
> Automatically run commands when you log in. Used in [hotel](https://github.com/typicode/hotel) and [stop-server](https://github.com/typicode/stop-server).

@@ -23,16 +23,25 @@ * Cross-platform (OS X, Linux and Windows)

startup.create('app', nodePath, args, out)
startup.remove('app')
// Create startup script and spawn process
startup.create('my-script', nodePath, args, out)
// Remove startup script
startup.remove('my-script')
```
Note: you should check that root isn't running this code to avoid startup scripts being created in root's home directory. Use [sudo-block](https://github.com/sindresorhus/sudo-block), [is-root](https://github.com/sindresorhus/is-root) or similar modules.
## API
`create(id, cmd, args, out)`
`add(id, cmd, args, out)`
Creates a startup script and spawns process.
Creates startup script.
`remove(id)`
Removes startup script but doesn't stop process.
Removes startup script.
`create(id, cmd, args, out)`
Creates a startup script and spawns process.
`dir`

@@ -46,4 +55,10 @@

## How it works
* On OS X, it creates a `plist` file in `~/Library/LaunchAgents`
* On Linux, it creates a `desktop` file in `~/.config/autostart`
* On Windows, it creates a `vbs` script in `AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup`
## License
MIT - [Typicode](https://github.com/typicode)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc