From 0cee011ab1f3d2ffd1486b7f3c18ba647af3ac64 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Tue, 20 Oct 2020 12:52:36 +0200 Subject: [PATCH 1/3] fix: add repository metadata to all packages --- .../__tests__/validate-package-json.spec.ts | 30 +++++++++++++++++++ packages/docusaurus-1.x/package.json | 3 +- packages/docusaurus-init-1.x/package.json | 5 ++++ packages/docusaurus-init/package.json | 3 +- packages/docusaurus-mdx-loader/package.json | 5 ++++ packages/docusaurus-migrate/package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ packages/docusaurus-plugin-debug/package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ packages/docusaurus-plugin-pwa/package.json | 5 ++++ .../docusaurus-plugin-sitemap/package.json | 5 ++++ .../docusaurus-preset-bootstrap/package.json | 5 ++++ .../docusaurus-preset-classic/package.json | 5 ++++ .../package.json | 5 ++++ .../docusaurus-theme-bootstrap/package.json | 5 ++++ .../docusaurus-theme-classic/package.json | 5 ++++ .../package.json | 5 ++++ .../package.json | 5 ++++ packages/docusaurus-types/package.json | 5 ++++ .../docusaurus-utils-validation/package.json | 5 ++++ packages/docusaurus-utils/package.json | 5 ++++ packages/docusaurus/package.json | 3 +- packages/lqip-loader/package.json | 5 ++++ packages/stylelint-copyright/package.json | 5 ++++ 30 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 packages/__tests__/validate-package-json.spec.ts diff --git a/packages/__tests__/validate-package-json.spec.ts b/packages/__tests__/validate-package-json.spec.ts new file mode 100644 index 000000000000..ecd608fa041f --- /dev/null +++ b/packages/__tests__/validate-package-json.spec.ts @@ -0,0 +1,30 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import util from 'util'; +import globCb from 'glob'; +import fsCb from 'fs'; + +const glob = util.promisify(globCb); +const readFile = util.promisify(fsCb.readFile); + +describe('packages', () => { + test('should contain repository and directory for every package', async () => { + const allPackageJson = await glob('packages/*/package.json'); + /* eslint-disable no-await-in-loop,no-restricted-syntax */ + for (const packageJson of allPackageJson) { + const content = JSON.parse(await readFile(packageJson, 'utf8')); + if (content.private !== true) { + expect(content.repository).toEqual({ + type: 'git', + url: 'https://github.com/facebook/docusaurus.git', + directory: packageJson.replace(/\/package\.json$/, ''), + }); + } + } + }); +}); diff --git a/packages/docusaurus-1.x/package.json b/packages/docusaurus-1.x/package.json index 19c25c4e99e0..360ea1969ce4 100644 --- a/packages/docusaurus-1.x/package.json +++ b/packages/docusaurus-1.x/package.json @@ -11,7 +11,8 @@ ], "repository": { "type": "git", - "url": "https://github.com/facebook/docusaurus.git" + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-1.x" }, "scripts": { "start": "cd ../../website-1.x && yarn start" diff --git a/packages/docusaurus-init-1.x/package.json b/packages/docusaurus-init-1.x/package.json index 084d4c923350..2f179b507ae9 100644 --- a/packages/docusaurus-init-1.x/package.json +++ b/packages/docusaurus-init-1.x/package.json @@ -10,6 +10,11 @@ "open source", "docusaurus" ], + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-init-1.x" + }, "bin": { "docusaurus-init": "initialize.js" }, diff --git a/packages/docusaurus-init/package.json b/packages/docusaurus-init/package.json index b40d3440f381..1c34be8f7b7d 100644 --- a/packages/docusaurus-init/package.json +++ b/packages/docusaurus-init/package.json @@ -4,7 +4,8 @@ "description": "Create Docusaurus app easily", "repository": { "type": "git", - "url": "https://github.com/facebook/docusaurus.git" + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-init" }, "bugs": { "url": "https://github.com/facebook/docusaurus/issues" diff --git a/packages/docusaurus-mdx-loader/package.json b/packages/docusaurus-mdx-loader/package.json index 22b54f71df1f..375508986e45 100644 --- a/packages/docusaurus-mdx-loader/package.json +++ b/packages/docusaurus-mdx-loader/package.json @@ -9,6 +9,11 @@ "scripts": { "build": "tsc" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-mdx-loader" + }, "license": "MIT", "dependencies": { "@babel/parser": "^7.9.4", diff --git a/packages/docusaurus-migrate/package.json b/packages/docusaurus-migrate/package.json index 5db1ed779674..b9473bcdda9e 100644 --- a/packages/docusaurus-migrate/package.json +++ b/packages/docusaurus-migrate/package.json @@ -11,6 +11,11 @@ "build": "tsc", "watch": "tsc --watch" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-migrate" + }, "publishConfig": { "access": "public" }, diff --git a/packages/docusaurus-module-type-aliases/package.json b/packages/docusaurus-module-type-aliases/package.json index 2ae61c311afb..4e4198f54357 100644 --- a/packages/docusaurus-module-type-aliases/package.json +++ b/packages/docusaurus-module-type-aliases/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-module-type-aliases" + }, "devDependencies": { "@types/react": "*", "@types/react-helmet": "*", diff --git a/packages/docusaurus-plugin-client-redirects/package.json b/packages/docusaurus-plugin-client-redirects/package.json index e77331d93778..006ae513ed24 100644 --- a/packages/docusaurus-plugin-client-redirects/package.json +++ b/packages/docusaurus-plugin-client-redirects/package.json @@ -7,6 +7,11 @@ "build": "tsc", "watch": "tsc --watch" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-client-redirects" + }, "publishConfig": { "access": "public" }, diff --git a/packages/docusaurus-plugin-content-blog/package.json b/packages/docusaurus-plugin-content-blog/package.json index 5d454dc858ef..952eec0b260f 100644 --- a/packages/docusaurus-plugin-content-blog/package.json +++ b/packages/docusaurus-plugin-content-blog/package.json @@ -8,6 +8,11 @@ "build": "tsc", "watch": "tsc --watch" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-content-blog" + }, "publishConfig": { "access": "public" }, diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index e886df63d077..b8d32ad7f01b 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -11,6 +11,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-content-docs" + }, "license": "MIT", "devDependencies": { "@docusaurus/module-type-aliases": "2.0.0-alpha.66", diff --git a/packages/docusaurus-plugin-content-pages/package.json b/packages/docusaurus-plugin-content-pages/package.json index 55b40437e344..98eaf90e7a06 100644 --- a/packages/docusaurus-plugin-content-pages/package.json +++ b/packages/docusaurus-plugin-content-pages/package.json @@ -11,6 +11,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-content-pages" + }, "license": "MIT", "devDependencies": { "@types/hapi__joi": "^17.1.2" diff --git a/packages/docusaurus-plugin-debug/package.json b/packages/docusaurus-plugin-debug/package.json index dd7db2dbe40e..f2b5085a3e4c 100644 --- a/packages/docusaurus-plugin-debug/package.json +++ b/packages/docusaurus-plugin-debug/package.json @@ -10,6 +10,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-debug" + }, "license": "MIT", "dependencies": { "@docusaurus/core": "2.0.0-alpha.66", diff --git a/packages/docusaurus-plugin-google-analytics/package.json b/packages/docusaurus-plugin-google-analytics/package.json index 01f3b6f4dec6..37273fc517d2 100644 --- a/packages/docusaurus-plugin-google-analytics/package.json +++ b/packages/docusaurus-plugin-google-analytics/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-google-analytics" + }, "license": "MIT", "dependencies": { "@docusaurus/core": "2.0.0-alpha.66" diff --git a/packages/docusaurus-plugin-google-gtag/package.json b/packages/docusaurus-plugin-google-gtag/package.json index ccac8db4435a..fcd81c330a7c 100644 --- a/packages/docusaurus-plugin-google-gtag/package.json +++ b/packages/docusaurus-plugin-google-gtag/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-google-gtag" + }, "license": "MIT", "dependencies": { "@docusaurus/core": "2.0.0-alpha.66" diff --git a/packages/docusaurus-plugin-ideal-image/package.json b/packages/docusaurus-plugin-ideal-image/package.json index b2b3dcdc430d..77d4e242102d 100644 --- a/packages/docusaurus-plugin-ideal-image/package.json +++ b/packages/docusaurus-plugin-ideal-image/package.json @@ -10,6 +10,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-ideal-image" + }, "license": "MIT", "devDependencies": { "fs-extra": "^9.0.0" diff --git a/packages/docusaurus-plugin-pwa/package.json b/packages/docusaurus-plugin-pwa/package.json index 914b8d57ed96..a07d2ac09770 100644 --- a/packages/docusaurus-plugin-pwa/package.json +++ b/packages/docusaurus-plugin-pwa/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-pwa" + }, "license": "MIT", "dependencies": { "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", diff --git a/packages/docusaurus-plugin-sitemap/package.json b/packages/docusaurus-plugin-sitemap/package.json index 0aaae735c24b..50c45a72874a 100644 --- a/packages/docusaurus-plugin-sitemap/package.json +++ b/packages/docusaurus-plugin-sitemap/package.json @@ -10,6 +10,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-plugin-sitemap" + }, "license": "MIT", "devDependencies": { "@types/hapi__joi": "^17.1.2" diff --git a/packages/docusaurus-preset-bootstrap/package.json b/packages/docusaurus-preset-bootstrap/package.json index ef8a232eb4c0..7ebed5243af0 100644 --- a/packages/docusaurus-preset-bootstrap/package.json +++ b/packages/docusaurus-preset-bootstrap/package.json @@ -7,6 +7,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-preset-bootstrap" + }, "dependencies": { "@docusaurus/core": "2.0.0-alpha.66", "@docusaurus/plugin-content-blog": "2.0.0-alpha.66", diff --git a/packages/docusaurus-preset-classic/package.json b/packages/docusaurus-preset-classic/package.json index c9c140c925c6..e1aaecd2f098 100644 --- a/packages/docusaurus-preset-classic/package.json +++ b/packages/docusaurus-preset-classic/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-preset-classic" + }, "license": "MIT", "dependencies": { "@docusaurus/core": "2.0.0-alpha.66", diff --git a/packages/docusaurus-remark-plugin-npm2yarn/package.json b/packages/docusaurus-remark-plugin-npm2yarn/package.json index c90142330170..7865b08bb882 100644 --- a/packages/docusaurus-remark-plugin-npm2yarn/package.json +++ b/packages/docusaurus-remark-plugin-npm2yarn/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-remark-plugin-npm2yarn" + }, "license": "MIT", "dependencies": { "npm-to-yarn": "^1.0.1" diff --git a/packages/docusaurus-theme-bootstrap/package.json b/packages/docusaurus-theme-bootstrap/package.json index 8479bc85245a..261ef82794e4 100644 --- a/packages/docusaurus-theme-bootstrap/package.json +++ b/packages/docusaurus-theme-bootstrap/package.json @@ -8,6 +8,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-theme-bootstrap" + }, "dependencies": { "@docusaurus/core": "2.0.0-alpha.66", "@docusaurus/plugin-content-blog": "2.0.0-alpha.66", diff --git a/packages/docusaurus-theme-classic/package.json b/packages/docusaurus-theme-classic/package.json index 206a10157406..77c824a11f02 100644 --- a/packages/docusaurus-theme-classic/package.json +++ b/packages/docusaurus-theme-classic/package.json @@ -7,6 +7,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-theme-classic" + }, "license": "MIT", "scripts": { "build": "tsc --noEmit && yarn babel && yarn prettier", diff --git a/packages/docusaurus-theme-live-codeblock/package.json b/packages/docusaurus-theme-live-codeblock/package.json index 22749611131d..420d9b4eadf1 100644 --- a/packages/docusaurus-theme-live-codeblock/package.json +++ b/packages/docusaurus-theme-live-codeblock/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-theme-live-codeblock" + }, "license": "MIT", "dependencies": { "@docusaurus/core": "2.0.0-alpha.66", diff --git a/packages/docusaurus-theme-search-algolia/package.json b/packages/docusaurus-theme-search-algolia/package.json index c343040530cd..9541254c4166 100644 --- a/packages/docusaurus-theme-search-algolia/package.json +++ b/packages/docusaurus-theme-search-algolia/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-theme-search-algolia" + }, "license": "MIT", "dependencies": { "@docsearch/react": "^1.0.0-alpha.27", diff --git a/packages/docusaurus-types/package.json b/packages/docusaurus-types/package.json index e4ef61b82597..e6c818019ed9 100644 --- a/packages/docusaurus-types/package.json +++ b/packages/docusaurus-types/package.json @@ -7,6 +7,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-types" + }, "license": "MIT", "dependencies": { "@types/webpack": "^4.41.0", diff --git a/packages/docusaurus-utils-validation/package.json b/packages/docusaurus-utils-validation/package.json index 576ac5b353cb..6f6fcff083f8 100644 --- a/packages/docusaurus-utils-validation/package.json +++ b/packages/docusaurus-utils-validation/package.json @@ -11,6 +11,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-utils-validation" + }, "license": "MIT", "devDependencies": { "@types/hapi__joi": "^17.1.2" diff --git a/packages/docusaurus-utils/package.json b/packages/docusaurus-utils/package.json index 35a71c0ab8ca..186bf43e910d 100644 --- a/packages/docusaurus-utils/package.json +++ b/packages/docusaurus-utils/package.json @@ -11,6 +11,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus-utils" + }, "license": "MIT", "dependencies": { "escape-string-regexp": "^2.0.0", diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 495cd62d547d..3875b12f9059 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -17,7 +17,8 @@ ], "repository": { "type": "git", - "url": "https://github.com/facebook/docusaurus.git" + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/docusaurus" }, "bin": { "docusaurus": "bin/docusaurus.js" diff --git a/packages/lqip-loader/package.json b/packages/lqip-loader/package.json index e7bca982b078..c529b16e7417 100644 --- a/packages/lqip-loader/package.json +++ b/packages/lqip-loader/package.json @@ -6,6 +6,11 @@ "publishConfig": { "access": "public" }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/lqip-loader" + }, "license": "MIT", "dependencies": { "loader-utils": "^1.2.3", diff --git a/packages/stylelint-copyright/package.json b/packages/stylelint-copyright/package.json index 43230c34cf09..e37fb15b664a 100644 --- a/packages/stylelint-copyright/package.json +++ b/packages/stylelint-copyright/package.json @@ -4,6 +4,11 @@ "description": "stylelint plugin to check css files for a copyright header", "main": "index.js", "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/facebook/docusaurus.git", + "directory": "packages/stylelint-copyright" + }, "dependencies": { "stylelint": "^13.2.1" } From a4f7d92f371bf2e337681b185dccb2b17e0836b0 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Tue, 20 Oct 2020 13:00:44 +0200 Subject: [PATCH 2/3] empty commit for cla bot From 9e4b0ea7959deb0f25c0f76d94d3821b94c05f86 Mon Sep 17 00:00:00 2001 From: slorber Date: Wed, 21 Oct 2020 14:52:44 +0200 Subject: [PATCH 3/3] move validate-package-json.test.ts + add glob devDependency --- .../validate-package-json.test.ts | 2 ++ package.json | 1 + 2 files changed, 3 insertions(+) rename packages/__tests__/validate-package-json.spec.ts => __tests__/validate-package-json.test.ts (94%) diff --git a/packages/__tests__/validate-package-json.spec.ts b/__tests__/validate-package-json.test.ts similarity index 94% rename from packages/__tests__/validate-package-json.spec.ts rename to __tests__/validate-package-json.test.ts index ecd608fa041f..92170c01275f 100644 --- a/packages/__tests__/validate-package-json.spec.ts +++ b/__tests__/validate-package-json.test.ts @@ -15,6 +15,8 @@ const readFile = util.promisify(fsCb.readFile); describe('packages', () => { test('should contain repository and directory for every package', async () => { const allPackageJson = await glob('packages/*/package.json'); + expect(allPackageJson.length).toBeGreaterThan(0); + /* eslint-disable no-await-in-loop,no-restricted-syntax */ for (const packageJson of allPackageJson) { const content = JSON.parse(await readFile(packageJson, 'utf8')); diff --git a/package.json b/package.json index 45deff891297..7e771406c5ad 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4.0.4", + "glob": "^7.1.6", "husky": "^4.2.3", "jest": "^25.2.7", "lerna": "^3.19.0",