@elaraai/create-east 1.0.68 → 1.0.70
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/index.js +17 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var RUNTIMES = {
|
|
|
28
28
|
destParent: "packages/python",
|
|
29
29
|
templateName: "python",
|
|
30
30
|
label: "Python",
|
|
31
|
+
tasks: 2,
|
|
31
32
|
valid: /^[a-z][a-z0-9_]*$/,
|
|
32
33
|
rule: "lowercase letters, digits and underscores, starting with a letter"
|
|
33
34
|
},
|
|
@@ -37,6 +38,7 @@ var RUNTIMES = {
|
|
|
37
38
|
destParent: "packages/node",
|
|
38
39
|
templateName: "node",
|
|
39
40
|
label: "Node",
|
|
41
|
+
tasks: 2,
|
|
40
42
|
valid: /^[a-z][a-z0-9-]*$/,
|
|
41
43
|
rule: "lowercase letters, digits and hyphens, starting with a letter"
|
|
42
44
|
},
|
|
@@ -46,6 +48,7 @@ var RUNTIMES = {
|
|
|
46
48
|
destParent: "packages/native",
|
|
47
49
|
templateName: "c",
|
|
48
50
|
label: "C",
|
|
51
|
+
tasks: 1,
|
|
49
52
|
valid: /^[a-z][a-z0-9_-]*$/,
|
|
50
53
|
rule: "lowercase letters, digits, underscores and hyphens, starting with a letter"
|
|
51
54
|
}
|
|
@@ -146,11 +149,13 @@ function excludePackagesFromRootTsconfig(projectDir) {
|
|
|
146
149
|
`);
|
|
147
150
|
}
|
|
148
151
|
function writeAppWiring(projectDir, names, members) {
|
|
149
|
-
const imports = members.map((m) => `import { ${m.ident}
|
|
150
|
-
const list = members.map((m) => `
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
//
|
|
152
|
+
const imports = members.map((m) => `import { ${m.ident}_tasks } from "./${m.name}.js";`).join("\n");
|
|
153
|
+
const list = members.map((m) => ` ...${m.ident}_tasks,`).join("\n");
|
|
154
|
+
const taskCount = members.reduce((n, m) => n + RUNTIMES[m.runtime].tasks, 0);
|
|
155
|
+
const barrel = `// Generated by create-e3 \u2014 collects the example tasks of every workspace package:
|
|
156
|
+
// a call of the package's platform function (its environment derived from the
|
|
157
|
+
// package) and, for python and node, a call of an East function the package
|
|
158
|
+
// exports (embedded at export). Add packages with \`create-e3 --python-packages=\u2026\`.
|
|
154
159
|
${imports}
|
|
155
160
|
|
|
156
161
|
export const packageTasks = [
|
|
@@ -163,10 +168,11 @@ ${list}
|
|
|
163
168
|
|
|
164
169
|
import { packageTasks } from "./packages/index.js";
|
|
165
170
|
|
|
166
|
-
// This app wires
|
|
167
|
-
// task's \`environment\` is captured
|
|
168
|
-
// re-runs only its
|
|
169
|
-
//
|
|
171
|
+
// This app wires the example tasks of each generated workspace package. A
|
|
172
|
+
// platform-function task's \`environment\` is captured per package, so editing
|
|
173
|
+
// one package re-runs only its tasks \u2014 the other packages stay cached; an
|
|
174
|
+
// imported East function is embedded at export and runs anywhere. Add your
|
|
175
|
+
// own inputs, tasks and dataflows here.
|
|
170
176
|
export default e3.package("${names.projectName}", "1.0.0", ...packageTasks);
|
|
171
177
|
`;
|
|
172
178
|
writeFileSync(join(projectDir, "src", "index.ts"), index);
|
|
@@ -180,9 +186,9 @@ import { packageTasks } from "./packages/index.js";
|
|
|
180
186
|
// Generated by create-e3 \u2014 smoke tests for the generated multi-package
|
|
181
187
|
// app. Replace with real tests as you add inputs, tasks and dataflows.
|
|
182
188
|
describeEast("${names.displayName}", (test) => {
|
|
183
|
-
test("wires
|
|
189
|
+
test("wires every example task of every workspace package", ($) => {
|
|
184
190
|
const count = $.const(BigInt(packageTasks.length), IntegerType);
|
|
185
|
-
$(Assert.equal(count, East.value(${
|
|
191
|
+
$(Assert.equal(count, East.value(${taskCount}n)));
|
|
186
192
|
});
|
|
187
193
|
|
|
188
194
|
test("exports the deployable package", ($) => {
|