Skip to content

Commit 51e73f3

Browse files
authored
Merge pull request #382 from formidablejs/release/0.28.2
Release/0.28.2
2 parents c42cbdb + 26d6c99 commit 51e73f3

File tree

14 files changed

+153
-28
lines changed

14 files changed

+153
-28
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Bun - Core Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: oven-sh/setup-bun@v2
12+
- name: Log in to Docker Hub
13+
uses: docker/login-action@v3
14+
with:
15+
username: ${{ secrets.DOCKERHUB_USERNAME }}
16+
password: ${{ secrets.DOCKERHUB_TOKEN }}
17+
- name: Start Redis
18+
uses: supercharge/[email protected]
19+
- name: Install dependencies
20+
run: bun install
21+
- name: Build
22+
run: bun run build
23+
- name: Run tests
24+
run: bun run test

.github/workflows/bun-e2e-test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Bun - E2E Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: oven-sh/setup-bun@v2
13+
- name: Install modules
14+
run: bun install --frozen-lockfile
15+
- name: Build
16+
run: bun run build
17+
- name: Prepare e2e tests
18+
run: RUNTIME=bun bun run pre-test
19+
- name: Run e2e tests
20+
run: bun run test:e2e
21+
- name: Clean up
22+
run: ./scripts/5-clean-up.sh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Automated Tests
1+
name: Node.js - Automated Tests
22

33
on:
44
schedule:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Core Tests
1+
name: Node.js - Core Tests
22

33
on: [push]
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: E2E Tests
1+
name: Node.js - E2E Tests
22

33
on: [push]
44

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44
Note: This repository contains the core code of the Formidable framework. If you want to build an application using Formidable, visit the main [Formidablejs repository](https://github.com/formidablejs/formidablejs-typescript).
55

66
<center>
7+
<p align="center">
78

8-
![Core](https://github.com/formidablejs/framework/actions/workflows/0-core-test.yml/badge.svg)
9-
![E2E](https://github.com/formidablejs/framework/actions/workflows/1-e2e-test.yml/badge.svg)
9+
![Node.js - Core](https://github.com/formidablejs/framework/actions/workflows/nodejs-core-test.yml/badge.svg)
10+
![Node.js - E2E](https://github.com/formidablejs/framework/actions/workflows/nodejs-e2e-test.yml/badge.svg)
11+
![Bun - Core](https://github.com/formidablejs/framework/actions/workflows/bun-core-test.yml/badge.svg)
12+
![Bun - E2E](https://github.com/formidablejs/framework/actions/workflows/bun-e2e-test.yml/badge.svg)
1013
![Package Manager](https://github.com/formidablejs/framework/actions/workflows/2-package-test.yml/badge.svg)
1114
![npm](https://img.shields.io/npm/v/@formidablejs/framework)
1215
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
1316
![GitHub](https://img.shields.io/github/license/formidablejs/framework)
1417
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
1518

19+
</p>
1620
</center>
1721

1822
Security

bin/formidablejs/Commands/Build.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { Command, Output, boolean } = require("@formidablejs/console");
22
const { exec, execSync } = require("child_process");
3-
const { getExt } = require('../ext')
3+
const { getExt } = require('../ext');
4+
const { getRuntime } = require("../runtime");
45

56
class Build extends Command {
67
get signature() {
@@ -18,6 +19,8 @@ class Build extends Command {
1819
}
1920

2021
handle() {
22+
const runtime = getRuntime();
23+
2124
if (this.option("watch-console")) {
2225
return execSync(
2326
`imba build bootstrap/console${getExt()} -p -s -f -w -o .formidable`,
@@ -29,7 +32,7 @@ class Build extends Command {
2932
}
3033

3134
const output = exec(
32-
`imba build bootstrap/console${getExt()} -p -s -f -o .formidable && imba build bootstrap/build${getExt()} -p -s -f -o .formidable && node craftsman config:cache`,
35+
`imba build bootstrap/console${getExt()} -p -s -f -o .formidable && imba build bootstrap/build${getExt()} -p -s -f -o .formidable && ${runtime} craftsman config:cache`,
3336
{
3437
stdio: "pipe",
3538
cwd: process.cwd(),
@@ -69,7 +72,21 @@ class Build extends Command {
6972
track.push(data);
7073
});
7174

75+
let workerThreadErrors = false;
76+
7277
output.stderr.on("data", function (data) {
78+
if (
79+
data.startsWith('NotImplementedError: worker_threads.Worker')
80+
) {
81+
if (workerThreadErrors) {
82+
return;
83+
}
84+
85+
workerThreadErrors = true;
86+
87+
return Output.write(" <bg:yellow> WARN </bg:yellow> Bun does not support node.js worker_threads yet.\n");
88+
}
89+
7390
process.stdout.write(data);
7491
});
7592

bin/formidablejs/Commands/Start.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { Command } = require("@formidablejs/console");
22
const { execSync } = require("child_process");
3+
const { getRuntime } = require("../runtime");
34

45
class Start extends Command {
56
get signature() {
@@ -11,7 +12,9 @@ class Start extends Command {
1112
}
1213

1314
handle() {
14-
execSync("node server", {
15+
const runtime = getRuntime();
16+
17+
execSync(`${runtime} server`, {
1518
stdio: "inherit",
1619
cwd: process.cwd(),
1720
});

bin/formidablejs/runtime.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const getRuntime = () => {
2+
const args = process.argv;
3+
let runtime = 'node';
4+
5+
if (args) {
6+
const executor = args[0].split('/').pop();
7+
8+
if (executor != undefined) {
9+
runtime = executor;
10+
}
11+
}
12+
13+
return runtime;
14+
}
15+
16+
module.exports = { getRuntime }

0 commit comments

Comments
 (0)