@bscotch/stitch-config 0.2.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.md ADDED
@@ -0,0 +1,29 @@
1
+ # License for the Stitch Monorepo
2
+
3
+ License information for the content of this git repository. The various packages in this repo are developed by [Butterscotch Shenanigans](https://www.bscotch.net) ("Bscotch").
4
+
5
+ ## License files
6
+
7
+ Whenever a `LICENSE` file is found in a folder, or a license is specified by a `package.json` or similar manifest file, that license takes precedence for all files in that folder and its subfolders.
8
+
9
+ This is the root-most `LICENSE` file, and therefore dictates the default licensing in this repository.
10
+
11
+ ## Stitch name and logo
12
+
13
+ ![Stitch Logo](https://img.bscotch.net/fit-in/256x256/logos/stitch.png "The Stitch Logo, copyright and trademark Butterscotch Shenanigans, all rights reserved.")
14
+
15
+ Stitch™ and its logo are trademarks of Bscotch. Bscotch reserves all rights to Stitch and its logo.
16
+
17
+ Stitch Logo ©2022 by Bscotch. All rights reserved.
18
+
19
+ ## Other code and content
20
+
21
+ Everything found in this project, except for the Stitch name and logo as described above or unless otherwise specified by a more proximal LICENSE file, falls under the MIT license (https://opensource.org/license/mit/):
22
+
23
+ Copyright 2023 Butterscotch Shenanigans
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Stitch Config
2
+
3
+ [Stitch](https://github.com/bscotch/stitch) is a collection of tools for managing [GameMaker](https://gamemaker.io) projects, developed by [Butterscotch Shenanigans](https://www.bscotch.net/).
4
+
5
+ Stitch projects make use of some shared libraries and resources. This package provides schemas and utilities to help manage the `stitch.config.json` file, which lives alongside a GameMaker project's `.yyp` file and is used for configuration of various Stitch features.
6
+
7
+ The `stitch.config.json` file is used for configuration options that:
8
+
9
+ - Are specific to the project (i.e. not general configuration)
10
+ - Must be followed by all collaborators on that project
11
+ - Are not machine-dependent nor user-dependent
@@ -0,0 +1,3 @@
1
+ export * from './schema.js';
2
+ export declare const stitchConfigFilename = "stitch.config.json";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,eAAO,MAAM,oBAAoB,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './schema.js';
2
+ export const stitchConfigFilename = 'stitch.config.json';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,125 @@
1
+ import { z } from 'zod';
2
+ export declare const jsonSchemaUrl = "https://raw.githubusercontent.com/bscotch/stitch/develop/packages/config/schemas/stitch.config.schema.json";
3
+ export type StitchConfig = z.infer<typeof stitchConfigSchema>;
4
+ export declare const stitchConfigSchema: z.ZodObject<{
5
+ $schema: z.ZodDefault<z.ZodLiteral<"https://raw.githubusercontent.com/bscotch/stitch/develop/packages/config/schemas/stitch.config.schema.json">>;
6
+ textureGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
7
+ audioGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
8
+ runtimeVersion: z.ZodOptional<z.ZodString>;
9
+ newSpriteRules: z.ZodOptional<z.ZodObject<{
10
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
12
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
14
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ }, z.ZodTypeAny, "passthrough">>>;
16
+ newSoundRules: z.ZodOptional<z.ZodObject<{
17
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
19
+ mono: z.ZodOptional<z.ZodBoolean>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ mono?: boolean | undefined;
22
+ }, {
23
+ mono?: boolean | undefined;
24
+ }>>>;
25
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
26
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
28
+ mono: z.ZodOptional<z.ZodBoolean>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ mono?: boolean | undefined;
31
+ }, {
32
+ mono?: boolean | undefined;
33
+ }>>>;
34
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
35
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
37
+ mono: z.ZodOptional<z.ZodBoolean>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ mono?: boolean | undefined;
40
+ }, {
41
+ mono?: boolean | undefined;
42
+ }>>>;
43
+ }, z.ZodTypeAny, "passthrough">>>;
44
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
45
+ $schema: z.ZodDefault<z.ZodLiteral<"https://raw.githubusercontent.com/bscotch/stitch/develop/packages/config/schemas/stitch.config.schema.json">>;
46
+ textureGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
47
+ audioGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
48
+ runtimeVersion: z.ZodOptional<z.ZodString>;
49
+ newSpriteRules: z.ZodOptional<z.ZodObject<{
50
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
51
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
52
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
53
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
54
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
55
+ }, z.ZodTypeAny, "passthrough">>>;
56
+ newSoundRules: z.ZodOptional<z.ZodObject<{
57
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
58
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
59
+ mono: z.ZodOptional<z.ZodBoolean>;
60
+ }, "strip", z.ZodTypeAny, {
61
+ mono?: boolean | undefined;
62
+ }, {
63
+ mono?: boolean | undefined;
64
+ }>>>;
65
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
66
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
67
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
68
+ mono: z.ZodOptional<z.ZodBoolean>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ mono?: boolean | undefined;
71
+ }, {
72
+ mono?: boolean | undefined;
73
+ }>>>;
74
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
75
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
76
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
77
+ mono: z.ZodOptional<z.ZodBoolean>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ mono?: boolean | undefined;
80
+ }, {
81
+ mono?: boolean | undefined;
82
+ }>>>;
83
+ }, z.ZodTypeAny, "passthrough">>>;
84
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
85
+ $schema: z.ZodDefault<z.ZodLiteral<"https://raw.githubusercontent.com/bscotch/stitch/develop/packages/config/schemas/stitch.config.schema.json">>;
86
+ textureGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
87
+ audioGroupAssignments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
88
+ runtimeVersion: z.ZodOptional<z.ZodString>;
89
+ newSpriteRules: z.ZodOptional<z.ZodObject<{
90
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
91
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
92
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
93
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
94
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
95
+ }, z.ZodTypeAny, "passthrough">>>;
96
+ newSoundRules: z.ZodOptional<z.ZodObject<{
97
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
99
+ mono: z.ZodOptional<z.ZodBoolean>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ mono?: boolean | undefined;
102
+ }, {
103
+ mono?: boolean | undefined;
104
+ }>>>;
105
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
106
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
107
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
108
+ mono: z.ZodOptional<z.ZodBoolean>;
109
+ }, "strip", z.ZodTypeAny, {
110
+ mono?: boolean | undefined;
111
+ }, {
112
+ mono?: boolean | undefined;
113
+ }>>>;
114
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
115
+ allowedNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
116
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
117
+ mono: z.ZodOptional<z.ZodBoolean>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ mono?: boolean | undefined;
120
+ }, {
121
+ mono?: boolean | undefined;
122
+ }>>>;
123
+ }, z.ZodTypeAny, "passthrough">>>;
124
+ }, z.ZodTypeAny, "passthrough">>;
125
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,aAAa,+GACoF,CAAC;AAE/G,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAwD5B,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ const allowedNames = z
3
+ .array(z.string())
4
+ .optional()
5
+ .describe('A list of regex patterns that new assets must match. Enforced by supported Stitch utilities.');
6
+ export const jsonSchemaUrl = 'https://raw.githubusercontent.com/bscotch/stitch/develop/packages/config/schemas/stitch.config.schema.json';
7
+ export const stitchConfigSchema = z
8
+ .object({
9
+ $schema: z.literal(jsonSchemaUrl).default(jsonSchemaUrl),
10
+ textureGroupAssignments: z
11
+ .record(z.string())
12
+ .default({})
13
+ .describe('A map of resource tree paths to texture groups name. Supported Stitch utilities will use this to assign sprites in those paths (recursively) to the specified texture group.'),
14
+ audioGroupAssignments: z
15
+ .record(z.string())
16
+ .default({})
17
+ .describe('A map of resource tree paths to audio groups name. Supported Stitch utilities will use this to assign sounds in those paths (recursively) to the specified audio group.'),
18
+ runtimeVersion: z
19
+ .string()
20
+ .optional()
21
+ .describe('When set, supported Stitch utilities will preferentially use this GameMaker runtime version.'),
22
+ newSpriteRules: z
23
+ .object({ allowedNames })
24
+ .passthrough()
25
+ .optional()
26
+ .describe('Rules for creating new sprite resources, followed by supported Stitch utilities.'),
27
+ newSoundRules: z
28
+ .object({
29
+ allowedNames,
30
+ defaults: z
31
+ .record(z.object({
32
+ mono: z
33
+ .boolean()
34
+ .optional()
35
+ .describe('Whether to default new sounds to mono. When not set, the default is stereo.'),
36
+ }))
37
+ .optional()
38
+ .describe('Default properties for new sound assets, by name pattern. E.g. `{".*":{ mono: true}}` defaults all new sounds to mono. The first matching pattern is used.'),
39
+ })
40
+ .passthrough()
41
+ .optional()
42
+ .describe('Rules for creating new sound resources, followed by supported Stitch utilities.'),
43
+ })
44
+ .passthrough()
45
+ .describe('Stitch configuration schema. Stitch utilities may support subsets of this configuration.');
46
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,CAAC;KACnB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KACjB,QAAQ,EAAE;KACV,QAAQ,CACP,8FAA8F,CAC/F,CAAC;AACJ,MAAM,CAAC,MAAM,aAAa,GACxB,4GAA4G,CAAC;AAG/G,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IACxD,uBAAuB,EAAE,CAAC;SACvB,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAClB,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CACP,8KAA8K,CAC/K;IACH,qBAAqB,EAAE,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAClB,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CACP,yKAAyK,CAC1K;IACH,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,8FAA8F,CAC/F;IACH,cAAc,EAAE,CAAC;SACd,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;SACxB,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CACP,kFAAkF,CACnF;IACH,aAAa,EAAE,CAAC;SACb,MAAM,CAAC;QACN,YAAY;QACZ,QAAQ,EAAE,CAAC;aACR,MAAM,CACL,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC;iBACJ,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,QAAQ,CACP,6EAA6E,CAC9E;SACJ,CAAC,CACH;aACA,QAAQ,EAAE;aACV,QAAQ,CACP,4JAA4J,CAC7J;KACJ,CAAC;SACD,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CACP,iFAAiF,CAClF;CACJ,CAAC;KACD,WAAW,EAAE;KACb,QAAQ,CACP,0FAA0F,CAC3F,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@bscotch/stitch-config",
3
+ "version": "0.2.0",
4
+ "description": "Schemas and utilities for the stitch.config.json file.",
5
+ "keywords": [
6
+ "stitch",
7
+ "bscotch"
8
+ ],
9
+ "homepage": "https://github.com/bscotch/stitch/tree/develop/packages/config#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/bscotch/stitch.git",
13
+ "directory": "packages/config"
14
+ },
15
+ "license": "MIT",
16
+ "type": "module",
17
+ "main": "dist/index.js",
18
+ "dependencies": {
19
+ "zod": "3.22.4"
20
+ },
21
+ "devDependencies": {
22
+ "source-map-support": "0.5.21",
23
+ "typescript": "5.3.3",
24
+ "zod-to-json-schema": "3.21.4"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc --build && node scripts/update-schemas.mjs",
31
+ "watch": "tsc --build --watch"
32
+ }
33
+ }