@sanity/plugin-kit 0.0.1-studio-v3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +398 -0
  3. package/assets/splat/LICENSE +21 -0
  4. package/assets/splat/editorconfig +13 -0
  5. package/assets/splat/eslint.config.js +5 -0
  6. package/assets/splat/gitignore +55 -0
  7. package/assets/splat/npmignore +9 -0
  8. package/assets/splat/prettierrc.js +6 -0
  9. package/assets/splat/sanity.json +8 -0
  10. package/assets/splat/template-tsconfig.json +23 -0
  11. package/assets/splat/v2-incompatible.js.template +11 -0
  12. package/lib/package.json +127 -0
  13. package/lib/src/actions/init.d.ts +65 -0
  14. package/lib/src/actions/init.js +83 -0
  15. package/lib/src/actions/init.js.map +1 -0
  16. package/lib/src/actions/link-watch.d.ts +3 -0
  17. package/lib/src/actions/link-watch.js +69 -0
  18. package/lib/src/actions/link-watch.js.map +1 -0
  19. package/lib/src/actions/splat.d.ts +26 -0
  20. package/lib/src/actions/splat.js +296 -0
  21. package/lib/src/actions/splat.js.map +1 -0
  22. package/lib/src/actions/verify/types.d.ts +77 -0
  23. package/lib/src/actions/verify/types.js +3 -0
  24. package/lib/src/actions/verify/types.js.map +1 -0
  25. package/lib/src/actions/verify/validations.d.ts +28 -0
  26. package/lib/src/actions/verify/validations.js +379 -0
  27. package/lib/src/actions/verify/validations.js.map +1 -0
  28. package/lib/src/actions/verify/verify-common.d.ts +43 -0
  29. package/lib/src/actions/verify/verify-common.js +88 -0
  30. package/lib/src/actions/verify/verify-common.js.map +1 -0
  31. package/lib/src/actions/verify-package.d.ts +5 -0
  32. package/lib/src/actions/verify-package.js +72 -0
  33. package/lib/src/actions/verify-package.js.map +1 -0
  34. package/lib/src/actions/verify-studio.d.ts +5 -0
  35. package/lib/src/actions/verify-studio.js +55 -0
  36. package/lib/src/actions/verify-studio.js.map +1 -0
  37. package/lib/src/actions/verify.d.ts +0 -0
  38. package/lib/src/actions/verify.js +330 -0
  39. package/lib/src/actions/verify.js.map +1 -0
  40. package/lib/src/cli.d.ts +2 -0
  41. package/lib/src/cli.js +86 -0
  42. package/lib/src/cli.js.map +1 -0
  43. package/lib/src/cmds/index.d.ts +8 -0
  44. package/lib/src/cmds/index.js +12 -0
  45. package/lib/src/cmds/index.js.map +1 -0
  46. package/lib/src/cmds/init.d.ts +4 -0
  47. package/lib/src/cmds/init.js +90 -0
  48. package/lib/src/cmds/init.js.map +1 -0
  49. package/lib/src/cmds/link-watch.d.ts +4 -0
  50. package/lib/src/cmds/link-watch.js +49 -0
  51. package/lib/src/cmds/link-watch.js.map +1 -0
  52. package/lib/src/cmds/splat.d.ts +4 -0
  53. package/lib/src/cmds/splat.js +63 -0
  54. package/lib/src/cmds/splat.js.map +1 -0
  55. package/lib/src/cmds/verify-package.d.ts +4 -0
  56. package/lib/src/cmds/verify-package.js +38 -0
  57. package/lib/src/cmds/verify-package.js.map +1 -0
  58. package/lib/src/cmds/verify-studio.d.ts +4 -0
  59. package/lib/src/cmds/verify-studio.js +38 -0
  60. package/lib/src/cmds/verify-studio.js.map +1 -0
  61. package/lib/src/cmds/verify.d.ts +0 -0
  62. package/lib/src/cmds/verify.js +42 -0
  63. package/lib/src/cmds/verify.js.map +1 -0
  64. package/lib/src/cmds/version.d.ts +4 -0
  65. package/lib/src/cmds/version.js +55 -0
  66. package/lib/src/cmds/version.js.map +1 -0
  67. package/lib/src/configs/buildExtensions.d.ts +1 -0
  68. package/lib/src/configs/buildExtensions.js +5 -0
  69. package/lib/src/configs/buildExtensions.js.map +1 -0
  70. package/lib/src/configs/default-source.d.ts +3 -0
  71. package/lib/src/configs/default-source.js +70 -0
  72. package/lib/src/configs/default-source.js.map +1 -0
  73. package/lib/src/configs/merged-packages.d.ts +1 -0
  74. package/lib/src/configs/merged-packages.js +24 -0
  75. package/lib/src/configs/merged-packages.js.map +1 -0
  76. package/lib/src/configs/uselessFiles.d.ts +1 -0
  77. package/lib/src/configs/uselessFiles.js +33 -0
  78. package/lib/src/configs/uselessFiles.js.map +1 -0
  79. package/lib/src/constants.d.ts +11 -0
  80. package/lib/src/constants.js +15 -0
  81. package/lib/src/constants.js.map +1 -0
  82. package/lib/src/dependencies/find.d.ts +0 -0
  83. package/lib/src/dependencies/find.js +195 -0
  84. package/lib/src/dependencies/find.js.map +1 -0
  85. package/lib/src/dependencies/import-linter.d.ts +3 -0
  86. package/lib/src/dependencies/import-linter.js +112 -0
  87. package/lib/src/dependencies/import-linter.js.map +1 -0
  88. package/lib/src/index.d.ts +2 -0
  89. package/lib/src/index.js +6 -0
  90. package/lib/src/index.js.map +1 -0
  91. package/lib/src/npm/manager.d.ts +7 -0
  92. package/lib/src/npm/manager.js +62 -0
  93. package/lib/src/npm/manager.js.map +1 -0
  94. package/lib/src/npm/package.d.ts +8 -0
  95. package/lib/src/npm/package.js +288 -0
  96. package/lib/src/npm/package.js.map +1 -0
  97. package/lib/src/npm/publish.d.ts +1 -0
  98. package/lib/src/npm/publish.js +14 -0
  99. package/lib/src/npm/publish.js.map +1 -0
  100. package/lib/src/npm/resolveLatestVersions.d.ts +3 -0
  101. package/lib/src/npm/resolveLatestVersions.js +35 -0
  102. package/lib/src/npm/resolveLatestVersions.js.map +1 -0
  103. package/lib/src/sanity/manifest.d.ts +48 -0
  104. package/lib/src/sanity/manifest.js +263 -0
  105. package/lib/src/sanity/manifest.js.map +1 -0
  106. package/lib/src/sharedFlags.d.ts +15 -0
  107. package/lib/src/sharedFlags.js +17 -0
  108. package/lib/src/sharedFlags.js.map +1 -0
  109. package/lib/src/util/command-parser.d.ts +9 -0
  110. package/lib/src/util/command-parser.js +41 -0
  111. package/lib/src/util/command-parser.js.map +1 -0
  112. package/lib/src/util/errorToUndefined.d.ts +1 -0
  113. package/lib/src/util/errorToUndefined.js +11 -0
  114. package/lib/src/util/errorToUndefined.js.map +1 -0
  115. package/lib/src/util/files.d.ts +36 -0
  116. package/lib/src/util/files.js +253 -0
  117. package/lib/src/util/files.js.map +1 -0
  118. package/lib/src/util/log.d.ts +14 -0
  119. package/lib/src/util/log.js +36 -0
  120. package/lib/src/util/log.js.map +1 -0
  121. package/lib/src/util/prompt.d.ts +13 -0
  122. package/lib/src/util/prompt.js +75 -0
  123. package/lib/src/util/prompt.js.map +1 -0
  124. package/lib/src/util/readme.d.ts +5 -0
  125. package/lib/src/util/readme.js +73 -0
  126. package/lib/src/util/readme.js.map +1 -0
  127. package/lib/src/util/request.d.ts +1 -0
  128. package/lib/src/util/request.js +19 -0
  129. package/lib/src/util/request.js.map +1 -0
  130. package/lib/src/util/user.d.ts +10 -0
  131. package/lib/src/util/user.js +106 -0
  132. package/lib/src/util/user.js.map +1 -0
  133. package/lib/test/cli.test.d.ts +1 -0
  134. package/lib/test/cli.test.js +64 -0
  135. package/lib/test/cli.test.js.map +1 -0
  136. package/lib/test/fixture-utils.d.ts +25 -0
  137. package/lib/test/fixture-utils.js +67 -0
  138. package/lib/test/fixture-utils.js.map +1 -0
  139. package/lib/test/init-verify-build.test.d.ts +1 -0
  140. package/lib/test/init-verify-build.test.js +75 -0
  141. package/lib/test/init-verify-build.test.js.map +1 -0
  142. package/lib/test/init.test.d.ts +1 -0
  143. package/lib/test/init.test.js +137 -0
  144. package/lib/test/init.test.js.map +1 -0
  145. package/lib/test/run-test-command.d.ts +1 -0
  146. package/lib/test/run-test-command.js +6 -0
  147. package/lib/test/run-test-command.js.map +1 -0
  148. package/lib/test/verify-package.test.d.ts +1 -0
  149. package/lib/test/verify-package.test.js +81 -0
  150. package/lib/test/verify-package.test.js.map +1 -0
  151. package/lib/test/version.test.d.ts +1 -0
  152. package/lib/test/version.test.js +48 -0
  153. package/lib/test/version.test.js.map +1 -0
  154. package/package.json +127 -0
  155. package/src/actions/init.ts +104 -0
  156. package/src/actions/link-watch.ts +74 -0
  157. package/src/actions/splat.ts +366 -0
  158. package/src/actions/verify/types.ts +84 -0
  159. package/src/actions/verify/validations.ts +401 -0
  160. package/src/actions/verify/verify-common.ts +92 -0
  161. package/src/actions/verify-package.ts +87 -0
  162. package/src/actions/verify-studio.ts +55 -0
  163. package/src/actions/verify.ts +328 -0
  164. package/src/cli.ts +77 -0
  165. package/src/cmds/index.ts +9 -0
  166. package/src/cmds/init.ts +85 -0
  167. package/src/cmds/link-watch.ts +51 -0
  168. package/src/cmds/splat.ts +59 -0
  169. package/src/cmds/verify-package.ts +36 -0
  170. package/src/cmds/verify-studio.ts +36 -0
  171. package/src/cmds/verify.ts +40 -0
  172. package/src/cmds/version.ts +67 -0
  173. package/src/configs/buildExtensions.ts +1 -0
  174. package/src/configs/default-source.ts +68 -0
  175. package/src/configs/merged-packages.ts +20 -0
  176. package/src/configs/uselessFiles.ts +29 -0
  177. package/src/constants.ts +13 -0
  178. package/src/dependencies/find.ts +193 -0
  179. package/src/dependencies/import-linter.ts +103 -0
  180. package/src/index.ts +4 -0
  181. package/src/npm/manager.ts +44 -0
  182. package/src/npm/package.ts +370 -0
  183. package/src/npm/publish.ts +9 -0
  184. package/src/npm/resolveLatestVersions.ts +26 -0
  185. package/src/sanity/manifest.ts +340 -0
  186. package/src/sharedFlags.ts +14 -0
  187. package/src/util/command-parser.ts +31 -0
  188. package/src/util/errorToUndefined.ts +7 -0
  189. package/src/util/files.ts +249 -0
  190. package/src/util/log.ts +44 -0
  191. package/src/util/prompt.ts +70 -0
  192. package/src/util/readme.ts +72 -0
  193. package/src/util/request.ts +13 -0
  194. package/src/util/user.ts +110 -0
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.verifyStudio = void 0;
16
+ const package_1 = require("../npm/package");
17
+ const log_1 = __importDefault(require("../util/log"));
18
+ const files_1 = require("../util/files");
19
+ const constants_1 = require("../constants");
20
+ const import_linter_1 = require("../dependencies/import-linter");
21
+ const outdent_1 = __importDefault(require("outdent"));
22
+ const chalk_1 = __importDefault(require("chalk"));
23
+ const verify_common_1 = require("./verify/verify-common");
24
+ const validations_1 = require("./verify/validations");
25
+ function verifyStudio({ basePath, flags }) {
26
+ var _a;
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ let errors = [];
29
+ const packageJson = yield (0, package_1.getPackage)({ basePath, validate: false });
30
+ const verifyConfig = ((_a = packageJson.sanityPlugin) === null || _a === void 0 ? void 0 : _a.verifyPackage) || {};
31
+ const validation = (0, verify_common_1.createValidator)(verifyConfig, flags, errors);
32
+ const tsConfig = yield (0, files_1.readJson5File)({ basePath, filename: 'tsconfig.json' });
33
+ yield validation('studioConfig', () => __awaiter(this, void 0, void 0, function* () { return (0, validations_1.validateStudioConfig)({ basePath }); }));
34
+ yield validation('dependencies', () => __awaiter(this, void 0, void 0, function* () { return (0, validations_1.validateSanityDependencies)(packageJson); }));
35
+ yield validation('eslintImports', () => __awaiter(this, void 0, void 0, function* () { return (0, import_linter_1.validateImports)({ basePath }); }));
36
+ if (errors.length) {
37
+ throw new Error((0, outdent_1.default) `
38
+ Detected validation issues!
39
+ This Sanity Studio is not completely V3 ready. Fix the issues starting from the top, or disable any checks you deem unnecessary.
40
+
41
+ More information is available here:
42
+ - Migration guide: ${constants_1.urls.migrationGuideStudio}
43
+ - Reference documentation: ${constants_1.urls.refDocs}
44
+
45
+ ${chalk_1.default.grey(`To fail-fast on first detected issue run:\nnpx ${constants_1.cliName} verify-studio --single`)}
46
+ `.trimStart());
47
+ }
48
+ yield (0, verify_common_1.runTscMaybe)(verifyConfig, tsConfig);
49
+ log_1.default.success((0, outdent_1.default) `
50
+ No outstanding upgrade issues detected. Studio is V3 ready!
51
+ `.trim());
52
+ });
53
+ }
54
+ exports.verifyStudio = verifyStudio;
55
+ //# sourceMappingURL=verify-studio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-studio.js","sourceRoot":"","sources":["../../../src/actions/verify-studio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAyC;AACzC,sDAA6B;AAC7B,yCAA2C;AAC3C,4CAA0C;AAC1C,iEAA6D;AAC7D,sDAA6B;AAC7B,kDAAyB;AACzB,0DAK+B;AAE/B,sDAAqF;AAErF,SAAsB,YAAY,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAyC;;;QAC1F,IAAI,MAAM,GAAa,EAAE,CAAA;QAEzB,MAAM,WAAW,GAAgB,MAAM,IAAA,oBAAU,EAAC,EAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAA;QAC9E,MAAM,YAAY,GAAwB,CAAA,MAAA,WAAW,CAAC,YAAY,0CAAE,aAAa,KAAI,EAAE,CAAA;QAEvF,MAAM,UAAU,GAAG,IAAA,+BAAe,EAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAE/D,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAW,EAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAC,CAAC,CAAA;QAErF,MAAM,UAAU,CAAC,cAAc,EAAE,GAAS,EAAE,gDAAC,OAAA,IAAA,kCAAoB,EAAC,EAAC,QAAQ,EAAC,CAAC,CAAA,GAAA,CAAC,CAAA;QAC9E,MAAM,UAAU,CAAC,cAAc,EAAE,GAAS,EAAE,gDAAC,OAAA,IAAA,wCAA0B,EAAC,WAAW,CAAC,CAAA,GAAA,CAAC,CAAA;QACrF,MAAM,UAAU,CAAC,eAAe,EAAE,GAAS,EAAE,gDAAC,OAAA,IAAA,+BAAe,EAAC,EAAC,QAAQ,EAAC,CAAC,CAAA,GAAA,CAAC,CAAA;QAE1E,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,IAAI,KAAK,CACb,IAAA,iBAAO,EAAA;;;;;6BAKgB,gBAAI,CAAC,oBAAoB;qCACjB,gBAAI,CAAC,OAAO;;UAEvC,eAAK,CAAC,IAAI,CACV,kDAAkD,mBAAO,yBAAyB,CACnF;OACF,CAAC,SAAS,EAAE,CACd,CAAA;SACF;QAED,MAAM,IAAA,2BAAW,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAEzC,aAAG,CAAC,OAAO,CACT,IAAA,iBAAO,EAAA;;GAER,CAAC,IAAI,EAAE,CACP,CAAA;;CACF;AAtCD,oCAsCC"}
File without changes
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ /*
3
+ import path from 'path'
4
+ //@ts-expect-error missing types
5
+ import spdxLicenseIds from 'spdx-license-ids'
6
+ import semver from 'semver'
7
+
8
+ import log from '../util/log'
9
+ import {fileExists, readJsonFile} from '../util/files'
10
+ import {readManifest, getReferencesPartPaths} from '../sanity/manifest'
11
+ import {getPackage, getReferencedPaths} from '../npm/package'
12
+ import {getPublishableFiles} from '../npm/publish'
13
+ import {findDependencies} from '../dependencies/find'
14
+ import {uselessFiles} from '../configs/uselessFiles'
15
+
16
+ export async function verify({basePath, flags}) {
17
+ const pkg = await getPackage({basePath, flags})
18
+ const manifest = await readManifest({
19
+ basePath,
20
+ pluginName: pkg.name,
21
+ flags,
22
+ verifyCompiledParts: true,
23
+ verifySourceParts: true,
24
+ })
25
+
26
+ // Get all files intended to be published from npm
27
+ const publishableFiles = await getPublishableFiles(basePath)
28
+
29
+ // Errors
30
+ await verifyPublishableFiles({basePath, pkg, manifest, publishableFiles})
31
+ await verifyLicenseKey(pkg)
32
+ await verifyPluginConfig(basePath)
33
+ await verifyImports({pkg, manifest, basePath})
34
+
35
+ // Warnings
36
+ const hasWarnings = await warnOnUselessFiles(publishableFiles)
37
+
38
+ // Huzzah
39
+ log.success(
40
+ hasWarnings
41
+ ? 'Plugin has warnings, but looks good to publish!'
42
+ : 'Plugin looks good to publish!'
43
+ )
44
+ }
45
+
46
+ async function verifyPublishableFiles({pkg, manifest, basePath, publishableFiles}) {
47
+ // Validate that these files exists, not just that they are publishable
48
+ if (!(await fileExists(path.resolve(basePath, 'README.md')))) {
49
+ throw new Error(
50
+ `This plugin does not contain a README.md, which is required for Sanity plugins.`
51
+ )
52
+ }
53
+
54
+ const [hasLicense, hasLicenseMd] = await Promise.all([
55
+ fileExists(path.resolve(basePath, 'LICENSE')),
56
+ fileExists(path.resolve(basePath, 'LICENSE.md')),
57
+ ])
58
+
59
+ if (!hasLicense && !hasLicenseMd) {
60
+ throw new Error(
61
+ `This plugin does not contain a LICENSE-file, which is required for Sanity plugins.`
62
+ )
63
+ }
64
+
65
+ // Always, uhm... "kindly suggest", to include these files
66
+ const files = ['README.md']
67
+ // Get files from parts as well as the ones references in package.json
68
+ .concat(getReferencesPartPaths(manifest, basePath), getReferencedPaths(pkg, basePath))
69
+ // Make all paths relative to base path
70
+ .map((file) =>
71
+ path.relative(basePath, path.isAbsolute(file) ? file : path.resolve(basePath, file))
72
+ )
73
+ // Remove duplicates
74
+ .filter((file, index, arr) => arr.indexOf(file, index + 1) === -1)
75
+
76
+ // Verify that all explicitly referenced files are publishable
77
+ const unpublishable = files.filter((file) => !publishableFiles.includes(file))
78
+
79
+ // Warn with "default error" for unknowns
80
+ const unknowns = unpublishable.filter((item) => item !== 'README.md').map((file) => `"${file}"`)
81
+
82
+ if (unknowns.length > 0) {
83
+ const paths = unknowns.join(', ')
84
+ throw new Error(
85
+ `This plugin references files that are ignored from being published: ${paths}. Check .gitignore, .npmignore and/or the "files" property of package.json. See https://docs.npmjs.com/using-npm/developers.html#keeping-files-out-of-your-package for more information.`
86
+ )
87
+ }
88
+ }
89
+
90
+ function verifyLicenseKey(pkg) {
91
+ if (!pkg.license) {
92
+ throw new Error(
93
+ `package.json is missing "license" key: see https://docs.npmjs.com/files/package.json#license and make sure it matches your "LICENSE" file. See https://choosealicense.com/ for help on choosing a license.`
94
+ )
95
+ }
96
+
97
+ if (pkg.license !== 'UNLICENSED' && !spdxLicenseIds.includes(pkg.license)) {
98
+ throw new Error(
99
+ `package.json has an invalid "license" key: it should be either an SPDX license ID (https://spdx.org/licenses/) or "UNLICENSE". See https://docs.npmjs.com/files/package.json#license and refer to https://choosealicense.com/ for help on choosing a license.`
100
+ )
101
+ }
102
+ }
103
+
104
+ async function verifyPluginConfig(basePath) {
105
+ const configPath = path.join(basePath, 'config.dist.json')
106
+ if (!(await fileExists(configPath))) {
107
+ return
108
+ }
109
+
110
+ let config
111
+ try {
112
+ config = await readJsonFile(configPath)
113
+ } catch (err: any) {
114
+ throw new Error(`Error reading plugin config (${configPath}): ${err.message}`)
115
+ }
116
+
117
+ if (typeof config !== 'object' || Array.isArray(config) || !config) {
118
+ throw new Error(
119
+ `Error reading plugin config (${configPath}): must be an object, got:\n${JSON.stringify(
120
+ config,
121
+ null,
122
+ 2
123
+ )}`
124
+ )
125
+ }
126
+ }
127
+
128
+ function warnOnUselessFiles(files) {
129
+ const warnFor = files
130
+ .filter(
131
+ (file) =>
132
+ uselessFiles.includes(file) ||
133
+ uselessFiles.some((useless) => file.startsWith(`${useless}/`))
134
+ )
135
+ .map((file) => `"${file}"`)
136
+ .join(', ')
137
+
138
+ if (warnFor.length === 0) {
139
+ return false
140
+ }
141
+
142
+ log.warn(
143
+ `This plugin is set to publish the following files, which are generally not needed in a published npm module: ${warnFor}.`
144
+ )
145
+ log.warn(
146
+ `Consider adding these files to an .npmignore or the package.json "files" property. See https://docs.npmjs.com/using-npm/developers.html#keeping-files-out-of-your-package for more information.`
147
+ )
148
+
149
+ return true
150
+ }
151
+
152
+ async function verifyImports({pkg, manifest, basePath}) {
153
+ // "Entry" as in... code may start here.
154
+ const entries = ([] as string[])
155
+ .concat(
156
+ getReferencedPaths(pkg, basePath), // From npm
157
+ getReferencesPartPaths(manifest, basePath) // From parts
158
+ )
159
+ // Remove duplicates
160
+ .filter((file, index, arr) => arr.indexOf(file, index + 1) === -1)
161
+ // Remove non-javascript/non-css entries
162
+ .filter((file) => ['.js', '.css'].includes(path.extname(file)))
163
+
164
+ const dependencies = findDependencies(entries)
165
+ const modules = dependencies.filter((dep) => !/^(all|part|config|sanity):/.test(dep))
166
+
167
+ await verifyNoUndeclaredDependencies(modules, pkg)
168
+ await verifyReactDependencies(modules, pkg)
169
+ await verifyUiDependencies(modules, pkg)
170
+ await verifyConfigParts(dependencies, pkg, basePath)
171
+ await verifyNoUnusedDependencies(modules, pkg)
172
+ await verifyNoUndeclaredParts(dependencies, pkg, manifest)
173
+ }
174
+
175
+ function verifyNoUndeclaredParts(dependencies, pkg, manifest) {
176
+ const parts = dependencies
177
+ .filter((dep) => dep.startsWith('all:') || dep.startsWith('part:'))
178
+ .map((part) => part.replace(/^all:/, ''))
179
+ .map((part) => part.replace(/\?$/, ''))
180
+ .filter((part) => part.startsWith(`part:${pkg.name.replace(/^sanity-plugin-/, '')}`))
181
+
182
+ const declaredParts = (manifest.parts || []).reduce(
183
+ (partNames, part) => [...partNames, ...[part.name, part.implements].filter(Boolean)],
184
+ []
185
+ )
186
+ const undeclaredParts = parts.filter((partName) => !declaredParts.includes(partName))
187
+
188
+ if (undeclaredParts.length > 0) {
189
+ const aPart = undeclaredParts.length > 1 ? 'parts' : 'a part'
190
+ const is = undeclaredParts.length > 1 ? 'are' : 'is'
191
+ const partList = undeclaredParts.map((part) => `"${part}"`).join(', ')
192
+ throw new Error(
193
+ `Invalid plugin: Source is using ${aPart} that ${is} not declared in "sanity.json":\n\n${partList}.`
194
+ )
195
+ }
196
+ }
197
+
198
+ function verifyNoUnusedDependencies(modules, pkg) {
199
+ const potentiallyUnused = Object.keys(pkg.dependencies || {}).filter(
200
+ (dep) => !modules.includes(dep)
201
+ )
202
+
203
+ if (potentiallyUnused.length > 0) {
204
+ const unusedNames = potentiallyUnused.map((dep) => `"${dep}"`).join(', ')
205
+ log.warn(`Found modules listed as dependencies which seem to be unused by code: ${unusedNames}`)
206
+ }
207
+ }
208
+
209
+ function verifyReactDependencies(modules, pkg) {
210
+ if (modules.includes('react') && 'react' in (pkg.dependencies || {})) {
211
+ throw new Error(
212
+ `Invalid plugin: "react" declared as a dependency - it should be declared as a peerDependency (package.json)`
213
+ )
214
+ }
215
+
216
+ if (modules.includes('react-dom') && 'react-dom' in (pkg.dependencies || {})) {
217
+ throw new Error(
218
+ `Invalid plugin: "react-dom" declared as a dependency - it should be declared as a peerDependency (package.json)`
219
+ )
220
+ }
221
+
222
+ if (modules.includes('prop-types') && 'prop-types' in (pkg.peerDependencies || {})) {
223
+ throw new Error(
224
+ `Invalid plugin: "prop-types" declares as peerDependency - it should be declared as a dependency (package.json)`
225
+ )
226
+ }
227
+ }
228
+
229
+ function verifyUiDependencies(modules, pkg) {
230
+ const peerDependencies = pkg.peerDependencies || {}
231
+ const dependencies = pkg.dependencies || {}
232
+
233
+ if (modules.includes('@sanity/ui') && '@sanity/ui' in peerDependencies) {
234
+ throw new Error(
235
+ `Invalid plugin: "@sanity/ui" declared as a peer dependency - it should be declared as a dependency (package.json)`
236
+ )
237
+ }
238
+
239
+ if (
240
+ modules.includes('@sanity/ui') &&
241
+ dependencies['@sanity/ui'] &&
242
+ semver.lt(semver.minVersion(dependencies['@sanity/ui']), '0.33.1')
243
+ ) {
244
+ throw new Error(
245
+ `Invalid plugin: "@sanity/ui" dependency must use version higher than or equal to 0.33.1 (package.json)`
246
+ )
247
+ }
248
+
249
+ if (modules.includes('@sanity/icons') && '@sanity/icons' in peerDependencies) {
250
+ throw new Error(
251
+ `Invalid plugin: "@sanity/icons" declared as a peer dependency - it should be declared as a dependency (package.json)`
252
+ )
253
+ }
254
+ }
255
+
256
+ async function verifyConfigParts(dependencies, pkg, basePath) {
257
+ const configName = `config:${pkg.name.replace(/^sanity-plugin-/, '')}`
258
+ if (
259
+ dependencies.includes(configName) &&
260
+ !(await fileExists(path.join(basePath, 'config.dist.json')))
261
+ ) {
262
+ throw new Error(
263
+ `Plugin imports plugin config (${configName}) but does not contain a "config.dist.json" file.`
264
+ )
265
+ }
266
+
267
+ const nonPluginConfigs = dependencies.filter(
268
+ (dep) => dep.startsWith('config:') && dep !== configName
269
+ )
270
+
271
+ if (nonPluginConfigs.length > 0) {
272
+ const configs = nonPluginConfigs.length > 1 ? 'configs' : 'config'
273
+ const nonPluginConfigNames = nonPluginConfigs.join(', ')
274
+ log.warn(
275
+ `Found references to external ${configs}: ${nonPluginConfigNames} - this is generally considered unsafe`
276
+ )
277
+ }
278
+ }
279
+
280
+ function verifyNoUndeclaredDependencies(modules, pkg) {
281
+ const undeclared = getUndeclaredDependencies(modules, pkg)
282
+ if (undeclared.length > 0) {
283
+ throw new Error(getUndeclaredDependenciesError(undeclared))
284
+ }
285
+ }
286
+
287
+ function getUndeclaredDependencies(modules, pkg) {
288
+ const deps = ([] as string[]).concat(
289
+ Object.keys(pkg.dependencies || {}),
290
+ Object.keys(pkg.peerDependencies || {})
291
+ )
292
+
293
+ const devDeps = Object.keys(pkg.devDependencies || {})
294
+
295
+ return modules
296
+ .filter((modDep) => !deps.includes(modDep))
297
+ .map((modDep) => ({
298
+ dependency: modDep,
299
+ isDevDep: devDeps.includes(modDep),
300
+ }))
301
+ }
302
+
303
+ function getUndeclaredDependenciesError(undeclared) {
304
+ const baseError = `Invalid plugin`
305
+ const moduleNames = undeclared.map((mod) => mod.dependency)
306
+
307
+ let declaredWhere = `should be declared in package.json under "dependencies" or "peerDependencies".`
308
+ if (moduleNames.length === 1 && moduleNames[0] === 'react') {
309
+ declaredWhere = `should be declared in package.json under "peerDependencies"`
310
+ } else if (moduleNames.includes('react')) {
311
+ declaredWhere = `should either be declared in package.json under "dependencies" or "peerDependencies" (react should be in "peerDependencies").`
312
+ }
313
+
314
+ const devDeps = undeclared.filter((dep) => dep.isDevDep).map((dep) => ` - ${dep.dependency}\n`)
315
+ if (devDeps.length > 0) {
316
+ const modules = devDeps.length > 1 ? 'modules' : 'module'
317
+ const depList = devDeps.join('')
318
+ const target = devDeps.length > 1 ? 'They' : 'It'
319
+ const are = devDeps.length > 1 ? 'are' : 'is'
320
+ return `${baseError}: Source uses ${modules} that ${are} declared in "devDependencies":\n\n${depList}\n${target} ${declaredWhere}`
321
+ }
322
+
323
+ const modules = undeclared.length > 1 ? 'modules' : 'module'
324
+ const depList = undeclared.map((dep) => ` - ${dep.dependency}\n`).join('')
325
+ const target = undeclared.length > 1 ? 'They' : 'It'
326
+ const are = undeclared.length > 1 ? 'are' : 'is'
327
+ return `${baseError}: Source uses ${modules} that ${are} not declared as dependencies:\n\n${depList}\n${target} ${declaredWhere}`
328
+ }
329
+ */
330
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/actions/verify.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuUE"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function cliEntry(argv?: string[], autoExit?: boolean): Promise<void>;
package/lib/src/cli.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.cliEntry = void 0;
17
+ const meow_1 = __importDefault(require("meow"));
18
+ const log_1 = __importDefault(require("./util/log"));
19
+ const cmds_1 = __importDefault(require("./cmds"));
20
+ const sharedFlags_1 = __importDefault(require("./sharedFlags"));
21
+ const constants_1 = require("./constants");
22
+ function cliEntry(argv = process.argv, autoExit = true) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const cli = (0, meow_1.default)(`
25
+ Usage
26
+ $ ${constants_1.cliName} [--help] [--debug] <command> [<args>]
27
+
28
+ These are common commands used in various situations:
29
+
30
+ init Create a new Sanity plugin
31
+ verify-package Check that a Sanity plugin package follows V3 conventions. Prints upgrade steps.
32
+ verify-studio Check that a Sanity Studio follows V3 conventions. Prints upgrade steps.
33
+ link-watch Recompiles plugin automatically on changes and runs yalc push --publish
34
+ version Show the version of ${constants_1.cliName} currently installed
35
+
36
+ Options
37
+ --silent Do not print info and warning messages
38
+ --verbose Log everything. This option conflicts with --silent
39
+ --debug Print stack trace on errors
40
+ --version Output the version number
41
+ --help Output usage information
42
+
43
+ Examples
44
+ # Init a new plugin in current directory
45
+ $ ${constants_1.cliName} init
46
+
47
+ # Init a new plugin in my-sanity-plugin directory
48
+ $ ${constants_1.cliName} init my-sanity-plugin
49
+
50
+ # Check that a Sanity plugin package in current directory follows V3 conventions
51
+ $ ${constants_1.cliName} verify-package
52
+
53
+ # Check that a Sanity Studio in current directory follows V3 conventions
54
+ $ ${constants_1.cliName} verify-studio
55
+ `, {
56
+ autoHelp: false,
57
+ flags: sharedFlags_1.default,
58
+ argv: argv.slice(2),
59
+ });
60
+ const commandName = cli.input[0];
61
+ if (!commandName) {
62
+ cli.showHelp(); // Exits
63
+ }
64
+ if (!(commandName in cmds_1.default)) {
65
+ console.error(`Unknown command "${commandName}"`);
66
+ cli.showHelp(); // Exits
67
+ }
68
+ if (cli.flags.silent && cli.flags.verbose) {
69
+ log_1.default.error(`--silent and --verbose are mutually exclusive`);
70
+ cli.showHelp(); // Exits
71
+ }
72
+ // Lazy-load command
73
+ const cmd = require(cmds_1.default[commandName]).default;
74
+ try {
75
+ log_1.default.setVerbosity(cli.flags);
76
+ yield cmd({ argv: argv.slice(3) });
77
+ }
78
+ catch (err) {
79
+ log_1.default.error(err instanceof TypeError || cli.flags.debug ? err.stack : err.message);
80
+ // eslint-disable-next-line no-process-exit
81
+ process.exit(1);
82
+ }
83
+ });
84
+ }
85
+ exports.cliEntry = cliEntry;
86
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,YAAY,CAAA;;;;;;;;;;;;;;;AACZ,gDAAuB;AACvB,qDAA4B;AAC5B,kDAA6B;AAC7B,gEAAuC;AACvC,2CAAmC;AAEnC,SAAsB,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;;QACjE,MAAM,GAAG,GAAG,IAAA,cAAI,EACd;;OAEG,mBAAO;;;;;;;;0CAQ4B,mBAAO;;;;;;;;;;;QAWzC,mBAAO;;;QAGP,mBAAO;;;QAGP,mBAAO;;;QAGP,mBAAO;CACd,EACG;YACE,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,qBAAW;YAClB,IAAI,EAAE,IAAI,CAA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+ version: string;
7
+ };
8
+ export default _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ init: require.resolve('./init'),
5
+ 'link-watch': require.resolve('./link-watch'),
6
+ 'verify-package': require.resolve('./verify-package'),
7
+ 'verify-studio': require.resolve('./verify-studio'),
8
+ version: require.resolve('./version'),
9
+ // wont make it for initial release
10
+ //splat: require.resolve('./splat'),
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cmds/index.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;IAC7C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrD,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;IACnD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IACrC,mCAAmC;IACnC,oCAAoC;CACrC,CAAA"}
@@ -0,0 +1,4 @@
1
+ declare function run({ argv }: {
2
+ argv: string[];
3
+ }): Promise<void>;
4
+ export default run;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const path_1 = __importDefault(require("path"));
16
+ const meow_1 = __importDefault(require("meow"));
17
+ const log_1 = __importDefault(require("../util/log"));
18
+ const init_1 = require("../actions/init");
19
+ const files_1 = require("../util/files");
20
+ const manager_1 = require("../npm/manager");
21
+ const manifest_1 = require("../sanity/manifest");
22
+ const prompt_1 = require("../util/prompt");
23
+ const constants_1 = require("../constants");
24
+ const description = `Initialize a new Sanity plugin`;
25
+ const help = `
26
+ Usage
27
+ $ ${constants_1.cliName} init [dir] [<args>]
28
+
29
+ Options
30
+ --no-eslint Disables ESLint config and dependencies from being added
31
+ --no-prettier Disables prettier config and dependencies from being added
32
+ --no-typescript Disables typescript config and dependencies from being added
33
+ --no-license Disables LICENSE + package.json license field from being added
34
+ --no-editorconfig Disables .editorconfig from being added
35
+ --no-gitignore Disables .gitignore from being added
36
+ --no-scripts Disables scripts from being added to package.json
37
+ --no-install Disables automatically running package manager install
38
+
39
+ --name [package-name] Use the provided package-name
40
+ --author [name] Use the provided author
41
+ --repo [url] Use the provided repo url
42
+ --license [spdx] Use the license with the given SPDX identifier
43
+ --force No promt when overwriting files
44
+
45
+ Examples
46
+ # Initialize a new plugin in the current directory
47
+ $ ${constants_1.cliName} init
48
+
49
+ # Initialize a plugin in the directory ~/my-plugin
50
+ $ ${constants_1.cliName} init ~/my-plugin
51
+
52
+ # Don't add eslint or prettier
53
+ $ ${constants_1.cliName} init --no-eslint --no-prettier
54
+ `;
55
+ function run({ argv }) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const cli = (0, meow_1.default)(help, { flags: init_1.initFlags, argv, description });
58
+ const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
59
+ const { exists, isRoot } = yield (0, manifest_1.hasSanityJson)(basePath);
60
+ if (exists && isRoot) {
61
+ throw new Error(`sanity.json has a "root" property set to true - are you trying to init into a studio instead of a plugin?`);
62
+ }
63
+ const { v3ConfigFile } = yield (0, manifest_1.findStudioV3Config)(basePath);
64
+ if (v3ConfigFile) {
65
+ throw new Error(`${v3ConfigFile} exsists - are you trying to init into a studio instead of a plugin?`);
66
+ }
67
+ log_1.default.info('Initializing new plugin in "%s"', basePath);
68
+ if (!cli.flags.force &&
69
+ !(yield (0, files_1.isEmptyish)(basePath)) &&
70
+ !(yield (0, prompt_1.prompt)('Directory is not empty, proceed?', { type: 'confirm', default: false }))) {
71
+ log_1.default.error('Directory is not empty. Cancelled.');
72
+ return;
73
+ }
74
+ yield (0, files_1.ensureDir)(basePath);
75
+ yield (0, init_1.init)({ basePath, flags: cli.flags });
76
+ if (cli.flags.install) {
77
+ if (yield (0, manager_1.installDependencies)(yield (0, manager_1.promptForPackageManager)(), { cwd: basePath })) {
78
+ log_1.default.info('Done!');
79
+ }
80
+ else {
81
+ log_1.default.error('Failed to install dependencies, try manually running `npm install`');
82
+ }
83
+ }
84
+ else {
85
+ log_1.default.info('Dependency installation skipped.');
86
+ }
87
+ });
88
+ }
89
+ exports.default = run;
90
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cmds/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,gDAAuB;AACvB,sDAA6B;AAC7B,0CAA+C;AAC/C,yCAAmD;AACnD,4CAA2E;AAC3E,iDAAoE;AACpE,2CAAqC;AACrC,4CAAoC;AAEpC,MAAM,WAAW,GAAG,gCAAgC,CAAA;AAEpD,MAAM,IAAI,GAAG;;MAEP,mBAAO;;;;;;;;;;;;;;;;;;;;MAoBP,mBAAO;;;MAGP,mBAAO;;;MAGP,mBAAO;CACZ,CAAA;AAED,SAAe,GAAG,CAAC,EAAC,IAAI,EAAmB;;QACzC,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,gBAAS,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC,C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