@platforma-sdk/block-tools 2.10.19 → 2.11.1

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 (33) hide show
  1. package/dist/cli.js +11 -11
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +362 -352
  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/v2/registry/schema_public.d.ts +150 -150
  11. package/package.json +6 -6
  12. package/src/structure/CLAUDE.md +2 -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 +1 -2
  23. package/src/structure/rules/model.ts +1 -2
  24. package/src/structure/rules/root-catalog-bump.ts +3 -4
  25. package/src/structure/rules/root-ci.ts +55 -0
  26. package/src/structure/rules/root.ts +2 -3
  27. package/src/structure/rules/software.ts +1 -2
  28. package/src/structure/rules/test.ts +1 -2
  29. package/src/structure/rules/ui.ts +3 -5
  30. package/src/structure/rules/workflow.ts +3 -5
  31. package/src/structure/structure-definition.ts +2 -0
  32. package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
  33. package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +34 -0
@@ -10,11 +10,9 @@ import {
10
10
  file,
11
11
  tpl,
12
12
  generate,
13
- blockVars,
14
13
  when,
15
14
  whenFilesExist,
16
15
  } from "../engine/api";
17
- import { getActiveRunContext } from "../engine/builders";
18
16
  import { uiPackageJsonInitial, uiPackageJsonRules } from "./ui-package-json";
19
17
  import { COLOCATED_TEST_GLOB } from "./shared/colocated-tests";
20
18
 
@@ -45,16 +43,16 @@ export function uiRules(): void {
45
43
  seed("src/main.ts", file("ui/src/main.ts"));
46
44
  seed(
47
45
  "src/app.ts",
48
- tpl("ui/src/app.tpl.ts", () => ({ modelPkg: `${blockVars().facadeName}.model` })),
46
+ tpl("ui/src/app.tpl.ts", (ctx) => ({ modelPkg: `${ctx.blockVars.facadeName}.model` })),
49
47
  );
50
48
  seed(
51
49
  "src/MainPage.vue",
52
- tpl("ui/src/MainPage.tpl.vue", () => ({ shortName: blockVars().shortName })),
50
+ tpl("ui/src/MainPage.tpl.vue", (ctx) => ({ shortName: ctx.blockVars.shortName })),
53
51
  );
54
52
 
55
53
  managed(
56
54
  "package.json",
57
- generate(() => uiPackageJsonInitial(getActiveRunContext())),
55
+ generate((ctx) => uiPackageJsonInitial(ctx)),
58
56
  () => {
59
57
  uiPackageJsonRules();
60
58
  },
@@ -13,9 +13,7 @@ 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
 
@@ -59,14 +57,14 @@ export function workflowRules(): void {
59
57
 
60
58
  seed(
61
59
  "src/main.tpl.tengo",
62
- tpl("workflow/src/main.tpl.tengo", () => ({
63
- shortName: blockVars().shortName,
60
+ tpl("workflow/src/main.tpl.tengo", (ctx) => ({
61
+ shortName: ctx.blockVars.shortName,
64
62
  })),
65
63
  );
66
64
 
67
65
  managed(
68
66
  "package.json",
69
- generate(() => workflowPackageJsonInitial(getActiveRunContext())),
67
+ generate((ctx) => workflowPackageJsonInitial(ctx)),
70
68
  () => {
71
69
  workflowPackageJsonRules();
72
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,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 }}