@decohere/devkit 0.0.1-dev.128 → 0.0.1-dev.130

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.
@@ -53,6 +53,9 @@ _export(exports, {
53
53
  },
54
54
  get ProjectOption () {
55
55
  return _options.ProjectOption;
56
+ },
57
+ get RootDirOption () {
58
+ return _options.RootDirOption;
56
59
  }
57
60
  });
58
61
  const _action = require("./action.js");
@@ -35,6 +35,9 @@ _export(exports, {
35
35
  },
36
36
  get ProjectOption () {
37
37
  return ProjectOption;
38
+ },
39
+ get RootDirOption () {
40
+ return RootDirOption;
38
41
  }
39
42
  });
40
43
  const _commander = require("commander");
@@ -73,6 +76,11 @@ class ConfigFileOption extends _commander.Option {
73
76
  this.default(defaultValue);
74
77
  }
75
78
  }
79
+ class RootDirOption extends _commander.Option {
80
+ constructor(){
81
+ super("--root-dir <dir>", "Workspace root (default: the current folder)");
82
+ }
83
+ }
76
84
  class LogLevelOption extends _commander.Option {
77
85
  constructor(){
78
86
  super("--log-level <level>", "Log level (trace, debug, info, warn, error)");
@@ -8,8 +8,14 @@ Object.defineProperty(exports, "Npm", {
8
8
  return Npm;
9
9
  }
10
10
  });
11
+ const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
11
12
  const _interoperror = require("../errors/interop.error.js");
12
13
  const _shell = require("../shell/shell.js");
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
13
19
  function _getRequireWildcardCache(nodeInterop) {
14
20
  if (typeof WeakMap !== "function") return null;
15
21
  var cacheBabelInterop = new WeakMap();
@@ -60,6 +66,13 @@ const Commands = {
60
66
  class Npm extends _shell.Shell {
61
67
  name = "npm";
62
68
  program = "npm";
69
+ /**
70
+ * A folder as npm reads it: a relative `dist/release` looks like the GitHub repository
71
+ * `dist/release` to npm, so it gets a leading `./`.
72
+ */ static folderSpec(directory) {
73
+ if (_nodepath.default.isAbsolute(directory) || /^\.\.?([/\\]|$)/.test(directory)) return directory;
74
+ return `./${directory}`;
75
+ }
63
76
  async publish(directory, options = {
64
77
  channel: "beta"
65
78
  }) {
@@ -80,7 +93,7 @@ class Npm extends _shell.Shell {
80
93
  }
81
94
  const args = [
82
95
  Commands.publish,
83
- directory
96
+ Npm.folderSpec(directory)
84
97
  ];
85
98
  let tmpUserConfigPath;
86
99
  args.push("--tag", channel ?? "beta");
@@ -1,4 +1,4 @@
1
1
  export { ActionMap, ActionResponse } from "./action.js";
2
2
  export { CommandError, CommandResponse, DecohereCommand } from "./command.js";
3
3
  export { ModuleManifest } from "./module.type.js";
4
- export { ConfigFileOption, ConfigurationOption, DryRunOption, EnvFileIfExistsOption, EnvFileOption, LogLevelOption, NoBuildOptions, NoCleanOptions, ProjectOption } from "./options.js";
4
+ export { ConfigFileOption, ConfigurationOption, DryRunOption, EnvFileIfExistsOption, EnvFileOption, LogLevelOption, NoBuildOptions, NoCleanOptions, ProjectOption, RootDirOption } from "./options.js";
@@ -34,6 +34,11 @@ export class ConfigFileOption extends Option {
34
34
  this.default(defaultValue);
35
35
  }
36
36
  }
37
+ export class RootDirOption extends Option {
38
+ constructor(){
39
+ super("--root-dir <dir>", "Workspace root (default: the current folder)");
40
+ }
41
+ }
37
42
  export class LogLevelOption extends Option {
38
43
  constructor(){
39
44
  super("--log-level <level>", "Log level (trace, debug, info, warn, error)");
@@ -1,3 +1,4 @@
1
+ import path from "node:path";
1
2
  import { InteropError } from "../errors/interop.error.js";
2
3
  import { Shell } from "../shell/shell.js";
3
4
  const Commands = {
@@ -9,6 +10,13 @@ const Commands = {
9
10
  export class Npm extends Shell {
10
11
  name = "npm";
11
12
  program = "npm";
13
+ /**
14
+ * A folder as npm reads it: a relative `dist/release` looks like the GitHub repository
15
+ * `dist/release` to npm, so it gets a leading `./`.
16
+ */ static folderSpec(directory) {
17
+ if (path.isAbsolute(directory) || /^\.\.?([/\\]|$)/.test(directory)) return directory;
18
+ return `./${directory}`;
19
+ }
12
20
  async publish(directory, options = {
13
21
  channel: "beta"
14
22
  }) {
@@ -29,7 +37,7 @@ export class Npm extends Shell {
29
37
  }
30
38
  const args = [
31
39
  Commands.publish,
32
- directory
40
+ Npm.folderSpec(directory)
33
41
  ];
34
42
  let tmpUserConfigPath;
35
43
  args.push("--tag", channel ?? "beta");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/devkit",
3
- "version": "0.0.1-dev.128",
3
+ "version": "0.0.1-dev.130",
4
4
  "description": "The shared base for Decohere's command-line tools: the command framework, git/npm/pnpm/docker wrappers, tracing, and file search and watch. Never needed in a production app.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,8 +48,8 @@
48
48
  "test": "echo \"Error: no test specified\" && exit 1"
49
49
  },
50
50
  "dependencies": {
51
- "@decohere/core": "0.0.1-dev.128",
52
- "@decohere/scribe": "0.0.1-dev.128",
51
+ "@decohere/core": "0.0.1-dev.130",
52
+ "@decohere/scribe": "0.0.1-dev.130",
53
53
  "commander": "^13.1.0",
54
54
  "glob": "^13.0.1",
55
55
  "picomatch": "^4.0.4"
@@ -4,4 +4,4 @@ export type { CommandHandler, CommandType } from "./command.js";
4
4
  export { CommandError, CommandResponse, DecohereCommand } from "./command.js";
5
5
  export type { ApplicationModule, CommandMap as CommandClassMap, ModuleConfig, WorkspaceFactoryOptions, } from "./module.type.js";
6
6
  export { ModuleManifest } from "./module.type.js";
7
- export { ConfigFileOption, ConfigurationOption, DryRunOption, EnvFileIfExistsOption, EnvFileOption, LogLevelOption, NoBuildOptions, NoCleanOptions, ProjectOption, } from "./options.js";
7
+ export { ConfigFileOption, ConfigurationOption, DryRunOption, EnvFileIfExistsOption, EnvFileOption, LogLevelOption, NoBuildOptions, NoCleanOptions, ProjectOption, RootDirOption, } from "./options.js";
@@ -5,6 +5,9 @@ export declare class ConfigurationOption extends Option {
5
5
  export declare class ConfigFileOption extends Option {
6
6
  constructor(defaultValue?: string);
7
7
  }
8
+ export declare class RootDirOption extends Option {
9
+ constructor();
10
+ }
8
11
  export declare class LogLevelOption extends Option {
9
12
  constructor();
10
13
  }
@@ -4,6 +4,11 @@ import type { NpmOptions, PublishOptions, VersionOptions, VersionType } from "./
4
4
  export declare class Npm extends Shell implements PackageManager {
5
5
  readonly name: "npm";
6
6
  protected program: string;
7
+ /**
8
+ * A folder as npm reads it: a relative `dist/release` looks like the GitHub repository
9
+ * `dist/release` to npm, so it gets a leading `./`.
10
+ */
11
+ private static folderSpec;
7
12
  publish(directory: string, options?: PublishOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
8
13
  /**
9
14
  * @description Runs in the directory of the package