@augeo/smelt 1.2.2

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.
Files changed (152) hide show
  1. package/.claude/settings.json +11 -0
  2. package/.github/workflows/verify.yml +64 -0
  3. package/.gitmodules +3 -0
  4. package/.prettierignore +25 -0
  5. package/.prettierrc.cjs +9 -0
  6. package/.zed/settings.json +21 -0
  7. package/AGENTS.md +232 -0
  8. package/LICENSE +21 -0
  9. package/README.md +266 -0
  10. package/biome.json +58 -0
  11. package/dist/cli.d.mts +1 -0
  12. package/dist/cli.mjs +350 -0
  13. package/dist/schema.d.mts +265 -0
  14. package/dist/schema.mjs +21 -0
  15. package/docs/TESTING.md +293 -0
  16. package/docs/assets-plan.md +197 -0
  17. package/docs/build-spec.md +466 -0
  18. package/docs/library-conversion-plan.md +419 -0
  19. package/example/.gitattributes +7 -0
  20. package/example/.shopifyignore +28 -0
  21. package/example/.theme-check.yml +7 -0
  22. package/example/blocks/_built--sections--hero--blocks--feature.liquid +52 -0
  23. package/example/config/settings_schema.json +10 -0
  24. package/example/layout/theme.liquid +25 -0
  25. package/example/locales/en.default.json +1 -0
  26. package/example/package-lock.json +51 -0
  27. package/example/package.json +20 -0
  28. package/example/sections/built--sections--hero.liquid +83 -0
  29. package/example/snippets/built--components--button.liquid +38 -0
  30. package/example/snippets/built--components--card.liquid +33 -0
  31. package/example/src/components/button/button.css +13 -0
  32. package/example/src/components/card/card.css +16 -0
  33. package/example/src/components/card/card.liquid +9 -0
  34. package/example/src/sections/hero/blocks/feature/feature.css +11 -0
  35. package/example/src/sections/hero/blocks/feature/feature.liquid +9 -0
  36. package/example/src/sections/hero/blocks/feature/feature.schema.ts +14 -0
  37. package/example/src/sections/hero/hero.css +15 -0
  38. package/example/src/sections/hero/hero.liquid +16 -0
  39. package/example/src/sections/hero/hero.schema.ts +26 -0
  40. package/example/src/sections/hero/hero.test.ts +43 -0
  41. package/example/src/utilities/labels.ts +5 -0
  42. package/example/templates/index.liquid +1 -0
  43. package/example/tsconfig.json +10 -0
  44. package/example/vitest.config.ts +6 -0
  45. package/lib/build/build.test.ts +475 -0
  46. package/lib/build/build.ts +314 -0
  47. package/lib/build/command.ts +27 -0
  48. package/lib/build/index.ts +1 -0
  49. package/lib/cli.ts +17 -0
  50. package/lib/dev/command.ts +25 -0
  51. package/lib/dev/index.ts +1 -0
  52. package/lib/dev/watch.ts +52 -0
  53. package/lib/resolver.test.ts +275 -0
  54. package/lib/resolver.ts +156 -0
  55. package/lib/schema.ts +37 -0
  56. package/package.json +59 -0
  57. package/scripts/codegen-schema.ts +66 -0
  58. package/src/components/button/button.css +13 -0
  59. package/src/components/button/button.liquid +5 -0
  60. package/src/components/button/button.ts +5 -0
  61. package/src/tsconfig.json +10 -0
  62. package/tests/example.test.ts +101 -0
  63. package/tsconfig.json +20 -0
  64. package/tsdown.config.ts +14 -0
  65. package/vendor/theme-liquid-docs/.gitattributes +10 -0
  66. package/vendor/theme-liquid-docs/.github/CODEOWNERS +1 -0
  67. package/vendor/theme-liquid-docs/.github/CODE_OF_CONDUCT.md +73 -0
  68. package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/bug_report.md +17 -0
  69. package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  70. package/vendor/theme-liquid-docs/.github/dependabot.yaml +6 -0
  71. package/vendor/theme-liquid-docs/.github/workflows/ci.yml +33 -0
  72. package/vendor/theme-liquid-docs/.github/workflows/cla.yml +27 -0
  73. package/vendor/theme-liquid-docs/.github/workflows/shopify-dev-preview-automation.yml +86 -0
  74. package/vendor/theme-liquid-docs/.github/workflows/update-latest.yml +56 -0
  75. package/vendor/theme-liquid-docs/.prettierrc.json +16 -0
  76. package/vendor/theme-liquid-docs/.vscode/settings.json +28 -0
  77. package/vendor/theme-liquid-docs/LICENSE.md +7 -0
  78. package/vendor/theme-liquid-docs/README.md +48 -0
  79. package/vendor/theme-liquid-docs/ai/claude/CLAUDE.md +1485 -0
  80. package/vendor/theme-liquid-docs/ai/cursor/rules/assets.mdc +15 -0
  81. package/vendor/theme-liquid-docs/ai/cursor/rules/blocks.mdc +339 -0
  82. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-group.mdc +103 -0
  83. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-text.mdc +59 -0
  84. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/section-example.mdc +61 -0
  85. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/snippet-example.mdc +72 -0
  86. package/vendor/theme-liquid-docs/ai/cursor/rules/liquid.mdc +837 -0
  87. package/vendor/theme-liquid-docs/ai/cursor/rules/locales.mdc +100 -0
  88. package/vendor/theme-liquid-docs/ai/cursor/rules/localization.mdc +67 -0
  89. package/vendor/theme-liquid-docs/ai/cursor/rules/mcp.mdc +2 -0
  90. package/vendor/theme-liquid-docs/ai/cursor/rules/schemas.mdc +184 -0
  91. package/vendor/theme-liquid-docs/ai/cursor/rules/sections.mdc +84 -0
  92. package/vendor/theme-liquid-docs/ai/cursor/rules/settings-schema.mdc +51 -0
  93. package/vendor/theme-liquid-docs/ai/cursor/rules/snippets.mdc +119 -0
  94. package/vendor/theme-liquid-docs/ai/github/copilot-instructions.md +1485 -0
  95. package/vendor/theme-liquid-docs/ai/liquid.mdc +638 -0
  96. package/vendor/theme-liquid-docs/data/filters.json +6148 -0
  97. package/vendor/theme-liquid-docs/data/latest.json +2 -0
  98. package/vendor/theme-liquid-docs/data/objects.json +20594 -0
  99. package/vendor/theme-liquid-docs/data/shopify_system_translations.json +2586 -0
  100. package/vendor/theme-liquid-docs/data/tags.json +1276 -0
  101. package/vendor/theme-liquid-docs/package.json +20 -0
  102. package/vendor/theme-liquid-docs/schemas/manifest_schema.json +31 -0
  103. package/vendor/theme-liquid-docs/schemas/manifest_theme.json +19 -0
  104. package/vendor/theme-liquid-docs/schemas/manifest_theme_app_extension.json +10 -0
  105. package/vendor/theme-liquid-docs/schemas/theme/app_block_entry.json +13 -0
  106. package/vendor/theme-liquid-docs/schemas/theme/default_setting_values.json +24 -0
  107. package/vendor/theme-liquid-docs/schemas/theme/local_block_entry.json +25 -0
  108. package/vendor/theme-liquid-docs/schemas/theme/preset.json +72 -0
  109. package/vendor/theme-liquid-docs/schemas/theme/preset_blocks.json +91 -0
  110. package/vendor/theme-liquid-docs/schemas/theme/section.json +208 -0
  111. package/vendor/theme-liquid-docs/schemas/theme/setting.json +1413 -0
  112. package/vendor/theme-liquid-docs/schemas/theme/settings.json +10 -0
  113. package/vendor/theme-liquid-docs/schemas/theme/targetted_block_entry.json +15 -0
  114. package/vendor/theme-liquid-docs/schemas/theme/theme_block.json +91 -0
  115. package/vendor/theme-liquid-docs/schemas/theme/theme_block_entry.json +14 -0
  116. package/vendor/theme-liquid-docs/schemas/theme/theme_settings.json +83 -0
  117. package/vendor/theme-liquid-docs/schemas/theme/translations.json +63 -0
  118. package/vendor/theme-liquid-docs/schemas/update/update_extension_schema_v1.json +186 -0
  119. package/vendor/theme-liquid-docs/tests/fixtures/section-nested-blocks.json +18 -0
  120. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-1.json +90 -0
  121. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-2.json +201 -0
  122. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-3.json +29 -0
  123. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-4.json +315 -0
  124. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-5.json +114 -0
  125. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-6.json +63 -0
  126. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-conditional-settings.json +145 -0
  127. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-preset-blocks-as-hash.json +60 -0
  128. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-static-block-preset.json +76 -0
  129. package/vendor/theme-liquid-docs/tests/fixtures/section-settings.json +34 -0
  130. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-1.json +234 -0
  131. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-2.json +253 -0
  132. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-basics.json +48 -0
  133. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-conditional-settings.json +202 -0
  134. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-presets-as-hash.json +50 -0
  135. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-settings.json +34 -0
  136. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-all-settings.json +313 -0
  137. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-dawn.json +1469 -0
  138. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-metadata.json +10 -0
  139. package/vendor/theme-liquid-docs/tests/fixtures/translations-1.json +14 -0
  140. package/vendor/theme-liquid-docs/tests/section.spec.ts +367 -0
  141. package/vendor/theme-liquid-docs/tests/test-constants.ts +58 -0
  142. package/vendor/theme-liquid-docs/tests/test-helpers.ts +104 -0
  143. package/vendor/theme-liquid-docs/tests/theme-settings/color_palette.spec.ts +184 -0
  144. package/vendor/theme-liquid-docs/tests/theme-settings/color_scheme_group.spec.ts +143 -0
  145. package/vendor/theme-liquid-docs/tests/theme-settings/general.spec.ts +192 -0
  146. package/vendor/theme-liquid-docs/tests/theme-settings/metaobject.spec.ts +94 -0
  147. package/vendor/theme-liquid-docs/tests/theme-settings/resource_list.spec.ts +58 -0
  148. package/vendor/theme-liquid-docs/tests/theme-settings/theme-metadata.spec.ts +59 -0
  149. package/vendor/theme-liquid-docs/tests/theme_block.spec.ts +266 -0
  150. package/vendor/theme-liquid-docs/tests/translations_schema.spec.ts +31 -0
  151. package/vendor/theme-liquid-docs/yarn.lock +543 -0
  152. package/vitest.config.ts +7 -0
@@ -0,0 +1,101 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { beforeEach, describe, expect, it } from "vitest";
5
+ import { build } from "../lib/build/build.ts";
6
+
7
+ const here = dirname(fileURLToPath(import.meta.url));
8
+ const repoRoot = dirname(here);
9
+ const examplePath = join(repoRoot, "example");
10
+
11
+ describe("running build against example/", () => {
12
+ beforeEach(async () => {
13
+ // Use the same layer names the CLI's `command.ts` populates, so the
14
+ // banners this test produces match what `smelt build` would write.
15
+ await build({
16
+ layers: [
17
+ { name: "consumer", path: examplePath },
18
+ { name: "@augeo/smelt", path: repoRoot },
19
+ ],
20
+ });
21
+ });
22
+
23
+ describe("the layered button", () => {
24
+ let output: string;
25
+ beforeEach(async () => {
26
+ output = await readFile(
27
+ join(examplePath, "snippets/built--components--button.liquid"),
28
+ "utf-8",
29
+ );
30
+ });
31
+
32
+ it("emits the built button under example/snippets/", () => {
33
+ expect(output).toBeTruthy();
34
+ });
35
+
36
+ it("uses the consumer's css from example/", () => {
37
+ // example/src/components/button/button.css uses #f3c724.
38
+ expect(output).toContain("#f3c724");
39
+ });
40
+
41
+ it("anchors the liquid slot against the baseline (the library's src/)", () => {
42
+ expect(output).toContain(
43
+ "GENERATED FROM @augeo/smelt/src/components/button/button.liquid",
44
+ );
45
+ });
46
+ });
47
+
48
+ describe("the hero section with a TS-authored schema", () => {
49
+ let output: string;
50
+ beforeEach(async () => {
51
+ output = await readFile(
52
+ join(examplePath, "sections/built--sections--hero.liquid"),
53
+ "utf-8",
54
+ );
55
+ });
56
+
57
+ it("injects a {% schema %} block compiled from hero.schema.ts", () => {
58
+ expect(output).toContain("{% schema %}");
59
+ expect(output).toContain("{% endschema %}");
60
+ });
61
+
62
+ it("includes the schema's name", () => {
63
+ expect(output).toContain('"name": "Hero"');
64
+ });
65
+
66
+ it("includes the heading setting", () => {
67
+ expect(output).toContain('"id": "heading"');
68
+ });
69
+
70
+ it("auto-merges the private feature block into hero's blocks: []", () => {
71
+ expect(output).toContain(
72
+ '"type": "_built--sections--hero--blocks--feature"',
73
+ );
74
+ });
75
+ });
76
+
77
+ describe("the private feature block nested under hero", () => {
78
+ let output: string;
79
+ beforeEach(async () => {
80
+ output = await readFile(
81
+ join(
82
+ examplePath,
83
+ "blocks/_built--sections--hero--blocks--feature.liquid",
84
+ ),
85
+ "utf-8",
86
+ );
87
+ });
88
+
89
+ it("emits the built file under blocks/ with the `_` prefix", () => {
90
+ expect(output).toBeTruthy();
91
+ });
92
+
93
+ it("inlines the feature's liquid body", () => {
94
+ expect(output).toContain('class="tr-feature"');
95
+ });
96
+
97
+ it("injects a {% schema %} block compiled from feature.schema.ts", () => {
98
+ expect(output).toContain('"name": "Feature"');
99
+ });
100
+ });
101
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["esnext"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "skipLibCheck": true,
10
+ "allowImportingTsExtensions": true,
11
+ "types": ["node"]
12
+ },
13
+ "include": [
14
+ "lib/**/*.ts",
15
+ "tests/**/*.ts",
16
+ "scripts/**/*.ts",
17
+ "tsdown.config.ts",
18
+ "vitest.config.ts"
19
+ ]
20
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: { cli: "lib/cli.ts", schema: "lib/schema.ts" },
5
+ outDir: "dist",
6
+ format: "esm",
7
+ platform: "node",
8
+ target: "node24",
9
+ clean: true,
10
+ dts: true,
11
+ deps: {
12
+ neverBundle: ["esbuild", "citty", "chokidar"],
13
+ },
14
+ });
@@ -0,0 +1,10 @@
1
+ # Set the default behavior, in case people don't have core.autocrlf set.
2
+ * text=auto
3
+
4
+ # Force all text files to be lf
5
+ * text eol=lf
6
+
7
+ # Denote all files that are truly binary and should not be modified.
8
+ *.png binary
9
+ *.jpg binary
10
+ *.gif binary
@@ -0,0 +1 @@
1
+ * @shopify/developer-platforms
@@ -0,0 +1,73 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ education, socio-economic status, nationality, personal appearance, race,
10
+ religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others’ private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at opensource@shopify.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project’s leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: Bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Summary**
11
+ <!--A clear and concise description of what the bug is.-->
12
+
13
+ **Expected**
14
+ <!-- Include what you expect should happen here -->
15
+
16
+ **Actual**
17
+ <!-- Include a description of what actually happens here -->
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12
+
13
+ **Describe the solution you'd like**
14
+ <!-- A clear and concise description of what you want to happen. -->
15
+
16
+ **Describe alternatives you've considered**
17
+ <!-- A clear and concise description of any alternative solutions or features you've considered. -->
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
@@ -0,0 +1,33 @@
1
+ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
2
+ name: CI
3
+
4
+ on: [push]
5
+
6
+ jobs:
7
+ lint:
8
+ runs-on: ${{ matrix.os }}
9
+ timeout-minutes: 30
10
+ strategy:
11
+ matrix:
12
+ os: [windows-latest, ubuntu-latest]
13
+ node-version: [22.x, 24.x]
14
+
15
+ name: OS ${{ matrix.os }} / NodeJS ${{ matrix.node-version }}
16
+
17
+ steps:
18
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
19
+
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'yarn'
25
+
26
+ - name: Install the packages
27
+ run: yarn install --frozen-lockfile --ignore-engines
28
+
29
+ - name: Run format:check
30
+ run: yarn format:check
31
+
32
+ - name: Run the unit tests
33
+ run: yarn test
@@ -0,0 +1,27 @@
1
+ # .github/workflows/cla.yml
2
+ name: Contributor License Agreement (CLA)
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ pull_request_target:
7
+ types: [opened, synchronize]
8
+ issue_comment:
9
+ types: [created]
10
+
11
+ jobs:
12
+ cla:
13
+ runs-on: ubuntu-latest
14
+ if: |
15
+ github.actor != 'shopify-dev-bot[bot]'
16
+ && (
17
+ (github.event.issue.pull_request
18
+ && !github.event.issue.pull_request.merged_at
19
+ && contains(github.event.comment.body, 'signed')
20
+ )
21
+ || (github.event.pull_request && !github.event.pull_request.merged)
22
+ )
23
+ steps:
24
+ - uses: Shopify/shopify-cla-action@v1
25
+ with:
26
+ github-token: ${{ secrets.GITHUB_TOKEN }}
27
+ cla-token: ${{ secrets.CLA_TOKEN }}
@@ -0,0 +1,86 @@
1
+ # This workflow dispatches a docs sync event to Shop/world's templated-apis-docs-sync
2
+ # workflow when Liquid JSON schema files change in a PR.
3
+ #
4
+ # The templated-apis-docs-sync workflow will then run the Liquid JSON schemas sync
5
+ # pipeline to create a draft pull request in shopify-dev which contains the changes
6
+ # to preview the schema changes in shopify-dev's preview environment.
7
+ #
8
+ name: 'Liquid JSON schemas preview dispatch'
9
+
10
+ on:
11
+ pull_request:
12
+ types: [opened, synchronize, reopened, ready_for_review, closed]
13
+ paths:
14
+ - 'schemas/theme/**'
15
+
16
+ concurrency:
17
+ group: liquid-json-schemas-preview-dispatch-${{ github.head_ref }}
18
+ cancel-in-progress: true
19
+
20
+ jobs:
21
+ dispatch-liquid-json-schemas-sync:
22
+ name: Dispatch Liquid JSON schemas sync
23
+ runs-on: shopify-ubuntu-latest
24
+ timeout-minutes: 10
25
+ steps:
26
+ - name: Create GitHub App Token (Shop org - world)
27
+ id: app-token
28
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
29
+ with:
30
+ app-id: ${{ secrets.SHOPIFY_DEV_DOCS_SYNC_APP_ID }}
31
+ private-key: ${{ secrets.SHOPIFY_DEV_DOCS_SYNC_APP_PRIVATE_KEY }}
32
+ owner: Shop
33
+ repositories: |
34
+ world
35
+
36
+ - name: Dispatch to templated-apis-docs-sync
37
+ env:
38
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
39
+ SOURCE_BRANCH: ${{ github.event.pull_request.base.ref }}
40
+ SOURCE_REF: ${{ github.event.pull_request.head.ref }}
41
+ PR_NUMBER: ${{ github.event.pull_request.number }}
42
+ run: |
43
+ if [ "${{ github.event.action }}" = "closed" ]; then
44
+ ACTION="close"
45
+ CHANGED_FILES='[]'
46
+ else
47
+ ACTION="sync"
48
+ CHANGED_FILES='["schemas/theme/"]'
49
+ fi
50
+
51
+ PAYLOAD=$(jq -n \
52
+ --arg action "$ACTION" \
53
+ --arg source_repo "Shopify/theme-liquid-docs" \
54
+ --arg source_branch "$SOURCE_BRANCH" \
55
+ --arg source_ref "$SOURCE_REF" \
56
+ --argjson source_pr_number "$PR_NUMBER" \
57
+ --argjson changed_files "$CHANGED_FILES" \
58
+ '{
59
+ event_type: "templated-api-docs-sync",
60
+ client_payload: {
61
+ action: $action,
62
+ source_repo: $source_repo,
63
+ source_branch: $source_branch,
64
+ source_ref: $source_ref,
65
+ source_pr_number: $source_pr_number,
66
+ changed_files: $changed_files
67
+ }
68
+ }')
69
+
70
+ echo "Dispatching $ACTION to shop/world templated-apis-docs-sync..."
71
+ echo "$PAYLOAD" | jq .
72
+
73
+ HTTP_STATUS=$(curl -s -o response.txt -w "%{http_code}" \
74
+ -X POST \
75
+ -H "Authorization: Bearer $GH_TOKEN" \
76
+ -H "Accept: application/vnd.github+json" \
77
+ https://api.github.com/repos/shop/world/dispatches \
78
+ -d "$PAYLOAD")
79
+
80
+ if [ "$HTTP_STATUS" -ge 200 ] && [ "$HTTP_STATUS" -lt 300 ]; then
81
+ echo "Successfully dispatched $ACTION event (HTTP $HTTP_STATUS)"
82
+ else
83
+ echo "Failed to dispatch $ACTION event (HTTP $HTTP_STATUS)"
84
+ cat response.txt
85
+ exit 1
86
+ fi
@@ -0,0 +1,56 @@
1
+ name: Update the 'data/latest.json' file
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout current repo
11
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
12
+
13
+ - name: Setup Node.js
14
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
15
+ with:
16
+ node-version: '20'
17
+ cache: 'yarn'
18
+
19
+ - name: Write latest sha to latest.json
20
+ run: |
21
+ echo -e { \"revision\": \"$(git rev-parse HEAD)\" }\\n > data/latest.json
22
+
23
+ - name: Install dependencies
24
+ run: yarn install --frozen-lockfile
25
+
26
+ - name: Create Pull Request
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ run: |
30
+ if [[ -n "$(git status --porcelain)" ]]; then
31
+ # Configure git
32
+ git config user.name "github-actions[bot]"
33
+ git config user.email "github-actions[bot]@users.noreply.github.com"
34
+
35
+ # Create and switch to new branch
36
+ BRANCH_NAME="update-ai-docs-$(date +%Y%m%d-%H%M%S)"
37
+ git checkout -b "$BRANCH_NAME"
38
+
39
+ # Commit changes
40
+ git add data/latest.json
41
+ git commit -m "Update the 'data/latest.json' file"
42
+
43
+ # Push branch
44
+ git push origin "$BRANCH_NAME"
45
+
46
+ # Create pull request using GitHub CLI
47
+ gh pr create \
48
+ --title "Update the 'data/latest.json' file" \
49
+ --body "Automated update of latest revision data.
50
+
51
+ - Updated \`data/latest.json\` with current revision SHA" \
52
+ --base main \
53
+ --head "$BRANCH_NAME"
54
+ else
55
+ echo "No changes to commit"
56
+ fi
@@ -0,0 +1,16 @@
1
+ {
2
+ "endOfLine": "lf",
3
+ "trailingComma": "all",
4
+ "tabWidth": 2,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "printWidth": 100,
8
+ "overrides": [
9
+ {
10
+ "files": "*.spec.ts",
11
+ "options": {
12
+ "printWidth": 100
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "json.schemas": [
3
+ {
4
+ "fileMatch": [
5
+ "tests/fixtures/section-*.json"
6
+ ],
7
+ "url": "./schemas/theme/section.json"
8
+ },
9
+ {
10
+ "fileMatch": [
11
+ "tests/fixtures/translations-*.json"
12
+ ],
13
+ "url": "./schemas/theme/translations.json"
14
+ },
15
+ {
16
+ "fileMatch": [
17
+ "tests/fixtures/theme-settings-*.json"
18
+ ],
19
+ "url": "./schemas/theme/theme_settings.json"
20
+ },
21
+ {
22
+ "fileMatch": [
23
+ "tests/fixtures/theme-block-*.json"
24
+ ],
25
+ "url": "./schemas/theme/theme_block.json"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,7 @@
1
+ Copyright 2022-present, Shopify Inc.
2
+
3
+ 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ 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.
@@ -0,0 +1,48 @@
1
+ # Theme Liquid Docs
2
+
3
+ Auto-generated documentation for Liquid schemas, drops, tags, and filters. Documentation stays fresh—whenever you update the schema, docs regenerate automatically.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ git clone https://github.com/Shopify/theme-liquid-docs
9
+ cd theme-liquid-docs
10
+ yarn install
11
+ ```
12
+
13
+ ## What's Inside
14
+
15
+ - **`data/`** — JSON files with Liquid drops, tags, and filters for themes
16
+ - **`schemas/`** — JSON Schema definitions for Liquid theme artifacts
17
+ - **`ai/`** — Context files that power AI-generated Liquid rules
18
+ - **`tests/`** — Test suite ensuring documentation accuracy
19
+ - **`scripts/`** — Automation scripts for docs generation
20
+
21
+ ### Available data
22
+
23
+ In `data/`, you have access to:
24
+ - `filters` — All available Liquid filters
25
+ - `tags` — All Liquid tags
26
+ - `objects` — All Liquid objects
27
+ - `latest.json` — Identifies the version of Liquid data used by CLI, theme-tools, and other dependent projects. See [Updating revision number](#updating-revision-number) for details.
28
+
29
+ Check `ai/liquid.mdc` for examples.
30
+
31
+ ### Updating revision number
32
+
33
+ Run the [GitHub Action](https://github.com/Shopify/theme-liquid-docs/actions/workflows/update-latest.yml) to update the Liquid docs used by all dependent projects.
34
+
35
+ 🚨 IF YOU DONT RUN THIS ACTION, DEPENDENT PROJECTS WILL USE LIQUID DOCS IDENTIFIED BY THE REVISION ID IN `data/latest.json`.
36
+
37
+ ## Contributing
38
+
39
+ Help us make these docs better:
40
+
41
+ 1. **Fork** this repository
42
+ 2. **Create** your feature branch (`git checkout -b improve-liquid-docs`)
43
+ 3. **Commit** your changes (`git commit -m 'Add array filter examples'`)
44
+ 4. **Push** and create a Pull Request
45
+
46
+ ## License
47
+
48
+ MIT License. See [LICENSE](./LICENSE.md) for details.