@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.
- package/dist/cli.js +12 -12
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +391 -355
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/builders.d.ts +7 -6
- package/dist/structure/engine/content-rules.d.ts +4 -4
- package/dist/structure/engine/ir.d.ts +11 -6
- package/dist/structure/rules/block-package-json.d.ts +1 -1
- package/dist/structure/rules/root-ci.d.ts +1 -0
- package/dist/structure/rules/shared/retired-deps.d.ts +7 -0
- package/package.json +7 -7
- package/src/structure/CLAUDE.md +30 -0
- package/src/structure/__tests__/discovery-shortname.test.ts +50 -0
- package/src/structure/__tests__/root-ci-workflows.test.ts +68 -0
- package/src/structure/engine/builders.ts +7 -6
- package/src/structure/engine/content-rules.ts +7 -7
- package/src/structure/engine/discovery-fs.ts +9 -1
- package/src/structure/engine/ir.ts +11 -6
- package/src/structure/engine/runner.ts +14 -14
- package/src/structure/rules/block-package-json.ts +2 -3
- package/src/structure/rules/block.ts +3 -4
- package/src/structure/rules/migrations.ts +16 -18
- package/src/structure/rules/model-package-json.ts +4 -5
- package/src/structure/rules/model.ts +1 -2
- package/src/structure/rules/root-catalog-bump.ts +3 -4
- package/src/structure/rules/root-ci.ts +55 -0
- package/src/structure/rules/root-package-json.ts +8 -6
- package/src/structure/rules/root-pnpm-workspace.ts +4 -7
- package/src/structure/rules/root.ts +2 -4
- package/src/structure/rules/shared/retired-deps.ts +42 -0
- package/src/structure/rules/software.ts +1 -2
- package/src/structure/rules/test-package-json.ts +12 -9
- package/src/structure/rules/test.ts +5 -2
- package/src/structure/rules/ui-package-json.ts +15 -21
- package/src/structure/rules/ui.ts +3 -5
- package/src/structure/rules/workflow-package-json.ts +7 -3
- package/src/structure/rules/workflow.ts +20 -17
- package/src/structure/structure-definition.ts +2 -0
- package/src/structure/templates/static/test/.oxfmtrc.json +4 -0
- package/src/structure/templates/static/test/.oxlintrc.json +3 -0
- package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
- 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
|
|
31
|
-
// (`src/**/*.test.ts`, incl. `src/test/`
|
|
32
|
-
//
|
|
33
|
-
//
|
|
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
|
-
() =>
|
|
45
|
-
|
|
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.
|
|
51
|
-
//
|
|
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
|
|
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(
|
|
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,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 }}
|