Skip to content

Commit

Permalink
Merge branch 'master' into remove-query-string
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Mar 4, 2024
2 parents 6840426 + cad1ded commit 6cbbc72
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 181 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-monkeys-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'playroom': patch
---

Remove dependency on `current-git-branch` package
5 changes: 5 additions & 0 deletions .changeset/six-fans-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'playroom': patch
---

Upgrade `webpack-dev-server` to v5
5 changes: 5 additions & 0 deletions .changeset/tiny-plums-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'playroom': patch
---

Fix async import of playroom config on Windows
3 changes: 2 additions & 1 deletion bin/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const commandLineArgs = require('command-line-args');
const commandLineUsage = require('command-line-usage');
const findUp = require('find-up');
const lib = require('../lib');
const url = require('url');

const showUsage = () => {
console.log(
Expand Down Expand Up @@ -65,7 +66,7 @@ const showUsage = () => {
process.exit(1);
}

const { default: config } = await import(configPath);
const { default: config } = await import(url.pathToFileURL(configPath));

const playroom = lib({
cwd: path.dirname(configPath),
Expand Down
15 changes: 13 additions & 2 deletions lib/provideDefaultConfig.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
const readPackage = require('read-pkg-up');
const currentGitBranch = require('current-git-branch');
const { execSync } = require('child_process');

/**
* @returns {string | null} The current git branch name, or null if no branch is found
*/
const getGitBranch = () => {
try {
return execSync('git branch --show-current').toString().trim();
} catch (e) {
return null;
}
};

const generateStorageKey = () => {
const pkg = readPackage.sync();
const packageName = (pkg && pkg.packageJson && pkg.packageJson.name) || null;
const branchName = currentGitBranch();
const branchName = getGitBranch();

const packageLabel = packageName ? `package:${packageName}` : null;
const branchLabel = branchName ? `branch:${branchName}` : null;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"command-line-usage": "^6.1.3",
"copy-to-clipboard": "^3.3.3",
"css-loader": "^6.7.2",
"current-git-branch": "^1.1.0",
"dedent": "^1.5.1",
"fast-glob": "^3.2.12",
"find-up": "^5.0.0",
Expand Down Expand Up @@ -107,7 +106,7 @@
"typescript": ">=5.0.0",
"use-debounce": "^10.0.0",
"webpack": "^5.75.0",
"webpack-dev-server": "^4.11.1",
"webpack-dev-server": "^5.0.2",
"webpack-merge": "^5.8.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 6cbbc72

Please sign in to comment.