@sanity/plugin-kit 3.1.3 → 3.1.5
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.
- package/dist/_chunks/{cli-87b31bbc.js → cli-f4f4acd8.js} +13 -7
- package/dist/_chunks/{cli-87b31bbc.js.map → cli-f4f4acd8.js.map} +1 -1
- package/dist/_chunks/{init-8a6a09d9.js → init-393aad6c.js} +4 -4
- package/dist/_chunks/{init-8a6a09d9.js.map → init-393aad6c.js.map} +1 -1
- package/dist/_chunks/{init-34e69f39.js → init-8648d8d8.js} +48 -32
- package/dist/_chunks/init-8648d8d8.js.map +1 -0
- package/dist/_chunks/{inject-34deee27.js → inject-a56d9c21.js} +4 -4
- package/dist/_chunks/{inject-34deee27.js.map → inject-a56d9c21.js.map} +1 -1
- package/dist/_chunks/{link-watch-12fdd526.js → link-watch-1013e82a.js} +13 -14
- package/dist/_chunks/{link-watch-12fdd526.js.map → link-watch-1013e82a.js.map} +1 -1
- package/dist/_chunks/{package-15d7d80a.js → package-840fec92.js} +88 -53
- package/dist/_chunks/{package-15d7d80a.js.map → package-840fec92.js.map} +1 -1
- package/dist/_chunks/{package-5d288ce1.js → package-e8eabd9c.js} +27 -27
- package/dist/_chunks/{package-5d288ce1.js.map → package-e8eabd9c.js.map} +1 -1
- package/dist/_chunks/{ts-f38310c6.js → ts-01b1d61c.js} +13 -15
- package/dist/_chunks/ts-01b1d61c.js.map +1 -0
- package/dist/_chunks/{verify-package-f115af11.js → verify-package-ee6106bd.js} +4 -4
- package/dist/_chunks/{verify-package-f115af11.js.map → verify-package-ee6106bd.js.map} +1 -1
- package/dist/_chunks/{verify-studio-67d4943f.js → verify-studio-4573ddb8.js} +4 -4
- package/dist/_chunks/{verify-studio-67d4943f.js.map → verify-studio-4573ddb8.js.map} +1 -1
- package/dist/_chunks/version-12991700.js +54 -0
- package/dist/_chunks/{version-d11694dc.js.map → version-12991700.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +26 -26
- package/src/dependencies/import-linter.ts +0 -8
- package/src/presets/semver-workflow.ts +0 -1
- package/src/util/request.ts +1 -3
- package/assets/inject/semver-workflow/npmrc +0 -1
- package/dist/_chunks/init-34e69f39.js.map +0 -1
- package/dist/_chunks/ts-f38310c6.js.map +0 -1
- package/dist/_chunks/version-d11694dc.js +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-
|
|
1
|
+
{"version":3,"file":"inject-a56d9c21.js","sources":["../../src/cmds/inject.ts"],"sourcesContent":["import {loadConfig as loadPackageConfig} from '@sanity/pkg-utils'\nimport path from 'path'\nimport meow from 'meow'\nimport log from '../util/log'\nimport {inject} from '../actions/inject'\nimport {findStudioV3Config} from '../sanity/manifest'\nimport {initFlags} from '../actions/init'\nimport {cliName, defaultOutDir} from '../constants'\nimport {presetHelpList} from '../presets/presets'\n\nconst description = `Inject configuration into a Sanity plugin`\n\nconst help = `\nUsage\n $ ${cliName} inject [dir] [<args>]\n\nOptions\n --no-eslint Disables ESLint config and dependencies from being added\n --no-prettier Disables prettier config and dependencies from being added\n --no-typescript Disables typescript config and dependencies from being added\n --no-license Disables LICENSE + package.json license field from being added\n --no-editorconfig Disables .editorconfig from being added\n --no-gitignore Disables .gitignore from being added\n --no-scripts Disables scripts from being added to package.json\n\n --license [spdx] Use the license with the given SPDX identifier\n --force No promt when overwriting files\n\n --preset [preset-name] Adds config and files from a named preset. --preset can be supplied multiple times.\n The following presets are available:\n${presetHelpList(30)}\n --preset-only Skips the default inject steps. Use this to apply a preset to an otherwise complete plugin.\n\nExamples\n # Inject configuration into the plugin in the current directory\n $ ${cliName} inject\n\n # Inject configuration into the plugin in ~/my-plugin\n $ ${cliName} inject ~/my-plugin\n\n # Don't inject eslint or prettier\n $ ${cliName} inject --no-eslint --no-prettier\n\n # Inject plugin configuration and semver-workflow into the plugin in the current directory\n $ @sanity/plugin-kit inject --preset semver-workflow\n\n # Only inject semver-workflow and renovatebot config from presets\n $ ${cliName} inject --preset-only --preset semver-workflow --preset renovatebot\n\n`\n\nasync function run({argv}: {argv: string[]}) {\n const cli = meow(help, {flags: initFlags, argv, description})\n const basePath = path.resolve(cli.input[0] || process.cwd())\n const packageConfig = await loadPackageConfig({cwd: basePath})\n const outDir = packageConfig?.dist ?? defaultOutDir\n\n const {v3ConfigFile} = await findStudioV3Config(basePath)\n if (v3ConfigFile) {\n throw new Error(\n `${v3ConfigFile} exists - are you trying to INJECT into a studio instead of a plugin?`\n )\n }\n log.info('Inject config into plugin in \"%s\"', basePath)\n\n await inject({basePath, outDir, flags: cli.flags, validate: false})\n log.info('Done!')\n}\n\nexport default run\n"],"names":["description","help","cliName","presetHelpList","run","argv","cli","meow","flags","initFlags","basePath","path","resolve","input","process","cwd","packageConfig","loadPackageConfig","loadConfig","outDir","dist","defaultOutDir","v3ConfigFile","findStudioV3Config","Error","log","info","inject","validate"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAMA,WAAc,8CAAA;AAEpB,MAAMC,IAAO,0BAEPC,WAAA,o5BAgBJC,oBAAe,EAAE,CAAA,yNAKbD,WAAA,qFAGAA,WAAA,6EAGAA,WAAA,mRAMAA,WAAA,4EAAA;AAIN,eAAeE,GAAA,OAA8B;EAAA;EAAA,IAA1B;IAACC;GAAyB;EACrC,MAAAC,KAAA,GAAMC,sBAAKN,IAAM,EAAA;IAACO,OAAOC,cAAW;IAAAJ,IAAA;IAAML;GAAY,CAAA;EACtD,MAAAU,QAAA,GAAWC,sBAAKC,OAAQ,CAAAN,KAAA,CAAIO,MAAM,CAAC,CAAA,IAAKC,OAAQ,CAAAC,GAAA,EAAK,CAAA;EAC3D,MAAMC,gBAAgB,MAAMC,QAAA,CAAAC,UAAA,CAAkB;IAACH,GAAA,EAAKL;EAAS,CAAA,CAAA;EACvD,MAAAS,MAAA,YAASH,+CAAeI,IAAQ,yCAAAC,iBAAA;EAEtC,MAAM;IAACC;EAAgB,CAAA,GAAA,MAAMC,4BAAmBb,QAAQ,CAAA;EACxD,IAAIY,YAAc,EAAA;IAChB,MAAM,IAAIE,KAAA,WACLF,YAAA,2EACL;EACF;EACIG,GAAAA,CAAAA,GAAA,CAAAC,IAAA,CAAK,qCAAqChB,QAAQ,CAAA;EAEhD,MAAAiB,IAAA,CAAAA,MAAA,CAAO;IAACjB,QAAU;IAAAS,MAAA;IAAQX,OAAOF,KAAI,CAAAE,KAAA;IAAOoB,QAAU,EAAA;EAAA,CAAM,CAAA;EAClEH,OAAA,CAAIC,KAAK,OAAO,CAAA;AAClB;"}
|
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
9
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
5
|
var path = require('path');
|
|
11
6
|
var meow = require('meow');
|
|
12
|
-
var _package$1 = require('./package-
|
|
13
|
-
var cli = require('./cli-
|
|
7
|
+
var _package$1 = require('./package-e8eabd9c.js');
|
|
8
|
+
var cli = require('./cli-f4f4acd8.js');
|
|
14
9
|
var nodemon = require('nodemon');
|
|
15
10
|
var concurrently = require('concurrently');
|
|
16
11
|
var chalk = require('chalk');
|
|
17
12
|
var fs = require('fs');
|
|
18
|
-
var _package = require('./package-
|
|
13
|
+
var _package = require('./package-840fec92.js');
|
|
19
14
|
var outdent = require('outdent');
|
|
20
15
|
var pkgUtils = require('@sanity/pkg-utils');
|
|
21
16
|
function _interopDefaultCompat(e) {
|
|
@@ -41,15 +36,18 @@ async function linkWatch(_ref) {
|
|
|
41
36
|
cwd: basePath
|
|
42
37
|
});
|
|
43
38
|
const outDir = (_ref2 = packageConfig == null ? void 0 : packageConfig.dist) !== null && _ref2 !== void 0 ? _ref2 : cli.defaultOutDir;
|
|
44
|
-
const watch =
|
|
39
|
+
const watch = {
|
|
45
40
|
command: "npm run watch",
|
|
46
|
-
extensions: "ts,js,png,svg,gif,jpeg,css"
|
|
47
|
-
|
|
41
|
+
extensions: "ts,js,png,svg,gif,jpeg,css",
|
|
42
|
+
...((_a = packageJson.sanityPlugin) == null ? void 0 : _a.linkWatch)
|
|
43
|
+
};
|
|
48
44
|
nodemon__default.default({
|
|
49
45
|
watch: [outDir],
|
|
50
46
|
ext: watch.extensions,
|
|
51
47
|
exec: "yalc push --changed"
|
|
48
|
+
//delay: 1000
|
|
52
49
|
});
|
|
50
|
+
|
|
53
51
|
const folder = path__default.default.join(basePath, outDir);
|
|
54
52
|
if (!(await _package.fileExists(folder))) {
|
|
55
53
|
await _package.mkdir(folder);
|
|
@@ -70,12 +68,13 @@ async function linkWatch(_ref) {
|
|
|
70
68
|
}
|
|
71
69
|
const description = "Run the watch command and pushes any changes to yalc";
|
|
72
70
|
const help = "\nUsage\n $ ".concat(_package$1.pkg.binname, " link-watch [<args>]\n\nOptions\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\nConfiguration\nTo override the default watch command configuration, provide an override in package.json under sanityPlugin:\n{\n \"sanityPlugin\": {\n \"watchCommand\": \"microbundle watch --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --css inline\",\n \"linkWatch\": {\n \"command\": \"npm run watch\",\n \"extensions\": \"js,png,svg,gif,jpeg,css\"\n }\n }\n}\n\nExamples\n # Run the watch command and pushes any changes to yalc\n $ ").concat(_package$1.pkg.binname, " link-watch\n");
|
|
73
|
-
const flags =
|
|
71
|
+
const flags = {
|
|
72
|
+
...cli.sharedFlags,
|
|
74
73
|
watch: {
|
|
75
74
|
type: "boolean",
|
|
76
75
|
default: false
|
|
77
76
|
}
|
|
78
|
-
}
|
|
77
|
+
};
|
|
79
78
|
function run(_ref3) {
|
|
80
79
|
let {
|
|
81
80
|
argv
|
|
@@ -91,4 +90,4 @@ function run(_ref3) {
|
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
exports.default = run;
|
|
94
|
-
//# sourceMappingURL=link-watch-
|
|
93
|
+
//# sourceMappingURL=link-watch-1013e82a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-watch-
|
|
1
|
+
{"version":3,"file":"link-watch-1013e82a.js","sources":["../../src/actions/link-watch.ts","../../src/cmds/link-watch.ts"],"sourcesContent":["/*\nISC License (ISC)\nCopyright 2019 Johan Otterud\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,\nprovided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH\nTHE USE OR PERFORMANCE OF THIS SOFTWARE.\n*/\n\n/*\nThis code is a modified version of https://github.com/johot/yalc-watch,\nand the ISC License has been added for this file only, in accordance with the package.json license field in that package\n*/\n\nimport nodemon from 'nodemon'\nimport concurrently from 'concurrently'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport path from 'path'\nimport log from '../util/log'\nimport {getPackage} from '../npm/package'\nimport outdent from 'outdent'\nimport {fileExists, mkdir} from '../util/files'\nimport {loadConfig as loadPackageConfig} from '@sanity/pkg-utils'\nimport {defaultOutDir} from '../constants'\n\ninterface YalcWatchConfig {\n command?: string\n extensions?: string\n}\n\ninterface PackageJson {\n sanityPlugin?: {linkWatch?: YalcWatchConfig}\n}\n\nexport async function linkWatch({basePath}: {basePath: string}) {\n const packageJson: PackageJson = JSON.parse(\n fs.readFileSync(path.join(basePath, 'package.json'), 'utf8')\n )\n\n const packageConfig = await loadPackageConfig({cwd: basePath})\n const outDir = packageConfig?.dist ?? defaultOutDir\n\n const watch: Required<YalcWatchConfig> = {\n command: 'npm run watch',\n extensions: 'ts,js,png,svg,gif,jpeg,css',\n ...packageJson.sanityPlugin?.linkWatch,\n }\n\n nodemon({\n watch: [outDir],\n ext: watch.extensions,\n exec: 'yalc push --changed',\n //delay: 1000\n })\n\n // ensure the folder exits so it can be watched\n const folder = path.join(basePath, outDir)\n if (!(await fileExists(folder))) {\n await mkdir(folder)\n }\n\n const pkg = await getPackage({basePath, validate: false})\n\n concurrently([watch.command])\n\n nodemon\n .on('start', function () {\n log.info(\n outdent`\n Watching ${outDir} for changes to files with extensions: ${watch.extensions}\n\n To test this package in Sanity Studio or another package, in a separate shell run:\n cd /path/to/sanity/studio-or-package\n\n Then, run one of the below commands, based on the package manager used in studio-or-package:\n\n ## yarn\n ${chalk.greenBright(`yalc add --link ${pkg.name} && yarn install`)}\n\n ## npm\n ${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)}\n `.trimStart()\n )\n })\n .on('quit', function () {\n process.exit()\n })\n .on('restart', function (files: any) {\n log.info('Found changes in files:', chalk.magentaBright(files))\n log.info('Pushing new yalc package...')\n })\n}\n","import path from 'path'\nimport meow from 'meow'\nimport pkg from '../../package.json'\nimport sharedFlags from '../sharedFlags'\nimport {linkWatch} from '../actions/link-watch'\n\nconst description = `Run the watch command and pushes any changes to yalc`\n\nconst help = `\nUsage\n $ ${pkg.binname} link-watch [<args>]\n\nOptions\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\nConfiguration\nTo override the default watch command configuration, provide an override in package.json under sanityPlugin:\n{\n \"sanityPlugin\": {\n \"watchCommand\": \"microbundle watch --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --css inline\",\n \"linkWatch\": {\n \"command\": \"npm run watch\",\n \"extensions\": \"js,png,svg,gif,jpeg,css\"\n }\n }\n}\n\nExamples\n # Run the watch command and pushes any changes to yalc\n $ ${pkg.binname} link-watch\n`\n\nconst flags = {\n ...sharedFlags,\n watch: {\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 basePath = path.resolve(cli.input[0] || process.cwd())\n return linkWatch({basePath})\n}\n\nexport default run\n"],"names":["linkWatch","basePath","_a","packageJson","JSON","parse","fs","readFileSync","path","join","packageConfig","loadPackageConfig","loadConfig","cwd","outDir","dist","defaultOutDir","watch","command","extensions","sanityPlugin","nodemon","ext","exec","folder","default","fileExists","mkdir","pkg","getPackage","validate","concurrently","on","log","info","outdent","chalk","greenBright","name","trimStart","process","exit","files","magentaBright","description","help","binname","flags","sharedFlags","type","run","argv","cli","meow","resolve","input"],"mappings":"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"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
4
|
-
const _excluded = ["default", "force"];
|
|
5
4
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
6
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
5
|
var fs = require('fs');
|
|
14
6
|
var path = require('path');
|
|
15
7
|
var util$1 = require('util');
|
|
16
8
|
var githubUrlToObject = require('github-url-to-object');
|
|
17
9
|
var validateNpmPackageName = require('validate-npm-package-name');
|
|
18
|
-
var _package = require('./package-
|
|
10
|
+
var _package = require('./package-e8eabd9c.js');
|
|
19
11
|
var pAny = require('p-any');
|
|
20
12
|
var crypto = require('crypto');
|
|
21
13
|
var url = require('url');
|
|
22
14
|
var inquirer = require('inquirer');
|
|
23
|
-
var cli = require('./cli-
|
|
15
|
+
var cli = require('./cli-f4f4acd8.js');
|
|
24
16
|
var pProps = require('p-props');
|
|
25
17
|
var getLatestVersion = require('get-latest-version');
|
|
26
18
|
var outdent = require('outdent');
|
|
@@ -45,11 +37,12 @@ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
|
45
37
|
const buildExtensions = [".js", ".jsx", ".es6", ".es", ".mjs", ".ts", ".tsx"];
|
|
46
38
|
async function prompt(message, options) {
|
|
47
39
|
const type = options.choices ? "list" : options.type;
|
|
48
|
-
const result = await inquirer__default.default.prompt([
|
|
40
|
+
const result = await inquirer__default.default.prompt([{
|
|
41
|
+
...options,
|
|
49
42
|
type,
|
|
50
43
|
message,
|
|
51
44
|
name: "single"
|
|
52
|
-
}
|
|
45
|
+
}]);
|
|
53
46
|
return result && result.single;
|
|
54
47
|
}
|
|
55
48
|
prompt.separator = () => new inquirer__default.default.Separator();
|
|
@@ -1331,10 +1324,10 @@ function writeJsonFile(filePath, content) {
|
|
|
1331
1324
|
}
|
|
1332
1325
|
async function writeFileWithOverwritePrompt(filePath, content, options) {
|
|
1333
1326
|
const {
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1327
|
+
default: defaultVal,
|
|
1328
|
+
force = false,
|
|
1329
|
+
...writeOptions
|
|
1330
|
+
} = options;
|
|
1338
1331
|
const withinCwd = filePath.startsWith(process.cwd());
|
|
1339
1332
|
const printablePath = withinCwd ? path__default.default.relative(process.cwd(), filePath) : filePath;
|
|
1340
1333
|
if (await fileEqualsData(filePath, content)) {
|
|
@@ -1507,9 +1500,10 @@ async function readManifest(options) {
|
|
|
1507
1500
|
return parsed;
|
|
1508
1501
|
}
|
|
1509
1502
|
async function validateManifest(manifest, opts) {
|
|
1510
|
-
const options =
|
|
1511
|
-
isPlugin: true
|
|
1512
|
-
|
|
1503
|
+
const options = {
|
|
1504
|
+
isPlugin: true,
|
|
1505
|
+
...opts
|
|
1506
|
+
};
|
|
1513
1507
|
if (!isObject$1(manifest)) {
|
|
1514
1508
|
throw new Error("Invalid sanity.json: Root must be an object");
|
|
1515
1509
|
}
|
|
@@ -1521,9 +1515,10 @@ async function validateManifest(manifest, opts) {
|
|
|
1521
1515
|
if ("root" in manifest && typeof manifest.root !== "boolean") {
|
|
1522
1516
|
throw new Error("Invalid sanity.json: \"root\" property must be a boolean if declared");
|
|
1523
1517
|
}
|
|
1524
|
-
await validateParts(manifest,
|
|
1518
|
+
await validateParts(manifest, {
|
|
1519
|
+
...options,
|
|
1525
1520
|
paths: absolutifyPaths(manifest.paths, options.basePath)
|
|
1526
|
-
})
|
|
1521
|
+
});
|
|
1527
1522
|
}
|
|
1528
1523
|
function validateProjectManifest(manifest) {
|
|
1529
1524
|
if ("paths" in manifest) {
|
|
@@ -1805,7 +1800,11 @@ function validateSanityDependencies(packageJson) {
|
|
|
1805
1800
|
devDependencies,
|
|
1806
1801
|
peerDependencies
|
|
1807
1802
|
} = packageJson;
|
|
1808
|
-
const allDependencies =
|
|
1803
|
+
const allDependencies = {
|
|
1804
|
+
...dependencies,
|
|
1805
|
+
...devDependencies,
|
|
1806
|
+
...peerDependencies
|
|
1807
|
+
};
|
|
1809
1808
|
const illegalDeps = Object.keys(allDependencies).filter(dep => mergedPackages.includes(dep));
|
|
1810
1809
|
const deps = new Set(illegalDeps);
|
|
1811
1810
|
const unique = [...deps.values()];
|
|
@@ -1820,7 +1819,11 @@ function validateDeprecatedDependencies(packageJson) {
|
|
|
1820
1819
|
devDependencies,
|
|
1821
1820
|
peerDependencies
|
|
1822
1821
|
} = packageJson;
|
|
1823
|
-
const allDependencies =
|
|
1822
|
+
const allDependencies = {
|
|
1823
|
+
...dependencies,
|
|
1824
|
+
...devDependencies,
|
|
1825
|
+
...peerDependencies
|
|
1826
|
+
};
|
|
1824
1827
|
const illegalDeps = Object.keys(allDependencies).filter(dep => deprecatedDevDeps.includes(dep));
|
|
1825
1828
|
const deps = new Set(illegalDeps);
|
|
1826
1829
|
const unique = [...deps.values()];
|
|
@@ -1984,14 +1987,19 @@ const forcedPeerPackageVersions = {
|
|
|
1984
1987
|
"styled-components": "^5.2"
|
|
1985
1988
|
};
|
|
1986
1989
|
const defaultDependencies = [cli.incompatiblePluginPackage];
|
|
1987
|
-
const defaultDevDependencies = ["npm-run-all", "rimraf", "sanity",
|
|
1990
|
+
const defaultDevDependencies = ["npm-run-all", "rimraf", "sanity",
|
|
1991
|
+
// peer dependencies of `sanity`
|
|
1992
|
+
"react", "react-dom", "styled-components",
|
|
1993
|
+
// peer dependencies of `styled-components`
|
|
1994
|
+
"react-is"];
|
|
1988
1995
|
const defaultPeerDependencies = ["react", "sanity"];
|
|
1989
1996
|
const readFile = util__default.default.promisify(fs__default.default.readFile);
|
|
1990
1997
|
const pathKeys = ["main", "module", "browser", "types", "typings"];
|
|
1991
1998
|
async function getPackage(opts) {
|
|
1992
|
-
const options =
|
|
1993
|
-
flags: {}
|
|
1994
|
-
|
|
1999
|
+
const options = {
|
|
2000
|
+
flags: {},
|
|
2001
|
+
...opts
|
|
2002
|
+
};
|
|
1995
2003
|
validateOptions(options);
|
|
1996
2004
|
const {
|
|
1997
2005
|
basePath,
|
|
@@ -2023,9 +2031,10 @@ async function getPackage(opts) {
|
|
|
2023
2031
|
}
|
|
2024
2032
|
async function validatePackage(manifest, opts) {
|
|
2025
2033
|
validateOptions(opts);
|
|
2026
|
-
const options =
|
|
2027
|
-
isPlugin: true
|
|
2028
|
-
|
|
2034
|
+
const options = {
|
|
2035
|
+
isPlugin: true,
|
|
2036
|
+
...opts
|
|
2037
|
+
};
|
|
2029
2038
|
if (options.isPlugin) {
|
|
2030
2039
|
await validatePluginPackage(manifest, options);
|
|
2031
2040
|
}
|
|
@@ -2060,11 +2069,12 @@ function validatePackageName(manifest) {
|
|
|
2060
2069
|
async function validatePaths(manifest, options) {
|
|
2061
2070
|
var _manifest$name;
|
|
2062
2071
|
var _a;
|
|
2063
|
-
const paths = await getPaths(
|
|
2072
|
+
const paths = await getPaths({
|
|
2073
|
+
...options,
|
|
2064
2074
|
pluginName: (_manifest$name = manifest.name) !== null && _manifest$name !== void 0 ? _manifest$name : "unknown",
|
|
2065
2075
|
verifySourceParts: false,
|
|
2066
2076
|
verifyCompiledParts: false
|
|
2067
|
-
})
|
|
2077
|
+
});
|
|
2068
2078
|
const abs = file => path__default.default.isAbsolute(file) ? file : path__default.default.resolve(path__default.default.join(options.basePath, file));
|
|
2069
2079
|
const exists = file => fs__default.default.existsSync(abs(file));
|
|
2070
2080
|
const willExist = file => paths && hasSourceEquivalent(abs(file), paths);
|
|
@@ -2147,47 +2157,69 @@ async function writePackageJson(data, options) {
|
|
|
2147
2157
|
}
|
|
2148
2158
|
}
|
|
2149
2159
|
cli.log.debug("Resolving latest versions for %s", newDevDependencies.join(", "));
|
|
2150
|
-
const dependencies = forceDependencyVersions(
|
|
2151
|
-
|
|
2152
|
-
|
|
2160
|
+
const dependencies = forceDependencyVersions({
|
|
2161
|
+
...(prev.dependencies || {}),
|
|
2162
|
+
...(addDeps || {}),
|
|
2163
|
+
...(await resolveLatestVersions(defaultDependencies))
|
|
2164
|
+
}, forcedPackageVersions);
|
|
2165
|
+
const devDependencies = forceDependencyVersions({
|
|
2166
|
+
...(addDevDeps || {}),
|
|
2167
|
+
...(prev.devDependencies || {}),
|
|
2168
|
+
...(await resolveLatestVersions([...newDevDependencies, ...defaultDevDependencies]))
|
|
2169
|
+
}, forcedDevPackageVersions);
|
|
2170
|
+
const peerDependencies = forceDependencyVersions({
|
|
2171
|
+
...(prev.peerDependencies || {}),
|
|
2172
|
+
...(addPeers || {}),
|
|
2173
|
+
...(await resolveLatestVersions(defaultPeerDependencies))
|
|
2174
|
+
}, forcedPeerPackageVersions);
|
|
2153
2175
|
const source = flags.typescript ? "./src/index.ts" : "./src/index.js";
|
|
2154
2176
|
const files = [outDir, "sanity.json", "src", "v2-incompatible.js"];
|
|
2155
2177
|
files.sort();
|
|
2156
|
-
const forcedOrder =
|
|
2178
|
+
const forcedOrder = {
|
|
2157
2179
|
name: pluginName,
|
|
2158
2180
|
version: (_prev$version = prev.version) !== null && _prev$version !== void 0 ? _prev$version : "1.0.0",
|
|
2159
2181
|
description: description || "",
|
|
2160
|
-
keywords: (_prev$keywords = prev.keywords) !== null && _prev$keywords !== void 0 ? _prev$keywords : ["sanity", "sanity-plugin"]
|
|
2161
|
-
|
|
2182
|
+
keywords: (_prev$keywords = prev.keywords) !== null && _prev$keywords !== void 0 ? _prev$keywords : ["sanity", "sanity-plugin"],
|
|
2183
|
+
...urlsFromOrigin(gitOrigin),
|
|
2184
|
+
...repoFromOrigin(gitOrigin),
|
|
2162
2185
|
license: license ? license.id : "UNLICENSED",
|
|
2163
2186
|
author: (user == null ? void 0 : user.email) ? "".concat(user.name, " <").concat(user.email, ">") : user == null ? void 0 : user.name,
|
|
2164
2187
|
exports: {
|
|
2165
|
-
".":
|
|
2166
|
-
|
|
2167
|
-
|
|
2188
|
+
".": {
|
|
2189
|
+
...(flags.typescript ? {
|
|
2190
|
+
types: "./".concat(outDir, "/index.d.ts")
|
|
2191
|
+
} : {}),
|
|
2168
2192
|
source,
|
|
2169
2193
|
require: "./".concat(outDir, "/index.js"),
|
|
2170
2194
|
import: "./".concat(outDir, "/index.esm.js"),
|
|
2171
2195
|
default: "./".concat(outDir, "/index.esm.js")
|
|
2172
|
-
}
|
|
2196
|
+
},
|
|
2173
2197
|
"./package.json": "./package.json"
|
|
2174
2198
|
},
|
|
2175
2199
|
main: "./".concat(outDir, "/index.js"),
|
|
2176
2200
|
module: "./".concat(outDir, "/index.esm.js"),
|
|
2177
|
-
source
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2201
|
+
source,
|
|
2202
|
+
...(flags.typescript ? {
|
|
2203
|
+
types: "./".concat(outDir, "/index.d.ts")
|
|
2204
|
+
} : {}),
|
|
2181
2205
|
files,
|
|
2182
|
-
scripts:
|
|
2206
|
+
scripts: {
|
|
2207
|
+
...prev.scripts
|
|
2208
|
+
},
|
|
2183
2209
|
dependencies: sortKeys(dependencies),
|
|
2184
2210
|
devDependencies: sortKeys(devDependencies),
|
|
2185
2211
|
peerDependencies: sortKeys(peerDependencies),
|
|
2186
2212
|
engines: {
|
|
2187
2213
|
node: ">=14"
|
|
2188
2214
|
}
|
|
2189
|
-
}
|
|
2190
|
-
const manifest =
|
|
2215
|
+
};
|
|
2216
|
+
const manifest = {
|
|
2217
|
+
...forcedOrder,
|
|
2218
|
+
// Use already configured values by default (if not otherwise specified)
|
|
2219
|
+
...(prev || {}),
|
|
2220
|
+
// We're de-declaring properties because of key order in package.json
|
|
2221
|
+
...forcedOrder
|
|
2222
|
+
};
|
|
2191
2223
|
delete manifest.typings;
|
|
2192
2224
|
const differs = JSON.stringify(prev) !== JSON.stringify(manifest);
|
|
2193
2225
|
cli.log.debug("Does manifest differ? %s", differs ? "yes" : "no");
|
|
@@ -2228,12 +2260,15 @@ function addScript(cmd, existing) {
|
|
|
2228
2260
|
}
|
|
2229
2261
|
async function addPackageJsonScripts(manifest, options, updateScripts) {
|
|
2230
2262
|
const originalScripts = manifest.scripts || {};
|
|
2231
|
-
const scripts = updateScripts(
|
|
2263
|
+
const scripts = updateScripts({
|
|
2264
|
+
...originalScripts
|
|
2265
|
+
});
|
|
2232
2266
|
const differs = Object.keys(scripts).some(key => scripts[key] !== originalScripts[key]);
|
|
2233
2267
|
if (differs) {
|
|
2234
|
-
await writePackageJsonDirect(
|
|
2268
|
+
await writePackageJsonDirect({
|
|
2269
|
+
...manifest,
|
|
2235
2270
|
scripts
|
|
2236
|
-
}
|
|
2271
|
+
}, options);
|
|
2237
2272
|
}
|
|
2238
2273
|
return differs;
|
|
2239
2274
|
}
|
|
@@ -2320,4 +2355,4 @@ exports.writeFile = writeFile;
|
|
|
2320
2355
|
exports.writeFileWithOverwritePrompt = writeFileWithOverwritePrompt;
|
|
2321
2356
|
exports.writePackageJson = writePackageJson;
|
|
2322
2357
|
exports.writePackageJsonDirect = writePackageJsonDirect;
|
|
2323
|
-
//# sourceMappingURL=package-
|
|
2358
|
+
//# sourceMappingURL=package-840fec92.js.map
|