From c6bb4075bfd96345d77ae93cf43279065ac18ad7 Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Tue, 20 Dec 2022 06:35:39 -0500 Subject: [PATCH 1/4] Suggested dev experience fixes --- .prettierrc.js | 15 ++++++ package.json | 28 +++++------ packages/cli/package.json | 4 +- packages/find-root/package.json | 2 +- packages/gatsby-source-workspace/README.md | 36 ++++++------- packages/gatsby-source-workspace/package.json | 22 ++++---- tsconfig.json | 3 +- yarn.lock | 50 ++++++++++++++++++- 8 files changed, 111 insertions(+), 49 deletions(-) create mode 100644 .prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..b3af668 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,15 @@ +// Documentation for this file: https://prettier.io/docs/en/configuration.html +module.exports = { + // Use .gitattributes to manage newlines + endOfLine: "auto", + + // Avoid line breaks in markdown + proseWrap: "never", + + // Prettier plugins + // + // Disabling search dirs and pointing directly at folder paths relative to this config file + // makes it easier for VSCode and WebStorm to find your plugins. + pluginSearchDirs: [], + plugins: ["./node_modules/prettier-plugin-packagejson"] +}; diff --git a/package.json b/package.json index f1ef6f0..f15adb2 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,18 @@ "packages/*", "test-gatsby" ], + "scripts": { + "postinstall": "preconstruct dev && manypkg check", + "release": "yarn preconstruct build && yarn changeset publish", + "test": "jest", + "test-gatsby": "cd test-gatsby && gatsby develop" + }, + "jest": { + "watchPlugins": [ + "jest-watch-typeahead/filename", + "jest-watch-typeahead/testname" + ] + }, "dependencies": { "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", @@ -22,26 +34,12 @@ "jest-watch-typeahead": "^0.6.0", "preconstruct": "^0.0.89", "prettier": "^2.8.1", + "prettier-plugin-packagejson": "^2.3.0", "typescript": "^4.9.4" }, - "jest": { - "watchPlugins": [ - "jest-watch-typeahead/filename", - "jest-watch-typeahead/testname" - ] - }, "preconstruct": { "packages": [ "packages/!(gatsby)*" ] - }, - "prettier": { - "proseWrap": "never" - }, - "scripts": { - "postinstall": "preconstruct dev && manypkg check", - "release": "yarn preconstruct build && yarn changeset publish", - "test-gatsby": "cd test-gatsby && gatsby develop", - "test": "jest" } } diff --git a/packages/cli/package.json b/packages/cli/package.json index c3d7d16..ed1aed4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,14 +1,14 @@ { "name": "@manypkg/cli", + "version": "0.19.2", "repository": { "type": "git", "url": "https://github.com/Thinkmill/manypkg.git", "directory": "packages/cli" }, - "version": "0.19.2", + "license": "MIT", "main": "dist/cli.cjs.js", "module": "dist/cli.esm.js", - "license": "MIT", "bin": { "manypkg": "./bin.js" }, diff --git a/packages/find-root/package.json b/packages/find-root/package.json index 475b776..5b90608 100644 --- a/packages/find-root/package.json +++ b/packages/find-root/package.json @@ -1,9 +1,9 @@ { "name": "@manypkg/find-root", "version": "1.1.0", + "license": "MIT", "main": "dist/find-root.cjs.js", "module": "dist/find-root.esm.js", - "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.6", "@types/node": "^12.7.1", diff --git a/packages/gatsby-source-workspace/README.md b/packages/gatsby-source-workspace/README.md index 07fcce6..6b2b815 100644 --- a/packages/gatsby-source-workspace/README.md +++ b/packages/gatsby-source-workspace/README.md @@ -8,7 +8,7 @@ // gatsby-config.js module.exports = { - plugins: [{ resolve: "@manypkg/gatsby-source-workspace" }] + plugins: [{ resolve: "@manypkg/gatsby-source-workspace" }], }; ``` @@ -42,10 +42,10 @@ module.exports = { { resolve: "@manypkg/gatsby-source-workspace", options: { - workspaceFilter: workspace => !workspace.packageJSON.private - } - } - ] + workspaceFilter: (workspace) => !workspace.packageJSON.private, + }, + }, + ], }; ``` @@ -71,12 +71,12 @@ module.exports = { extraFields: [ { name: "license", - definition: `String` - } - ] - } - } - ] + definition: `String`, + }, + ], + }, + }, + ], }; ``` @@ -113,13 +113,13 @@ module.exports = { { name: "readme", definition: `String`, - getFieldInfo: async ws => - await fs.readFile(path.join(ws.dir, "README.md"), "utf-8") - } - ] - } - } - ] + getFieldInfo: async (ws) => + await fs.readFile(path.join(ws.dir, "README.md"), "utf-8"), + }, + ], + }, + }, + ], }; ``` diff --git a/packages/gatsby-source-workspace/package.json b/packages/gatsby-source-workspace/package.json index 5084233..8241570 100644 --- a/packages/gatsby-source-workspace/package.json +++ b/packages/gatsby-source-workspace/package.json @@ -2,21 +2,21 @@ "name": "@manypkg/gatsby-source-workspace", "version": "0.4.1", "license": "MIT", - "peerDependencies": { - "gatsby": "^2.15.28" + "files": [ + "gatsby-node.js", + "index.js" + ], + "dependencies": { + "find-workspaces-root": "^0.2.0", + "fs-extra": "^8.1.0", + "get-workspaces": "^0.6.0" }, "devDependencies": { "gatsby": "^2.15.28", "react": "^16.10.1", "react-dom": "^16.10.1" }, - "dependencies": { - "find-workspaces-root": "^0.2.0", - "fs-extra": "^8.1.0", - "get-workspaces": "^0.6.0" - }, - "files": [ - "gatsby-node.js", - "index.js" - ] + "peerDependencies": { + "gatsby": "^2.15.28" + } } diff --git a/tsconfig.json b/tsconfig.json index b466982..8b80901 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -46,9 +46,10 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + "useUnknownInCatchVariables": false /* Source Map Options */ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ diff --git a/yarn.lock b/yarn.lock index c1f7e65..3310a68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5747,7 +5747,7 @@ detect-libc@^1.0.2: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -detect-newline@^3.0.0: +detect-newline@3.1.0, detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== @@ -7607,6 +7607,11 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +git-hooks-list@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156" + integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ== + git-up@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" @@ -7694,6 +7699,20 @@ globals@^11.1.0, globals@^11.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globby@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.0.tgz#abfcd0630037ae174a88590132c2f6804e291072" + integrity sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw== + dependencies: + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" + globby@^10.0.1: version "10.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" @@ -9031,6 +9050,11 @@ is-path-inside@^3.0.1: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== +is-plain-obj@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -12361,6 +12385,13 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= +prettier-plugin-packagejson@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.3.0.tgz#5c242a39627c227d813161618fa88e64e44e9c84" + integrity sha512-2SAPMMk1UDkqsB7DifWKcwCm6VC52JXMrzLHfbcQHJRWhRCj9zziOy+s+2XOyPBeyqFqS+A/1IKzOrxKFTo6pw== + dependencies: + sort-package-json "1.57.0" + prettier@^1.18.2: version "1.18.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" @@ -14041,6 +14072,23 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" +sort-object-keys@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" + integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg== + +sort-package-json@1.57.0: + version "1.57.0" + resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.57.0.tgz#e95fb44af8ede0bb6147e3f39258102d4bb23fc4" + integrity sha512-FYsjYn2dHTRb41wqnv+uEqCUvBpK3jZcTp9rbz2qDTmel7Pmdtf+i2rLaaPMRZeSVM60V3Se31GyWFpmKs4Q5Q== + dependencies: + detect-indent "^6.0.0" + detect-newline "3.1.0" + git-hooks-list "1.0.3" + globby "10.0.0" + is-plain-obj "2.1.0" + sort-object-keys "^1.1.3" + source-list-map@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1" From 0aa7c33be719cc0f3e5b5dfb1e2bc446b7e3751d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 21 Dec 2022 11:18:58 +0100 Subject: [PATCH 2/4] Bump `@types/prettier` --- .prettierrc.js | 12 ++++++------ yarn.lock | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index b3af668..ca8d008 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,4 +1,6 @@ // Documentation for this file: https://prettier.io/docs/en/configuration.html + +/** @type {import('prettier').Options} */ module.exports = { // Use .gitattributes to manage newlines endOfLine: "auto", @@ -6,10 +8,8 @@ module.exports = { // Avoid line breaks in markdown proseWrap: "never", - // Prettier plugins - // - // Disabling search dirs and pointing directly at folder paths relative to this config file - // makes it easier for VSCode and WebStorm to find your plugins. - pluginSearchDirs: [], - plugins: ["./node_modules/prettier-plugin-packagejson"] + // Disabling search dirs and pointing directly at plugins + // makes it easier for VSCode and WebStorm to find them. + pluginSearchDirs: false, + plugins: [require("prettier-plugin-packagejson")], }; diff --git a/yarn.lock b/yarn.lock index 3310a68..abb7b5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2848,9 +2848,9 @@ "@types/node" "*" "@types/prettier@^2.0.0": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.2.tgz#5bb52ee68d0f8efa9cc0099920e56be6cc4e37f3" - integrity sha512-IkVfat549ggtkZUthUzEX49562eGikhSYeVGX97SkMFn+sTZrgRewXjQ4tPKFPCykZHkX1Zfd9OoELGqKU2jJA== + version "2.7.2" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0" + integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg== "@types/prop-types@*": version "15.7.3" From 97967a3db30a00dc1c758faf5763afff18a03d3a Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Thu, 22 Dec 2022 00:34:42 -0500 Subject: [PATCH 3/4] remove useUnknown setting --- tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 8b80901..d47de10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -49,7 +49,6 @@ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - "useUnknownInCatchVariables": false /* Source Map Options */ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ From 1d8392bebfdc10002230f537eb025f4374b42277 Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Thu, 22 Dec 2022 08:47:32 -0500 Subject: [PATCH 4/4] Update .prettierrc.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz BurzyƄski --- .prettierrc.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index ca8d008..6a6377c 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -8,8 +8,7 @@ module.exports = { // Avoid line breaks in markdown proseWrap: "never", - // Disabling search dirs and pointing directly at plugins - // makes it easier for VSCode and WebStorm to find them. + // Disabling search dirs and pointing directly at plugins to keep configuration explicit pluginSearchDirs: false, plugins: [require("prettier-plugin-packagejson")], };