@platforma-sdk/block-tools 2.10.18 → 2.11.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.
Files changed (42) hide show
  1. package/dist/cli.js +12 -12
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +391 -355
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/structure/engine/builders.d.ts +7 -6
  6. package/dist/structure/engine/content-rules.d.ts +4 -4
  7. package/dist/structure/engine/ir.d.ts +11 -6
  8. package/dist/structure/rules/block-package-json.d.ts +1 -1
  9. package/dist/structure/rules/root-ci.d.ts +1 -0
  10. package/dist/structure/rules/shared/retired-deps.d.ts +7 -0
  11. package/package.json +7 -7
  12. package/src/structure/CLAUDE.md +30 -0
  13. package/src/structure/__tests__/discovery-shortname.test.ts +50 -0
  14. package/src/structure/__tests__/root-ci-workflows.test.ts +68 -0
  15. package/src/structure/engine/builders.ts +7 -6
  16. package/src/structure/engine/content-rules.ts +7 -7
  17. package/src/structure/engine/discovery-fs.ts +9 -1
  18. package/src/structure/engine/ir.ts +11 -6
  19. package/src/structure/engine/runner.ts +14 -14
  20. package/src/structure/rules/block-package-json.ts +2 -3
  21. package/src/structure/rules/block.ts +3 -4
  22. package/src/structure/rules/migrations.ts +16 -18
  23. package/src/structure/rules/model-package-json.ts +4 -5
  24. package/src/structure/rules/model.ts +1 -2
  25. package/src/structure/rules/root-catalog-bump.ts +3 -4
  26. package/src/structure/rules/root-ci.ts +55 -0
  27. package/src/structure/rules/root-package-json.ts +8 -6
  28. package/src/structure/rules/root-pnpm-workspace.ts +4 -7
  29. package/src/structure/rules/root.ts +2 -4
  30. package/src/structure/rules/shared/retired-deps.ts +42 -0
  31. package/src/structure/rules/software.ts +1 -2
  32. package/src/structure/rules/test-package-json.ts +12 -9
  33. package/src/structure/rules/test.ts +5 -2
  34. package/src/structure/rules/ui-package-json.ts +15 -21
  35. package/src/structure/rules/ui.ts +3 -5
  36. package/src/structure/rules/workflow-package-json.ts +7 -3
  37. package/src/structure/rules/workflow.ts +20 -17
  38. package/src/structure/structure-definition.ts +2 -0
  39. package/src/structure/templates/static/test/.oxfmtrc.json +4 -0
  40. package/src/structure/templates/static/test/.oxlintrc.json +3 -0
  41. package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
  42. package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +34 -0
@@ -13,24 +13,21 @@ import {
13
13
  remove,
14
14
  when,
15
15
  whenFilesExist,
16
- blockVars,
17
16
  } from "../engine/api";
18
- import { getActiveRunContext } from "../engine/builders";
19
17
  import { workflowPackageJsonInitial, workflowPackageJsonRules } from "./workflow-package-json";
20
18
  import { COLOCATED_TEST_GLOB } from "./shared/colocated-tests";
21
19
 
22
20
  export function workflowRules(): void {
23
21
  scope("workflow", () => {
24
- // tsconfig for the TypeScript vitest integration tests under src/test
25
- // (e.g. mixcr's workflow/src/test/columns.test.ts). types:[] keeps the
26
- // isomorphic workflow free of ambient Node/DOM types.
27
- fixed("tsconfig.json", file("workflow/tsconfig.json"));
28
22
  // Tengo source formatter (emacs batch); the `format` script invokes it.
29
23
  fixed("format.el", file("workflow/format.el"));
30
- // vitest config only when the workflow carries co-located tests
31
- // (`src/**/*.test.ts`, incl. `src/test/`) — paired with the conditional
32
- // `vitest` devDep + `test` script in workflow-package-json. scaffold (not
33
- // fixed): author-tunable when present; a test-less workflow gets none.
24
+ // The TS-test tsconfig + vitest config exist ONLY when the workflow carries
25
+ // co-located tests (`src/**/*.test.ts`, incl. `src/test/` — e.g. mixcr's
26
+ // workflow/src/test/columns.test.ts). They pair with the conditional
27
+ // `vitest` devDep + `test` script in workflow-package-json. tsconfig is
28
+ // `fixed` (structural: types:[] keeps the isomorphic workflow free of
29
+ // ambient Node/DOM types); vitest.config is `scaffold` (author-tunable once
30
+ // present). A test-less workflow gets neither and stays a refresh fixpoint.
34
31
  //
35
32
  // Skipped entirely for sdk-internal (in-monorepo) blocks: they own their
36
33
  // test config under the monorepo's shared infrastructure (e.g. a bespoke
@@ -41,27 +38,33 @@ export function workflowRules(): void {
41
38
  () =>
42
39
  when(
43
40
  whenFilesExist(COLOCATED_TEST_GLOB),
44
- () => scaffold("vitest.config.mts", file("workflow/vitest.config.mts")),
45
- () => remove("vitest.config.mts"),
41
+ () => {
42
+ fixed("tsconfig.json", file("workflow/tsconfig.json"));
43
+ scaffold("vitest.config.mts", file("workflow/vitest.config.mts"));
44
+ },
45
+ () => {
46
+ remove("tsconfig.json");
47
+ remove("vitest.config.mts");
48
+ },
46
49
  ),
47
50
  );
48
51
  // No workflow facade (index.js / index.d.ts): the block loader resolves the
49
52
  // workflow via the `block:` components dist path (workflow/dist/.../main.plj.gz),
50
- // never the JS facade. It was orphaned in production — dropped. Actively
51
- // removed so existing blocks that carry it get cleaned (idempotent on absence).
53
+ // never the JS facade. Removed so blocks that carry one get cleaned
54
+ // (idempotent on absence).
52
55
  remove("index.js");
53
56
  remove("index.d.ts");
54
57
 
55
58
  seed(
56
59
  "src/main.tpl.tengo",
57
- tpl("workflow/src/main.tpl.tengo", () => ({
58
- shortName: blockVars().shortName,
60
+ tpl("workflow/src/main.tpl.tengo", (ctx) => ({
61
+ shortName: ctx.blockVars.shortName,
59
62
  })),
60
63
  );
61
64
 
62
65
  managed(
63
66
  "package.json",
64
- generate(() => workflowPackageJsonInitial(getActiveRunContext())),
67
+ generate((ctx) => workflowPackageJsonInitial(ctx)),
65
68
  () => {
66
69
  workflowPackageJsonRules();
67
70
  },
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { defineStructure } from "./engine/api";
7
7
  import { rootRules } from "./rules/root";
8
+ import { rootCiRules } from "./rules/root-ci";
8
9
  import { blockRules } from "./rules/block";
9
10
  import { modelRules } from "./rules/model";
10
11
  import { uiRules } from "./rules/ui";
@@ -16,6 +17,7 @@ import { rootCatalogBumpRules } from "./rules/root-catalog-bump";
16
17
 
17
18
  export const STRUCTURE = defineStructure(() => {
18
19
  rootRules();
20
+ rootCiRules();
19
21
  blockRules();
20
22
  modelRules();
21
23
  uiRules();
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["node_modules/@milaboratories/ts-builder/configs/oxfmt.json"],
3
+ "ignorePatterns": ["dist", "coverage", "CHANGELOG.md"]
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["node_modules/@milaboratories/ts-builder/dist/configs/oxlint-test.json"]
3
+ }
@@ -0,0 +1,67 @@
1
+ name: Build, Test and Release Platforma Block
2
+ on:
3
+ merge_group:
4
+ pull_request:
5
+ types: [opened, reopened, synchronize]
6
+ branches:
7
+ - 'main'
8
+ push:
9
+ branches:
10
+ - 'main'
11
+ workflow_dispatch: {}
12
+ jobs:
13
+ init:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: milaboratory/github-ci/actions/context/init@v4
17
+ with:
18
+ version-canonize: false
19
+ branch-versioning: main
20
+ run:
21
+ needs:
22
+ - init
23
+ uses: milaboratory/github-ci/.github/workflows/node-simple-pnpm.yaml@v4
24
+ with:
25
+ app-name: '${appName}'
26
+ app-name-slug: '${appNameSlug}'
27
+ node-version: '20.x'
28
+ build-script-name: 'build'
29
+ pnpm-recursive-build: false
30
+
31
+ test: true
32
+ test-script-name: 'test'
33
+ pnpm-recursive-tests: false
34
+ team-id: 'ciplopen'
35
+
36
+ publish-to-public: 'true'
37
+ package-path: 'block'
38
+ create-tag: 'true'
39
+
40
+ npmrc-config: |
41
+ {
42
+ "registries": {
43
+ "https://registry.npmjs.org/": {
44
+ "scopes": ["milaboratories", "platforma-sdk", "platforma-open"],
45
+ "tokenVar": "NPMJS_TOKEN"
46
+ }
47
+ }
48
+ }
49
+ secrets:
50
+ env: |
51
+ { "PL_LICENSE": ${{ toJSON(secrets.MI_LICENSE) }},
52
+ "MI_LICENSE": ${{ toJSON(secrets.MI_LICENSE) }},
53
+ "NPMJS_TOKEN": ${{ toJSON(secrets.NPMJS_TOKEN) }},
54
+ "PL_CI_TEST_USER": ${{ toJSON(secrets.PL_CI_TEST_USER) }},
55
+ "PL_CI_TEST_PASSWORD": ${{ toJSON(secrets.PL_CI_TEST_PASSWORD) }},
56
+
57
+ "AWS_CI_IAM_MONOREPO_SIMPLE_ROLE": ${{ toJSON(secrets.AWS_CI_IAM_MONOREPO_SIMPLE_ROLE) }},
58
+ "AWS_CI_TURBOREPO_S3_BUCKET": ${{ toJSON(secrets.AWS_CI_TURBOREPO_S3_BUCKET) }},
59
+ "PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL": ${{ toJSON(secrets.PL_REGISTRY_PLOPEN_UPLOAD_URL) }},
60
+ "QUAY_USERNAME": ${{ toJSON(secrets.QUAY_USERNAME) }},
61
+ "QUAY_ROBOT_TOKEN": ${{ toJSON(secrets.QUAY_ROBOT_TOKEN) }} }
62
+
63
+ SLACK_CHANNEL: ${{ secrets.SLACK_BLOCKS_CI_CHANNEL }}
64
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
65
+
66
+ GH_ZEN_APP_ID: ${{ secrets.GH_ZEN_APP_ID }}
67
+ GH_ZEN_APP_PRIVATE_KEY: ${{ secrets.GH_ZEN_APP_PRIVATE_KEY }}
@@ -0,0 +1,34 @@
1
+ name: Mark Platforma Block as Stable
2
+ on:
3
+ workflow_dispatch: {}
4
+ jobs:
5
+ init:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: milaboratory/github-ci/actions/context/init@v4
9
+ with:
10
+ version-canonize: false
11
+ branch-versioning: main
12
+ run:
13
+ needs:
14
+ - init
15
+ uses: milaboratory/github-ci/.github/workflows/block-mark-stable.yaml@v4
16
+ with:
17
+ app-name: '${appName}'
18
+ node-version: '20.x'
19
+ npmrc-config: |
20
+ {
21
+ "registries": {
22
+ "https://registry.npmjs.org/": {
23
+ "scopes": ["milaboratories", "platforma-sdk", "platforma-open"],
24
+ "tokenVar": "NPMJS_TOKEN"
25
+ }
26
+ }
27
+ }
28
+ secrets:
29
+ env: |
30
+ { "NPMJS_TOKEN": ${{ toJSON(secrets.NPMJS_TOKEN) }},
31
+ "AWS_CI_IAM_MONOREPO_SIMPLE_ROLE": ${{ toJSON(secrets.AWS_CI_IAM_MONOREPO_SIMPLE_ROLE) }} }
32
+
33
+ SLACK_CHANNEL: ${{ secrets.SLACK_BLOCKS_CI_CHANNEL }}
34
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}