Skip to content

Commit

Permalink
🔀 merge remote-tracking branch 'origin/master' into antoinekm/workshop
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Apr 2, 2023
2 parents f24d34f + 90ded26 commit d0b7140
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
"start": "turbo start",
"build": "turbo run build",
"build:packages": "turbo run p:build",
"build:apps": "turbo run build --filter='./examples/*' --filter=docs",
"build:docs": "turbo run build --filter=docs...",
"build:examples": "turbo run build --filter='./examples/*'",
"build:examples:expo": "turbo run build --filter=expo-typescript...",
"build:examples:next": "turbo run build --filter=next-typescript...",
"dev": "turbo run p:watch dev --parallel --no-cache",
"dev": "node start-dev.js",
"dev:packages": "turbo run p:watch",
"dev:apps": "turbo run dev --filter='./examples/*' --filter=docs",
"dev:docs": "turbo run dev --filter=docs",
"dev:examples": "turbo run dev --filter=./examples/*",
"dev:examples": "turbo run dev --filter='./examples/*'",
"dev:examples:expo": "turbo run dev --filter=expo-typescript",
"dev:examples:next": "turbo run dev --filter=next-typescript",
"dev:examples:react": "turbo run dev --filter=react-typescript",
Expand Down Expand Up @@ -47,12 +49,14 @@
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"babel-plugin-styled-components": "^2.0.7",
"cross-spawn": "^7.0.3",
"eslint": "^8.26.0",
"eslint-config-next": "^13.0.2",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.10",
"husky": "^8.0.1",
"merge-stream": "^2.0.0",
"path-browserify": "^1.0.1",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions start-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const spawn = require("cross-spawn");
const merge = require("merge-stream");

const env = { ...process.env, FORCE_COLOR: true };

const devPackages = spawn("pnpm", ["dev:packages"], {
stdio: "pipe",
env,
});

const devApps = () => spawn("pnpm", ["dev:apps"], { stdio: "pipe", env });

const waitForSuccess = (stream) => {
return new Promise((resolve) => {
stream.on("data", (data) => {
const output = data.toString();
console.log(output);
if (
output.includes("info") &&
output.includes("waiting for changes...")
) {
stream.removeAllListeners("data");
resolve();
}
});
});
};

devPackages.stderr.on("data", (data) => {
console.error(data.toString());
});

devPackages.on("exit", (code) => {
console.log(`dev:packages exited with code ${code}`);
});

waitForSuccess(devPackages.stdout).then(() => {
const devAppsProcess = devApps();
const mergedOutput = merge(devPackages.stdout, devAppsProcess.stdout);
mergedOutput.on("data", (data) => {
console.log(data.toString());
});
const mergedError = merge(devPackages.stderr, devAppsProcess.stderr);
mergedError.on("data", (data) => {
console.error(data.toString());
});
});

0 comments on commit d0b7140

Please sign in to comment.