bingo 0.5.1 → 0.5.3
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/lib/cli/display/createClackDisplay.d.ts.map +1 -1
- package/lib/cli/display/createClackDisplay.js +3 -1
- package/lib/cli/display/createClackDisplay.js.map +1 -1
- package/lib/cli/importers/tryImportTemplate.d.ts +1 -1
- package/lib/cli/importers/tryImportTemplate.d.ts.map +1 -1
- package/lib/cli/loggers/logHelpText.d.ts +1 -1
- package/lib/cli/loggers/logHelpText.d.ts.map +1 -1
- package/lib/cli/loggers/logHelpText.js.map +1 -1
- package/lib/cli/loggers/logOutro.d.ts.map +1 -1
- package/lib/cli/loggers/logOutro.js +5 -1
- package/lib/cli/loggers/logOutro.js.map +1 -1
- package/lib/cli/loggers/logOutro.test.js +24 -8
- package/lib/cli/loggers/logOutro.test.js.map +1 -1
- package/lib/cli/loggers/logSchemasHelpOptions.js +1 -1
- package/lib/cli/loggers/logSchemasHelpOptions.js.map +1 -1
- package/lib/cli/loggers/logStartText.js +1 -1
- package/lib/cli/loggers/logStartText.js.map +1 -1
- package/lib/cli/loggers/logStartText.test.js +17 -11
- package/lib/cli/loggers/logStartText.test.js.map +1 -1
- package/lib/cli/prompts/promptForDirectory.d.ts +3 -3
- package/lib/cli/prompts/promptForDirectory.d.ts.map +1 -1
- package/lib/cli/prompts/promptForDirectory.js.map +1 -1
- package/lib/cli/prompts/promptForOptionSchemas.d.ts +1 -2
- package/lib/cli/prompts/promptForOptionSchemas.d.ts.map +1 -1
- package/lib/cli/prompts/promptForOptionSchemas.js +1 -7
- package/lib/cli/prompts/promptForOptionSchemas.js.map +1 -1
- package/lib/cli/runCLI.d.ts +3 -3
- package/lib/cli/runCLI.d.ts.map +1 -1
- package/lib/cli/runCLI.js.map +1 -1
- package/lib/cli/runTemplateCLI.d.ts +3 -1
- package/lib/cli/runTemplateCLI.d.ts.map +1 -1
- package/lib/cli/runTemplateCLI.js +2 -0
- package/lib/cli/runTemplateCLI.js.map +1 -1
- package/lib/cli/runTemplateCLI.test.js +1 -0
- package/lib/cli/runTemplateCLI.test.js.map +1 -1
- package/lib/cli/setup/createRepositoryOnGitHub.d.ts.map +1 -1
- package/lib/cli/setup/createRepositoryOnGitHub.js +15 -0
- package/lib/cli/setup/createRepositoryOnGitHub.js.map +1 -1
- package/lib/cli/setup/createRepositoryOnGitHub.test.js +20 -0
- package/lib/cli/setup/createRepositoryOnGitHub.test.js.map +1 -1
- package/lib/cli/setup/runModeSetup.d.ts +3 -3
- package/lib/cli/setup/runModeSetup.d.ts.map +1 -1
- package/lib/cli/setup/runModeSetup.js +16 -2
- package/lib/cli/setup/runModeSetup.js.map +1 -1
- package/lib/cli/transition/readConfigSettings.d.ts +5 -0
- package/lib/cli/transition/readConfigSettings.d.ts.map +1 -0
- package/lib/cli/transition/readConfigSettings.js +18 -0
- package/lib/cli/transition/readConfigSettings.js.map +1 -0
- package/lib/cli/transition/readConfigSettings.test.d.ts +2 -0
- package/lib/cli/transition/readConfigSettings.test.d.ts.map +1 -0
- package/lib/cli/transition/readConfigSettings.test.js +40 -0
- package/lib/cli/transition/readConfigSettings.test.js.map +1 -0
- package/lib/cli/transition/runModeTransition.d.ts +3 -3
- package/lib/cli/transition/runModeTransition.d.ts.map +1 -1
- package/lib/cli/transition/runModeTransition.js +26 -4
- package/lib/cli/transition/runModeTransition.js.map +1 -1
- package/lib/cli/transition/runModeTransition.test.js +42 -4
- package/lib/cli/transition/runModeTransition.test.js.map +1 -1
- package/lib/cli/transition/templateMismatchError.d.ts +4 -0
- package/lib/cli/transition/templateMismatchError.d.ts.map +1 -0
- package/lib/cli/transition/templateMismatchError.js +16 -0
- package/lib/cli/transition/templateMismatchError.js.map +1 -0
- package/lib/cli/transition/templateMismatchError.test.d.ts +2 -0
- package/lib/cli/transition/templateMismatchError.test.d.ts.map +1 -0
- package/lib/cli/transition/templateMismatchError.test.js +36 -0
- package/lib/cli/transition/templateMismatchError.test.js.map +1 -0
- package/lib/config/tryImportConfig.d.ts +1 -1
- package/lib/config/tryImportConfig.d.ts.map +1 -1
- package/lib/config/tryImportConfig.js +2 -2
- package/lib/config/tryImportConfig.js.map +1 -1
- package/lib/contexts/createDisplay.d.ts +2 -2
- package/lib/contexts/createDisplay.d.ts.map +1 -1
- package/lib/contexts/createSystemContextWithAuth.d.ts +1 -1
- package/lib/contexts/createSystemContextWithAuth.d.ts.map +1 -1
- package/lib/creators/createTemplate.d.ts +2 -2
- package/lib/creators/createTemplate.d.ts.map +1 -1
- package/lib/creators/createTemplate.js +3 -1
- package/lib/creators/createTemplate.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/mergers/mergeScripts.d.ts.map +1 -1
- package/lib/mergers/mergeScripts.js +8 -3
- package/lib/mergers/mergeScripts.js.map +1 -1
- package/lib/mergers/mergeScripts.test.js +66 -13
- package/lib/mergers/mergeScripts.test.js.map +1 -1
- package/lib/predicates/isCreatedConfig.d.ts +3 -8
- package/lib/predicates/isCreatedConfig.d.ts.map +1 -1
- package/lib/predicates/isCreatedConfig.js.map +1 -1
- package/lib/predicates/isCreatedConfig.test.js +1 -1
- package/lib/predicates/isCreatedConfig.test.js.map +1 -1
- package/lib/predicates/isTemplate.d.ts +2 -1
- package/lib/predicates/isTemplate.d.ts.map +1 -1
- package/lib/predicates/isTemplate.js.map +1 -1
- package/lib/predicates/isTemplateConfig.d.ts +4 -0
- package/lib/predicates/isTemplateConfig.d.ts.map +1 -0
- package/lib/predicates/isTemplateConfig.js +8 -0
- package/lib/predicates/isTemplateConfig.js.map +1 -0
- package/lib/predicates/isTemplateConfig.test.d.ts +2 -0
- package/lib/predicates/isTemplateConfig.test.d.ts.map +1 -0
- package/lib/predicates/isTemplateConfig.test.js +32 -0
- package/lib/predicates/isTemplateConfig.test.js.map +1 -0
- package/lib/preparation/prepareOptions.d.ts +4 -0
- package/lib/preparation/prepareOptions.d.ts.map +1 -1
- package/lib/preparation/prepareOptions.js +9 -1
- package/lib/preparation/prepareOptions.js.map +1 -1
- package/lib/producers/produceTemplate.d.ts +24 -2
- package/lib/producers/produceTemplate.d.ts.map +1 -1
- package/lib/producers/produceTemplate.js +2 -0
- package/lib/producers/produceTemplate.js.map +1 -1
- package/lib/runners/runTemplate.d.ts +31 -6
- package/lib/runners/runTemplate.d.ts.map +1 -1
- package/lib/runners/runTemplate.js +6 -0
- package/lib/runners/runTemplate.js.map +1 -1
- package/lib/types/configs.d.ts +40 -0
- package/lib/types/configs.d.ts.map +1 -0
- package/lib/types/configs.js +2 -0
- package/lib/types/configs.js.map +1 -0
- package/lib/types/options.d.ts +10 -0
- package/lib/types/options.d.ts.map +1 -1
- package/lib/types/templates.d.ts +42 -10
- package/lib/types/templates.d.ts.map +1 -1
- package/package.json +3 -3
- package/lib/cli/prompts/promptForOptions.d.ts +0 -20
- package/lib/cli/prompts/promptForOptions.d.ts.map +0 -1
- package/lib/cli/prompts/promptForOptions.js +0 -38
- package/lib/cli/prompts/promptForOptions.js.map +0 -1
- package/lib/cli/prompts/promptForSchema.d.ts +0 -3
- package/lib/cli/prompts/promptForSchema.d.ts.map +0 -1
- package/lib/cli/prompts/promptForSchema.js +0 -42
- package/lib/cli/prompts/promptForSchema.js.map +0 -1
- package/lib/config/createConfig.d.ts +0 -6
- package/lib/config/createConfig.d.ts.map +0 -1
- package/lib/config/createConfig.js +0 -2
- package/lib/config/createConfig.js.map +0 -1
- package/lib/config/types.d.ts +0 -2
- package/lib/config/types.d.ts.map +0 -1
- package/lib/config/types.js +0 -2
- package/lib/config/types.js.map +0 -1
- package/lib/contexts/createTake.d.ts +0 -3
- package/lib/contexts/createTake.d.ts.map +0 -1
- package/lib/contexts/createTake.js +0 -26
- package/lib/contexts/createTake.js.map +0 -1
- package/lib/contexts/createTake.test.d.ts +0 -2
- package/lib/contexts/createTake.test.d.ts.map +0 -1
- package/lib/contexts/createTake.test.js +0 -71
- package/lib/contexts/createTake.test.js.map +0 -1
- package/lib/options.d.ts +0 -23
- package/lib/options.d.ts.map +0 -1
- package/lib/options.js +0 -4
- package/lib/options.js.map +0 -1
- package/lib/shapes.d.ts +0 -23
- package/lib/shapes.d.ts.map +0 -1
- package/lib/shapes.js +0 -4
- package/lib/shapes.js.map +0 -1
package/lib/types/templates.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { CreatedDirectory } from "bingo-fs";
|
|
1
2
|
import { AboutBase } from "./about.js";
|
|
3
|
+
import { CreateTemplateConfig } from "./configs.js";
|
|
2
4
|
import { Creation } from "./creations.js";
|
|
3
5
|
import { TakeInput } from "./inputs.js";
|
|
4
6
|
import { LazyOptionalOptions } from "./options.js";
|
|
5
7
|
import { AnyShape, InferredObject } from "./shapes.js";
|
|
8
|
+
/**
|
|
9
|
+
* Logs a message to the running user.
|
|
10
|
+
*/
|
|
11
|
+
export type ContextLog = (message: string) => void;
|
|
6
12
|
/**
|
|
7
13
|
* Either a value or a Promise for the value.
|
|
8
14
|
*/
|
|
@@ -23,9 +29,15 @@ export interface RepositoryLocator {
|
|
|
23
29
|
/**
|
|
24
30
|
* Description of how to setup or transition a repository given a set of options.
|
|
25
31
|
* @template OptionsShape Schemas of options the template takes in.
|
|
32
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
26
33
|
* @see {@link https://create.bingo/build/concepts/templates}
|
|
27
34
|
*/
|
|
28
|
-
export interface Template<OptionsShape extends AnyShape
|
|
35
|
+
export interface Template<OptionsShape extends AnyShape, Refinements> extends TemplateDefinition<OptionsShape, Refinements> {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a configuration object to be default-exported from a config file.
|
|
38
|
+
* @see {@link https://www.create.bingo/configuration#createconfig}
|
|
39
|
+
*/
|
|
40
|
+
createConfig: CreateTemplateConfig<OptionsShape, Refinements>;
|
|
29
41
|
/**
|
|
30
42
|
* Schemas of options the template takes in.
|
|
31
43
|
*/
|
|
@@ -43,20 +55,26 @@ export interface TemplateAbout extends AboutBase {
|
|
|
43
55
|
/**
|
|
44
56
|
* Context provided to template producers.
|
|
45
57
|
* @template Options Options values as described by the template's options schema.
|
|
58
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
46
59
|
* @see {@link http://create.bingo/build/details/contexts#template-contexts}
|
|
47
60
|
*/
|
|
48
|
-
export interface TemplateContext<Options extends object> {
|
|
61
|
+
export interface TemplateContext<Options extends object, Refinements> {
|
|
49
62
|
/**
|
|
50
63
|
* Options values as described by the template's options schema.
|
|
51
64
|
*/
|
|
52
65
|
options: Options;
|
|
66
|
+
/**
|
|
67
|
+
* Any optional customizations from a template-specific config file.
|
|
68
|
+
*/
|
|
69
|
+
refinements?: Partial<Refinements>;
|
|
53
70
|
}
|
|
54
71
|
/**
|
|
55
72
|
* Definition for creating a new Template.
|
|
56
73
|
* @template OptionsShape Schemas of options the template takes in.
|
|
74
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
57
75
|
* @see {@link https://www.create.bingo/build/apis/create-template}
|
|
58
76
|
*/
|
|
59
|
-
export interface TemplateDefinition<OptionsShape extends AnyShape
|
|
77
|
+
export interface TemplateDefinition<OptionsShape extends AnyShape, Refinements> {
|
|
60
78
|
/**
|
|
61
79
|
* About information for the template, including an optional repository locator.
|
|
62
80
|
* @see {@link https://www.create.bingo/build/apis/create-template#about}
|
|
@@ -71,35 +89,47 @@ export interface TemplateDefinition<OptionsShape extends AnyShape = AnyShape> {
|
|
|
71
89
|
* Sets up lazily load default options values.
|
|
72
90
|
* @see {@link https://www.create.bingo/build/apis/create-template#prepare}
|
|
73
91
|
*/
|
|
74
|
-
prepare?: TemplatePrepare<InferredObject<OptionsShape
|
|
92
|
+
prepare?: TemplatePrepare<InferredObject<OptionsShape>, Refinements>;
|
|
75
93
|
/**
|
|
76
94
|
* Generates the creations describing a repository made from the template.
|
|
77
95
|
* @see {@link https://www.create.bingo/build/apis/create-template#produce}
|
|
78
96
|
*/
|
|
79
|
-
produce: TemplateProduce<InferredObject<OptionsShape
|
|
97
|
+
produce: TemplateProduce<InferredObject<OptionsShape>, Refinements>;
|
|
80
98
|
/**
|
|
81
99
|
* Additional production function for initializing a new repository with the template.
|
|
82
100
|
* @see {@link https://www.create.bingo/build/apis/create-template#setup}
|
|
83
101
|
*/
|
|
84
|
-
setup?: TemplateProduce<InferredObject<OptionsShape
|
|
102
|
+
setup?: TemplateProduce<InferredObject<OptionsShape>, Refinements>;
|
|
85
103
|
/**
|
|
86
104
|
* Additional production function for migrating an existing repository to the template.
|
|
87
105
|
* @see {@link https://www.create.bingo/build/apis/create-template#transition}
|
|
88
106
|
*/
|
|
89
|
-
transition?: TemplateProduce<InferredObject<OptionsShape
|
|
107
|
+
transition?: TemplateProduce<InferredObject<OptionsShape>, Refinements>;
|
|
90
108
|
}
|
|
91
109
|
/**
|
|
92
110
|
* Sets up lazily loaded default options values.
|
|
93
111
|
* @param context Shared helper functions and information.
|
|
112
|
+
* @template Options Options values as described by the template's options schema.
|
|
113
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
94
114
|
* @see {@link https://www.create.bingo/build/apis/create-template#prepare}
|
|
95
115
|
*/
|
|
96
|
-
export type TemplatePrepare<Options extends object> = (context: TemplatePrepareContext<Partial<Options
|
|
116
|
+
export type TemplatePrepare<Options extends object, Refinements> = (context: TemplatePrepareContext<Partial<Options>, Refinements>) => LazyOptionalOptions<Partial<Options>>;
|
|
97
117
|
/**
|
|
98
118
|
* Shared helper functions and information passed to template options preparers.
|
|
99
119
|
* @param context Shared helper functions and information.
|
|
120
|
+
* @template Options Options values as described by the template's options schema.
|
|
121
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
100
122
|
* @see {@link https://www.create.bingo/build/details/contexts#options-contexts}
|
|
101
123
|
*/
|
|
102
|
-
export interface TemplatePrepareContext<Options extends object> extends TemplateContext<Options> {
|
|
124
|
+
export interface TemplatePrepareContext<Options extends object, Refinements> extends TemplateContext<Options, Refinements> {
|
|
125
|
+
/**
|
|
126
|
+
* Logs a message to the running user.
|
|
127
|
+
*/
|
|
128
|
+
log: ContextLog;
|
|
129
|
+
/**
|
|
130
|
+
* Existing directory of files on disk, if available.
|
|
131
|
+
*/
|
|
132
|
+
files?: CreatedDirectory;
|
|
103
133
|
/**
|
|
104
134
|
* Runs an Input.
|
|
105
135
|
*/
|
|
@@ -108,7 +138,9 @@ export interface TemplatePrepareContext<Options extends object> extends Template
|
|
|
108
138
|
/**
|
|
109
139
|
* Generates the creations describing a repository made from the template.
|
|
110
140
|
* @param context Shared helper functions and information.
|
|
141
|
+
* @template Options Options values as described by the template's options schema.
|
|
142
|
+
* @template Refinements Any optional customizations from a template-specific config file.
|
|
111
143
|
* @see {@link https://www.create.bingo/build/apis/create-template#produce}
|
|
112
144
|
*/
|
|
113
|
-
export type TemplateProduce<Options extends object> = (context: TemplateContext<Options>) => PromiseOrSync<Partial<Creation>>;
|
|
145
|
+
export type TemplateProduce<Options extends object, Refinements> = (context: TemplateContext<Options, Refinements>) => PromiseOrSync<Partial<Creation>>;
|
|
114
146
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/types/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC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ClE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,KAC1C,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bingo",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Delightful templates for web repositories. 💝",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"slugify": "^1.6.6",
|
|
36
36
|
"without-undefined-properties": "^0.1.1",
|
|
37
37
|
"zod": "^3.24.2",
|
|
38
|
-
"bingo-systems": "^0.5.
|
|
39
|
-
"bingo-fs": "^0.5.
|
|
38
|
+
"bingo-systems": "^0.5.3",
|
|
39
|
+
"bingo-fs": "^0.5.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/hosted-git-info": "3.0.5",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AnyShape, InferredObject } from "../../options.js";
|
|
2
|
-
import { SystemContext } from "../../types/system.js";
|
|
3
|
-
import { Template } from "../../types/templates.js";
|
|
4
|
-
export type PromptedOptions<Options extends object> = PromptedOptionsCancelled<Options> | PromptedOptionsProduced<Options>;
|
|
5
|
-
export interface PromptedOptionsCancelled<Options extends object> {
|
|
6
|
-
cancelled: true;
|
|
7
|
-
prompted: Partial<Options>;
|
|
8
|
-
}
|
|
9
|
-
export interface PromptedOptionsProduced<Options extends object> {
|
|
10
|
-
cancelled: false;
|
|
11
|
-
completed: Options;
|
|
12
|
-
prompted: Partial<Options>;
|
|
13
|
-
}
|
|
14
|
-
export interface PromptForOptionsSettings<OptionsShape extends AnyShape> {
|
|
15
|
-
existing: Partial<InferredObject<OptionsShape>>;
|
|
16
|
-
offline?: boolean;
|
|
17
|
-
system: SystemContext;
|
|
18
|
-
}
|
|
19
|
-
export declare function promptForOptions<OptionsShape extends AnyShape = AnyShape>(template: Template<OptionsShape>, { existing, offline, system }: PromptForOptionsSettings<OptionsShape>): Promise<PromptedOptions<InferredObject<OptionsShape>>>;
|
|
20
|
-
//# sourceMappingURL=promptForOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptForOptions.d.ts","sourceRoot":"","sources":["../../../src/cli/prompts/promptForOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIpD,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,MAAM,IAC/C,wBAAwB,CAAC,OAAO,CAAC,GACjC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAEpC,MAAM,WAAW,wBAAwB,CAAC,OAAO,SAAS,MAAM;IAC/D,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB,CAAC,OAAO,SAAS,MAAM;IAC9D,SAAS,EAAE,KAAK,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB,CAAC,YAAY,SAAS,QAAQ;IACtE,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACtB;AAED,wBAAsB,gBAAgB,CACrC,YAAY,SAAS,QAAQ,GAAG,QAAQ,EAExC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,wBAAwB,CAAC,YAAY,CAAC,GACnE,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAwCxD"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as prompts from "@clack/prompts";
|
|
2
|
-
import { prepareOptions } from "../../preparation/prepareOptions.js";
|
|
3
|
-
import { getSchemaDefaultValue } from "../../utils/getSchemaDefaultValue.js";
|
|
4
|
-
import { promptForSchema } from "./promptForSchema.js";
|
|
5
|
-
export async function promptForOptions(template, { existing, offline, system }) {
|
|
6
|
-
const { directory } = system;
|
|
7
|
-
const completed = {
|
|
8
|
-
directory,
|
|
9
|
-
...existing,
|
|
10
|
-
...(await prepareOptions(template, {
|
|
11
|
-
...system,
|
|
12
|
-
existing: { ...existing, directory },
|
|
13
|
-
offline,
|
|
14
|
-
})),
|
|
15
|
-
};
|
|
16
|
-
const prompted = {};
|
|
17
|
-
for (const [key, schema] of Object.entries(template.options)) {
|
|
18
|
-
const defaultValue = getSchemaDefaultValue(schema);
|
|
19
|
-
if ((schema.isOptional() && defaultValue === undefined) ||
|
|
20
|
-
completed[key] !== undefined) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const produced = await promptForSchema(key, schema, defaultValue);
|
|
24
|
-
if (prompts.isCancel(produced)) {
|
|
25
|
-
return { cancelled: true, prompted };
|
|
26
|
-
}
|
|
27
|
-
prompted[key] = produced;
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
cancelled: false,
|
|
31
|
-
completed: {
|
|
32
|
-
...completed,
|
|
33
|
-
...prompted,
|
|
34
|
-
},
|
|
35
|
-
prompted,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=promptForOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptForOptions.js","sourceRoot":"","sources":["../../../src/cli/prompts/promptForOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,g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,EAAE;YACV,GAAG,SAAS;YACZ,GAAG,QAAQ;SACA;QACZ,QAAQ;KACR,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptForSchema.d.ts","sourceRoot":"","sources":["../../../src/cli/prompts/promptForSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAMzB,wBAAsB,eAAe,CACpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,CAAC,UAAU,EACpB,YAAY,EAAE,OAAO,oBA+CrB"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as prompts from "@clack/prompts";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
import { validateNumber, validatorFromSchema } from "./validators.js";
|
|
4
|
-
export async function promptForSchema(key, schema, defaultValue) {
|
|
5
|
-
const def = schema._def;
|
|
6
|
-
const message = schema.description
|
|
7
|
-
? `What will the ${schema.description} be? (--${key})`
|
|
8
|
-
: `What will the --${key} be?`;
|
|
9
|
-
let value;
|
|
10
|
-
while (value === undefined || value === "") {
|
|
11
|
-
switch (def.typeName) {
|
|
12
|
-
case z.ZodFirstPartyTypeKind.ZodBoolean: {
|
|
13
|
-
value = await prompts.confirm({
|
|
14
|
-
initialValue: defaultValue,
|
|
15
|
-
message,
|
|
16
|
-
});
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
case z.ZodFirstPartyTypeKind.ZodNumber:
|
|
20
|
-
value = Number(await prompts.text({
|
|
21
|
-
message,
|
|
22
|
-
placeholder: defaultValue,
|
|
23
|
-
validate: validateNumber,
|
|
24
|
-
}));
|
|
25
|
-
break;
|
|
26
|
-
// TODO: Handle numeric literals, unions, ...
|
|
27
|
-
default: {
|
|
28
|
-
const text = await prompts.text({
|
|
29
|
-
message,
|
|
30
|
-
placeholder: defaultValue,
|
|
31
|
-
validate: validatorFromSchema(schema),
|
|
32
|
-
});
|
|
33
|
-
if (prompts.isCancel(text)) {
|
|
34
|
-
return text;
|
|
35
|
-
}
|
|
36
|
-
return schema.parse(text);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=promptForSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptForSchema.js","sourceRoot":"","sources":["../../../src/cli/prompts/promptForSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItE,MAAM,CAAC,KAAK,UAAU,eAAe,CACpC,GAAW,EACX,MAAoB,EACpB,YAAqB;IAErB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAc,CAAC;IAClC,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW;QACjC,CAAC,CAAC,iBAAiB,MAAM,CAAC,WAAW,WAAW,GAAG,GAAG;QACtD,CAAC,CAAC,mBAAmB,GAAG,MAAM,CAAC;IAChC,IAAI,KAAc,CAAC;IAEnB,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC5C,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC;YACtB,KAAK,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;gBACzC,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;oBAC7B,YAAY,EAAE,YAAuB;oBACrC,OAAO;iBACP,CAAC,CAAC;gBACH,MAAM;YACP,CAAC;YAED,KAAK,CAAC,CAAC,qBAAqB,CAAC,SAAS;gBACrC,KAAK,GAAG,MAAM,CACb,MAAM,OAAO,CAAC,IAAI,CAAC;oBAClB,OAAO;oBACP,WAAW,EAAE,YAAsB;oBACnC,QAAQ,EAAE,cAAc;iBACxB,CAAC,CACF,CAAC;gBACF,MAAM;YAEP,6CAA6C;YAE7C,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;oBAC/B,OAAO;oBACP,WAAW,EAAE,YAAsB;oBACnC,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC;iBACrC,CAAC,CAAC;gBAEH,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,OAAO,IAAI,CAAC;gBACb,CAAC;gBAED,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;YACtC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AnyShape, InferredObject } from "../options.js";
|
|
2
|
-
export interface CreateConfigArgs<OptionsShape extends AnyShape = AnyShape, Settings extends object = object> {
|
|
3
|
-
options?: InferredObject<OptionsShape>;
|
|
4
|
-
settings?: Settings;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=createConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createConfig.d.ts","sourceRoot":"","sources":["../../src/config/createConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIzD,MAAM,WAAW,gBAAgB,CAChC,YAAY,SAAS,QAAQ,GAAG,QAAQ,EACxC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAEhC,OAAO,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createConfig.js","sourceRoot":"","sources":["../../src/config/createConfig.ts"],"names":[],"mappings":""}
|
package/lib/config/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":""}
|
package/lib/config/types.js
DELETED
package/lib/config/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTake.d.ts","sourceRoot":"","sources":["../../src/contexts/createTake.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAiB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE3E,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAkCzD"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import hashObject from "hash-object";
|
|
2
|
-
export function createTake(system) {
|
|
3
|
-
const cache = new Map();
|
|
4
|
-
const take = ((input, args) => {
|
|
5
|
-
const hash = hashObject({ args, input });
|
|
6
|
-
if (cache.has(hash)) {
|
|
7
|
-
return cache.get(hash);
|
|
8
|
-
}
|
|
9
|
-
let result;
|
|
10
|
-
function getter() {
|
|
11
|
-
result ??= [
|
|
12
|
-
input({
|
|
13
|
-
...system,
|
|
14
|
-
args,
|
|
15
|
-
take,
|
|
16
|
-
}),
|
|
17
|
-
];
|
|
18
|
-
return result[0];
|
|
19
|
-
}
|
|
20
|
-
getter.then = async () => await getter();
|
|
21
|
-
cache.set(hash, getter);
|
|
22
|
-
return getter;
|
|
23
|
-
});
|
|
24
|
-
return take;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=createTake.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTake.js","sourceRoot":"","sources":["../../src/contexts/createTake.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAKrC,MAAM,UAAU,UAAU,CAAC,MAAmB;IAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,MAAM,IAAI,GAAG,CAAC,CACb,KAAuC,EACvC,IAA+B,EAC9B,EAAE;QACH,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEzC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QAED,IAAI,MAA4B,CAAC;QAEjC,SAAS,MAAM;YACd,MAAM,KAAK;gBACV,KAAK,CAAC;oBACL,GAAG,MAAM;oBACT,IAAI;oBACJ,IAAI;iBACJ,CAAC;aACF,CAAC;YACF,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,EAAE,CAAC;QAEzC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IACf,CAAC,CAAc,CAAC;IAEhB,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTake.test.d.ts","sourceRoot":"","sources":["../../src/contexts/createTake.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { createSystemFetchers } from "bingo-systems";
|
|
2
|
-
import { describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { createInput } from "../creators/createInput.js";
|
|
5
|
-
import { createTake } from "./createTake.js";
|
|
6
|
-
const createMockSystem = () => ({
|
|
7
|
-
fetchers: createSystemFetchers({
|
|
8
|
-
fetch: vi.fn(),
|
|
9
|
-
}),
|
|
10
|
-
fs: {
|
|
11
|
-
readDirectory: vi.fn(),
|
|
12
|
-
readFile: vi.fn(),
|
|
13
|
-
},
|
|
14
|
-
runner: vi.fn(),
|
|
15
|
-
});
|
|
16
|
-
describe("createTake", () => {
|
|
17
|
-
describe("without args", () => {
|
|
18
|
-
it("produces a getter when called the first time", () => {
|
|
19
|
-
const value = { inner: 123 };
|
|
20
|
-
const take = createTake(createMockSystem());
|
|
21
|
-
const produce = vi.fn().mockReturnValueOnce(value);
|
|
22
|
-
const input = createInput({ produce });
|
|
23
|
-
const getter = take(input);
|
|
24
|
-
expect(getter()).toBe(value);
|
|
25
|
-
expect(produce).toHaveBeenCalledOnce();
|
|
26
|
-
});
|
|
27
|
-
it("returns the same value from the getter when the getter is called multiple times", () => {
|
|
28
|
-
const value = { inner: 123 };
|
|
29
|
-
const take = createTake(createMockSystem());
|
|
30
|
-
const produce = vi.fn().mockReturnValueOnce(value);
|
|
31
|
-
const input = createInput({ produce });
|
|
32
|
-
const getter = take(input);
|
|
33
|
-
getter();
|
|
34
|
-
expect(getter()).toBe(value);
|
|
35
|
-
expect(produce).toHaveBeenCalledOnce();
|
|
36
|
-
});
|
|
37
|
-
it("produces the same cached getter when called the second time", () => {
|
|
38
|
-
const value = { inner: 123 };
|
|
39
|
-
const take = createTake(createMockSystem());
|
|
40
|
-
const produce = vi.fn().mockReturnValueOnce(value);
|
|
41
|
-
const input = createInput({ produce });
|
|
42
|
-
take(input);
|
|
43
|
-
const getter = take(input);
|
|
44
|
-
expect(getter()).toBe(value);
|
|
45
|
-
expect(produce).toHaveBeenCalledOnce();
|
|
46
|
-
});
|
|
47
|
-
it("produces the same result when two getters are created and called once", () => {
|
|
48
|
-
const value = { inner: 123 };
|
|
49
|
-
const take = createTake(createMockSystem());
|
|
50
|
-
const produce = vi.fn().mockReturnValueOnce(value);
|
|
51
|
-
const input = createInput({ produce });
|
|
52
|
-
const getterFirst = take(input);
|
|
53
|
-
const actualFirst = getterFirst();
|
|
54
|
-
const getterSecond = take(input);
|
|
55
|
-
expect(getterSecond()).toBe(actualFirst);
|
|
56
|
-
expect(produce).toHaveBeenCalledOnce();
|
|
57
|
-
});
|
|
58
|
-
it("passes args when provided and in the schema", () => {
|
|
59
|
-
const take = createTake(createMockSystem());
|
|
60
|
-
const input = createInput({
|
|
61
|
-
args: {
|
|
62
|
-
value: z.number(),
|
|
63
|
-
},
|
|
64
|
-
produce: ({ args }) => args.value * 2,
|
|
65
|
-
});
|
|
66
|
-
const getter = take(input, { value: 123 });
|
|
67
|
-
expect(getter()).toBe(246);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=createTake.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTake.test.js","sourceRoot":"","sources":["../../src/contexts/createTake.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/B,QAAQ,EAAE,oBAAoB,CAAC;QAC9B,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;KACd,CAAC;IACF,EAAE,EAAE;QACH,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;QACtB,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;KACjB;IACD,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE;CACf,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACvD,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,gBAA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YAEH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAE3C,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/options.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Any object containing Zod schemas that are optional.
|
|
4
|
-
* In other words, allows providing an empty object {} value.
|
|
5
|
-
*/
|
|
6
|
-
export type AnyOptionalShape = Record<string, z.ZodDefault<z.ZodType> | z.ZodOptional<z.ZodType>>;
|
|
7
|
-
/**
|
|
8
|
-
* Any object containing Zod schemas as values.
|
|
9
|
-
*/
|
|
10
|
-
export type AnyShape = z.ZodRawShape;
|
|
11
|
-
/**
|
|
12
|
-
* Given an object containing Zod schemas, produces the equivalent runtime type.
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* InferredObject<{ value: z.ZodNumber }>
|
|
16
|
-
* ```
|
|
17
|
-
* is the same as:
|
|
18
|
-
* ```ts
|
|
19
|
-
* { value: number }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export type InferredObject<OptionsShape extends AnyShape | undefined> = OptionsShape extends AnyShape ? z.infer<z.ZodObject<OptionsShape>> : undefined;
|
|
23
|
-
//# sourceMappingURL=options.d.ts.map
|
package/lib/options.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACpC,MAAM,EACN,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC;AAErC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,QAAQ,GAAG,SAAS,IACnE,YAAY,SAAS,QAAQ,GAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,GAClC,SAAS,CAAC"}
|
package/lib/options.js
DELETED
package/lib/options.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,oGAAoG"}
|
package/lib/shapes.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Any object containing Zod schemas that are optional.
|
|
4
|
-
* In other words, allows providing an empty object {} value.
|
|
5
|
-
*/
|
|
6
|
-
export type AnyOptionalShape = Record<string, z.ZodDefault<z.ZodType> | z.ZodOptional<z.ZodType>>;
|
|
7
|
-
/**
|
|
8
|
-
* Any object containing Zod schemas as values.
|
|
9
|
-
*/
|
|
10
|
-
export type AnyShape = z.ZodRawShape;
|
|
11
|
-
/**
|
|
12
|
-
* Given an object containing Zod schemas, produces the equivalent runtime type.
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* InferredObject<{ value: z.ZodNumber }>
|
|
16
|
-
* ```
|
|
17
|
-
* is the same as:
|
|
18
|
-
* ```ts
|
|
19
|
-
* { value: number }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export type InferredObject<OptionsShape extends AnyShape | undefined> = OptionsShape extends AnyShape ? z.infer<z.ZodObject<OptionsShape>> : undefined;
|
|
23
|
-
//# sourceMappingURL=shapes.d.ts.map
|
package/lib/shapes.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../src/shapes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACpC,MAAM,EACN,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC;AAErC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,QAAQ,GAAG,SAAS,IACnE,YAAY,SAAS,QAAQ,GAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,GAClC,SAAS,CAAC"}
|
package/lib/shapes.js
DELETED
package/lib/shapes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shapes.js","sourceRoot":"","sources":["../src/shapes.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,oGAAoG"}
|