{"id":3488,"date":"2016-03-22T12:47:21","date_gmt":"2016-03-22T12:47:21","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3488"},"modified":"2016-03-22T12:47:21","modified_gmt":"2016-03-22T12:47:21","slug":"show-current-version-author-dependencies-node-script","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/show-current-version-author-dependencies-node-script\/","title":{"rendered":"Show the current version, author, and dependencies for a node script"},"content":{"rendered":"<p>It&#8217;s often useful to have an application know about itself: you can use the current version to identify data for required for migrations, expose a list of libraries you use for debugging purposes, or create screens that show end users license and author information for your application.<\/p>\n<p>In a node script, you can pull this information by importing your own package.json:<\/p>\n<pre lang=\"javascript\">\nlet me = require('.\/package.json');\nlet version = me.version,\n    author = me.author,\n    dependencies = me.dependencies;\n<\/pre>\n<p>This is an example output:<\/p>\n<pre lang=\"javascript\">\nGary Sieling\n1.0.0\n{ async: '^2.0.0-rc.1',\n  bluebird: '^3.3.4',\n  dropzone: '^4.3.0',\n  'eventsource-polyfill': '^0.9.6',\n  express: '^4.13.4',\n  'express-http-proxy': '^0.6.0',\n  jquery: '^2.2.1',\n  jsx: '^0.9.89',\n  lodash: '^4.5.1',\n  morgan: '^1.7.0',\n  react: '^0.14.7',\n  'react-bootstrap': '^0.28.3',\n  'react-dom': '^0.14.7',\n  'react-router': '^2.0.0',\n  request: '^2.69.0',\n  'request-promise': '^2.0.1',\n  webpack: '^1.8.11',\n  'webpack-dev-middleware': '*',\n  'webpack-hot-middleware': '^2.7.1' }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s often useful to have an application know about itself: you can use the current version to identify data for required for migrations, expose a list of libraries you use for debugging purposes, or create screens that show end users license and author information for your application. In a node script, you can pull this &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/show-current-version-author-dependencies-node-script\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Show the current version, author, and dependencies for a node script&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[302,387,388,389],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3488"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3488"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3488\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}