@sanity/plugin-kit 2.2.0 → 3.0.0
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/LICENSE +1 -1
- package/README.md +53 -38
- package/assets/inject/semver-workflow/lint-staged.template.js +1 -1
- package/bin/plugin-kit.js +2 -0
- package/dist/_chunks/cli-9f3b6fb3.js +162 -0
- package/dist/_chunks/cli-9f3b6fb3.js.map +1 -0
- package/dist/_chunks/init-3ad3f71f.js +104 -0
- package/dist/_chunks/init-3ad3f71f.js.map +1 -0
- package/dist/_chunks/init-ed4b5e78.js +952 -0
- package/dist/_chunks/init-ed4b5e78.js.map +1 -0
- package/dist/_chunks/inject-c90dc62d.js +49 -0
- package/dist/_chunks/inject-c90dc62d.js.map +1 -0
- package/dist/_chunks/link-watch-7f10aeab.js +94 -0
- package/dist/_chunks/link-watch-7f10aeab.js.map +1 -0
- package/dist/_chunks/package-ad838e5c.js +2246 -0
- package/dist/_chunks/package-ad838e5c.js.map +1 -0
- package/dist/_chunks/package-fa6580ba.js +152 -0
- package/dist/_chunks/package-fa6580ba.js.map +1 -0
- package/dist/_chunks/ts-89567e57.js +167 -0
- package/dist/_chunks/ts-89567e57.js.map +1 -0
- package/dist/_chunks/verify-package-27b93f01.js +96 -0
- package/dist/_chunks/verify-package-27b93f01.js.map +1 -0
- package/dist/_chunks/verify-studio-3633e659.js +75 -0
- package/dist/_chunks/verify-studio-3633e659.js.map +1 -0
- package/dist/_chunks/version-d6a290e2.js +58 -0
- package/dist/_chunks/version-d6a290e2.js.map +1 -0
- package/dist/cli.js +9 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -16
- package/src/actions/init.ts +2 -0
- package/src/actions/inject.ts +66 -87
- package/src/actions/link-watch.ts +8 -5
- package/src/actions/verify/types.ts +0 -23
- package/src/actions/verify/validations.ts +65 -39
- package/src/actions/verify/verify-common.ts +4 -4
- package/src/actions/verify-package.ts +13 -7
- package/src/actions/verify-studio.ts +7 -4
- package/src/cli.ts +1 -3
- package/src/cmds/index.ts +18 -6
- package/src/cmds/inject.ts +5 -2
- package/src/cmds/link-watch.ts +0 -1
- package/src/configs/default-source.ts +10 -14
- package/src/configs/eslint.ts +51 -0
- package/src/configs/forced-package-versions.ts +8 -7
- package/src/configs/git.ts +68 -0
- package/src/configs/pkg-config.ts +31 -0
- package/src/configs/prettier.ts +11 -0
- package/src/configs/tsconfig.ts +79 -0
- package/src/constants.ts +2 -0
- package/src/index.ts +1 -4
- package/src/npm/package.ts +62 -26
- package/src/presets/presets.ts +2 -1
- package/src/presets/renovatebot.ts +10 -1
- package/src/presets/semver-workflow.ts +26 -14
- package/src/presets/ui-workshop.ts +28 -12
- package/src/presets/ui.ts +68 -0
- package/src/sanity/manifest.ts +2 -2
- package/src/util/files.ts +8 -8
- package/src/util/readme.ts +17 -15
- package/src/util/ts.ts +13 -0
- package/assets/inject/gitignore +0 -57
- package/assets/inject/package.config.template +0 -16
- package/assets/inject/template-tsconfig.json +0 -24
- package/lib/package.json +0 -129
- package/lib/src/actions/init.d.ts +0 -73
- package/lib/src/actions/init.js +0 -79
- package/lib/src/actions/init.js.map +0 -1
- package/lib/src/actions/inject.d.ts +0 -31
- package/lib/src/actions/inject.js +0 -350
- package/lib/src/actions/inject.js.map +0 -1
- package/lib/src/actions/link-watch.d.ts +0 -3
- package/lib/src/actions/link-watch.js +0 -87
- package/lib/src/actions/link-watch.js.map +0 -1
- package/lib/src/actions/verify/types.d.ts +0 -75
- package/lib/src/actions/verify/types.js +0 -3
- package/lib/src/actions/verify/types.js.map +0 -1
- package/lib/src/actions/verify/validations.d.ts +0 -27
- package/lib/src/actions/verify/validations.js +0 -410
- package/lib/src/actions/verify/validations.js.map +0 -1
- package/lib/src/actions/verify/verify-common.d.ts +0 -44
- package/lib/src/actions/verify/verify-common.js +0 -89
- package/lib/src/actions/verify/verify-common.js.map +0 -1
- package/lib/src/actions/verify-package.d.ts +0 -5
- package/lib/src/actions/verify-package.js +0 -73
- package/lib/src/actions/verify-package.js.map +0 -1
- package/lib/src/actions/verify-studio.d.ts +0 -5
- package/lib/src/actions/verify-studio.js +0 -55
- package/lib/src/actions/verify-studio.js.map +0 -1
- package/lib/src/cli.d.ts +0 -2
- package/lib/src/cli.js +0 -87
- package/lib/src/cli.js.map +0 -1
- package/lib/src/cmds/index.d.ts +0 -9
- package/lib/src/cmds/index.js +0 -11
- package/lib/src/cmds/index.js.map +0 -1
- package/lib/src/cmds/init.d.ts +0 -4
- package/lib/src/cmds/init.js +0 -95
- package/lib/src/cmds/init.js.map +0 -1
- package/lib/src/cmds/inject.d.ts +0 -4
- package/lib/src/cmds/inject.js +0 -76
- package/lib/src/cmds/inject.js.map +0 -1
- package/lib/src/cmds/link-watch.d.ts +0 -4
- package/lib/src/cmds/link-watch.js +0 -49
- package/lib/src/cmds/link-watch.js.map +0 -1
- package/lib/src/cmds/verify-package.d.ts +0 -4
- package/lib/src/cmds/verify-package.js +0 -38
- package/lib/src/cmds/verify-package.js.map +0 -1
- package/lib/src/cmds/verify-studio.d.ts +0 -4
- package/lib/src/cmds/verify-studio.js +0 -38
- package/lib/src/cmds/verify-studio.js.map +0 -1
- package/lib/src/cmds/verify.d.ts +0 -0
- package/lib/src/cmds/verify.js +0 -42
- package/lib/src/cmds/verify.js.map +0 -1
- package/lib/src/cmds/version.d.ts +0 -4
- package/lib/src/cmds/version.js +0 -55
- package/lib/src/cmds/version.js.map +0 -1
- package/lib/src/configs/banned-packages.d.ts +0 -2
- package/lib/src/configs/banned-packages.js +0 -30
- package/lib/src/configs/banned-packages.js.map +0 -1
- package/lib/src/configs/buildExtensions.d.ts +0 -1
- package/lib/src/configs/buildExtensions.js +0 -5
- package/lib/src/configs/buildExtensions.js.map +0 -1
- package/lib/src/configs/default-source.d.ts +0 -3
- package/lib/src/configs/default-source.js +0 -70
- package/lib/src/configs/default-source.js.map +0 -1
- package/lib/src/configs/forced-package-versions.d.ts +0 -16
- package/lib/src/configs/forced-package-versions.js +0 -14
- package/lib/src/configs/forced-package-versions.js.map +0 -1
- package/lib/src/configs/uselessFiles.d.ts +0 -1
- package/lib/src/configs/uselessFiles.js +0 -33
- package/lib/src/configs/uselessFiles.js.map +0 -1
- package/lib/src/constants.d.ts +0 -11
- package/lib/src/constants.js +0 -15
- package/lib/src/constants.js.map +0 -1
- package/lib/src/dependencies/find.d.ts +0 -0
- package/lib/src/dependencies/find.js +0 -195
- package/lib/src/dependencies/find.js.map +0 -1
- package/lib/src/dependencies/import-linter.d.ts +0 -3
- package/lib/src/dependencies/import-linter.js +0 -112
- package/lib/src/dependencies/import-linter.js.map +0 -1
- package/lib/src/index.d.ts +0 -2
- package/lib/src/index.js +0 -6
- package/lib/src/index.js.map +0 -1
- package/lib/src/npm/manager.d.ts +0 -7
- package/lib/src/npm/manager.js +0 -62
- package/lib/src/npm/manager.js.map +0 -1
- package/lib/src/npm/package.d.ts +0 -11
- package/lib/src/npm/package.js +0 -302
- package/lib/src/npm/package.js.map +0 -1
- package/lib/src/npm/publish.d.ts +0 -1
- package/lib/src/npm/publish.js +0 -14
- package/lib/src/npm/publish.js.map +0 -1
- package/lib/src/npm/resolveLatestVersions.d.ts +0 -3
- package/lib/src/npm/resolveLatestVersions.js +0 -37
- package/lib/src/npm/resolveLatestVersions.js.map +0 -1
- package/lib/src/presets/presets.d.ts +0 -8
- package/lib/src/presets/presets.js +0 -53
- package/lib/src/presets/presets.js.map +0 -1
- package/lib/src/presets/renovatebot.d.ts +0 -2
- package/lib/src/presets/renovatebot.js +0 -24
- package/lib/src/presets/renovatebot.js.map +0 -1
- package/lib/src/presets/semver-workflow.d.ts +0 -8
- package/lib/src/presets/semver-workflow.js +0 -166
- package/lib/src/presets/semver-workflow.js.map +0 -1
- package/lib/src/presets/ui-workshop.d.ts +0 -2
- package/lib/src/presets/ui-workshop.js +0 -88
- package/lib/src/presets/ui-workshop.js.map +0 -1
- package/lib/src/sanity/manifest.d.ts +0 -48
- package/lib/src/sanity/manifest.js +0 -263
- package/lib/src/sanity/manifest.js.map +0 -1
- package/lib/src/sharedFlags.d.ts +0 -15
- package/lib/src/sharedFlags.js +0 -17
- package/lib/src/sharedFlags.js.map +0 -1
- package/lib/src/util/command-parser.d.ts +0 -9
- package/lib/src/util/command-parser.js +0 -46
- package/lib/src/util/command-parser.js.map +0 -1
- package/lib/src/util/errorToUndefined.d.ts +0 -1
- package/lib/src/util/errorToUndefined.js +0 -11
- package/lib/src/util/errorToUndefined.js.map +0 -1
- package/lib/src/util/files.d.ts +0 -36
- package/lib/src/util/files.js +0 -264
- package/lib/src/util/files.js.map +0 -1
- package/lib/src/util/log.d.ts +0 -14
- package/lib/src/util/log.js +0 -36
- package/lib/src/util/log.js.map +0 -1
- package/lib/src/util/prompt.d.ts +0 -14
- package/lib/src/util/prompt.js +0 -75
- package/lib/src/util/prompt.js.map +0 -1
- package/lib/src/util/readme.d.ts +0 -8
- package/lib/src/util/readme.js +0 -92
- package/lib/src/util/readme.js.map +0 -1
- package/lib/src/util/request.d.ts +0 -1
- package/lib/src/util/request.js +0 -19
- package/lib/src/util/request.js.map +0 -1
- package/lib/src/util/user.d.ts +0 -13
- package/lib/src/util/user.js +0 -111
- package/lib/src/util/user.js.map +0 -1
- package/lib/test/cli.test.d.ts +0 -1
- package/lib/test/cli.test.js +0 -64
- package/lib/test/cli.test.js.map +0 -1
- package/lib/test/fixture-utils.d.ts +0 -25
- package/lib/test/fixture-utils.js +0 -67
- package/lib/test/fixture-utils.js.map +0 -1
- package/lib/test/init-verify-build.test.d.ts +0 -1
- package/lib/test/init-verify-build.test.js +0 -68
- package/lib/test/init-verify-build.test.js.map +0 -1
- package/lib/test/init.test.d.ts +0 -1
- package/lib/test/init.test.js +0 -169
- package/lib/test/init.test.js.map +0 -1
- package/lib/test/inject.test.d.ts +0 -1
- package/lib/test/inject.test.js +0 -75
- package/lib/test/inject.test.js.map +0 -1
- package/lib/test/run-test-command.d.ts +0 -1
- package/lib/test/run-test-command.js +0 -6
- package/lib/test/run-test-command.js.map +0 -1
- package/lib/test/semver-workflow.test.d.ts +0 -1
- package/lib/test/semver-workflow.test.js +0 -93
- package/lib/test/semver-workflow.test.js.map +0 -1
- package/lib/test/verify-package.test.d.ts +0 -1
- package/lib/test/verify-package.test.js +0 -87
- package/lib/test/verify-package.test.js.map +0 -1
- package/lib/test/version.test.d.ts +0 -1
- package/lib/test/version.test.js +0 -48
- package/lib/test/version.test.js.map +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
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 = verify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AK,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"}
|
package/lib/src/cli.d.ts
DELETED
package/lib/src/cli.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
inject Inject config into an existing Sanity v3 plugin
|
|
32
|
-
verify-package Check that a Sanity plugin package follows V3 conventions. Prints upgrade steps.
|
|
33
|
-
verify-studio Check that a Sanity Studio follows V3 conventions. Prints upgrade steps.
|
|
34
|
-
link-watch Recompiles plugin automatically on changes and runs yalc push --publish
|
|
35
|
-
version Show the version of ${constants_1.cliName} currently installed
|
|
36
|
-
|
|
37
|
-
Options
|
|
38
|
-
--silent Do not print info and warning messages
|
|
39
|
-
--verbose Log everything. This option conflicts with --silent
|
|
40
|
-
--debug Print stack trace on errors
|
|
41
|
-
--version Output the version number
|
|
42
|
-
--help Output usage information
|
|
43
|
-
|
|
44
|
-
Examples
|
|
45
|
-
# Init a new plugin in current directory
|
|
46
|
-
$ ${constants_1.cliName} init
|
|
47
|
-
|
|
48
|
-
# Init a new plugin in my-sanity-plugin directory
|
|
49
|
-
$ ${constants_1.cliName} init my-sanity-plugin
|
|
50
|
-
|
|
51
|
-
# Check that a Sanity plugin package in current directory follows V3 conventions
|
|
52
|
-
$ ${constants_1.cliName} verify-package
|
|
53
|
-
|
|
54
|
-
# Check that a Sanity Studio in current directory follows V3 conventions
|
|
55
|
-
$ ${constants_1.cliName} verify-studio
|
|
56
|
-
`, {
|
|
57
|
-
autoHelp: false,
|
|
58
|
-
flags: sharedFlags_1.default,
|
|
59
|
-
argv: argv.slice(2),
|
|
60
|
-
});
|
|
61
|
-
const commandName = cli.input[0];
|
|
62
|
-
if (!commandName) {
|
|
63
|
-
cli.showHelp(); // Exits
|
|
64
|
-
}
|
|
65
|
-
if (!(commandName in cmds_1.default)) {
|
|
66
|
-
console.error(`Unknown command "${commandName}"`);
|
|
67
|
-
cli.showHelp(); // Exits
|
|
68
|
-
}
|
|
69
|
-
if (cli.flags.silent && cli.flags.verbose) {
|
|
70
|
-
log_1.default.error(`--silent and --verbose are mutually exclusive`);
|
|
71
|
-
cli.showHelp(); // Exits
|
|
72
|
-
}
|
|
73
|
-
// Lazy-load command
|
|
74
|
-
const cmd = require(cmds_1.default[commandName]).default;
|
|
75
|
-
try {
|
|
76
|
-
log_1.default.setVerbosity(cli.flags);
|
|
77
|
-
yield cmd({ argv: argv.slice(3) });
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
log_1.default.error(err instanceof TypeError || cli.flags.debug ? err.stack : err.message);
|
|
81
|
-
// eslint-disable-next-line no-process-exit
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
exports.cliEntry = cliEntry;
|
|
87
|
-
//# sourceMappingURL=cli.js.map
|
package/lib/src/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;;;0CAS4B,mBAAO;;;;;;;;;;;QAWzC,mBAAO;;;QAGP,mBAAO;;;QAGP,mBAAO;;;QAGP,mBAAO;CACd,EACG;YACE,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,qBAAW;YAClB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SACpB,CACF,CAA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
|
3
|
-
exports.default = {
|
|
4
|
-
init: require.resolve('./init'),
|
|
5
|
-
inject: require.resolve('./inject'),
|
|
6
|
-
'link-watch': require.resolve('./link-watch'),
|
|
7
|
-
'verify-package': require.resolve('./verify-package'),
|
|
8
|
-
'verify-studio': require.resolve('./verify-studio'),
|
|
9
|
-
version: require.resolve('./version'),
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;IACnC,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;CACtC,CAAA"}
|
package/lib/src/cmds/init.d.ts
DELETED
package/lib/src/cmds/init.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
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 presets_1 = require("../presets/presets");
|
|
25
|
-
const description = `Initialize a new Sanity plugin`;
|
|
26
|
-
const help = `
|
|
27
|
-
Usage
|
|
28
|
-
$ ${constants_1.cliName} init [dir] [<args>]
|
|
29
|
-
|
|
30
|
-
Options
|
|
31
|
-
--no-eslint Disables ESLint config and dependencies from being added
|
|
32
|
-
--no-prettier Disables prettier config and dependencies from being added
|
|
33
|
-
--no-typescript Disables typescript config and dependencies from being added
|
|
34
|
-
--no-license Disables LICENSE + package.json license field from being added
|
|
35
|
-
--no-editorconfig Disables .editorconfig from being added
|
|
36
|
-
--no-gitignore Disables .gitignore from being added
|
|
37
|
-
--no-scripts Disables scripts from being added to package.json
|
|
38
|
-
--no-install Disables automatically running package manager install
|
|
39
|
-
|
|
40
|
-
--name [package-name] Use the provided package-name
|
|
41
|
-
--author [name] Use the provided author
|
|
42
|
-
--repo [url] Use the provided repo url
|
|
43
|
-
--license [spdx] Use the license with the given SPDX identifier
|
|
44
|
-
--force No promt when overwriting files
|
|
45
|
-
|
|
46
|
-
--preset [preset-name] Adds config and files from a named preset. --preset can be supplied multiple times.
|
|
47
|
-
The following presets are available:
|
|
48
|
-
${(0, presets_1.presetHelpList)(30)}
|
|
49
|
-
|
|
50
|
-
Examples
|
|
51
|
-
# Initialize a new plugin in the current directory
|
|
52
|
-
$ ${constants_1.cliName} init
|
|
53
|
-
|
|
54
|
-
# Initialize a plugin in the directory ~/my-plugin
|
|
55
|
-
$ ${constants_1.cliName} init ~/my-plugin
|
|
56
|
-
|
|
57
|
-
# Don't add eslint or prettier
|
|
58
|
-
$ ${constants_1.cliName} init --no-eslint --no-prettier
|
|
59
|
-
`;
|
|
60
|
-
function run({ argv }) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const cli = (0, meow_1.default)(help, { flags: init_1.initFlags, argv, description });
|
|
63
|
-
const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
|
|
64
|
-
const { exists, isRoot } = yield (0, manifest_1.hasSanityJson)(basePath);
|
|
65
|
-
if (exists && isRoot) {
|
|
66
|
-
throw new Error(`sanity.json has a "root" property set to true - are you trying to init into a studio instead of a plugin?`);
|
|
67
|
-
}
|
|
68
|
-
const { v3ConfigFile } = yield (0, manifest_1.findStudioV3Config)(basePath);
|
|
69
|
-
if (v3ConfigFile) {
|
|
70
|
-
throw new Error(`${v3ConfigFile} exsists - are you trying to init into a studio instead of a plugin?`);
|
|
71
|
-
}
|
|
72
|
-
log_1.default.info('Initializing new plugin in "%s"', basePath);
|
|
73
|
-
if (!cli.flags.force &&
|
|
74
|
-
!(yield (0, files_1.isEmptyish)(basePath)) &&
|
|
75
|
-
!(yield (0, prompt_1.prompt)('Directory is not empty, proceed?', { type: 'confirm', default: false }))) {
|
|
76
|
-
log_1.default.error('Directory is not empty. Cancelled.');
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
yield (0, files_1.ensureDir)(basePath);
|
|
80
|
-
yield (0, init_1.init)({ basePath, flags: cli.flags });
|
|
81
|
-
if (cli.flags.install) {
|
|
82
|
-
if (yield (0, manager_1.installDependencies)(yield (0, manager_1.promptForPackageManager)(), { cwd: basePath })) {
|
|
83
|
-
log_1.default.info('Done!');
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
log_1.default.error('Failed to install dependencies, try manually running `npm install`');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
log_1.default.info('Dependency installation skipped.');
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
exports.default = run;
|
|
95
|
-
//# sourceMappingURL=init.js.map
|
package/lib/src/cmds/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AACpC,gDAAiD;AAEjD,MAAM,WAAW,GAAG,gCAAgC,CAAA;AAEpD,MAAM,IAAI,GAAG;;MAEP,mBAAO;;;;;;;;;;;;;;;;;;;;EAoBX,IAAA,wBAAc,EAAC,EAAE,CAAC;;;;MAId,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,CAAA;QAC7D,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAE5D,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,MAAM,IAAA,wBAAa,EAAC,QAAQ,CAAC,CAAA;QACtD,IAAI,MAAM,IAAI,MAAM,EAAE;YACpB,MAAM,IAAI,KAAK,CACb,2GAA2G,CAC5G,CAAA;SACF;QAED,MAAM,EAAC,YAAY,EAAC,GAAG,MAAM,IAAA,6BAAkB,EAAC,QAAQ,CAAC,CAAA;QACzD,IAAI,YAAY,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,GAAG,YAAY,sEAAsE,CACtF,CAAA;SACF;QAED,aAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAA;QACrD,IACE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK;YAChB,CAAC,CAAC,MAAM,IAAA,kBAAU,EAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC,MAAM,IAAA,eAAM,EAAC,kCAAkC,EAAE,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC,EACtF;YACA,aAAG,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAA;YAC/C,OAAM;SACP;QAED,MAAM,IAAA,iBAAS,EAAC,QAAQ,CAAC,CAAA;QACzB,MAAM,IAAA,WAAI,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAC,CAAC,CAAA;QACxC,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE;YACrB,IAAI,MAAM,IAAA,6BAAmB,EAAC,MAAM,IAAA,iCAAuB,GAAE,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,CAAC,EAAE;gBAC/E,aAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aAClB;iBAAM;gBACL,aAAG,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAA;aAChF;SACF;aAAM;YACL,aAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAA;SAC7C;IACH,CAAC;CAAA;AAED,kBAAe,GAAG,CAAA"}
|
package/lib/src/cmds/inject.d.ts
DELETED
package/lib/src/cmds/inject.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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 inject_1 = require("../actions/inject");
|
|
19
|
-
const manifest_1 = require("../sanity/manifest");
|
|
20
|
-
const init_1 = require("../actions/init");
|
|
21
|
-
const constants_1 = require("../constants");
|
|
22
|
-
const presets_1 = require("../presets/presets");
|
|
23
|
-
const description = `Inject configuration into a Sanity plugin`;
|
|
24
|
-
const help = `
|
|
25
|
-
Usage
|
|
26
|
-
$ ${constants_1.cliName} inject [dir] [<args>]
|
|
27
|
-
|
|
28
|
-
Options
|
|
29
|
-
--no-eslint Disables ESLint config and dependencies from being added
|
|
30
|
-
--no-prettier Disables prettier config and dependencies from being added
|
|
31
|
-
--no-typescript Disables typescript config and dependencies from being added
|
|
32
|
-
--no-license Disables LICENSE + package.json license field from being added
|
|
33
|
-
--no-editorconfig Disables .editorconfig from being added
|
|
34
|
-
--no-gitignore Disables .gitignore from being added
|
|
35
|
-
--no-scripts Disables scripts from being added to package.json
|
|
36
|
-
|
|
37
|
-
--license [spdx] Use the license with the given SPDX identifier
|
|
38
|
-
--force No promt when overwriting files
|
|
39
|
-
|
|
40
|
-
--preset [preset-name] Adds config and files from a named preset. --preset can be supplied multiple times.
|
|
41
|
-
The following presets are available:
|
|
42
|
-
${(0, presets_1.presetHelpList)(30)}
|
|
43
|
-
--preset-only Skips the default inject steps. Use this to apply a preset to an otherwise complete plugin.
|
|
44
|
-
|
|
45
|
-
Examples
|
|
46
|
-
# Inject configuration into the plugin in the current directory
|
|
47
|
-
$ ${constants_1.cliName} inject
|
|
48
|
-
|
|
49
|
-
# Inject configuration into the plugin in ~/my-plugin
|
|
50
|
-
$ ${constants_1.cliName} inject ~/my-plugin
|
|
51
|
-
|
|
52
|
-
# Don't inject eslint or prettier
|
|
53
|
-
$ ${constants_1.cliName} inject --no-eslint --no-prettier
|
|
54
|
-
|
|
55
|
-
# Inject plugin configuration and semver-workflow into the plugin in the current directory
|
|
56
|
-
$ @sanity/plugin-kit inject --preset semver-workflow
|
|
57
|
-
|
|
58
|
-
# Only inject semver-workflow and renovatebot config from presets
|
|
59
|
-
$ ${constants_1.cliName} inject --preset-only --preset semver-workflow --preset renovatebot
|
|
60
|
-
|
|
61
|
-
`;
|
|
62
|
-
function run({ argv }) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const cli = (0, meow_1.default)(help, { flags: init_1.initFlags, argv, description });
|
|
65
|
-
const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
|
|
66
|
-
const { v3ConfigFile } = yield (0, manifest_1.findStudioV3Config)(basePath);
|
|
67
|
-
if (v3ConfigFile) {
|
|
68
|
-
throw new Error(`${v3ConfigFile} exists - are you trying to INJECT into a studio instead of a plugin?`);
|
|
69
|
-
}
|
|
70
|
-
log_1.default.info('Inject config into plugin in "%s"', basePath);
|
|
71
|
-
yield (0, inject_1.inject)({ basePath, flags: cli.flags, validate: false });
|
|
72
|
-
log_1.default.info('Done!');
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
exports.default = run;
|
|
76
|
-
//# sourceMappingURL=inject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const meow_1 = __importDefault(require("meow"));
|
|
8
|
-
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
|
-
const sharedFlags_1 = __importDefault(require("../sharedFlags"));
|
|
10
|
-
const link_watch_1 = require("../actions/link-watch");
|
|
11
|
-
const description = `Run the watch command and pushes any changes to yalc`;
|
|
12
|
-
const help = `
|
|
13
|
-
Usage
|
|
14
|
-
$ ${package_json_1.default.binname} link-watch [<args>]
|
|
15
|
-
|
|
16
|
-
Options
|
|
17
|
-
--silent Do not print info and warning messages
|
|
18
|
-
--verbose Log everything. This option conflicts with --silent
|
|
19
|
-
--version Output the version number
|
|
20
|
-
--help Output usage information
|
|
21
|
-
|
|
22
|
-
Configuration
|
|
23
|
-
To override the default watch command configuration, provide an override in package.json under sanityPlugin:
|
|
24
|
-
{
|
|
25
|
-
"sanityPlugin": {
|
|
26
|
-
"watchCommand": "microbundle watch --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --css inline",
|
|
27
|
-
"linkWatch": {
|
|
28
|
-
"folder": "lib",
|
|
29
|
-
"command": "npm run watch",
|
|
30
|
-
"extensions": "js,png,svg,gif,jpeg,css"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Examples
|
|
36
|
-
# Run the watch command and pushes any changes to yalc
|
|
37
|
-
$ ${package_json_1.default.binname} link-watch
|
|
38
|
-
`;
|
|
39
|
-
const flags = Object.assign(Object.assign({}, sharedFlags_1.default), { watch: {
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
default: false,
|
|
42
|
-
} });
|
|
43
|
-
function run({ argv }) {
|
|
44
|
-
const cli = (0, meow_1.default)(help, { flags, argv, description });
|
|
45
|
-
const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
|
|
46
|
-
return (0, link_watch_1.linkWatch)({ basePath });
|
|
47
|
-
}
|
|
48
|
-
exports.default = run;
|
|
49
|
-
//# sourceMappingURL=link-watch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-watch.js","sourceRoot":"","sources":["../../../src/cmds/link-watch.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,gDAAuB;AACvB,sEAAoC;AACpC,iEAAwC;AACxC,sDAA+C;AAE/C,MAAM,WAAW,GAAG,sDAAsD,CAAA;AAE1E,MAAM,IAAI,GAAG;;MAEP,sBAAG,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;MAuBX,sBAAG,CAAC,OAAO;CAChB,CAAA;AAED,MAAM,KAAK,GAAG,gCACT,qBAAW,KACd,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,GACO,CAAA;AAEV,SAAS,GAAG,CAAC,EAAC,IAAI,EAAmB;IACnC,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAClD,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IAC5D,OAAO,IAAA,sBAAS,EAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;AAC9B,CAAC;AAED,kBAAe,GAAG,CAAA"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const meow_1 = __importDefault(require("meow"));
|
|
8
|
-
const verify_package_1 = require("../actions/verify-package");
|
|
9
|
-
const constants_1 = require("../constants");
|
|
10
|
-
const verify_common_1 = require("../actions/verify/verify-common");
|
|
11
|
-
const description = `Verify that a Sanity plugin package is v3 compatible, and print upgrade steps if not.`;
|
|
12
|
-
const help = `
|
|
13
|
-
Usage
|
|
14
|
-
$ ${constants_1.cliName} verify-package [dir] [<args>]
|
|
15
|
-
|
|
16
|
-
Options
|
|
17
|
-
--single Enables fail-fast mode: Will only output the first validation that fails.
|
|
18
|
-
--silent Do not print info and warning messages
|
|
19
|
-
--verbose Log everything. This option conflicts with --silent
|
|
20
|
-
--version Output the version number
|
|
21
|
-
--help Output usage information
|
|
22
|
-
|
|
23
|
-
Each check will describe how they can be individually disabled.
|
|
24
|
-
|
|
25
|
-
Examples
|
|
26
|
-
# Verify Sanity plugin package in current directory
|
|
27
|
-
$ ${constants_1.cliName} verify-package
|
|
28
|
-
|
|
29
|
-
# Verify Sanity plugin package in my-plugin directory in silent mode
|
|
30
|
-
$ ${constants_1.cliName} verify-package my-plugin-directory --silent
|
|
31
|
-
`;
|
|
32
|
-
function run({ argv }) {
|
|
33
|
-
const cli = (0, meow_1.default)(help, { flags: verify_common_1.verifyFlags, argv, description });
|
|
34
|
-
const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
|
|
35
|
-
return (0, verify_package_1.verifyPackage)({ basePath, flags: cli.flags });
|
|
36
|
-
}
|
|
37
|
-
exports.default = run;
|
|
38
|
-
//# sourceMappingURL=verify-package.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-package.js","sourceRoot":"","sources":["../../../src/cmds/verify-package.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,gDAAuB;AACvB,8DAAuD;AACvD,4CAAoC;AACpC,mEAA2D;AAE3D,MAAM,WAAW,GAAG,uFAAuF,CAAA;AAE3G,MAAM,IAAI,GAAG;;MAEP,mBAAO;;;;;;;;;;;;;MAaP,mBAAO;;;MAGP,mBAAO;CACZ,CAAA;AAED,SAAS,GAAG,CAAC,EAAC,IAAI,EAAmB;IACnC,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,2BAAW,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAC/D,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IAC5D,OAAO,IAAA,8BAAa,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAC,CAAC,CAAA;AACpD,CAAC;AAED,kBAAe,GAAG,CAAA"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const meow_1 = __importDefault(require("meow"));
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const verify_common_1 = require("../actions/verify/verify-common");
|
|
10
|
-
const verify_studio_1 = require("../actions/verify-studio");
|
|
11
|
-
const description = `Verify that a Sanity Studio is configured correctly for v3, and print upgrade steps if not.`;
|
|
12
|
-
const help = `
|
|
13
|
-
Usage
|
|
14
|
-
$ ${constants_1.cliName} verify-studio [dir] [<args>]
|
|
15
|
-
|
|
16
|
-
Options
|
|
17
|
-
--single Enables fail-fast mode: Will only output the first validation that fails.
|
|
18
|
-
--silent Do not print info and warning messages
|
|
19
|
-
--verbose Log everything. This option conflicts with --silent
|
|
20
|
-
--version Output the version number
|
|
21
|
-
--help Output usage information
|
|
22
|
-
|
|
23
|
-
Each check will describe how they can be individually disabled.
|
|
24
|
-
|
|
25
|
-
Examples
|
|
26
|
-
# Verify Sanity Studio in current directory
|
|
27
|
-
$ ${constants_1.cliName} verify-studio
|
|
28
|
-
|
|
29
|
-
# Verify Sanity Studio in my-sanity-studio directory in silent mode
|
|
30
|
-
$ ${constants_1.cliName} verify-studio my-sanity-studio --silent
|
|
31
|
-
`;
|
|
32
|
-
function run({ argv }) {
|
|
33
|
-
const cli = (0, meow_1.default)(help, { flags: verify_common_1.verifyFlags, argv, description });
|
|
34
|
-
const basePath = path_1.default.resolve(cli.input[0] || process.cwd());
|
|
35
|
-
return (0, verify_studio_1.verifyStudio)({ basePath, flags: cli.flags });
|
|
36
|
-
}
|
|
37
|
-
exports.default = run;
|
|
38
|
-
//# sourceMappingURL=verify-studio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-studio.js","sourceRoot":"","sources":["../../../src/cmds/verify-studio.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,gDAAuB;AACvB,4CAAoC;AACpC,mEAA2D;AAC3D,4DAAqD;AAErD,MAAM,WAAW,GAAG,6FAA6F,CAAA;AAEjH,MAAM,IAAI,GAAG;;MAEP,mBAAO;;;;;;;;;;;;;MAaP,mBAAO;;;MAGP,mBAAO;CACZ,CAAA;AAED,SAAS,GAAG,CAAC,EAAC,IAAI,EAAmB;IACnC,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,2BAAW,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAC/D,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IAC5D,OAAO,IAAA,4BAAY,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAC,CAAC,CAAA;AACnD,CAAC;AAED,kBAAe,GAAG,CAAA"}
|
package/lib/src/cmds/verify.d.ts
DELETED
|
File without changes
|
package/lib/src/cmds/verify.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import meow from 'meow'
|
|
5
|
-
import pkg from '../../package.json'
|
|
6
|
-
import {verify} from '../actions/verify'
|
|
7
|
-
import sharedFlags from '../sharedFlags'
|
|
8
|
-
|
|
9
|
-
const description = `Verify that a Sanity plugin is ready for publishing`
|
|
10
|
-
|
|
11
|
-
const help = `
|
|
12
|
-
Usage
|
|
13
|
-
$ ${pkg.binname} verify [<dir>]
|
|
14
|
-
|
|
15
|
-
Examples
|
|
16
|
-
# Verify the plugin in the current directory
|
|
17
|
-
$ ${pkg.binname} verify
|
|
18
|
-
|
|
19
|
-
# Verify the plugin in ~/my-plugin
|
|
20
|
-
$ ${pkg.binname} verify ~/my-plugin
|
|
21
|
-
|
|
22
|
-
# Allow package.json to reference files inside the uncompiled source folder
|
|
23
|
-
$ ${pkg.binname} verify --allow-source-target
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
const flags = {
|
|
27
|
-
...sharedFlags,
|
|
28
|
-
allowSourceTarget: {
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
default: false,
|
|
31
|
-
},
|
|
32
|
-
} as const
|
|
33
|
-
|
|
34
|
-
function run({argv}: {argv: string[]}) {
|
|
35
|
-
const cli = meow(help, {flags, argv, description})
|
|
36
|
-
const basePath = path.resolve(cli.input[0] || process.cwd())
|
|
37
|
-
return verify({basePath, flags: cli.flags})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default run
|
|
41
|
-
*/
|
|
42
|
-
//# sourceMappingURL=verify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/cmds/verify.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCE"}
|