From a0e2c4d45fa159f7824c23039cd605e4add08650 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 6 May 2021 13:37:53 +0100 Subject: [PATCH] Added initial `package-json` package no issue - this adds the templated package from Slimer ready for pulling the history in from Ghost --- ghost/package-json/.eslintrc.js | 6 ++++ ghost/package-json/LICENSE | 21 +++++++++++ ghost/package-json/README.md | 39 +++++++++++++++++++++ ghost/package-json/index.js | 0 ghost/package-json/package.json | 27 ++++++++++++++ ghost/package-json/test/.eslintrc.js | 6 ++++ ghost/package-json/test/utils/assertions.js | 11 ++++++ ghost/package-json/test/utils/index.js | 11 ++++++ ghost/package-json/test/utils/overrides.js | 10 ++++++ 9 files changed, 131 insertions(+) create mode 100644 ghost/package-json/.eslintrc.js create mode 100644 ghost/package-json/LICENSE create mode 100644 ghost/package-json/README.md create mode 100644 ghost/package-json/index.js create mode 100644 ghost/package-json/package.json create mode 100644 ghost/package-json/test/.eslintrc.js create mode 100644 ghost/package-json/test/utils/assertions.js create mode 100644 ghost/package-json/test/utils/index.js create mode 100644 ghost/package-json/test/utils/overrides.js diff --git a/ghost/package-json/.eslintrc.js b/ghost/package-json/.eslintrc.js new file mode 100644 index 0000000000..c9c1bcb522 --- /dev/null +++ b/ghost/package-json/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: ['ghost'], + extends: [ + 'plugin:ghost/node' + ] +}; diff --git a/ghost/package-json/LICENSE b/ghost/package-json/LICENSE new file mode 100644 index 0000000000..366ae5f624 --- /dev/null +++ b/ghost/package-json/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-2021 Ghost Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ghost/package-json/README.md b/ghost/package-json/README.md new file mode 100644 index 0000000000..4f5be20053 --- /dev/null +++ b/ghost/package-json/README.md @@ -0,0 +1,39 @@ +# Package Json + +## Install + +`npm install @tryghost/package-json --save` + +or + +`yarn add @tryghost/package-json` + + +## Usage + + +## Develop + +This is a mono repository, managed with [lerna](https://lernajs.io/). + +Follow the instructions for the top-level repo. +1. `git clone` this repo & `cd` into it as usual +2. Run `yarn` to install top-level dependencies. + + +## Run + +- `yarn dev` + + +## Test + +- `yarn lint` run just eslint +- `yarn test` run lint and tests + + + + +# Copyright & License + +Copyright (c) 2013-2021 Ghost Foundation - Released under the [MIT license](LICENSE). \ No newline at end of file diff --git a/ghost/package-json/index.js b/ghost/package-json/index.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ghost/package-json/package.json b/ghost/package-json/package.json new file mode 100644 index 0000000000..37e8f2f4f4 --- /dev/null +++ b/ghost/package-json/package.json @@ -0,0 +1,27 @@ +{ + "name": "@tryghost/package-json", + "version": "0.0.0", + "repository": "https://github.com/TryGhost/Utils/tree/master/packages/package-json", + "author": "Ghost Foundation", + "license": "MIT", + "main": "index.js", + "scripts": { + "dev": "echo \"Implement me!\"", + "test": "NODE_ENV=testing mocha './test/**/*_spec.js'", + "lint": "eslint . --ext .js --cache", + "posttest": "yarn lint" + }, + "files": [ + "index.js", + "lib" + ], + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "mocha": "8.3.2", + "should": "13.2.3", + "sinon": "10.0.0" + }, + "dependencies": {} +} diff --git a/ghost/package-json/test/.eslintrc.js b/ghost/package-json/test/.eslintrc.js new file mode 100644 index 0000000000..829b601eb0 --- /dev/null +++ b/ghost/package-json/test/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: ['ghost'], + extends: [ + 'plugin:ghost/test' + ] +}; diff --git a/ghost/package-json/test/utils/assertions.js b/ghost/package-json/test/utils/assertions.js new file mode 100644 index 0000000000..7364ee8aa1 --- /dev/null +++ b/ghost/package-json/test/utils/assertions.js @@ -0,0 +1,11 @@ +/** + * Custom Should Assertions + * + * Add any custom assertions to this file. + */ + +// Example Assertion +// should.Assertion.add('ExampleAssertion', function () { +// this.params = {operator: 'to be a valid Example Assertion'}; +// this.obj.should.be.an.Object; +// }); diff --git a/ghost/package-json/test/utils/index.js b/ghost/package-json/test/utils/index.js new file mode 100644 index 0000000000..0d67d86ff8 --- /dev/null +++ b/ghost/package-json/test/utils/index.js @@ -0,0 +1,11 @@ +/** + * Test Utilities + * + * Shared utils for writing tests + */ + +// Require overrides - these add globals for tests +require('./overrides'); + +// Require assertions - adds custom should assertions +require('./assertions'); diff --git a/ghost/package-json/test/utils/overrides.js b/ghost/package-json/test/utils/overrides.js new file mode 100644 index 0000000000..90203424ee --- /dev/null +++ b/ghost/package-json/test/utils/overrides.js @@ -0,0 +1,10 @@ +// This file is required before any test is run + +// Taken from the should wiki, this is how to make should global +// Should is a global in our eslint test config +global.should = require('should').noConflict(); +should.extend(); + +// Sinon is a simple case +// Sinon is a global in our eslint test config +global.sinon = require('sinon');