├── .appcast.xml ├── .gitignore ├── LICENSE ├── README.md ├── assets └── icon.png ├── package-lock.json ├── package.json └── src ├── manifest.json └── my-command.js /.appcast.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build artifacts 2 | install-library-bundle.sketchplugin 3 | 4 | # npm 5 | node_modules 6 | .npm 7 | npm-debug.log 8 | 9 | # mac 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ale Muñoz 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Install Library Bundle 2 | 3 | If you've ever built a complex Design System in Sketch, chances are you've had to split your system into a few Libraries. If you then want to share them with your team, you have to send around a bunch of links, and ask people to click them, and everything is a mess. 4 | 5 | With this plugin, you'll still need to send a bunch of links, but at least you only have to click once to run it and have all the Libraries installed at once. 6 | 7 | The plugin accepts RSS links (for self-hosted Libraries) and Sketch Cloud links (for Libraries shared using Sketch Cloud) 8 | 9 | ## Installation 10 | 11 | - Download [the latest version](https://github.com/bomberstudios/install-library-bundle/releases/latest/download/install-library-bundle.sketchplugin.zip) and double click it to install it 12 | 13 | ## Sample Libraries 14 | 15 | If you want to try the plugin, but don't have any Shared Libraries at hand, try pasting this into the plugin's input to install a few of the Libraries we list at https://sketch.com/libraries/: 16 | 17 | ``` 18 | https://sketch.cloud/s/MyY5w, https://sketch.cloud/s/8wEvw, https://sketch.cloud/s/Oo3Pm 19 | ``` -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bomberstudios/install-library-bundle/beb6ffcd443d2b72ceb9fa6adc9aa84764769baa/assets/icon.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "install-library-bundle", 3 | "description": "Installs a bunch of shared Sketch Libraries at once, because life is too short for clicking links.", 4 | "version": "1.0.0", 5 | "engines": { 6 | "sketch": ">=49.0" 7 | }, 8 | "skpm": { 9 | "name": "Install Library Bundle", 10 | "manifest": "src/manifest.json", 11 | "main": "install-library-bundle.sketchplugin", 12 | "assets": [ 13 | "assets/**/*" 14 | ] 15 | }, 16 | "scripts": { 17 | "build": "skpm-build", 18 | "watch": "skpm-build --watch", 19 | "start": "skpm-build --watch --run", 20 | "postinstall": "npm run build && skpm-link" 21 | }, 22 | "devDependencies": { 23 | "@skpm/builder": "^0.7.7", 24 | "serialize-javascript": "^3.1.0" 25 | }, 26 | "author": "Ale Muñoz ", 27 | "repository": "https://github.com/bomberstudios/install-library-bundle.git" 28 | } 29 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "compatibleVersion": 3, 3 | "bundleVersion": 1, 4 | "icon": "icon.png", 5 | "commands": [ 6 | { 7 | "name": "Install Library Bundle…", 8 | "identifier": "install-library-bundle.my-command-identifier", 9 | "script": "./my-command.js" 10 | } 11 | ], 12 | "menu": { 13 | "title": "install-library-bundle", 14 | "isRoot": true, 15 | "items": [ 16 | "install-library-bundle.my-command-identifier" 17 | ] 18 | } 19 | } -------------------------------------------------------------------------------- /src/my-command.js: -------------------------------------------------------------------------------- 1 | import sketch from 'sketch' 2 | const Library = sketch.Library 3 | const UI = sketch.UI 4 | 5 | // documentation: https://developer.sketchapp.com/reference/api/ 6 | 7 | export default function() { 8 | UI.getInputFromUser( 9 | 'URLs for Libraries', 10 | { 11 | description: 'Comma-separated list of RSS or Sketch Cloud links', 12 | initialValue: 'https://…', 13 | }, 14 | (err, value) => { 15 | if (err) { 16 | // most likely the user canceled the input 17 | return 18 | } else { 19 | parseInput(value) 20 | } 21 | } 22 | ) 23 | // var feeds = [ 24 | // 'https://foobar.com/feed1.xml', 25 | // 'https://foobar.com/feed2.xml', 26 | // 'https://foobar.com/feed3.xml' 27 | // ] 28 | // 29 | 30 | } 31 | 32 | function parseInput(urlList){ 33 | var feeds = urlList.split(',') 34 | feeds.forEach(rss => { 35 | // Trim whitespace, just in case there were spaces around the commas 36 | rss = rss.trim() 37 | // Extract RSS link from Cloud links 38 | if (rss.indexOf('https://sketch.cloud') != -1) { 39 | // This is a Cloud share, grab the RSS link for it 40 | rss = rss.replace('https://sketch.cloud/s/','https://client.sketch.cloud/v1/shares/') + '/rss' 41 | } 42 | UI.message(`Downloading Library…`) 43 | var lib = Library.getRemoteLibraryWithRSS(rss, (err, library) => { 44 | if (err) { 45 | UI.message(`Error downloading ${rss}`) 46 | } else { 47 | UI.message(`${library.name} installed`) 48 | } 49 | }) 50 | }) 51 | } --------------------------------------------------------------------------------