{"id":13554842,"url":"https://github.com/debitoor/nocms","last_synced_at":"2025-04-05T10:31:01.301Z","repository":{"id":57311187,"uuid":"79365651","full_name":"debitoor/nocms","owner":"debitoor","description":"\"NO, You don't need a CMS\"","archived":false,"fork":false,"pushed_at":"2020-09-12T09:08:58.000Z","size":2810,"stargazers_count":14,"open_issues_count":27,"forks_count":1,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-10-23T03:00:03.866Z","etag":null,"topics":["cli","static-site-generator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nocms","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/debitoor.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":"2017-01-18T17:34:30.000Z","updated_at":"2023-08-06T06:26:47.000Z","dependencies_parsed_at":"2022-09-06T04:40:19.382Z","dependency_job_id":null,"html_url":"https://github.com/debitoor/nocms","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debitoor%2Fnocms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debitoor%2Fnocms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debitoor%2Fnocms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debitoor%2Fnocms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/debitoor","download_url":"https://codeload.github.com/debitoor/nocms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249515,"owners_count":20908211,"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":["cli","static-site-generator"],"created_at":"2024-08-01T12:02:55.976Z","updated_at":"2025-04-05T10:30:59.918Z","avatar_url":"https://github.com/debitoor.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","cli"],"sub_categories":[],"readme":"# NOCMS\n\"NO, You don't need a CMS\" is what you are going to tell your boss the next time he comes running waving his arms and yelling incomprehensibly about some new microsite for his wife's pony he wants to make in drupal, wordpress or any of the 1 billion other \"let's stuff all your content in a mysql database and front it with some 10 year old php scripts\" things that pop up in your facebook feed disguised as content.\n\n[![Build Status](https://travis-ci.org/debitoor/nocms.svg?branch=master)](https://travis-ci.org/debitoor/nocms)\n[![NPM Version](https://img.shields.io/npm/v/nocms.svg)](https://www.npmjs.com/package/nocms)\n\n## Install\n``` bash\n$ npm install nocms --save\n```\n\n### Plugins by @debitoor\n* [nocms-plugin-directory-resources](https://www.npmjs.com/package/nocms-plugin-directory-resources)\n* [nocms-plugin-file-resources](https://www.npmjs.com/package/nocms-plugin-file-resources)\n* [nocms-plugin-image-resources](https://www.npmjs.com/package/nocms-plugin-image-resources)\n* [nocms-plugin-json-resources](https://www.npmjs.com/package/nocms-plugin-json-resources)\n\n## CLI Usage\n\n### Compile\nCompiles all resources in the input directory and writes them to the output directory.\n\n``` bash\n$ nocms compile --in-dir ./src/ --out-dir ./compiled/\n```\n\n### Server\nRuns a webserver on the port given and compiles resources in the input directory and writes them to the output directory before serving them to the user.\n``` bash\n$ nocms server --in-dir ./src/ --out-dir ./compiled/ --port 1234\n```\n\nNOCMS is multithreaded and spins of one worker instance for each cpu as reported by `os.cpus()`.\n\n## Plugins\nA Plugin is any module that exports an `activate` function that when invoked registers one or more providers.\n\n``` javascript\nexport function activate (pluginActivationContext)\n```\n\nPlugins installed in `node_modules` will be activated automatically.\n\n### pluginActivationContext\nThe plugin activation context gives plugins access to provider registration and to IO functions bound to the input and output directories.\n\n* findFiles\n* readFile\n* registerResourceProvider\n* watchFiles\n* writeFile\n\n#### findFiles\nFinds files relative to the input directory. Returns a `Promise` that resolves with an `Array` of file paths relative to the input directory.\n\n``` javascript\nasync function findFiles (pattern, options)\n```\n\nParameters:\n* pattern: [Glob](https://github.com/isaacs/node-glob) pattern,\n* options: Glob options\n\n#### readFile\nAsynchronously reads the contents of a file relative to the input directory. Returns a `Promise` that resolves with the contents of the file, a `String` or a `Buffer`.\n\n``` javascript\nasync function readFile (file, options)\n```\n\nParameters:\n* file: File path relative to the input directory\n* options: Same as when calling fs.readFile\n\n#### registerResourceProvider\nRegisters a resource provider with NOCMS. See [Resource Provider](#resource-provider).\n\n``` javascript\nfunction registerResourceProvider (resourceProvider)\n```\n\nParameters:\n* resourceProvider: An instance of a resource provider\n\n#### watchFiles\nWatches files relative to the input directory. Returns a [chokidar](https://github.com/paulmillr/chokidar) instance.\n\n``` javascript\nfunction watchFiles (pattern, options)\n```\n\nParameters:\n* pattern: Glob pattern\n* options: Chokidar options\n\n#### writeFile\nAsynchronously writes a file to the output directory. Automatically creates any missing parts of the file path before writing the file. Returns a promise.\n\n``` javascript\nasync function writeFile (file, data, options) {}\n```\n\nParameters:\n* file: file path relative to the output directory.\n* data: `String` or `Buffer`\n* options: Same as fs.writeFile\n\nExample:\n``` javascript\nlet html = '\u003chtml\u003e\u003c/html\u003e';\nawait writeFile('index.html', html, 'utf8');\n```\n\n### Resource Provider\nResource Providers are responsible for collecting meta data for, and compiling resources. A resource provider has two functions:\n\n#### getResources\nAsynchronously provides an `Array` of resource objects. A resource must as a minimum have an `id` field.\n\n``` javascript\nasync function getResources ()\n```\n\n#### compileResource\nAsynchronously compiles a resource object and writes the result to the file system. Returns a `Promise` that resolves with `undefined`.\n\n``` javascript\nasync function compileResource (resource, resourceCompilationContext)\n```\n\nParameters:\n* resource: a resource object\n* resourceCompilationContext: a resource compilation context.\n\n#### Resource Compilation Context\nThe resource compilation context is an object with two fields.\n\n* resourceMap: a id/resource map of all resources from all resource providers\n* resourceTree: a resource tree of all resources from all resource providers\n\nThe resource compilation context can be used to provide resource meta data to templates during compilation.\n\n## Config\n\nConfigurations can be written in a `.nocmsrc` file at the root of the project, and will be served as json to plugins.\n\n## Develop\n\n### Bootstrap\nRun lerna bootstrap\n\n``` bash\n$ npm run bootstrap\n```\n\n### Build\n``` bash\n$ npm run build\n```\n\n### Test\n``` bash\n$ npm test\n```\n\nThe end to end tests (rather integration than e2e) are in the root of the project in `example-sites` and make use of lerna to link the local modules, so if they are built, they are immediately tested as the newest version, as they are a symlink.\n\nThe expected rendered HTML/CSS/JS will be compared to the actually produced output.\n\n## License\nMIT License\n\nCopyright (c) 2017 [Debitoor](https://debitoor.com/)\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebitoor%2Fnocms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdebitoor%2Fnocms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebitoor%2Fnocms/lists"}