{"_id":"@altostack/spekulate","_rev":"3-2e3e5622e09cef9c2e4d8353b82fb5de","name":"@altostack/spekulate","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.0":{"name":"@altostack/spekulate","version":"2.0.0","description":"Automatically generates an RPM Spec file for your Node.js project","main":"index.js","scripts":{"test":"mocha","lint":"eslint .","posttest":"npm run lint","coverage":"istanbul cover _mocha -- -R dot"},"repository":{"type":"git","url":"git+https://github.com/bbc/speculate.git"},"keywords":["spec","rpm","file","node","generate"],"author":{"name":"ibl-team@lists.forge.bbc.co.uk"},"license":"Apache-2.0","bugs":{"url":"https://github.com/bbc/speculate/issues"},"homepage":"https://github.com/bbc/speculate#readme","bin":{"spekulate":"./bin/spekulate.js"},"dependencies":{"commander":"^2.9.0","hogan.js":"^3.0.2","rimraf":"^2.5.2","tar-fs":"^1.11.1"},"eslintConfig":{"extends":"iplayer-es6","parserOptions":{"ecmaVersion":8}},"devDependencies":{"codeclimate-test-reporter":"^0.5.0","eslint":"^4.19.1","eslint-config-iplayer-es6":"^4.0.1","istanbul":"^0.4.2","mocha":"^5.0.4","sinon":"^4.4.8"},"directories":{"lib":"lib","test":"test"},"_id":"@altostack/spekulate@2.0.0","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"},"dist":{"integrity":"sha512-oxg98uwPu7jsj4nU7QzOf0i2twFvvAXgnywwsoSsVCTMi4U5id1Z9NJIwYcYs8y8UD4mhvttzMTr3xrafcsQTw==","shasum":"a3232a004944e50afdaeb0af04e931a0c8c7cb68","tarball":"https://registry.npmjs.org/@altostack/spekulate/-/spekulate-2.0.0.tgz","fileCount":60,"unpackedSize":60468,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcqUYwCRA9TVsSAnZWagAAKFkP/1V7FhWf/8u4cLepQIqJ\nqLXNMiheOa+PE4yXLtfbK9uHvdan0zlrydOz5u+W4mmS3e35ZHKSsy2jHtG/\nWnmRT1M0Gd/0+lZy3WrChEpL/brkqT+UEOwCgaR+Jrdfg/d+5VUbDfN32Hzl\nUKGhHWffEG/Azf5vKFFyXMnqwkIMqypvOk1APGqXFP+c0BVWdLsUA9klfCx+\nuOe1G87KsPAa7Iu0SHG0BweWwVliT0Z4GiyPEYIC8OQip1i3B1pPxjiGlYcn\nd1721xnWYNML3vt31NlKWn+QcSHX8fCqZqpUMxSfVU41lEMMh66N8x7zU8IQ\nb7cBEk2Wi6LjGRVneQo0xfxldUl7E87uNiUNJYhSc+qSjpWsZuNK2h1ycTce\nVRJspjJUXrlK2H21su2ZSpNZSr5042ffdrLf4yg/N8idfSa4yb7yk0a5kt8c\nDXwMMiaV76Osohm2yoKQfl/41goW2yeKaEBuvaYA0zAaNechCrTu3h1R2TSm\nzZBGGAaoEbauvF+cemkcfD1SBxp6jYU3HQREwg124rL6zIBrEcQ4WlPJ8X7z\n/2WjTPosarw0AZR8oUe14XWsTYtNr8DLlWyTJCcl7OUGXQhX2i7lhDX1+mSv\n0+HuFW45yD2t8cGxp0be2XI4yt9u0uPvDYiRul+loKMalV/LgfhwZRX/SsFt\ng/QR\r\n=ATfS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICmDMMQfT6fDiqqL2H58KoisoAbEUXrMbVCt1AFQDrXtAiABBSJTm3H8QR8vD36OGIHeDv3b6frVSgV0z0L/coduxQ=="}]},"maintainers":[{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spekulate_2.0.0_1554597424094_0.07518741237030668"},"_hasShrinkwrap":false},"2.0.1":{"name":"@altostack/spekulate","version":"2.0.1","description":"Automatically generates an RPM Spec file for your Node.js project","main":"index.js","scripts":{"test":"mocha","lint":"eslint .","posttest":"npm run lint","coverage":"istanbul cover _mocha -- -R dot"},"repository":{"type":"git","url":"git+https://github.com/bbc/speculate.git"},"keywords":["spec","rpm","file","node","generate"],"author":{"name":"ibl-team@lists.forge.bbc.co.uk"},"license":"Apache-2.0","bugs":{"url":"https://github.com/bbc/speculate/issues"},"homepage":"https://github.com/bbc/speculate#readme","bin":{"spekulate":"./bin/spekulate.js"},"dependencies":{"commander":"^2.9.0","hogan.js":"^3.0.2","rimraf":"^2.5.2","tar-fs":"^1.11.1","lodash":"^4.17.11"},"eslintConfig":{"extends":"iplayer-es6","parserOptions":{"ecmaVersion":8}},"devDependencies":{"codeclimate-test-reporter":"^0.5.0","eslint":"^4.19.1","eslint-config-iplayer-es6":"^4.0.1","istanbul":"^0.4.2","mocha":"^5.0.4","sinon":"^4.4.8"},"directories":{"lib":"lib","test":"test"},"_id":"@altostack/spekulate@2.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"},"dist":{"integrity":"sha512-1nVczJz7UvQwfodxMfuWgcZNddcKg9k6AofvvosXKBUdUakffyyj9ti4p6mrzrkqqexvgbN2j6ouQGqJnycarw==","shasum":"da48e6044c1b934262e6c3d59c87eb6a3b2f4bdf","tarball":"https://registry.npmjs.org/@altostack/spekulate/-/spekulate-2.0.1.tgz","fileCount":60,"unpackedSize":60494,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcqUnYCRA9TVsSAnZWagAAgBoP/A4k1DLZ4QNTKcWT5xy1\nRTMWJtXEdJ8wYHhjsZCdKhURogxi2t+cSKFjiZpcJLHa98z+Zi3Y0qyA03JR\nGsXmFBUgleAoafGBl76ykqJ4uGendy/s+hDcilNq5LYp2rFXdp6EF/NlXcuH\nv7dK2Gnv0Z6kfwfgGJZnJuLx/VYy8ShjrWqIYghdbTZbQtlA2i9BOgjNEhm0\n/8P07PF4/Ve/GpSSaUguAoQiV/QANyv8rE+JKNSufjzq0WOjGSofI/kk5djw\nu1CtwAweFVjfT7w9aMgvjoGMRHaduKfXnVp5jNw1vLa+fbA/hwFk2VIWFFLS\nwvfyNeCWntlPJbAiNzK3jn/h9XJj2da49vSfUmK1PQl11Cia7XPdNHsmtGPo\nCH5MFc67KKSNrDEYR92Ka9NljvMoF/itEbe3nPDHpQzW78Yqm7w2cOLfqCxY\nSBidBJHweN1Lc9mjXtzxqVd09FugpnmYVrPGj1sz2YBCb0eHpdvtGB0cnf+S\n0Yu8zrE5uBBVl667ivPfqQ2pkmdhTIkEri69d9yP39RkVIfjW5jF4R2Va0fL\neK7hJJiLlzuw0EPVhGUv0wAdCPqr3/oXqSYz5jQ4A9eFFPwJZLaPOARk0VHv\nCRlE+fN4z/P6T6oySBysqMkkHTUQTFXSxK8WW4LC/Nv9Zy6MmgPoaDPISFE4\nRXPl\r\n=leIw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDho0jWT/P7BVEwpK3J7InZgmRH1cb7GN0b7tSkUdtIUQIgdsZuG8QpuxtsTNOak4zYqVn5Sw+gjWvALEjiWz6La+k="}]},"maintainers":[{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spekulate_2.0.1_1554598360003_0.17959124848791586"},"_hasShrinkwrap":false},"2.0.2":{"name":"@altostack/spekulate","version":"2.0.2","description":"Automatically generates an RPM Spec file for your Node.js project","main":"index.js","scripts":{"test":"mocha","lint":"eslint .","posttest":"npm run lint","coverage":"istanbul cover _mocha -- -R dot"},"repository":{"type":"git","url":"git+https://github.com/bbc/speculate.git"},"keywords":["spec","rpm","file","node","generate"],"author":{"name":"ibl-team@lists.forge.bbc.co.uk"},"license":"Apache-2.0","bugs":{"url":"https://github.com/bbc/speculate/issues"},"homepage":"https://github.com/bbc/speculate#readme","bin":{"spekulate":"./bin/spekulate.js"},"dependencies":{"commander":"^2.9.0","hogan.js":"^3.0.2","rimraf":"^2.5.2","tar-fs":"^1.11.1","lodash":"^4.17.11"},"eslintConfig":{"extends":"iplayer-es6","parserOptions":{"ecmaVersion":8}},"devDependencies":{"codeclimate-test-reporter":"^0.5.0","eslint":"^4.19.1","eslint-config-iplayer-es6":"^4.0.1","istanbul":"^0.4.2","mocha":"^5.0.4","sinon":"^4.4.8"},"directories":{"lib":"lib","test":"test"},"_id":"@altostack/spekulate@2.0.2","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"},"dist":{"integrity":"sha512-QPBAvDTagXaBCG5tR3u5T6CP7cV6KjB3GfDNsOvYE6Vv++CABpG6z13Fizx2cAMVxVyt/9WMvX/oQpwhYwgKOA==","shasum":"a5806523916653f280db697ce7f467bcffbc108c","tarball":"https://registry.npmjs.org/@altostack/spekulate/-/spekulate-2.0.2.tgz","fileCount":60,"unpackedSize":60206,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcq0pICRA9TVsSAnZWagAAU7IP/ijWqHICVCL1l+BKZKSq\n8nFFZEIE2EmuOTgtyTRbayoGtUc7PC7qOiYpfliRucnPD1RxrXDOFt627uej\n9xNZQEyypIfT6dNqHuH1629CMbaQCPjvab+JELLhUZ+4I6bwl8naJ3tChN5r\n2oGIdLChReZPT/zwxF96KxgYgVUBYoPiGTPccFGUVAyoEv3UyXVlNvjmNB+H\nMMShBGh+8c8yO39tdZBrPlTKY1GoABOLivgI9MABkVgVO9RJgEEMAyz0njan\nmD5IS+y5hH6H8wXBW0IPK/RLMG4VGtMZZjn+M/AcR42izLNSgu6a+j0oP5lt\nbxIYuD4g+69IRTUqn3t7gemBakDXHPwKt8mknOcoiXGtn/wnoSfAMItc5slj\n8okpZq/aSJOaM2KVIWk2emKOB/ZGjWIrKIB817g5bCg6wXIPagfo66qVODZT\nHnxMNNegPe1hfJGSs0fwZE/GV3JQhIsqPcVz5Sp0NIdgSKgzJ2SXl9jNpntI\n2T1mCFkWSMkk9OmlYkrdtWiKfJ6gWHnV0BFWm5eOcyPra3YH+Escc7+xHJ9M\nO3dpFC33h14OLd7ee3oZc+FtcB9jTVz948xla97QCdVNm/JEoOyW6o4rTsxd\nNSj8EA7tzZpvXUPerrCJrbU/Ruvr5Kmt1iy3g07m56HpKlSvHwsx6jaKEHfs\nOm2w\r\n=AJxj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDAfuZkiM2GRp/Vrt31TIcUBpw0tyCzixn7yQ6LOKKbYAiBzNoDeatmGUZIZ1QIZTq1/z9Ua2aAXL5okt0F2Z8NU/w=="}]},"maintainers":[{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spekulate_2.0.2_1554729543761_0.05120381255898865"},"_hasShrinkwrap":false}},"time":{"created":"2019-04-07T00:37:03.884Z","2.0.0":"2019-04-07T00:37:04.266Z","modified":"2022-04-04T13:40:29.097Z","2.0.1":"2019-04-07T00:52:40.183Z","2.0.2":"2019-04-08T13:19:04.080Z"},"maintainers":[{"name":"moh-abk","email":"mohammed.abubakar@altostack.io"}],"description":"Automatically generates an RPM Spec file for your Node.js project","homepage":"https://github.com/bbc/speculate#readme","keywords":["spec","rpm","file","node","generate"],"repository":{"type":"git","url":"git+https://github.com/bbc/speculate.git"},"author":{"name":"ibl-team@lists.forge.bbc.co.uk"},"bugs":{"url":"https://github.com/bbc/speculate/issues"},"license":"Apache-2.0","readme":"# spekulate\n\n> Automatically generates an RPM Spec file for your Node.js project\n\n## Installation\n\n```\nnpm install --global spekulate\n```\n\n## Features\n\n* Generates an RPM Spec file for your project\n* Creates a [systemd](https://www.freedesktop.org/wiki/Software/systemd/) service definition file\n* Supports configuration using your existing `package.json`\n* Currently supports CentOS 7\n\n## Usage\n\nLet's start with a simple Node.js project:\n\n```\nmy-cool-api\n├── package.json\n└── server.js\n\n0 directories, 2 files\n```\n\nFirst run npm install to install your dependencies:\n\n```\nnpm install\n```\n\nThis creates the `node_modules` directory:\n\n```\nmy-cool-api\n├── node_modules\n├── package.json\n└── server.js\n\n1 directory, 2 files\n```\n\nRun the `spekulate` command from inside the project directory:\n\n```\nspekulate\n```\n\nYou've now got an RPM Spec file and a systemd service definition for your project. You'll also notice that your application has been packaged into a `tar.gz` archive, ready to be built with an RPM building tool like [`rpmbuild`](http://www.rpm.org/max-rpm-snapshot/rpmbuild.8.html) or [`mock`](https://github.com/rpm-software-management/mock/wiki):\n\n```\nmy-cool-api\n├── SOURCES\n│   └── my-cool-api.tar.gz\n├── SPECS\n│   └── my-cool-api.spec\n├── node_modules\n├── my-cool-api.service\n├── package.json\n└── server.js\n\n3 directories, 5 files\n```\n\nspekulate is designed to be used at build time, just before you package your application into an RPM. Because of this, we recommend adding the generated files to your `.gitignore` file:\n\n```\n*.service\nSOURCES\nSPECS\n```\n\n### Install your dependencies _first_\n\nspekulate assumes that you've _already installed your npm dependencies_ when it is run. This means that you don't need to worry about running `npm install` inside a clean RPM-building environment like _mock_.\n\nThe generated spec file instructs your RPM building tool to run [`npm rebuild`](https://docs.npmjs.com/cli/rebuild) as part of the build process. This ensures that any native modules are rebuilt for your target environment, even if they were originally installed on a different platform.\n\nIf for some reason you do not want to rebuild your native modules, you can explicity tell spekulate not to rebuild by adding the following to your `package.json`:\n\n```json\n{\n  \"spec\": {\n    \"rebuild\": false\n  }\n}\n```\n\nA typical spekulate build looks like this:\n\n```bash\nnpm install\nnpm test\nspekulate\n# build the RPM (using rpmbuild, mock etc.)\n```\n\n### Local installation\n\nTo avoid the need to install spekulate globally, we recommend installing it _locally_ and creating an [npm script](https://docs.npmjs.com/misc/scripts) in your `package.json` file:\n\n```\nnpm install --save-dev spekulate\n```\n\n```json\n{\n  \"scripts\": {\n    \"spec\": \"spekulate\"\n  }\n}\n```\n\nYou can then run `npm run spec` to generate your spec file in an environment where spekulate isn't installed globally (like your CI server.)\n\n### Pruning dependencies\n\nTo minimise the final RPM size, your development dependencies (dependencies added with the --save-dev flag) are automatically [pruned](https://docs.npmjs.com/cli/prune) so that they're not shipped with your production code.\n\nIf for some reason you need to package your dev dependencies with your production code you can explicity tell spekulate not to prune by adding the following to your `package.json`:\n\n```json\n{\n  \"spec\": {\n    \"prune\": false\n  }\n}\n```\n\n### `npm start` script\n\nThe systemd service file that spekulate generates uses the `npm start` script to start your application. Make sure that you've defined this script in your `package.json` file.\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"node server.js\"\n  }\n}\n```\n\n### Including only certain files\n\nSimilar to `npm`, if you specify a `files` directive in your `package.json` then `spekulate` will only include those files or directories plus `package.json` and `node_modules` in the source tarball:\n\n```json\n{\n  \"files\": [\n    \"lib\",\n    \"routes\",\n    \"index.js\"\n  ]\n}\n```\n\nAlongside this, the `main` attribute is also included in the `files` listing, although the service is still started using `npm start`:\n\n```json\n{\n  \"main\": \"server.js\",\n  \"files\": [\n    \"lib\",\n    \"routes\",\n    \"index.js\"\n  ]\n}\n```\n\nIf you have only a `main` directive, spekulate will assume you are using it for its original purpose and not create an archive only including that one file.\n\n### Node versions\n\nBy default, the spec file that spekulate generates _isn't_ tied to a particular Node version. It simply requires the `nodejs` package. It's up to you to make the package available when you install the RPM using `yum`.\n\nWe **strongly recommend** that you use the [Nodesource binary distributions](https://github.com/nodesource/distributions) to install a modern version of Node.js for both your RPM building environment and your target server. Follow the setup instructions for [Enterprise Linux](https://github.com/nodesource/distributions#rpm) and then run `yum install nodejs`.\n\nIf you're using multiple node repositories or a repository with multiple versions of node, you can specify an RPM version requirement with the `nodeVersion` property in your `package.json` file:\n\n```json\n{\n  \"spec\": {\n    \"nodeVersion\": \"< 5.0.0\"\n  }\n}\n```\nThe `nodeVersion` property must conform to the [RPM version syntax](http://rpm.org/user_doc/dependencies.html#requires). Take particular note of the `epoch` (`[epoch:]version[-release]`) as a range without an epoch may not result in the desired dependency:\n\n```shell\n\"nodeVersion\": \"< 7.0.0\"\n---\nAvailable Packages\nnodejs.x86_64                             6.2.2-1nodesource.el7.centos          nodesource # <- matches as no epoch specified\nnodejs.x86_64                             1:6.3.0-1nodesource.el7.centos        nodesource\nnodejs.x86_64                             2:6.11.0-1nodesource.el7.centos       nodesource # <- Latest but epoch of '2'\n```\n\n### Directory Structure\n\nspekulate creates the following directories for your application:\n\n|Directory|Purpose|\n|---------|-------|\n|`/opt/:projectName`|This is where your application is stored|\n|`/var/log/:projectName`|This is created for any log files that your application needs to write to|\n\n## Configuration\n\nspekulate is configured using the `spec` property inside your existing `package.json` file.\n\n### Dependencies\n\nTo add a dependency to the generated spec file, list the package dependencies in the `requires` array:\n\n```json\n{\n  \"spec\": {\n    \"requires\": [\n      \"vim\",\n      \"screen\"\n    ]\n  }\n}\n```\n\nIf you have any build dependencies (such as `python` for `node-gyp`), instead of having them available outside the build environment you can instead add them to the `buildRequires` array:\n\n```json\n{\n  \"spec\": {\n    \"buildRequires\": [\n      \"python\"\n    ]\n  }\n}\n```\n\n### Executables\n\nIf you have scripts that need to be executable when they're installed on your target server, add them to the `executable` array. You can list both files and entire directories:\n\n```json\n{\n  \"spec\": {\n    \"executable\": [\n      \"./other-scripts/my-script.js\",\n      \"./scripts\"\n    ]\n  }\n}\n```\n\n### Config files\n\nIf you have files that need to be preserved after every `yum update`, you can add them to the `config` array.\nOn update you can achieve following two behaviors:\n1. `\"noreplace\": false` (default): Local edited file will be renamed with `.rpmsave`\n2. `\"noreplace\": true`: Local edited file will be preserved and new file from update will be renamed with `.rpmnew`\n\n```json\n{\n  \"spec\": {\n    \"config\": [\n      {\"file\": \"./my-config.js\", \"noreplace\": true},\n      {\"file\": \"./my-other-config.js\"}\n    ]\n  }\n}\n```\n\n### Post Install Actions\n\nIf you need to perform any actions after installing your package (such as moving files on the target server) you can specify these inline using the `post` property:\n\n```json\n{\n  \"spec\": {\n    \"post\": [\n      \"mv /opt/my-cool-api/rc.local /etc/rc.local\"\n    ]\n  }\n}\n```\n\n### Environment variable\n\nIf you need to specify environment variables during startup (NODE_ENV for example) you can specify these inline using the spec.environment property:\n\n```json\n{\n  \"spec\": {\n    \"environment\": {\n      \"NODE_ENV\": \"production\",\n      \"NODE_INSTANCE\": \"%i\"\n    }\n  }\n}\n```\n\n### Service Options\n\nIf you need to set specific [systemd service options](https://www.freedesktop.org/software/systemd/man/systemd.exec.html) - in the  `[Service]` section of the .service file, you can specify these using the spec.serviceOptions property:\n\n```json\n{\n  \"spec\": {\n    \"serviceOptions\": {\n      \"CPUSchedulingPriority\": 50,\n      \"LimitNOFILE\": 10000\n    }\n  }\n}\n```\n\n#### Unit Options\n\nYou can set specific [systemd unit options](https://www.freedesktop.org/software/systemd/man/systemd.unit.html) - in the `[Unit]` section of the .service file, you can specify these using the spec.unitOptions property:\n\n```json\n{\n  \"spec\": {\n    \"unitOptions\": {\n      \"After\": \"my-cooler-api.service\",\n      \"Before\": \"my-coolest-api.service\",\n      \"Requires\": \"my-very-cool-api.service\",\n    }\n  }\n}\n```\n\nIf you do not require any specific unit options spekulate will use default options:\n```\n[Unit]\nDescription=My Cool API\nAfter=network.target nss-lookup.target\n```\n\n### Release Number\n\nBy default spekulate will set the RPM release number to 1, if you want to override this you can do so by using the `--release` flag:\n\n```sh\nspekulate --release=7\n```\n\n### Custom Name\n\nBy default spekulate will set the name from `package.json`, if you want to override this you can do so by using the `--name` flag:\n\n```sh\nspekulate --name=my-cool-api\n```\n\nThis is useful if you are using private NPM packages which start with an `@`.\n","readmeFilename":"README.md"}