Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/scripts/expand-liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,26 @@ async function directoryNames(parentPath) {

async function expandExtensionLiquidTemplates(projectName, flavor) {
console.log(`Expanding liquid templates for ${projectName}`);
const pathSuffix =
flavor === "typescript" || flavor === "vanilla-js" ? "js" : "rs";

let pathSuffix;
switch (flavor) {
case "typescript":
case "vanilla-js":
pathSuffix = "js";
break;
Comment on lines +38 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works for this one outlier which uses a separate -ts suffix for some reason. Maybe we want to make this a pattern/regex somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm good point, let me have a look. I don't think my code change have any impact on what you mention, but might as well try to fix it at the same time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being explored here: #290

case "rust":
pathSuffix = "rs";
break;
case "wasm":
pathSuffix = "wasm";
break;
default:
throw(`Unrecognized language ${flavor}.`);
}

const projectPath = path.join(process.cwd(), projectName + "-" + pathSuffix);
const langName =
flavor === "typescript" || flavor === "vanilla-js" ? "javascript" : "rust";

if (langName === "javascript") {
if (flavor === "typescript" || flavor === "vanilla-js") {
await (
await glob(path.join(projectPath, "src", "!(*.liquid|*.graphql)"))
).forEach(async (path) => await fs.rm(path));
Expand All @@ -52,7 +65,7 @@ async function expandExtensionLiquidTemplates(projectName, flavor) {

await expandLiquidTemplates(projectPath, liquidData);

if (langName === "javascript") {
if (flavor === "typescript" || flavor === "vanilla-js") {
const srcFilePaths = await glob(
path.join(projectPath, "src", "!(*.liquid|*.graphql)")
);
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/validate-wasm-functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Validate WASM Functions

on:
pull_request:
branches: ["main"]
paths:
- "functions-*-wasm/**"
- ".github/workflows/validate-wasm-functions.yml"

env:
CARGO_TERM_COLOR: always

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install node dependencies
run: yarn
- name: Expand liquid for TypeScript functions
run: CI=1 yarn expand-liquid wasm
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ yarn expand-liquid [rust|vanilla-js|typescript] <project-name-without-suffix>

# optionally specify only the language argument to expand all functions projects for that language
yarn expand-liquid rust
yarn expand-liquid vanilla-js
yarn expand-liquid typescript
yarn expand-liquid vanilla-js
yarn expand-liquid wasm
```

### JavaScript / TypeScript
Expand Down