@sanity/plugin-kit 3.1.7 → 3.1.9

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 (57) hide show
  1. package/assets/inject/semver-workflow/.github/workflows/main.yml +13 -10
  2. package/dist/_chunks/{cli-7e8e9944.js → cli-a67211d1.js} +7 -7
  3. package/dist/_chunks/cli-a67211d1.js.map +1 -0
  4. package/dist/_chunks/{init-09ede150.js → init-2d09de2c.js} +4 -4
  5. package/dist/_chunks/init-2d09de2c.js.map +1 -0
  6. package/dist/_chunks/{init-2e964d91.js → init-50b074f7.js} +5 -5
  7. package/dist/_chunks/init-50b074f7.js.map +1 -0
  8. package/dist/_chunks/{inject-998410a7.js → inject-ef0110b8.js} +4 -4
  9. package/dist/_chunks/{inject-998410a7.js.map → inject-ef0110b8.js.map} +1 -1
  10. package/dist/_chunks/{link-watch-aff484af.js → link-watch-2e480365.js} +4 -4
  11. package/dist/_chunks/link-watch-2e480365.js.map +1 -0
  12. package/dist/_chunks/{package-9a9abcc4.js → package-9cfb2864.js} +26 -21
  13. package/dist/_chunks/{package-9a9abcc4.js.map → package-9cfb2864.js.map} +1 -1
  14. package/dist/_chunks/{package-a73ac254.js → package-f7519d2d.js} +6 -4
  15. package/dist/_chunks/package-f7519d2d.js.map +1 -0
  16. package/dist/_chunks/{ts-01bd6fdc.js → ts-e380acbd.js} +3 -3
  17. package/dist/_chunks/ts-e380acbd.js.map +1 -0
  18. package/dist/_chunks/{verify-package-8b8b38d4.js → verify-package-6a34ec23.js} +4 -4
  19. package/dist/_chunks/verify-package-6a34ec23.js.map +1 -0
  20. package/dist/_chunks/{verify-studio-541170dd.js → verify-studio-34a9971f.js} +4 -4
  21. package/dist/_chunks/verify-studio-34a9971f.js.map +1 -0
  22. package/dist/_chunks/{version-acdf225d.js → version-d009c876.js} +3 -3
  23. package/dist/_chunks/version-d009c876.js.map +1 -0
  24. package/dist/cli.js +1 -1
  25. package/package.json +24 -20
  26. package/src/actions/inject.ts +4 -4
  27. package/src/actions/link-watch.ts +2 -2
  28. package/src/actions/verify/types.ts +1 -1
  29. package/src/actions/verify/validations.ts +13 -13
  30. package/src/actions/verify/verify-common.ts +4 -4
  31. package/src/actions/verify-package.ts +6 -6
  32. package/src/actions/verify-studio.ts +3 -3
  33. package/src/cli.ts +1 -1
  34. package/src/cmds/init.ts +2 -2
  35. package/src/cmds/inject.ts +1 -1
  36. package/src/cmds/version.ts +1 -1
  37. package/src/npm/package.ts +12 -12
  38. package/src/npm/publish.ts +1 -1
  39. package/src/npm/resolveLatestVersions.ts +4 -2
  40. package/src/presets/presets.ts +2 -2
  41. package/src/presets/renovatebot.ts +1 -1
  42. package/src/presets/semver-workflow.ts +3 -3
  43. package/src/presets/ui-workshop.ts +2 -2
  44. package/src/presets/ui.ts +4 -4
  45. package/src/sanity/manifest.ts +18 -18
  46. package/src/util/files.ts +4 -4
  47. package/src/util/prompt.ts +1 -1
  48. package/src/util/user.ts +2 -2
  49. package/dist/_chunks/cli-7e8e9944.js.map +0 -1
  50. package/dist/_chunks/init-09ede150.js.map +0 -1
  51. package/dist/_chunks/init-2e964d91.js.map +0 -1
  52. package/dist/_chunks/link-watch-aff484af.js.map +0 -1
  53. package/dist/_chunks/package-a73ac254.js.map +0 -1
  54. package/dist/_chunks/ts-01bd6fdc.js.map +0 -1
  55. package/dist/_chunks/verify-package-8b8b38d4.js.map +0 -1
  56. package/dist/_chunks/verify-studio-541170dd.js.map +0 -1
  57. package/dist/_chunks/version-acdf225d.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-studio-34a9971f.js","sources":["../../src/actions/verify-studio.ts","../../src/cmds/verify-studio.ts"],"sourcesContent":["import {loadConfig as loadPackageConfig} from '@sanity/pkg-utils'\nimport {getPackage} from '../npm/package'\nimport log from '../util/log'\nimport {cliName, urls} from '../constants'\nimport {validateImports} from '../dependencies/import-linter'\nimport outdent from 'outdent'\nimport chalk from 'chalk'\nimport {\n createValidator,\n runTscMaybe,\n VerifyFlags,\n VerifyPackageConfig,\n} from './verify/verify-common'\nimport {PackageJson} from './verify/types'\nimport {validateSanityDependencies, validateStudioConfig} from './verify/validations'\nimport {readTSConfig} from '../util/ts'\n\nexport async function verifyStudio({basePath, flags}: {basePath: string; flags: VerifyFlags}) {\n let errors: string[] = []\n\n const packageJson: PackageJson = await getPackage({basePath, validate: false})\n const verifyConfig: VerifyPackageConfig = packageJson.sanityPlugin?.verifyPackage || {}\n const packageConfig = await loadPackageConfig({cwd: basePath})\n const tsconfig = packageConfig?.tsconfig ?? 'tsconfig.json'\n\n const validation = createValidator(verifyConfig, flags, errors)\n\n const ts = await readTSConfig({basePath, filename: tsconfig})\n\n await validation('studioConfig', async () => validateStudioConfig({basePath}))\n await validation('dependencies', async () => validateSanityDependencies(packageJson))\n await validation('eslintImports', async () => validateImports({basePath}))\n\n if (errors.length) {\n throw new Error(\n outdent`\n Detected validation issues!\n This Sanity Studio is not completely V3 ready. Fix the issues starting from the top, or disable any checks you deem unnecessary.\n\n More information is available here:\n - Migration guide: ${urls.migrationGuideStudio}\n - Reference documentation: ${urls.refDocs}\n\n ${chalk.grey(\n `To fail-fast on first detected issue run:\\nnpx ${cliName} verify-studio --single`,\n )}\n `.trimStart(),\n )\n }\n\n await runTscMaybe(verifyConfig, ts)\n\n log.success(\n outdent`\n No outstanding upgrade issues detected. Studio is V3 ready!\n `.trim(),\n )\n}\n","import path from 'path'\nimport meow from 'meow'\nimport {cliName} from '../constants'\nimport {verifyFlags} from '../actions/verify/verify-common'\nimport {verifyStudio} from '../actions/verify-studio'\n\nconst description = `Verify that a Sanity Studio is configured correctly for v3, and print upgrade steps if not.`\n\nconst help = `\nUsage\n $ ${cliName} verify-studio [dir] [<args>]\n\nOptions\n --single Enables fail-fast mode: Will only output the first validation that fails.\n --silent Do not print info and warning messages\n --verbose Log everything. This option conflicts with --silent\n --version Output the version number\n --help Output usage information\n\nEach check will describe how they can be individually disabled.\n\nExamples\n # Verify Sanity Studio in current directory\n $ ${cliName} verify-studio\n\n # Verify Sanity Studio in my-sanity-studio directory in silent mode\n $ ${cliName} verify-studio my-sanity-studio --silent\n`\n\nfunction run({argv}: {argv: string[]}) {\n const cli = meow(help, {flags: verifyFlags, argv, description})\n const basePath = path.resolve(cli.input[0] || process.cwd())\n return verifyStudio({basePath, flags: cli.flags})\n}\n\nexport default run\n"],"names":["verifyStudio","_ref","_ref2","basePath","flags","_a","errors","packageJson","getPackage","validate","verifyConfig","sanityPlugin","verifyPackage","packageConfig","loadPackageConfig","loadConfig","cwd","tsconfig","validation","createValidator","ts","readTSConfig","filename","validateStudioConfig","validateSanityDependencies","validateImports","length","Error","outdent","_templateObject","_taggedTemplateLiteral","urls","migrationGuideStudio","refDocs","chalk","default","grey","concat","cliName","trimStart","runTscMaybe","log","success","_templateObject2","trim","description","help","run","_ref3","argv","cli","meow","verifyFlags","path","resolve","input","process"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,eAAsBA,YAAaA,CAAAC,IAAA,EAA2D;EAAA,IAAAC,KAAA;EAAA,IAA3D;IAACC,QAAU;IAAAC;GAAgD,GAAAH,IAAA;EAjB9F,IAAAI,EAAA;EAkBE,IAAIC,SAAmB,EAAC;EAExB,MAAMC,cAA2B,MAAMC,mBAAA,CAAW;IAACL,QAAU;IAAAM,QAAA,EAAU;GAAM,CAAA;EAC7E,MAAMC,YAAoC,GAAA,CAAA,CAAAL,EAAA,GAAAE,WAAA,CAAYI,YAAZ,KAAA,IAAA,GAAA,KAAA,CAAA,GAAAN,EAAA,CAA0BO,kBAAiB,CAAA,CAAC;EACtF,MAAMC,gBAAgB,MAAMC,QAAA,CAAAC,UAAA,CAAkB;IAACC,GAAA,EAAKb;EAAS,CAAA,CAAA;EACvD,MAAAc,QAAA,IAAAf,KAAA,GAAWW,+CAAeI,QAAY,cAAAf,KAAA,cAAAA,KAAA,GAAA,eAAA;EAE5C,MAAMgB,UAAa,GAAAC,EAAA,CAAAA,eAAA,CAAgBT,YAAc,EAAAN,KAAA,EAAOE,MAAM,CAAA;EAE9D,MAAMc,OAAK,MAAMC,eAAA,CAAa;IAAClB,QAAU;IAAAmB,QAAA,EAAUL;GAAS,CAAA;EAE5D,MAAMC,WAAW,cAAgB,EAAA,YAAYK,8BAAqB;IAACpB;EAAS,CAAA,CAAC,CAAA;EAC7E,MAAMe,UAAW,CAAA,cAAA,EAAgB,YAAYM,QAAAA,CAAAA,0BAAA,CAA2BjB,WAAW,CAAC,CAAA;EACpF,MAAMW,WAAW,eAAiB,EAAA,YAAYO,mBAAgB;IAACtB;EAAS,CAAA,CAAC,CAAA;EAEzE,IAAIG,OAAOoB,MAAQ,EAAA;IACjB,MAAM,IAAIC,KAAA,CACRC,wBAAA,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,yUAKuBC,GAAAA,CAAAA,KAAKC,oBAAoB,EACjBD,GAAAA,CAAAA,KAAKE,OAAO,EAEvCC,cAAM,CAAAC,OAAA,CAAAC,IAAA,mDAAAC,MAAA,CAC4CC,GAAAA,CAAAA,OAAO,4BAAA,CAC1D,EACDC,SAAU,CAAA,CAAA,CACd;EACF;EAEM,MAAAC,EAAA,CAAAA,WAAA,CAAY9B,cAAcU,IAAE,CAAA;EAE9BqB,GAAAA,CAAAA,GAAA,CAAAC,OAAA,CACFd,wBAAA,CAAAe,gBAAA,KAAAA,gBAAA,GAAAb,sBAAA,8EAEAc,IAAK,CAAA,CAAA,CACP;AACF;ACnDA,MAAMC,WAAc,gGAAA;AAEpB,MAAMC,IAAO,mBAAAT,MAAA,CAEPC,WAAO,+dAAAD,MAAA,CAaPC,WAAO,mGAAAD,MAAA,CAGPC,WAAO,+CAAA;AAGb,SAASS,GAAAA,CAAAC,KAAA,EAA8B;EAAA,IAA1B;IAACC;GAAyB,GAAAD,KAAA;EAC/B,MAAAE,GAAA,GAAMC,sBAAKL,IAAM,EAAA;IAAC1C,OAAOgD,cAAa;IAAAH,IAAA;IAAMJ;GAAY,CAAA;EACxD,MAAA1C,QAAA,GAAWkD,sBAAKC,OAAQ,CAAAJ,GAAA,CAAIK,MAAM,CAAC,CAAA,IAAKC,OAAQ,CAAAxC,GAAA,CAAA,CAAK,CAAA;EAC3D,OAAOhB,aAAa;IAACG,QAAA;IAAUC,KAAO,EAAA8C,GAAA,CAAI9C;GAAM,CAAA;AAClD;"}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var meow = require('meow');
4
- var _package = require('./package-9a9abcc4.js');
5
- var cli = require('./cli-7e8e9944.js');
4
+ var _package = require('./package-9cfb2864.js');
5
+ var cli = require('./cli-a67211d1.js');
6
6
  function _interopDefaultCompat(e) {
7
7
  return e && typeof e === 'object' && 'default' in e ? e : {
8
8
  default: e
@@ -51,4 +51,4 @@ function run(_ref) {
51
51
  cli.log.msg(versionParts[partIndex]);
52
52
  }
53
53
  exports.default = run;
54
- //# sourceMappingURL=version-acdf225d.js.map
54
+ //# sourceMappingURL=version-d009c876.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-d009c876.js","sources":["../../src/cmds/version.ts"],"sourcesContent":["import meow from 'meow'\nimport pkg from '../../package.json'\nimport log from '../util/log'\nimport sharedFlags from '../sharedFlags'\n\nconst description = `Show the installed version of ${pkg.name}`\n\nconst help = `\nUsage\n $ ${pkg.binname} version\n\nOptions\n --major Show only the major version\n --minor Show only the minor version\n --patch Show only the patch version\n\nExamples\n $ ${pkg.binname} version\n ${pkg.name} version ${pkg.version}\n\n $ ${pkg.binname} version --major\n ${pkg.version.split('.')[0]}\n`\n\nconst flags = {\n ...sharedFlags,\n\n major: {\n type: 'boolean',\n default: false,\n },\n\n minor: {\n type: 'boolean',\n default: false,\n },\n\n patch: {\n type: 'boolean',\n default: false,\n },\n} as const\n\nfunction run({argv}: {argv: string[]}) {\n const cli = meow(help, {flags, argv, description})\n const versionParts = pkg.version.split('.')\n const versionNames = ['major', 'minor', 'patch']\n const versionFlags = versionNames.filter((flagName) => cli.flags[flagName])\n const versionFlag = versionFlags[0]\n const numVersionFlags = versionFlags.length\n\n if (numVersionFlags === 0) {\n log.msg(`${pkg.name} version ${pkg.version}`)\n return\n }\n\n if (numVersionFlags > 1) {\n throw new Error(\n `--major, --minor and --patch are mutually exclusive - only one can be used at a time`,\n )\n }\n\n const partIndex = versionNames.indexOf(versionFlag)\n log.msg(versionParts[partIndex])\n}\n\nexport default run\n"],"names":["description","concat","pkg","name","help","binname","version","split","flags","sharedFlags","major","type","default","minor","patch","run","_ref","argv","cli","meow","versionParts","versionNames","versionFlags","filter","flagName","versionFlag","numVersionFlags","length","log","msg","Error","partIndex","indexOf"],"mappings":";;;;;;;;;;;AAKA,MAAMA,WAAA,oCAAAC,MAAA,CAA+CC,YAAA,CAAIC,IAAI,CAAA;AAE7D,MAAMC,IAAO,mBAAAH,MAAA,CAEPC,QAAAA,CAAAA,IAAIG,OAAO,mKAAAJ,MAAA,CAQXC,QAAAA,CAAAA,IAAIG,OAAO,kBAAAJ,MAAA,CACbC,QAAI,CAAAA,GAAA,CAAAC,IAAI,eAAAF,MAAA,CAAYC,QAAAA,CAAAA,GAAA,CAAII,OAAO,cAAAL,MAAA,CAE7BC,QAAAA,CAAAA,IAAIG,OAAO,0BAAAJ,MAAA,CACbC,QAAAA,CAAAA,IAAII,OAAQ,CAAAC,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,OAAA;AAG7B,MAAMC,KAAQ,GAAA;EACZ,GAAGC,GAAA,CAAAA,WAAA;EAEHC,KAAO,EAAA;IACLC,IAAM,EAAA,SAAA;IACNC,OAAS,EAAA;EACX,CAAA;EAEAC,KAAO,EAAA;IACLF,IAAM,EAAA,SAAA;IACNC,OAAS,EAAA;EACX,CAAA;EAEAE,KAAO,EAAA;IACLH,IAAM,EAAA,SAAA;IACNC,OAAS,EAAA;EACX;AACF,CAAA;AAEA,SAASG,GAAAA,CAAAC,IAAA,EAA8B;EAAA,IAA1B;IAACC;GAAyB,GAAAD,IAAA;EACrC,MAAME,QAAMC,aAAAA,CAAAA,OAAK,CAAAf,IAAA,EAAM;IAACI,KAAO;IAAAS,IAAA;IAAMjB;GAAY,CAAA;EACjD,MAAMoB,YAAe,GAAAlB,QAAA,CAAAA,GAAA,CAAII,OAAQ,CAAAC,KAAA,CAAM,GAAG,CAAA;EAC1C,MAAMc,YAAe,GAAA,CAAC,OAAS,EAAA,OAAA,EAAS,OAAO,CAAA;EACzC,MAAAC,YAAA,GAAeD,aAAaE,MAAO,CAACC,YAAaN,KAAI,CAAAV,KAAA,CAAMgB,QAAQ,CAAC,CAAA;EACpE,MAAAC,WAAA,GAAcH,aAAa,CAAC,CAAA;EAClC,MAAMI,kBAAkBJ,YAAa,CAAAK,MAAA;EAErC,IAAID,oBAAoB,CAAG,EAAA;IACzBE,OAAA,CAAIC,cAAO3B,YAAA,CAAIC,IAAI,eAAAF,MAAA,CAAYC,QAAA,CAAAA,GAAA,CAAII,OAAO,CAAE,CAAA;IAC5C;EACF;EAEA,IAAIoB,kBAAkB,CAAG,EAAA;IACvB,MAAM,IAAII,KAAA,uFACR,CACF;EACF;EAEM,MAAAC,SAAA,GAAYV,YAAa,CAAAW,OAAA,CAAQP,WAAW,CAAA;EAC9CG,GAAAA,CAAAA,GAAA,CAAAC,GAAA,CAAIT,YAAa,CAAAW,SAAS,CAAC,CAAA;AACjC;"}
package/dist/cli.js CHANGED
@@ -4,6 +4,6 @@ Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
6
  require('meow');
7
- var cli = require('./_chunks/cli-7e8e9944.js');
7
+ var cli = require('./_chunks/cli-a67211d1.js');
8
8
  exports.cliEntry = cli.cliEntry;
9
9
  //# sourceMappingURL=cli.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/plugin-kit",
3
- "version": "3.1.7",
3
+ "version": "3.1.9",
4
4
  "description": "Enhanced Sanity.io plugin development experience",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -69,65 +69,65 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@rexxars/choosealicense-list": "^1.1.2",
72
- "@sanity/pkg-utils": "^2.2.5",
72
+ "@sanity/pkg-utils": "^2.4.5",
73
73
  "chalk": "^4.1.2",
74
- "concurrently": "^7.6.0",
74
+ "concurrently": "^8.0.0",
75
75
  "discover-path": "^1.0.0",
76
76
  "email-validator": "^2.0.4",
77
77
  "execa": "^5.1.1",
78
- "get-it": "^8.0.9",
79
- "get-latest-version": "^5.0.0",
78
+ "get-it": "^8.0.11",
79
+ "get-latest-version": "^5.0.1",
80
80
  "git-remote-origin-url": "^3.1.0",
81
81
  "git-user-info": "^2.0.3",
82
82
  "github-url-to-object": "^4.0.6",
83
83
  "inquirer": "^8.2.5",
84
84
  "meow": "^9.0.0",
85
- "nodemon": "^2.0.20",
85
+ "nodemon": "^2.0.21",
86
86
  "npm-packlist": "^7.0.4",
87
87
  "npm-run-path": "^4.0.1",
88
88
  "outdent": "^0.8.0",
89
89
  "p-any": "^3.0.0",
90
90
  "p-props": "^4.0.0",
91
91
  "postcss": "^8.4.21",
92
- "rimraf": "^4.1.2",
92
+ "rimraf": "^4.4.0",
93
93
  "semver": "^7.3.8",
94
- "spdx-license-ids": "^3.0.12",
94
+ "spdx-license-ids": "^3.0.13",
95
95
  "validate-npm-package-name": "^5.0.0",
96
96
  "xdg-basedir": "^4.0.0",
97
97
  "yalc": "^1.0.0-pre.53"
98
98
  },
99
99
  "devDependencies": {
100
- "@commitlint/cli": "^17.4.3",
101
- "@commitlint/config-conventional": "^17.4.3",
100
+ "@commitlint/cli": "^17.4.4",
101
+ "@commitlint/config-conventional": "^17.4.4",
102
102
  "@sanity/semantic-release-preset": "^4.0.0",
103
- "@sanity/ui-workshop": "^1.2.0",
103
+ "@sanity/ui-workshop": "^1.2.1",
104
104
  "@types/eslint": "^8.21.1",
105
105
  "@types/fs-extra": "^11.0.1",
106
106
  "@types/inquirer": "^9.0.3",
107
- "@types/node": "^18.13.0",
107
+ "@types/node": "^18.15.4",
108
108
  "@types/nodemon": "^1.19.2",
109
109
  "@types/tap": "^15.0.8",
110
110
  "@typescript-eslint/eslint-plugin": "^5.52.0",
111
111
  "@typescript-eslint/parser": "^5.52.0",
112
112
  "eslint": "^8.34.0",
113
- "eslint-config-prettier": "^8.6.0",
113
+ "eslint-config-prettier": "^8.8.0",
114
114
  "eslint-config-sanity": "^6.0.0",
115
- "eslint-plugin-prettier": "^4.2.1",
115
+ "eslint-plugin-prettier": "^5.0.0",
116
116
  "eslint-plugin-react-hooks": "^4.6.0",
117
- "fs-extra": "^10.1.0",
117
+ "fs-extra": "^11.1.1",
118
118
  "husky": "^8.0.3",
119
119
  "json5": "^2.2.3",
120
120
  "lint-staged": "^13.1.2",
121
121
  "npm-run-all": "^4.1.5",
122
- "prettier": "^2.8.4",
123
- "prettier-plugin-packagejson": "^2.4.3",
122
+ "prettier": "^3.0.0",
123
+ "prettier-plugin-packagejson": "^2.4.5",
124
124
  "readdirp": "^3.6.0",
125
- "rimraf": "^4.1.2",
125
+ "rimraf": "^4.4.0",
126
126
  "sanity": "^3.3.1",
127
- "sinon": "^14.0.2",
127
+ "sinon": "^15.0.2",
128
128
  "tap": "^16.3.4",
129
129
  "ts-node": "^10.9.1",
130
- "typescript": "^4.9.5"
130
+ "typescript": "^5.0.2"
131
131
  },
132
132
  "peerDependencies": {
133
133
  "eslint": ">=8.0.0"
@@ -135,5 +135,9 @@
135
135
  "engines": {
136
136
  "node": ">=14"
137
137
  },
138
+ "publishConfig": {
139
+ "access": "public",
140
+ "provenance": true
141
+ },
138
142
  "binname": "sanity-plugin"
139
143
  }
@@ -156,7 +156,7 @@ async function writeReadme(data: PackageData, options: InjectOptions) {
156
156
  async function writeLicense(
157
157
  {license}: PackageData,
158
158
  options: InjectOptions,
159
- licenseChanged: boolean
159
+ licenseChanged: boolean,
160
160
  ) {
161
161
  const {basePath, flags} = options
162
162
 
@@ -184,7 +184,7 @@ async function getLicense(
184
184
  pluginName,
185
185
  pkg,
186
186
  requireUserConfirmation,
187
- }: PackageData & {requireUserConfirmation?: boolean}
187
+ }: PackageData & {requireUserConfirmation?: boolean},
188
188
  ) {
189
189
  const license = await getLicenseIdentifier(flags, pkg, requireUserConfirmation)
190
190
  if (!license) {
@@ -202,7 +202,7 @@ async function getLicense(
202
202
  async function getLicenseIdentifier(
203
203
  flags: InitFlags,
204
204
  pkg: PackageJson | undefined,
205
- requireUserConfirmation = false
205
+ requireUserConfirmation = false,
206
206
  ) {
207
207
  // --no-license
208
208
  if ((flags.license as unknown) === false) {
@@ -245,7 +245,7 @@ async function getLicenseIdentifier(
245
245
  async function getProjectDescription(
246
246
  basePath: string,
247
247
  pkg: PackageJson | undefined,
248
- requireUserConfirmation = false
248
+ requireUserConfirmation = false,
249
249
  ) {
250
250
  let description = await resolveProjectDescription(basePath, pkg)
251
251
  if (requireUserConfirmation) {
@@ -40,7 +40,7 @@ interface PackageJson {
40
40
 
41
41
  export async function linkWatch({basePath}: {basePath: string}) {
42
42
  const packageJson: PackageJson = JSON.parse(
43
- fs.readFileSync(path.join(basePath, 'package.json'), 'utf8')
43
+ fs.readFileSync(path.join(basePath, 'package.json'), 'utf8'),
44
44
  )
45
45
 
46
46
  const packageConfig = await loadPackageConfig({cwd: basePath})
@@ -85,7 +85,7 @@ export async function linkWatch({basePath}: {basePath: string}) {
85
85
 
86
86
  ## npm
87
87
  ${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)}
88
- `.trimStart()
88
+ `.trimStart(),
89
89
  )
90
90
  })
91
91
  .on('quit', function () {
@@ -39,7 +39,7 @@ export interface SanityV2Json {
39
39
  {
40
40
  implements?: string
41
41
  path?: 'string'
42
- }
42
+ },
43
43
  ]
44
44
  }
45
45
 
@@ -50,7 +50,7 @@ export function validateModule(packageJson: PackageJson, options: {outDir: strin
50
50
  errors.push(
51
51
  outdent`
52
52
  Expected source, exports, main, module and files entries in package.json, but ${missingFields.join(
53
- ', '
53
+ ', ',
54
54
  )} where missing.
55
55
 
56
56
  Example:
@@ -77,7 +77,7 @@ export function validateModule(packageJson: PackageJson, options: {outDir: strin
77
77
  ],
78
78
 
79
79
  Refer to @sanity/pkg-utils for more: https://github.com/sanity-io/pkg-utils#sanitypkg-utils
80
- `.trimStart()
80
+ `.trimStart(),
81
81
  )
82
82
  }
83
83
 
@@ -108,7 +108,7 @@ export function validateScripts(packageJson: PackageJson): string[] {
108
108
  Please add the following to your package.json "scripts":
109
109
 
110
110
  ${divergentScripts.map(([key, value]) => `"${key}": "${value}"`).join(',\n')}
111
- `.trimStart()
111
+ `.trimStart(),
112
112
  )
113
113
  }
114
114
  return errors
@@ -116,7 +116,7 @@ export function validateScripts(packageJson: PackageJson): string[] {
116
116
 
117
117
  export async function validateTsConfig(
118
118
  ts: ParsedCommandLine,
119
- options: {basePath: string; outDir: string; tsconfig: string}
119
+ options: {basePath: string; outDir: string; tsconfig: string},
120
120
  ) {
121
121
  const {basePath, outDir, tsconfig} = options
122
122
 
@@ -179,7 +179,7 @@ export async function validateTsConfig(
179
179
  ${expectedOutput}
180
180
 
181
181
  Please update your ${tsconfig} accordingly.
182
- `.trimStart()
182
+ `.trimStart(),
183
183
  )
184
184
  }
185
185
 
@@ -259,7 +259,7 @@ export async function validateBabelConfig({basePath}: {basePath: string}) {
259
259
  return [
260
260
  outdent`
261
261
  Found babel-config file: [${babelFiles.join(
262
- ', '
262
+ ', ',
263
263
  )}]. When using default @sanity/plugin-kit build command,
264
264
  this is probably not needed.
265
265
 
@@ -314,7 +314,7 @@ export async function validateStudioConfig({basePath}: {basePath: string}): Prom
314
314
  errors.push(
315
315
  outdent`
316
316
  sanity.cli.(${suffixes.join(
317
- ' | '
317
+ ' | ',
318
318
  )}) missing. Please create a file named sanity.cli.ts with the following content:
319
319
 
320
320
  ${chalk.green(
@@ -326,13 +326,13 @@ export async function validateStudioConfig({basePath}: {basePath: string}): Prom
326
326
  projectId: '${sanityJson?.api?.projectId ?? 'project-id'}',
327
327
  dataset: '${sanityJson?.api?.dataset ?? 'dataset'}',
328
328
  }
329
- })`
329
+ })`,
330
330
  )}
331
331
 
332
332
  Make sure to replace the projectId and dataset fields with your own.
333
333
 
334
334
  For more, see ${urls.migrationGuideStudio}
335
- `.trimStart()
335
+ `.trimStart(),
336
336
  )
337
337
  }
338
338
 
@@ -340,7 +340,7 @@ export async function validateStudioConfig({basePath}: {basePath: string}): Prom
340
340
  errors.push(
341
341
  outdent`
342
342
  sanity.config.(${suffixes.join(
343
- ' | '
343
+ ' | ',
344
344
  )}) missing. At a minimum sanity.config.ts should contain:
345
345
 
346
346
  ${chalk
@@ -364,14 +364,14 @@ export async function validateStudioConfig({basePath}: {basePath: string}): Prom
364
364
  /* put your v2 schema-types here */
365
365
  ],
366
366
  },
367
- })`
367
+ })`,
368
368
  )
369
369
  .trimStart()}
370
370
 
371
371
  Make sure to replace the projectId and dataset fields with your own.
372
372
 
373
373
  For more, see ${urls.migrationGuideStudio}
374
- `.trimStart()
374
+ `.trimStart(),
375
375
  )
376
376
  }
377
377
 
@@ -446,7 +446,7 @@ export async function validatePluginSanityJson({
446
446
 
447
447
  export function validatePackageName(packageJson: PackageJson) {
448
448
  const valid: {validForNewPackages?: boolean; errors: string[]} = validateNpmPackageName(
449
- packageJson.name
449
+ packageJson.name,
450
450
  )
451
451
  if (!valid.validForNewPackages) {
452
452
  return [`Invalid package.json: "name" is invalid: ${valid.errors.join(', ')}`]
@@ -49,18 +49,18 @@ export function disableCheckText(checkKey: string) {
49
49
  "${checkKey}": false
50
50
  }
51
51
  }
52
- `.trimStart()
52
+ `.trimStart(),
53
53
  )
54
54
  }
55
55
 
56
56
  export function createValidator(
57
57
  verifyConfig: VerifyPackageConfig,
58
58
  flags: VerifyFlags,
59
- errors: string[]
59
+ errors: string[],
60
60
  ) {
61
61
  return async function validation(
62
62
  checkKey: keyof VerifyPackageConfig,
63
- task: () => Promise<string[] | undefined>
63
+ task: () => Promise<string[] | undefined>,
64
64
  ) {
65
65
  if (verifyConfig[checkKey] !== false) {
66
66
  const result = await task()
@@ -77,7 +77,7 @@ export function createValidator(
77
77
  outdent`Detected outstanding upgrade issues.
78
78
 
79
79
  Fail-fast (--single) mode enabled, stopping validation here.
80
- `
80
+ `,
81
81
  )
82
82
  }
83
83
  }
@@ -49,10 +49,10 @@ export async function verifyPackage({basePath, flags}: {basePath: string; flags:
49
49
  await validation('module', async () => validateModule(packageJson, {outDir}))
50
50
  await validation('nodeEngine', async () => validateNodeEngine(packageJson))
51
51
  await validation('duplicateConfig', async () =>
52
- disallowDuplicateEslintConfig(basePath, packageJson)
52
+ disallowDuplicateEslintConfig(basePath, packageJson),
53
53
  )
54
54
  await validation('duplicateConfig', async () =>
55
- disallowDuplicatePrettierConfig(basePath, packageJson)
55
+ disallowDuplicatePrettierConfig(basePath, packageJson),
56
56
  )
57
57
 
58
58
  if (ts) {
@@ -65,7 +65,7 @@ export async function verifyPackage({basePath, flags}: {basePath: string; flags:
65
65
 
66
66
  await validation('dependencies', async () => validateSanityDependencies(packageJson))
67
67
  await validation('deprecatedDependencies', async () =>
68
- validateDeprecatedDependencies(packageJson)
68
+ validateDeprecatedDependencies(packageJson),
69
69
  )
70
70
  await validation('eslintImports', async () => validateImports({basePath}))
71
71
 
@@ -84,9 +84,9 @@ export async function verifyPackage({basePath, flags}: {basePath: string; flags:
84
84
  - Reference documentation: ${urls.refDocs}
85
85
 
86
86
  ${chalk.grey(
87
- `To fail-fast on first detected issue run:\nnpx ${cliName} verify-package' --single`
87
+ `To fail-fast on first detected issue run:\nnpx ${cliName} verify-package' --single`,
88
88
  )}
89
- `.trimStart()
89
+ `.trimStart(),
90
90
  )
91
91
  }
92
92
 
@@ -100,6 +100,6 @@ export async function verifyPackage({basePath, flags}: {basePath: string; flags:
100
100
  - Use plugin-kit to build and develop the plugin according to ${urls.pluginReadme}.
101
101
  - Build the plugin and fix any compilation errors
102
102
  - Test the plugin using the link-watch command
103
- `.trim()
103
+ `.trim(),
104
104
  )
105
105
  }
@@ -42,9 +42,9 @@ export async function verifyStudio({basePath, flags}: {basePath: string; flags:
42
42
  - Reference documentation: ${urls.refDocs}
43
43
 
44
44
  ${chalk.grey(
45
- `To fail-fast on first detected issue run:\nnpx ${cliName} verify-studio --single`
45
+ `To fail-fast on first detected issue run:\nnpx ${cliName} verify-studio --single`,
46
46
  )}
47
- `.trimStart()
47
+ `.trimStart(),
48
48
  )
49
49
  }
50
50
 
@@ -53,6 +53,6 @@ export async function verifyStudio({basePath, flags}: {basePath: string; flags:
53
53
  log.success(
54
54
  outdent`
55
55
  No outstanding upgrade issues detected. Studio is V3 ready!
56
- `.trim()
56
+ `.trim(),
57
57
  )
58
58
  }
package/src/cli.ts CHANGED
@@ -43,7 +43,7 @@ export async function cliEntry(argv = process.argv, autoExit = true) {
43
43
  autoHelp: false,
44
44
  flags: sharedFlags,
45
45
  argv: argv.slice(2),
46
- }
46
+ },
47
47
  )
48
48
 
49
49
  const commandName = cli.input[0]
package/src/cmds/init.ts CHANGED
@@ -53,14 +53,14 @@ async function run({argv}: {argv: string[]}) {
53
53
  const {exists, isRoot} = await hasSanityJson(basePath)
54
54
  if (exists && isRoot) {
55
55
  throw new Error(
56
- `sanity.json has a "root" property set to true - are you trying to init into a studio instead of a plugin?`
56
+ `sanity.json has a "root" property set to true - are you trying to init into a studio instead of a plugin?`,
57
57
  )
58
58
  }
59
59
 
60
60
  const {v3ConfigFile} = await findStudioV3Config(basePath)
61
61
  if (v3ConfigFile) {
62
62
  throw new Error(
63
- `${v3ConfigFile} exsists - are you trying to init into a studio instead of a plugin?`
63
+ `${v3ConfigFile} exsists - are you trying to init into a studio instead of a plugin?`,
64
64
  )
65
65
  }
66
66
 
@@ -58,7 +58,7 @@ async function run({argv}: {argv: string[]}) {
58
58
  const {v3ConfigFile} = await findStudioV3Config(basePath)
59
59
  if (v3ConfigFile) {
60
60
  throw new Error(
61
- `${v3ConfigFile} exists - are you trying to INJECT into a studio instead of a plugin?`
61
+ `${v3ConfigFile} exists - are you trying to INJECT into a studio instead of a plugin?`,
62
62
  )
63
63
  }
64
64
  log.info('Inject config into plugin in "%s"', basePath)
@@ -56,7 +56,7 @@ function run({argv}: {argv: string[]}) {
56
56
 
57
57
  if (numVersionFlags > 1) {
58
58
  throw new Error(
59
- `--major, --minor and --patch are mutually exclusive - only one can be used at a time`
59
+ `--major, --minor and --patch are mutually exclusive - only one can be used at a time`,
60
60
  )
61
61
  }
62
62
 
@@ -54,7 +54,7 @@ export async function getPackage(opts: ManifestOptions): Promise<PackageJson> {
54
54
  } catch (err: any) {
55
55
  if (err.code === 'ENOENT') {
56
56
  throw new Error(
57
- `No package.json found. package.json is required to publish to npm. Use \`${cliName} init\` for a new plugin, or \`npm init\` for an existing one`
57
+ `No package.json found. package.json is required to publish to npm. Use \`${cliName} init\` for a new plugin, or \`npm init\` for an existing one`,
58
58
  )
59
59
  }
60
60
 
@@ -113,7 +113,7 @@ function validatePackageName(manifest: PackageJson) {
113
113
  }
114
114
 
115
115
  const valid: {validForNewPackages?: boolean; errors: string[]} = validateNpmPackageName(
116
- manifest.name
116
+ manifest.name,
117
117
  )
118
118
  if (!valid.validForNewPackages) {
119
119
  throw new Error(`Invalid package.json: "name" is invalid: ${valid.errors.join(', ')}`)
@@ -122,7 +122,7 @@ function validatePackageName(manifest: PackageJson) {
122
122
  const isScoped = manifest.name[0] === '@'
123
123
  if (!isScoped && !manifest.name.startsWith('sanity-plugin-')) {
124
124
  throw new Error(
125
- `Invalid package.json: "name" should be prefixed with "sanity-plugin-" (or scoped - @your-company/plugin-name)`
125
+ `Invalid package.json: "name" should be prefixed with "sanity-plugin-" (or scoped - @your-company/plugin-name)`,
126
126
  )
127
127
  }
128
128
  }
@@ -157,7 +157,7 @@ async function validatePaths(manifest: PackageJson, options: ManifestOptions) {
157
157
  // instead we want to target `./dist/MyComponent.js` which is the location it'll be compiled to
158
158
  if (!options?.flags?.allowSourceTarget && paths && withinSourceDir(manifestValue)) {
159
159
  throw new Error(
160
- `Invalid package.json: "${key}" points to file within source (uncompiled) directory. Use --allow-source-target if you really want to do this.`
160
+ `Invalid package.json: "${key}" points to file within source (uncompiled) directory. Use --allow-source-target if you really want to do this.`,
161
161
  )
162
162
  }
163
163
 
@@ -171,7 +171,7 @@ async function validatePaths(manifest: PackageJson, options: ManifestOptions) {
171
171
  !(await willExist(manifestValue))
172
172
  ) {
173
173
  throw new Error(
174
- `Invalid package.json: "${key}" points to file that will not exist after compiling`
174
+ `Invalid package.json: "${key}" points to file that will not exist after compiling`,
175
175
  )
176
176
  }
177
177
 
@@ -185,7 +185,7 @@ async function validatePaths(manifest: PackageJson, options: ManifestOptions) {
185
185
  throw new Error(
186
186
  inOutDir
187
187
  ? `Invalid package.json: "${key}" points to file that does not exist, and "paths" is not configured to compile to this location`
188
- : `Invalid package.json: "${key}" points to file that does not exist, and no equivalent is found in source directory`
188
+ : `Invalid package.json: "${key}" points to file that does not exist, and no equivalent is found in source directory`,
189
189
  )
190
190
  }
191
191
  }
@@ -237,7 +237,7 @@ export async function writePackageJson(data: PackageData, options: InjectOptions
237
237
  'eslint',
238
238
  'eslint-config-sanity',
239
239
  'eslint-plugin-react',
240
- 'eslint-plugin-react-hooks'
240
+ 'eslint-plugin-react-hooks',
241
241
  )
242
242
 
243
243
  if (usePrettier) {
@@ -256,7 +256,7 @@ export async function writePackageJson(data: PackageData, options: InjectOptions
256
256
  ...(addDeps || {}),
257
257
  ...(await resolveLatestVersions(defaultDependencies)),
258
258
  },
259
- forcedPackageVersions
259
+ forcedPackageVersions,
260
260
  )
261
261
  const devDependencies = forceDependencyVersions(
262
262
  {
@@ -264,7 +264,7 @@ export async function writePackageJson(data: PackageData, options: InjectOptions
264
264
  ...(prev.devDependencies || {}),
265
265
  ...(await resolveLatestVersions([...newDevDependencies, ...defaultDevDependencies])),
266
266
  },
267
- forcedDevPackageVersions
267
+ forcedDevPackageVersions,
268
268
  )
269
269
  const peerDependencies = forceDependencyVersions(
270
270
  {
@@ -272,7 +272,7 @@ export async function writePackageJson(data: PackageData, options: InjectOptions
272
272
  ...(addPeers || {}),
273
273
  ...(await resolveLatestVersions(defaultPeerDependencies)),
274
274
  },
275
- forcedPeerPackageVersions
275
+ forcedPeerPackageVersions,
276
276
  )
277
277
 
278
278
  const source = flags.typescript ? './src/index.ts' : './src/index.js'
@@ -375,7 +375,7 @@ export function addScript(cmd: string, existing: string) {
375
375
  export async function addPackageJsonScripts(
376
376
  manifest: PackageJson,
377
377
  options: InjectOptions,
378
- updateScripts: (currentScripts: Record<string, string>) => Record<string, string>
378
+ updateScripts: (currentScripts: Record<string, string>) => Record<string, string>,
379
379
  ) {
380
380
  const originalScripts = manifest.scripts || {}
381
381
  const scripts = updateScripts({...originalScripts})
@@ -424,7 +424,7 @@ export function sortKeys<T extends Record<string, unknown>>(unordered: T): T {
424
424
  /** @internal */
425
425
  export function forceDependencyVersions(
426
426
  deps: Record<string, string>,
427
- versions = forcedPackageVersions
427
+ versions = forcedPackageVersions,
428
428
  ): Record<string, string> {
429
429
  const entries = Object.entries(deps).map((entry) => {
430
430
  const [pkg] = entry
@@ -4,6 +4,6 @@ import npmPacklist from 'npm-packlist'
4
4
 
5
5
  export function getPublishableFiles(basePath: string) {
6
6
  return npmPacklist({basePath}).then((files: string[]) =>
7
- files.map((file) => path.normalize(file))
7
+ files.map((file) => path.normalize(file)),
8
8
  )
9
9
  }
@@ -2,7 +2,9 @@ import pProps from 'p-props'
2
2
  import getLatestVersion from 'get-latest-version'
3
3
 
4
4
  // We may want to lock certain dependencies to specific versions
5
- const lockedDependencies: Record<string, string> = {}
5
+ const lockedDependencies: Record<string, string> = {
6
+ 'styled-components': '^5.2',
7
+ }
6
8
 
7
9
  export function resolveLatestVersions(packages: string[]) {
8
10
  const versions: Record<string, string> = {}
@@ -19,7 +21,7 @@ export function resolveLatestVersions(packages: string[]) {
19
21
  }
20
22
  return rangeify(version)
21
23
  },
22
- {concurrency: 8}
24
+ {concurrency: 8},
23
25
  )
24
26
  }
25
27
 
@@ -38,8 +38,8 @@ function presetsFromInput(inputPresets: string[] | undefined): Preset[] {
38
38
  if (unknownPresets.length) {
39
39
  throw new Error(
40
40
  `Unknown --preset(s): [${unknownPresets.join(', ')}]. Must be one of: [${presetNames.join(
41
- ', '
42
- )}]`
41
+ ', ',
42
+ )}]`,
43
43
  )
44
44
  }
45
45
 
@@ -16,6 +16,6 @@ async function applyPreset(options: InjectOptions) {
16
16
  to: 'renovate.json',
17
17
  },
18
18
  ],
19
- options
19
+ options,
20
20
  )
21
21
  }
@@ -67,8 +67,8 @@ async function addDevDependencies(options: InjectOptions) {
67
67
  Please confer
68
68
  https://github.com/sanity-io/plugin-kit/blob/main/docs/semver-workflow.md#manual-steps-after-inject
69
69
  to finalize configuration for this preset.
70
- `.trim()
71
- )
70
+ `.trim(),
71
+ ),
72
72
  )
73
73
  }
74
74
 
@@ -79,7 +79,7 @@ async function updateReadme(options: InjectOptions) {
79
79
  const readme = (await readFile(readmePath, 'utf8').catch(errorToUndefined)) ?? ''
80
80
 
81
81
  const {v3Banner, install, usage, developTest, license, releaseSnippet} = await readmeSnippets(
82
- options
82
+ options,
83
83
  )
84
84
 
85
85
  const prependSections = missingSections(readme, [v3Banner, install, usage])