Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
0af4e24
refactor(core): overhaul CLI, API, config & builder modules (#26)
Androlax2 Jul 12, 2025
87fd479
refactor(cli) (#28)
Androlax2 Jul 12, 2025
e5e0c04
refactor/cli (#29)
Androlax2 Jul 12, 2025
fbcf03f
feat(cache): add skipReads option for CacheManager and CLI support
Androlax2 Jul 12, 2025
8143f45
refactor(cli,commands): remove ListCommand and related functionalities
Androlax2 Jul 12, 2025
98cb2ef
refactor(run): remove outdated TODO comment in ItemBuilder
Androlax2 Jul 12, 2025
d722fd1
feat(build): replace tsconfig-paths with tsx and update dependencies
Androlax2 Jul 12, 2025
2720f01
feat(cli): add deletion detection
Androlax2 Jul 12, 2025
610d289
feat(itemTypeBuilder): enhance update logic with name-based item type…
Androlax2 Jul 12, 2025
9493eee
feat(cli,runCommand): add support for concurrent builds with customiz…
Androlax2 Jul 12, 2025
63633db
refactor(runCommand): enhance concurrent build handling and deadlock …
Androlax2 Jul 12, 2025
c0b9946
feat(sync,cli): add DatoCMS sync functionality and CLI integration
Androlax2 Jul 13, 2025
1aad915
feat(fileGenerator): enhance file generation with dependency resoluti…
Androlax2 Jul 13, 2025
9b322ea
feat(config): update sync paths to use .generated directory for block…
Androlax2 Jul 13, 2025
7337e2a
feat(sync): refine file generation and dependency resolution in DatoC…
Androlax2 Jul 13, 2025
461754d
feat(sync): remove specific item type filter from file generation in …
Androlax2 Jul 13, 2025
b3c8ae4
feat(sync): refactor DatoCmsSync and FileGenerator for improved file …
Androlax2 Jul 13, 2025
5fb597a
feat(fileGenerator): improve model and block configuration formatting…
Androlax2 Jul 13, 2025
686f344
feat(fileGenerator): update async call to use PascalCase for item typ…
Androlax2 Jul 13, 2025
5eeffda
refactor(ConfigParser): streamline configuration loading and enhance …
Androlax2 Jul 13, 2025
db2d44f
refactor(tests): remove unnecessary afterEach and simplify test command
Androlax2 Jul 13, 2025
596711b
refactor(ItemTypeBuilder): update constructor to accept a configurati…
Androlax2 Jul 13, 2025
e2176f9
refactor(mockConfig): add mock configuration utility for DatoBuilder
Androlax2 Jul 13, 2025
c9e65a6
refactor(mockConfig): enhance createMockConfig to accept partial conf…
Androlax2 Jul 14, 2025
54438d0
refactor(tests): clean up test cases and improve mock configurations
Androlax2 Jul 14, 2025
8f2f358
refactor(biome): change complexity and nursery rules from error to warn
Androlax2 Jul 14, 2025
c1e3720
refactor(CacheManager): simplify cache handling by always initializin…
Androlax2 Jul 14, 2025
7c4a794
refactor(FileDiscoverer): add tests for file discovery functionality …
Androlax2 Jul 14, 2025
c4cf7e8
refactor(ItemBuilder): add comprehensive tests for buildItem function…
Androlax2 Jul 14, 2025
95a7ad3
refactor(builder): enhance error handling and add tests for field ope…
Androlax2 Jul 14, 2025
6a4c53c
refactor(tests): add unit tests for Field, Integer, ItemTypeBuilder, …
Androlax2 Jul 14, 2025
0240a16
test: remove itemtypebuilder test for now
Androlax2 Jul 14, 2025
d670c64
refactor(DependencyResolver): add unit tests for topologicalSort func…
Androlax2 Jul 14, 2025
c2b3d16
refactor(DeletionDetector): add unit tests for deletion detection and…
Androlax2 Jul 14, 2025
2870bc2
refactor(BuildExecutor): add unit tests for executeBuild and getOrBui…
Androlax2 Jul 14, 2025
d240ef7
refactor(DeletionManager): add unit tests for deletion summary and co…
Androlax2 Jul 14, 2025
ffb3d69
refactor(ItemBuilder): add unit tests for buildItem method and error …
Androlax2 Jul 14, 2025
1743700
Merge branch 'refactor/dato-builder' into feat/dato-sync
Androlax2 Jul 14, 2025
c1f651c
feat(ConfigParser): add sync paths for blocks and models in configura…
Androlax2 Jul 14, 2025
22e50a0
feat(ConfigParser): add sync paths for blocks and models in tests
Androlax2 Jul 14, 2025
75abffe
feat(DatoCmsSync): enhance type safety by using ItemType and Field types
Androlax2 Jul 14, 2025
3f5242c
feat(DatoCmsSync): improve type references by importing ItemType and …
Androlax2 Jul 14, 2025
51ee1b0
feat(FileGenerator): enhance block validators with type safety and re…
Androlax2 Jul 14, 2025
ceab35f
feat(FileGenerator): improve type safety in getFieldMethodName by usi…
Androlax2 Jul 14, 2025
f272404
feat(DatoCmsSync): refactor FileGenerator import and improve module s…
Androlax2 Jul 14, 2025
6ecf405
feat(FileGenerators): implement base field generator and specific fie…
Androlax2 Jul 14, 2025
3b7ab4a
feat(FieldGenerator): enhance field generator factory with custom and…
Androlax2 Jul 14, 2025
6e736f6
feat(AssetGenerator): rename ImageFieldGenerator to AssetGenerator an…
Androlax2 Jul 14, 2025
75c9129
feat(FieldGenerator): refactor BaseFieldGenerator to FieldGenerator a…
Androlax2 Jul 14, 2025
5b366b4
feat(DateGenerator): enhance FieldGenerator with generic method names…
Androlax2 Jul 14, 2025
5559846
feat(DateGenerator): implement DateGenerator class and add comprehens…
Androlax2 Jul 14, 2025
2aa6db0
feat(DateGenerator): implement DateGenerator class and add comprehens…
Androlax2 Jul 14, 2025
5410e2c
feat(DateGenerator): refactor tests to use createMockField for field …
Androlax2 Jul 14, 2025
e3d2f81
feat(FieldGenerator): remove redundant tests for MockDateGenerator
Androlax2 Jul 14, 2025
ff07195
feat(FieldGenerator): prepend method calls with a dot for consistency
Androlax2 Jul 14, 2025
2e4b1c5
feat(FileGenerators): add BlockReferenceAnalyzer, BuilderConfigGenera…
Androlax2 Jul 14, 2025
52ceffb
feat(CodeFormatter): implement CodeFormatter class for code formattin…
Androlax2 Jul 14, 2025
013d644
feat(CodeFormatter): update default configuration and improve type usage
Androlax2 Jul 14, 2025
5f6a130
feat(CodeFormatter): integrate ESLint for improved code formatting an…
Androlax2 Jul 14, 2025
b1b5265
feat(DateGenerator): enhance date generation with additional properti…
Androlax2 Jul 14, 2025
447df14
feat(DateGenerator): add method call generation for date range and im…
Androlax2 Jul 14, 2025
9d065e2
feat(DateGenerator): enhance date handling by preserving original str…
Androlax2 Jul 14, 2025
1019fb7
feat(FieldGenerator): add tests for Date serialization with original …
Androlax2 Jul 14, 2025
bcb9fcd
feat(DateGenerator): add tests for handling various date formats and …
Androlax2 Jul 14, 2025
6304e1f
feat(DateGenerator): refactor date handling and improve validator int…
Androlax2 Jul 14, 2025
da24393
feat(DateFieldGenerator): rename DateGenerator to DateFieldGenerator …
Androlax2 Jul 14, 2025
02ee899
feat(DateFieldGenerator): refactor to infer types and improve method …
Androlax2 Jul 14, 2025
5f3853b
feat(DateFieldGenerator): update tests to use DateFieldGenerator and …
Androlax2 Jul 14, 2025
140d5f0
feat(DateFieldGenerator): refactor to improve type inference and meth…
Androlax2 Jul 14, 2025
0abd040
feat(DateTimeFieldGenerator): implement datetime field generation wit…
Androlax2 Jul 15, 2025
2706e59
feat(DateTimeFieldGenerator): update hints and improve label consiste…
Androlax2 Jul 15, 2025
8ebb279
feat(FieldGenerator): refactor range validator processing and enhance…
Androlax2 Jul 15, 2025
1755b97
feat(LocationFieldGenerator): implement location field generation and…
Androlax2 Jul 15, 2025
ed9109f
feat(ColorPickerFieldGenerator): implement color picker field generat…
Androlax2 Jul 15, 2025
1f5e612
feat(AssetGallery): update import statement for Field and adjust type…
Androlax2 Jul 15, 2025
8b48c33
feat(SeoFieldGenerator): implement SEO field generator and add corres…
Androlax2 Jul 15, 2025
c2b5d5f
feat(GalleryFieldGenerator): implement gallery field generator and ad…
Androlax2 Jul 15, 2025
23d362b
feat(FieldGenerators): add Float, Integer, SingleAsset, and ExternalV…
Androlax2 Jul 15, 2025
9f497cb
feat(TextFieldGenerators): implement text field generators with compr…
Androlax2 Jul 15, 2025
085c479
feat(BooleanFieldGenerators): implement Boolean and BooleanRadioGroup…
Androlax2 Jul 15, 2025
160f88a
feat(StringFieldGenerators): implement string field generators with c…
Androlax2 Jul 15, 2025
ee15676
fix(StringFieldGenerators): fix TypeScript type errors in validators …
Androlax2 Jul 15, 2025
10db6cc
fix(StringFieldGenerators): update test expectations for new field st…
Androlax2 Jul 15, 2025
55f2134
refactor(FieldGeneratorFactory): remove Partial type and exclude impl…
Androlax2 Jul 15, 2025
9131bb9
feat(FileGeneration): add tests for ImportGenerator, FileGenerationSe…
Androlax2 Jul 15, 2025
822eb5a
refactor(FieldGeneratorFactory): update generatorMap to use Partial t…
Androlax2 Jul 15, 2025
f3630d4
fix(tests): update FileGeneration tests to match implementation changes
Androlax2 Jul 15, 2025
aa08a2c
feat(link-fields): implement complete link field generation system
Androlax2 Jul 15, 2025
edf8c5a
feat(json-fields): implement JSON field generators
Androlax2 Jul 16, 2025
c563966
feat(text-fields): implement rich text, single block, and structured …
Androlax2 Jul 16, 2025
fe30d86
fix: resolve TypeScript errors in field generators
Androlax2 Jul 16, 2025
1070182
fix: remove invalid required validators from rich text and structured…
Androlax2 Jul 16, 2025
42b7edb
fix: don't convert item_types for structured_text_inline_blocks valid…
Androlax2 Jul 16, 2025
24b7638
fix: correct TypeScript assignment for structured_text_inline_blocks …
Androlax2 Jul 16, 2025
21a98b5
fix: add type cast for structured_text_inline_blocks validator assign…
Androlax2 Jul 16, 2025
80740b7
fix(log): handle log error on Build with JSON
Androlax2 Jul 16, 2025
18ecc37
feat: add comprehensive API logging to DatoAPI
Androlax2 Jul 16, 2025
711ebb9
fix: use RegExp.source instead of toString() for custom_pattern
Androlax2 Jul 16, 2025
22333f8
feat: add exhaustive field configuration tests for models and blocks
Androlax2 Jul 17, 2025
5768787
refactor(blocks): remove exhaustive field configuration testing block
Androlax2 Jul 18, 2025
a2bda43
refactor(validators): simplify field validator handling
Androlax2 Jul 18, 2025
513a8d7
chore(config): enhance jest and npmignore configurations
Androlax2 Jul 18, 2025
0307f6b
chore(*): replace nodemon with tsc watch and clean dependencies
Androlax2 Jul 18, 2025
eec7e28
chore(config): update TypeScript build configuration for stricter checks
Androlax2 Jul 18, 2025
c4755b2
chore(config): update tsconfig for stricter type checks and modern st…
Androlax2 Jul 18, 2025
f066791
chore(config,model-builder): update tsconfig and enhance type safety
Androlax2 Jul 18, 2025
d677bb5
chore(config,field-generators): enhance field handling and update Typ…
Androlax2 Jul 18, 2025
4310ccc
chore(lefthook): update Biome diagnostic level to error
Androlax2 Jul 18, 2025
67774e7
chore(field-generators): enhance type safety and improve validator ha…
Androlax2 Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ build/
node_modules/
dato-builder.config.*
coverage/
src/datocms/
src/.itemTypeBuilderCache.json
#src/datocms/
src/.itemTypeBuilderCache.json
.dato-builder-cache
CLAUDE.md
50 changes: 47 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
src
tests
tsconfig.json
# Source files
src/
tests/
*.test.ts
*.test.js
__tests__/

# Configuration files
tsconfig.json
tsconfig.build.json
jest.config.js
.env
.env.*
*.config.js
*.config.mjs
*.config.ts

# Development files
.vscode/
.idea/
*.log
*.tmp
*.temp
coverage/
.nyc_output/
.cache/

# Git and CI
.git/
.github/
.gitignore
.gitattributes
lefthook.yml
commitlint.config.js
release.config.mjs

# Documentation
README.md
CHANGELOG.md
docs/
*.md

# Build artifacts
build/.tsbuildinfo
node_modules/
.DS_Store
Thumbs.db
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ module.exports = {
debug: false, // enable verbose logging
modelApiKeySuffix: undefined, // suffix for model API keys (e.g. "page" becomes "page_model")
blockApiKeySuffix: "block", // suffix for block API keys (e.g. "hero" becomes "hero_block")

// Paths for building from local to DatoCMS
modelsPath: "./datocms/models", // where to find model definitions
blocksPath: "./datocms/blocks", // where to find block definitions

// Paths for syncing from DatoCMS to local
syncModelsPath: "./src/datocms/models", // where to generate synced models
syncBlocksPath: "./src/datocms/blocks", // where to generate synced blocks
};
```

Expand All @@ -97,11 +105,18 @@ module.exports = {

## CLI Commands

- **`npx dato-builder run <file|dir>`**
Build one or more scripts (blocks, models, or whole folders).
- **`npx dato-builder build`**
Build DatoCMS types and blocks from your local definitions.

- **`npx dato-builder sync [options]`**
Sync blocks and models from DatoCMS to local TypeScript files.

Options:
- `--dry-run`: Show what would be synced without making any changes
- `--force`: Force sync all items, ignoring cache

- **`npx dato-builder clear-cache`**
Wipe the local cache that tracks whats already been synced.
Wipe the local cache that tracks what's already been synced.

---

Expand Down Expand Up @@ -169,12 +184,29 @@ npx dato-builder run datocms/models/TestModel.ts
### 3. Build Everything

```bash
npx dato-builder run datocms/
npx dato-builder build
```

### 4. Sync from DatoCMS

You can also sync existing blocks and models from DatoCMS to your local project:

```bash
# Dry run to see what would be synced
npx dato-builder sync --dry-run

# Sync all changes
npx dato-builder sync

# Force sync everything, ignoring cache
npx dato-builder sync --force
```

This will generate TypeScript files in your configured sync paths (default: `./src/datocms/blocks` and `./src/datocms/models`) that match your DatoCMS schema.

---

_Note: You can add more builder scripts (blocks or models) and then point `run` at the parent folder to sync them all in one go._
_Note: The sync command creates a single source of truth by generating local files from your DatoCMS schema, while the build command pushes your local definitions to DatoCMS._

# Comprehensive Field & Validator Reference

Expand Down
Loading
Loading