@savvy-web/templates 0.1.3 → 0.1.4
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/index.d.ts +199 -2
- package/lib/biome/index.js +12 -0
- package/lib/changeset/index.js +12 -0
- package/lib/gitignore/index.js +12 -0
- package/lib/package-json/index.js +12 -0
- package/lib/pnpm/index.js +12 -0
- package/lib/readme/index.js +12 -0
- package/lib/tsconfig/index.js +12 -0
- package/lib/turbo/index.js +24 -0
- package/lib/vscode/index.js +12 -0
- package/lib/workspace/index.js +12 -0
- package/package.json +3 -2
- package/tsdoc-metadata.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { Schema } from "effect";
|
|
|
6
6
|
*
|
|
7
7
|
* Templates produce content with a logical name and suggested filename.
|
|
8
8
|
* The consumer decides where (and whether) to write the content.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
9
11
|
*/
|
|
10
12
|
interface TemplateEntry {
|
|
11
13
|
/** Logical name for this entry (e.g., "tsconfig", "biome", "vscode-settings") */
|
|
@@ -15,21 +17,51 @@ interface TemplateEntry {
|
|
|
15
17
|
/** The generated file content */
|
|
16
18
|
readonly content: string;
|
|
17
19
|
}
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* A template: typed options in, content entries out.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
19
25
|
type Template<O> = (options: O) => TemplateEntry[];
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* An update template: existing content + partial options in, content entries out.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
21
31
|
type UpdateTemplate<O> = (existing: string, options: Partial<O>) => TemplateEntry[];
|
|
22
32
|
//#endregion
|
|
23
33
|
//#region src/lib/biome/index.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Options for generating a Biome configuration file.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
24
39
|
declare const BiomeOptions: Schema.Struct<{
|
|
25
40
|
version: typeof Schema.String;
|
|
26
41
|
extends: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
27
42
|
root: Schema.optional<typeof Schema.Boolean>;
|
|
28
43
|
}>;
|
|
44
|
+
/**
|
|
45
|
+
* The decoded type of {@link BiomeOptions}.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
29
49
|
type BiomeOptionsType = typeof BiomeOptions.Type;
|
|
50
|
+
/**
|
|
51
|
+
* Generates a `biome.jsonc` configuration file entry.
|
|
52
|
+
*
|
|
53
|
+
* @param options - the Biome configuration options
|
|
54
|
+
* @returns an array containing the generated `biome.jsonc` entry
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
30
57
|
declare function createBiome(options: unknown): TemplateEntry[];
|
|
31
58
|
//#endregion
|
|
32
59
|
//#region src/lib/changeset/index.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Options for generating a Changesets configuration file.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
33
65
|
declare const ChangesetOptions: Schema.Struct<{
|
|
34
66
|
access: Schema.optionalWith<Schema.Literal<["public", "restricted"]>, {
|
|
35
67
|
default: () => "restricted";
|
|
@@ -42,10 +74,27 @@ declare const ChangesetOptions: Schema.Struct<{
|
|
|
42
74
|
}>;
|
|
43
75
|
repo: Schema.optional<Schema.filter<typeof Schema.String>>;
|
|
44
76
|
}>;
|
|
77
|
+
/**
|
|
78
|
+
* The decoded type of {@link ChangesetOptions}.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
45
82
|
type ChangesetOptionsType = typeof ChangesetOptions.Type;
|
|
83
|
+
/**
|
|
84
|
+
* Generates a `.changeset/config.json` configuration file entry.
|
|
85
|
+
*
|
|
86
|
+
* @param options - the Changesets configuration options
|
|
87
|
+
* @returns an array containing the generated changeset config entry
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
46
90
|
declare function createChangeset(options: unknown): TemplateEntry[];
|
|
47
91
|
//#endregion
|
|
48
92
|
//#region src/lib/gitignore/index.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Options for generating a `.gitignore` file.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
49
98
|
declare const GitignoreOptions: Schema.Struct<{
|
|
50
99
|
sections: Schema.optional<Schema.Struct<{
|
|
51
100
|
node: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -56,10 +105,27 @@ declare const GitignoreOptions: Schema.Struct<{
|
|
|
56
105
|
}>>;
|
|
57
106
|
additional: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
58
107
|
}>;
|
|
108
|
+
/**
|
|
109
|
+
* The decoded type of {@link GitignoreOptions}.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
59
113
|
type GitignoreOptionsType = typeof GitignoreOptions.Type;
|
|
114
|
+
/**
|
|
115
|
+
* Generates a `.gitignore` file entry.
|
|
116
|
+
*
|
|
117
|
+
* @param options - the gitignore configuration options
|
|
118
|
+
* @returns an array containing the generated `.gitignore` entry
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
60
121
|
declare function createGitignore(options: unknown): TemplateEntry[];
|
|
61
122
|
//#endregion
|
|
62
123
|
//#region src/lib/package-json/index.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Options for generating a `package.json` file.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
63
129
|
declare const PackageJsonOptions: Schema.Struct<{
|
|
64
130
|
name: typeof Schema.String;
|
|
65
131
|
version: Schema.optionalWith<typeof Schema.String, {
|
|
@@ -103,28 +169,79 @@ declare const PackageJsonOptions: Schema.Struct<{
|
|
|
103
169
|
}>>;
|
|
104
170
|
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
105
171
|
}>;
|
|
172
|
+
/**
|
|
173
|
+
* The decoded type of {@link PackageJsonOptions}.
|
|
174
|
+
*
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
106
177
|
type PackageJsonOptionsType = typeof PackageJsonOptions.Type;
|
|
178
|
+
/**
|
|
179
|
+
* Generates a sorted `package.json` file entry.
|
|
180
|
+
*
|
|
181
|
+
* @param options - the package.json configuration options
|
|
182
|
+
* @returns an array containing the generated `package.json` entry
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
107
185
|
declare function createPackageJson(options: unknown): TemplateEntry[];
|
|
108
186
|
//#endregion
|
|
109
187
|
//#region src/lib/pnpm/index.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* Options for generating a `pnpm-workspace.yaml` file.
|
|
190
|
+
*
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
110
193
|
declare const PnpmWorkspaceOptions: Schema.Struct<{
|
|
111
194
|
packages: Schema.Array$<typeof Schema.String>;
|
|
112
195
|
autoInstallPeers: Schema.optional<typeof Schema.Boolean>;
|
|
113
196
|
catalogMode: Schema.optional<Schema.Literal<["strict", "prefer", "manual"]>>;
|
|
114
197
|
catalog: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
115
198
|
}>;
|
|
199
|
+
/**
|
|
200
|
+
* The decoded type of {@link PnpmWorkspaceOptions}.
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
116
204
|
type PnpmWorkspaceOptionsType = typeof PnpmWorkspaceOptions.Type;
|
|
205
|
+
/**
|
|
206
|
+
* Generates a `pnpm-workspace.yaml` file entry.
|
|
207
|
+
*
|
|
208
|
+
* @param options - the pnpm workspace configuration options
|
|
209
|
+
* @returns an array containing the generated `pnpm-workspace.yaml` entry
|
|
210
|
+
* @public
|
|
211
|
+
*/
|
|
117
212
|
declare function createPnpmWorkspace(options: unknown): TemplateEntry[];
|
|
118
213
|
//#endregion
|
|
119
214
|
//#region src/lib/readme/index.d.ts
|
|
215
|
+
/**
|
|
216
|
+
* Options for generating a `README.md` file.
|
|
217
|
+
*
|
|
218
|
+
* @public
|
|
219
|
+
*/
|
|
120
220
|
declare const ReadmeOptions: Schema.Struct<{
|
|
121
221
|
name: typeof Schema.String;
|
|
122
222
|
description: Schema.optional<typeof Schema.String>;
|
|
123
223
|
}>;
|
|
224
|
+
/**
|
|
225
|
+
* The decoded type of {@link ReadmeOptions}.
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
124
229
|
type ReadmeOptionsType = typeof ReadmeOptions.Type;
|
|
230
|
+
/**
|
|
231
|
+
* Generates a `README.md` file entry.
|
|
232
|
+
*
|
|
233
|
+
* @param options - the README configuration options
|
|
234
|
+
* @returns an array containing the generated `README.md` entry
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
125
237
|
declare function createReadme(options: unknown): TemplateEntry[];
|
|
126
238
|
//#endregion
|
|
127
239
|
//#region src/lib/tsconfig/index.d.ts
|
|
240
|
+
/**
|
|
241
|
+
* Options for generating a `tsconfig.json` file.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
128
245
|
declare const TsConfigOptions: Schema.Struct<{
|
|
129
246
|
extends: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.String>]>>;
|
|
130
247
|
composite: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -134,10 +251,27 @@ declare const TsConfigOptions: Schema.Struct<{
|
|
|
134
251
|
path: typeof Schema.String;
|
|
135
252
|
}>>>;
|
|
136
253
|
}>;
|
|
254
|
+
/**
|
|
255
|
+
* The decoded type of {@link TsConfigOptions}.
|
|
256
|
+
*
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
137
259
|
type TsConfigOptionsType = typeof TsConfigOptions.Type;
|
|
260
|
+
/**
|
|
261
|
+
* Generates a `tsconfig.json` file entry.
|
|
262
|
+
*
|
|
263
|
+
* @param options - the TypeScript configuration options
|
|
264
|
+
* @returns an array containing the generated `tsconfig.json` entry
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
138
267
|
declare function createTsConfig(options: unknown): TemplateEntry[];
|
|
139
268
|
//#endregion
|
|
140
269
|
//#region src/lib/turbo/index.d.ts
|
|
270
|
+
/**
|
|
271
|
+
* Options for generating a root `turbo.json` file.
|
|
272
|
+
*
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
141
275
|
declare const TurboRootOptions: Schema.Struct<{
|
|
142
276
|
tasks: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
143
277
|
globalDependencies: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
@@ -146,15 +280,49 @@ declare const TurboRootOptions: Schema.Struct<{
|
|
|
146
280
|
ui: Schema.optional<Schema.Literal<["tui", "stream"]>>;
|
|
147
281
|
concurrency: Schema.optional<Schema.Union<[typeof Schema.String, typeof Schema.Number]>>;
|
|
148
282
|
}>;
|
|
283
|
+
/**
|
|
284
|
+
* The decoded type of {@link TurboRootOptions}.
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
149
288
|
type TurboRootOptionsType = typeof TurboRootOptions.Type;
|
|
289
|
+
/**
|
|
290
|
+
* Options for generating a workspace-level `turbo.json` file.
|
|
291
|
+
*
|
|
292
|
+
* @public
|
|
293
|
+
*/
|
|
150
294
|
declare const TurboWorkspaceOptions: Schema.Struct<{
|
|
151
295
|
tasks: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
152
296
|
}>;
|
|
297
|
+
/**
|
|
298
|
+
* The decoded type of {@link TurboWorkspaceOptions}.
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
*/
|
|
153
302
|
type TurboWorkspaceOptionsType = typeof TurboWorkspaceOptions.Type;
|
|
303
|
+
/**
|
|
304
|
+
* Generates a root `turbo.json` file entry.
|
|
305
|
+
*
|
|
306
|
+
* @param options - the root Turborepo configuration options
|
|
307
|
+
* @returns an array containing the generated root `turbo.json` entry
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
154
310
|
declare function createTurboRoot(options: unknown): TemplateEntry[];
|
|
311
|
+
/**
|
|
312
|
+
* Generates a workspace-level `turbo.json` file entry.
|
|
313
|
+
*
|
|
314
|
+
* @param options - the workspace Turborepo configuration options
|
|
315
|
+
* @returns an array containing the generated workspace `turbo.json` entry
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
155
318
|
declare function createTurboWorkspace(options: unknown): TemplateEntry[];
|
|
156
319
|
//#endregion
|
|
157
320
|
//#region src/lib/vscode/index.d.ts
|
|
321
|
+
/**
|
|
322
|
+
* Options for generating VS Code configuration files.
|
|
323
|
+
*
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
158
326
|
declare const VsCodeOptions: Schema.Struct<{
|
|
159
327
|
settings: Schema.optional<Schema.Struct<{
|
|
160
328
|
biome: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -163,10 +331,27 @@ declare const VsCodeOptions: Schema.Struct<{
|
|
|
163
331
|
}>>;
|
|
164
332
|
extensions: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
165
333
|
}>;
|
|
334
|
+
/**
|
|
335
|
+
* The decoded type of {@link VsCodeOptions}.
|
|
336
|
+
*
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
166
339
|
type VsCodeOptionsType = typeof VsCodeOptions.Type;
|
|
340
|
+
/**
|
|
341
|
+
* Generates `.vscode/settings.json` and `.vscode/extensions.json` file entries.
|
|
342
|
+
*
|
|
343
|
+
* @param options - the VS Code configuration options
|
|
344
|
+
* @returns an array containing the generated VS Code configuration entries
|
|
345
|
+
* @public
|
|
346
|
+
*/
|
|
167
347
|
declare function createVsCode(options: unknown): TemplateEntry[];
|
|
168
348
|
//#endregion
|
|
169
349
|
//#region src/lib/workspace/index.d.ts
|
|
350
|
+
/**
|
|
351
|
+
* Options for generating a complete workspace scaffold.
|
|
352
|
+
*
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
170
355
|
declare const WorkspaceOptions: Schema.Struct<{
|
|
171
356
|
name: typeof Schema.String;
|
|
172
357
|
packageManager: Schema.Literal<["pnpm", "npm", "bun"]>;
|
|
@@ -183,7 +368,19 @@ declare const WorkspaceOptions: Schema.Struct<{
|
|
|
183
368
|
vscode: Schema.optional<typeof Schema.Boolean>;
|
|
184
369
|
}>>;
|
|
185
370
|
}>;
|
|
371
|
+
/**
|
|
372
|
+
* The decoded type of {@link WorkspaceOptions}.
|
|
373
|
+
*
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
186
376
|
type WorkspaceOptionsType = typeof WorkspaceOptions.Type;
|
|
377
|
+
/**
|
|
378
|
+
* Generates all file entries for a new workspace scaffold.
|
|
379
|
+
*
|
|
380
|
+
* @param options - the workspace configuration options
|
|
381
|
+
* @returns an array of template entries for the complete workspace
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
187
384
|
declare function createWorkspace(options: unknown): TemplateEntry[];
|
|
188
385
|
//#endregion
|
|
189
386
|
export { BiomeOptions, type BiomeOptionsType, ChangesetOptions, type ChangesetOptionsType, GitignoreOptions, type GitignoreOptionsType, PackageJsonOptions, type PackageJsonOptionsType, PnpmWorkspaceOptions, type PnpmWorkspaceOptionsType, ReadmeOptions, type ReadmeOptionsType, type Template, type TemplateEntry, TsConfigOptions, type TsConfigOptionsType, TurboRootOptions, type TurboRootOptionsType, TurboWorkspaceOptions, type TurboWorkspaceOptionsType, type UpdateTemplate, VsCodeOptions, type VsCodeOptionsType, WorkspaceOptions, type WorkspaceOptionsType, createBiome, createChangeset, createGitignore, createPackageJson, createPnpmWorkspace, createReadme, createTsConfig, createTurboRoot, createTurboWorkspace, createVsCode, createWorkspace };
|
package/lib/biome/index.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/biome/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for generating a Biome configuration file.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
const BiomeOptions = Schema.Struct({
|
|
5
10
|
version: Schema.String,
|
|
6
11
|
extends: Schema.optional(Schema.Array(Schema.String)),
|
|
7
12
|
root: Schema.optional(Schema.Boolean)
|
|
8
13
|
});
|
|
14
|
+
/**
|
|
15
|
+
* Generates a `biome.jsonc` configuration file entry.
|
|
16
|
+
*
|
|
17
|
+
* @param options - the Biome configuration options
|
|
18
|
+
* @returns an array containing the generated `biome.jsonc` entry
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
9
21
|
function createBiome(options) {
|
|
10
22
|
const opts = Schema.decodeUnknownSync(BiomeOptions)(options);
|
|
11
23
|
const config = { $schema: `https://biomejs.dev/schemas/${opts.version}/schema.json` };
|
package/lib/changeset/index.js
CHANGED
|
@@ -2,12 +2,24 @@ import { Schema } from "effect";
|
|
|
2
2
|
|
|
3
3
|
//#region src/lib/changeset/index.ts
|
|
4
4
|
const RepoPattern = Schema.String.pipe(Schema.pattern(/^[^/\s]+\/[^/\s]+$/));
|
|
5
|
+
/**
|
|
6
|
+
* Options for generating a Changesets configuration file.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
5
10
|
const ChangesetOptions = Schema.Struct({
|
|
6
11
|
access: Schema.optionalWith(Schema.Literal("public", "restricted"), { default: () => "restricted" }),
|
|
7
12
|
baseBranch: Schema.optionalWith(Schema.String, { default: () => "main" }),
|
|
8
13
|
changelog: Schema.optionalWith(Schema.String, { default: () => "@savvy-web/changesets/changelog" }),
|
|
9
14
|
repo: Schema.optional(RepoPattern)
|
|
10
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Generates a `.changeset/config.json` configuration file entry.
|
|
18
|
+
*
|
|
19
|
+
* @param options - the Changesets configuration options
|
|
20
|
+
* @returns an array containing the generated changeset config entry
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
11
23
|
function createChangeset(options) {
|
|
12
24
|
const opts = Schema.decodeUnknownSync(ChangesetOptions)(options);
|
|
13
25
|
const config = {
|
package/lib/gitignore/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gitignore/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for generating a `.gitignore` file.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
const GitignoreOptions = Schema.Struct({
|
|
5
10
|
sections: Schema.optional(Schema.Struct({
|
|
6
11
|
node: Schema.optional(Schema.Boolean),
|
|
@@ -11,6 +16,13 @@ const GitignoreOptions = Schema.Struct({
|
|
|
11
16
|
})),
|
|
12
17
|
additional: Schema.optional(Schema.Array(Schema.String))
|
|
13
18
|
});
|
|
19
|
+
/**
|
|
20
|
+
* Generates a `.gitignore` file entry.
|
|
21
|
+
*
|
|
22
|
+
* @param options - the gitignore configuration options
|
|
23
|
+
* @returns an array containing the generated `.gitignore` entry
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
14
26
|
function createGitignore(options) {
|
|
15
27
|
const opts = Schema.decodeUnknownSync(GitignoreOptions)(options);
|
|
16
28
|
const sections = {
|
|
@@ -19,6 +19,11 @@ const PublishConfig = Schema.Struct({
|
|
|
19
19
|
linkDirectory: Schema.optional(Schema.Boolean),
|
|
20
20
|
targets: Schema.optional(Schema.Unknown)
|
|
21
21
|
});
|
|
22
|
+
/**
|
|
23
|
+
* Options for generating a `package.json` file.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
22
27
|
const PackageJsonOptions = Schema.Struct({
|
|
23
28
|
name: Schema.String,
|
|
24
29
|
version: Schema.optionalWith(Schema.String, { default: () => "0.0.0" }),
|
|
@@ -57,6 +62,13 @@ const PackageJsonOptions = Schema.Struct({
|
|
|
57
62
|
publishConfig: Schema.optional(PublishConfig),
|
|
58
63
|
keywords: Schema.optional(Schema.Array(Schema.String))
|
|
59
64
|
});
|
|
65
|
+
/**
|
|
66
|
+
* Generates a sorted `package.json` file entry.
|
|
67
|
+
*
|
|
68
|
+
* @param options - the package.json configuration options
|
|
69
|
+
* @returns an array containing the generated `package.json` entry
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
60
72
|
function createPackageJson(options) {
|
|
61
73
|
const opts = Schema.decodeUnknownSync(PackageJsonOptions)(options);
|
|
62
74
|
const pkg = {
|
package/lib/pnpm/index.js
CHANGED
|
@@ -2,6 +2,11 @@ import { Schema } from "effect";
|
|
|
2
2
|
import yaml from "js-yaml";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/pnpm/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Options for generating a `pnpm-workspace.yaml` file.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
5
10
|
const PnpmWorkspaceOptions = Schema.Struct({
|
|
6
11
|
packages: Schema.Array(Schema.String),
|
|
7
12
|
autoInstallPeers: Schema.optional(Schema.Boolean),
|
|
@@ -11,6 +16,13 @@ const PnpmWorkspaceOptions = Schema.Struct({
|
|
|
11
16
|
value: Schema.String
|
|
12
17
|
}))
|
|
13
18
|
});
|
|
19
|
+
/**
|
|
20
|
+
* Generates a `pnpm-workspace.yaml` file entry.
|
|
21
|
+
*
|
|
22
|
+
* @param options - the pnpm workspace configuration options
|
|
23
|
+
* @returns an array containing the generated `pnpm-workspace.yaml` entry
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
14
26
|
function createPnpmWorkspace(options) {
|
|
15
27
|
const opts = Schema.decodeUnknownSync(PnpmWorkspaceOptions)(options);
|
|
16
28
|
const config = { packages: opts.packages };
|
package/lib/readme/index.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/readme/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for generating a `README.md` file.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
const ReadmeOptions = Schema.Struct({
|
|
5
10
|
name: Schema.String,
|
|
6
11
|
description: Schema.optional(Schema.String)
|
|
7
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* Generates a `README.md` file entry.
|
|
15
|
+
*
|
|
16
|
+
* @param options - the README configuration options
|
|
17
|
+
* @returns an array containing the generated `README.md` entry
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
8
20
|
function createReadme(options) {
|
|
9
21
|
const opts = Schema.decodeUnknownSync(ReadmeOptions)(options);
|
|
10
22
|
const lines = [`# ${opts.name}`];
|
package/lib/tsconfig/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/tsconfig/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for generating a `tsconfig.json` file.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
const TsConfigOptions = Schema.Struct({
|
|
5
10
|
extends: Schema.optional(Schema.Union(Schema.String, Schema.Array(Schema.String))),
|
|
6
11
|
composite: Schema.optional(Schema.Boolean),
|
|
@@ -8,6 +13,13 @@ const TsConfigOptions = Schema.Struct({
|
|
|
8
13
|
exclude: Schema.optional(Schema.Array(Schema.String)),
|
|
9
14
|
references: Schema.optional(Schema.Array(Schema.Struct({ path: Schema.String })))
|
|
10
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Generates a `tsconfig.json` file entry.
|
|
18
|
+
*
|
|
19
|
+
* @param options - the TypeScript configuration options
|
|
20
|
+
* @returns an array containing the generated `tsconfig.json` entry
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
11
23
|
function createTsConfig(options) {
|
|
12
24
|
const opts = Schema.decodeUnknownSync(TsConfigOptions)(options);
|
|
13
25
|
const config = {};
|
package/lib/turbo/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/turbo/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for generating a root `turbo.json` file.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
const TurboRootOptions = Schema.Struct({
|
|
5
10
|
tasks: Schema.Record({
|
|
6
11
|
key: Schema.String,
|
|
@@ -12,10 +17,22 @@ const TurboRootOptions = Schema.Struct({
|
|
|
12
17
|
ui: Schema.optional(Schema.Literal("tui", "stream")),
|
|
13
18
|
concurrency: Schema.optional(Schema.Union(Schema.String, Schema.Number))
|
|
14
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* Options for generating a workspace-level `turbo.json` file.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
15
25
|
const TurboWorkspaceOptions = Schema.Struct({ tasks: Schema.optional(Schema.Record({
|
|
16
26
|
key: Schema.String,
|
|
17
27
|
value: Schema.Unknown
|
|
18
28
|
})) });
|
|
29
|
+
/**
|
|
30
|
+
* Generates a root `turbo.json` file entry.
|
|
31
|
+
*
|
|
32
|
+
* @param options - the root Turborepo configuration options
|
|
33
|
+
* @returns an array containing the generated root `turbo.json` entry
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
19
36
|
function createTurboRoot(options) {
|
|
20
37
|
const opts = Schema.decodeUnknownSync(TurboRootOptions)(options);
|
|
21
38
|
const config = {
|
|
@@ -33,6 +50,13 @@ function createTurboRoot(options) {
|
|
|
33
50
|
content: JSON.stringify(config, null, " ")
|
|
34
51
|
}];
|
|
35
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Generates a workspace-level `turbo.json` file entry.
|
|
55
|
+
*
|
|
56
|
+
* @param options - the workspace Turborepo configuration options
|
|
57
|
+
* @returns an array containing the generated workspace `turbo.json` entry
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
36
60
|
function createTurboWorkspace(options) {
|
|
37
61
|
const opts = Schema.decodeUnknownSync(TurboWorkspaceOptions)(options);
|
|
38
62
|
const config = { extends: ["//"] };
|
package/lib/vscode/index.js
CHANGED
|
@@ -6,10 +6,22 @@ const Settings = Schema.Struct({
|
|
|
6
6
|
turbo: Schema.optional(Schema.Boolean),
|
|
7
7
|
vitest: Schema.optional(Schema.Boolean)
|
|
8
8
|
});
|
|
9
|
+
/**
|
|
10
|
+
* Options for generating VS Code configuration files.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
9
14
|
const VsCodeOptions = Schema.Struct({
|
|
10
15
|
settings: Schema.optional(Settings),
|
|
11
16
|
extensions: Schema.optional(Schema.Array(Schema.String))
|
|
12
17
|
});
|
|
18
|
+
/**
|
|
19
|
+
* Generates `.vscode/settings.json` and `.vscode/extensions.json` file entries.
|
|
20
|
+
*
|
|
21
|
+
* @param options - the VS Code configuration options
|
|
22
|
+
* @returns an array containing the generated VS Code configuration entries
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
13
25
|
function createVsCode(options) {
|
|
14
26
|
const opts = Schema.decodeUnknownSync(VsCodeOptions)(options);
|
|
15
27
|
const features = opts.settings ?? {};
|
package/lib/workspace/index.js
CHANGED
|
@@ -17,6 +17,11 @@ const Features = Schema.Struct({
|
|
|
17
17
|
changesets: Schema.optional(Schema.Boolean),
|
|
18
18
|
vscode: Schema.optional(Schema.Boolean)
|
|
19
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* Options for generating a complete workspace scaffold.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
20
25
|
const WorkspaceOptions = Schema.Struct({
|
|
21
26
|
name: Schema.String,
|
|
22
27
|
packageManager: Schema.Literal("pnpm", "npm", "bun"),
|
|
@@ -25,6 +30,13 @@ const WorkspaceOptions = Schema.Struct({
|
|
|
25
30
|
biomeVersion: Schema.optionalWith(Schema.String, { default: () => "2.3.3" }),
|
|
26
31
|
features: Schema.optional(Features)
|
|
27
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* Generates all file entries for a new workspace scaffold.
|
|
35
|
+
*
|
|
36
|
+
* @param options - the workspace configuration options
|
|
37
|
+
* @returns an array of template entries for the complete workspace
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
28
40
|
function createWorkspace(options) {
|
|
29
41
|
const opts = Schema.decodeUnknownSync(WorkspaceOptions)(options);
|
|
30
42
|
const features = opts.features ?? {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/templates",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Pure TypeScript templates for Silk Suite project scaffolding",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/templates",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./index.d.ts",
|
|
26
26
|
"import": "./index.js"
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"js-yaml": "^4.2.0",
|