{"id":13725330,"url":"https://github.com/hzoo/twpm","last_synced_at":"2025-03-21T10:31:56.415Z","repository":{"id":57383017,"uuid":"54805006","full_name":"hzoo/twpm","owner":"hzoo","description":":bird: twitter package manager: npx twpm install 712799807073419264 --save left-pad ","archived":false,"fork":false,"pushed_at":"2017-11-08T23:44:39.000Z","size":237,"stargazers_count":44,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T00:35:44.671Z","etag":null,"topics":["flavortown","twpm"],"latest_commit_sha":null,"homepage":"https://gist.github.com/rauchg/5b032c2c2166e4e36713","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hzoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-27T00:01:24.000Z","updated_at":"2023-09-08T17:08:35.000Z","dependencies_parsed_at":"2022-09-26T19:52:33.936Z","dependency_job_id":null,"html_url":"https://github.com/hzoo/twpm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzoo%2Ftwpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzoo%2Ftwpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzoo%2Ftwpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzoo%2Ftwpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hzoo","download_url":"https://codeload.github.com/hzoo/twpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244777942,"owners_count":20508818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flavortown","twpm"],"created_at":"2024-08-03T01:02:19.658Z","updated_at":"2025-03-21T10:31:55.989Z","avatar_url":"https://github.com/hzoo.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## twpm (twitter package manager) [![](https://img.shields.io/npm/v/twpm.svg?style=flat-square)](https://www.npmjs.com/package/twpm) [![](https://img.shields.io/travis/hzoo/twpm/master.svg?style=flat-square)](https://travis-ci.org/hzoo/twpm)\n\n\u003e https://gist.github.com/rauchg/5b032c2c2166e4e36713#gistcomment-1732501\n\n[![](twpm.gif)](https://twitter.com/rauchg/status/712799807073419264)\n\n### Install\n\n\u003e Check out the [setup](#setup) info (need twitter credentials)\n\n```bash\nnpm i twpm -g\n\n# use npx for one-off command\nnpx twpm install\n```\n\n#### Installing \"packages\"\n\n```bash\ntwpm install https://twitter.com/rauchg/status/712799807073419264 --save left-pad\n```\n\n### Usage (in code)\n\n\u003e The default package folder/require prefix is `@twpm/`\n\n```js\n// usage for `twpm install 712799807073419264 --save left-pad`\nconst leftPad = require(\"@twpm/left-pad\");\nleftPad(1, 5) // \"00001\"\n```\n\n### Setup (2 ways)\n\n### Environment Variables\n\nYou need to add `TWITTER_CONSUMER_KEY` and `TWITTER_CONSUMER_SECRET` environment variables when running twpm\n\n### Config file (`./twitter-config.js`)\n\nCreate a config file at the root of your git repo.\n\n\u003e You can create a Twitter app to get keys at https://apps.twitter.com.\n\n```js\nmodule.exports = {\n  \"consumer_key\": \"\",\n  \"consumer_secret\": \"\",\n  \"app_only_auth\": true,\n};\n```\n\n### Commands\n\n#### Install\n\n```bash\n# will install to node_modules/@twpm/712799807073419264\ntwpm install 712799807073419264\n\n# will install to node_modules/@twpm/712799807073419264\ntwpm install https://twitter.com/rauchg/status/712799807073419264\n\n`twpm install` creates a `index.js` with transpiled source and a `package.json` with metadata (including the original source).\n\n# Will install to node_modules/@twpm/left-pad\ntwpm install 712799807073419264 --save left-pad\n\n# install everything under `twpm.dependencies` in `package.json`\ntwpm install\n\n# shorthand\ntwpm i\n```\n\n#### Search\n\nYou can search through tweets that are hashtagged with `#twpm` and install them\n\n```js\n# get some random ones\ntwpm search\n# specific keyword search\ntwpm search left-pad\n```\n\n### Tweets\n\nSince twpm will be transpiling the code, twpm will strip out the first line if the tweet is multiline and contains the hashtag `#twpm`.\n\n#### Tweet\n\n```js\n@_henryzhu //#twpm:left-pad\nexport default (v, n, c = '0') =\u003e String(v).length \u003e= n ? '' + v : (String(c).repeat(n) + v).slice(-n);\n```\n\n#### Extracted Code\n\n```js\n// Input to be transpiled (just the function. otherwise an error will occur with decorators)\nexport default (v, n, c = '0') =\u003e String(v).length \u003e= n ? '' + v : (String(c).repeat(n) + v).slice(-n);\n```\n\nCurrently you will need to use a `export default function() {}` or `export default () =\u003e {}` in your tweet.\n\n### Config: `twpm` key in `package.json`\n\n```js\n{\n  \"name\": \"your-app-here\",\n  \"twpm\": {\n    \"modulesLocation\": \"node_modules\", // default folder\n    \"folderPrefix\": \"@twpm/\", // default prefix\n    \"packageMetadata\": [\n      \"name\",\n      \"text\",\n      \"screen_name\",\n      \"id_str\",\n      \"retweet_count\",\n      \"favorite_count\",\n      \"created_at\",\n      \"user\"\n    ] // default fields to take from twitter status\n    \"dependencies\": {\n      \"@twpm/left-pad\": \"712799807073419264\"\n      \"@twpm/sort\": \"713782217646931968\"\n    }\n  }\n}\n```\n\n### Example\n\n![left-pad](left-pad.png)\n\n```bash\n# twpm i 712799807073419264 --save left-pad\ntwpm-left-pad@0.0.0 /Users/hzoo/twpm-test\n\nTweet 712799807073419264: 359 🔄, 632 💟\n@rauchg at Thu Mar 24 00:34:51 +0000 2016\n===\n// ES6 leftPad\nexport default (v, n, c = '0') =\u003e String(v).length \u003e= n ? '' + v : (String(c).repeat(n) + v).slice(-n);\n---\n```\n\n```\n- twpm-test\n  - node_modules\n    - @twpm\n      - left-pad\n        - index.js # transpiled index.js\n        - package.json # reformatted twitter data + name field\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzoo%2Ftwpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhzoo%2Ftwpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzoo%2Ftwpm/lists"}