├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── cli.js ├── index.js ├── license ├── package.json ├── readme.md └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{package.json,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: objective-c 3 | before_install: 4 | - brew update 5 | - brew unlink node 6 | install: brew install node 7 | script: 8 | - npm install 9 | - npm test 10 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const meow = require('meow'); 4 | const macosModel = require('./'); 5 | 6 | meow({ 7 | help: [ 8 | 'Example', 9 | ' $ macos-model', 10 | ' MacBook Pro (Retina, 15-inch, Mid 2014)' 11 | ] 12 | }); 13 | 14 | macosModel().then(console.log); 15 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const osxInfo = require('osx-info'); 3 | 4 | module.exports = () => osxInfo().then(data => data.name); 5 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Kevin Martensson (github.com/kevva) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "macos-model", 3 | "version": "1.0.2", 4 | "description": "Get your Mac model", 5 | "license": "MIT", 6 | "repository": "kevva/macos-model", 7 | "author": { 8 | "name": "Kevin Martensson", 9 | "email": "kevinmartensson@gmail.com", 10 | "url": "github.com/kevva" 11 | }, 12 | "engines": { 13 | "node": ">=4" 14 | }, 15 | "bin": "cli.js", 16 | "scripts": { 17 | "test": "xo && ava" 18 | }, 19 | "files": [ 20 | "cli.js", 21 | "index.js" 22 | ], 23 | "keywords": [ 24 | "app", 25 | "cli", 26 | "cli-app", 27 | "info", 28 | "mac", 29 | "macos", 30 | "model", 31 | "osx" 32 | ], 33 | "dependencies": { 34 | "meow": "^3.3.0", 35 | "osx-info": "^1.0.0" 36 | }, 37 | "devDependencies": { 38 | "ava": "*", 39 | "xo": "*" 40 | }, 41 | "xo": { 42 | "esnext": true 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # macos-model [![Build Status](https://travis-ci.org/kevva/macos-model.svg?branch=master)](https://travis-ci.org/kevva/macos-model) 2 | 3 | > Get your Mac model 4 | 5 | 6 | ## Install 7 | 8 | ``` 9 | $ npm install --save macos-model 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ```js 16 | const macosModel = require('macos-model'); 17 | 18 | macosModel().then(model => { 19 | console.log(model); 20 | //=> 'MacBook Pro (Retina, 15-inch, Mid 2014)' 21 | }); 22 | ``` 23 | 24 | 25 | ## CLI 26 | 27 | ``` 28 | $ npm install --global macos-model 29 | ``` 30 | 31 | ``` 32 | $ macos-model --help 33 | 34 | Example 35 | $ macos-model 36 | MacBook Pro (Retina, 15-inch, Mid 2014) 37 | ``` 38 | 39 | 40 | ## Related 41 | 42 | * [osx-info](https://github.com/gillstrom/osx-info) - Get info about your Mac 43 | 44 | 45 | ## License 46 | 47 | MIT © [Kevin Martensson](http://github.com/kevva) 48 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import fn from './'; 3 | 4 | test(async t => t.is(typeof await fn(), 'string')); 5 | --------------------------------------------------------------------------------