npm-workspaces-publish-tool 0.0.4 → 0.0.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-workspaces-publish-tool",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "An unopinionated tool to assist publishing of npm based mono-repo workspaces",
5
5
  "main": "build/src/cli.js",
6
6
  "type": "module",
package/build/src/cli.js CHANGED
@@ -56,14 +56,14 @@ function getReleaseOrderFromInDegree(inDegree, dependencies) {
56
56
  }
57
57
  return order;
58
58
  }
59
- function getDirtyMap(workspaces, lastTag) {
59
+ function getDirtyMap(workspaces, lastTag, cwd) {
60
60
  const dirtyMap = new Map();
61
61
  const changedFiles = lastTag
62
62
  ? getChangesBetweenRefs(lastTag, 'HEAD', [], '', cwd)
63
63
  : [];
64
64
  for (const ws of workspaces) {
65
65
  const isNew = !lastTag;
66
- const isDirty = changedFiles.some((f) => f.startsWith(ws.path + '/') || f === ws.path);
66
+ const isDirty = changedFiles.some((f) => resolve(cwd, f).includes(ws.path));
67
67
  if (isNew) {
68
68
  dirtyMap.set(ws.name, 'new');
69
69
  }
@@ -123,7 +123,8 @@ function getDirtyPackagesVersionChanges(workspaces, dirtyMap, lastTag, cwd) {
123
123
  });
124
124
  continue;
125
125
  }
126
- const previousPkgRaw = git(['show', `${lastTag}:${ws.path}/package.json`], {
126
+ const relativeWsPath = relative(cwd, ws.path);
127
+ const previousPkgRaw = git(['show', `${lastTag}:${relativeWsPath}/package.json`], {
127
128
  cwd,
128
129
  });
129
130
  if (!previousPkgRaw.success) {
@@ -352,7 +353,7 @@ function validatePublish() {
352
353
  const { dependencies } = createDependencyMap(packageInfos);
353
354
  const inDegree = calculateWorkspaceInDegree(workspaces, dependencies);
354
355
  const releaseOrder = getReleaseOrderFromInDegree(inDegree, dependencies);
355
- const dirtyMap = getDirtyMap(workspaces, lastMonoRepoTag);
356
+ const dirtyMap = getDirtyMap(workspaces, lastMonoRepoTag, cwd);
356
357
  const dirtyVersionChanges = getDirtyPackagesVersionChanges(workspaces, dirtyMap, lastMonoRepoTag, cwd);
357
358
  console.log('🏗️ Building packages...');
358
359
  for (const pkgName of releaseOrder) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-workspaces-publish-tool",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "An unopinionated tool to assist publishing of npm based mono-repo workspaces",
5
5
  "main": "build/src/cli.js",
6
6
  "type": "module",