@decohere/core 0.0.1-dev.118 → 0.0.1-dev.120
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.
- package/commonjs/src/caching/cache-manager.js +3 -3
- package/commonjs/src/caching/index.js +1 -1
- package/commonjs/src/caching/map-cache.js +39 -0
- package/commonjs/src/io/io.js +0 -3
- package/es6/src/caching/cache-manager.js +3 -3
- package/es6/src/caching/index.js +1 -1
- package/es6/src/caching/map-cache.js +35 -0
- package/es6/src/caching/memoize.decorator.js +1 -1
- package/es6/src/io/io.js +0 -3
- package/package.json +6 -40
- package/types/src/caching/index.d.ts +1 -1
- package/types/src/caching/map-cache.d.ts +23 -0
- package/types/src/caching/memoize.decorator.d.ts +1 -1
- package/types/src/io/io.d.ts +0 -3
- package/commonjs/src/caching/node-cache-memoize.adapter.js +0 -49
- package/commonjs/src/cli/action.js +0 -65
- package/commonjs/src/cli/command.js +0 -127
- package/commonjs/src/cli/index.js +0 -61
- package/commonjs/src/cli/module.type.js +0 -18
- package/commonjs/src/cli/options.js +0 -115
- package/commonjs/src/diagnostics/index.js +0 -22
- package/commonjs/src/diagnostics/trace.js +0 -86
- package/commonjs/src/interop/docker/docker.js +0 -54
- package/commonjs/src/interop/errors/interop.error.js +0 -12
- package/commonjs/src/interop/git/git.js +0 -134
- package/commonjs/src/interop/git/git.types.js +0 -4
- package/commonjs/src/interop/index.js +0 -97
- package/commonjs/src/interop/node/index.js +0 -18
- package/commonjs/src/interop/node/node.js +0 -45
- package/commonjs/src/interop/npm/npm.js +0 -231
- package/commonjs/src/interop/npm/npm.types.js +0 -16
- package/commonjs/src/interop/pnpm/pnpm.js +0 -34
- package/commonjs/src/interop/pnpm/pnpm.types.js +0 -4
- package/commonjs/src/interop/shell/shell.argv.js +0 -45
- package/commonjs/src/interop/shell/shell.js +0 -105
- package/commonjs/src/interop/shell/shell.types.js +0 -4
- package/commonjs/src/interop/types/detect-package-manager.js +0 -71
- package/commonjs/src/interop/types/package-manager.js +0 -4
- package/commonjs/src/interop/yarn/yarn.js +0 -34
- package/commonjs/src/interop/yarn/yarn.types.js +0 -4
- package/commonjs/src/io/find-directories.js +0 -21
- package/commonjs/src/io/find-file.js +0 -45
- package/commonjs/src/io/watch.js +0 -261
- package/commonjs/src/semver/index.js +0 -18
- package/commonjs/src/semver/semver.js +0 -92
- package/commonjs/src/testing/flush-promises.js +0 -16
- package/commonjs/src/testing/glob-with-memfs.js +0 -22
- package/commonjs/src/testing/index.js +0 -22
- package/commonjs/src/testing/memfs.js +0 -52
- package/commonjs/src/testing/mock-logger.js +0 -36
- package/commonjs/src/testing/spy-on-constructor.js +0 -27
- package/es6/src/caching/node-cache-memoize.adapter.js +0 -37
- package/es6/src/cli/action.js +0 -47
- package/es6/src/cli/command.js +0 -106
- package/es6/src/cli/index.js +0 -4
- package/es6/src/cli/module.type.js +0 -11
- package/es6/src/cli/options.js +0 -76
- package/es6/src/diagnostics/index.js +0 -1
- package/es6/src/diagnostics/trace.js +0 -68
- package/es6/src/interop/docker/docker.js +0 -44
- package/es6/src/interop/errors/interop.error.js +0 -2
- package/es6/src/interop/git/git.js +0 -124
- package/es6/src/interop/git/git.types.js +0 -1
- package/es6/src/interop/index.js +0 -21
- package/es6/src/interop/node/index.js +0 -1
- package/es6/src/interop/node/node.js +0 -35
- package/es6/src/interop/npm/npm.js +0 -180
- package/es6/src/interop/npm/npm.types.js +0 -6
- package/es6/src/interop/pnpm/pnpm.js +0 -24
- package/es6/src/interop/pnpm/pnpm.types.js +0 -1
- package/es6/src/interop/shell/shell.argv.js +0 -35
- package/es6/src/interop/shell/shell.js +0 -95
- package/es6/src/interop/shell/shell.types.js +0 -1
- package/es6/src/interop/types/detect-package-manager.js +0 -50
- package/es6/src/interop/types/package-manager.js +0 -1
- package/es6/src/interop/yarn/yarn.js +0 -24
- package/es6/src/interop/yarn/yarn.types.js +0 -1
- package/es6/src/io/find-directories.js +0 -11
- package/es6/src/io/find-file.js +0 -27
- package/es6/src/io/watch.js +0 -238
- package/es6/src/semver/index.js +0 -1
- package/es6/src/semver/semver.js +0 -71
- package/es6/src/testing/flush-promises.js +0 -6
- package/es6/src/testing/glob-with-memfs.js +0 -20
- package/es6/src/testing/index.js +0 -5
- package/es6/src/testing/memfs.js +0 -25
- package/es6/src/testing/mock-logger.js +0 -26
- package/es6/src/testing/spy-on-constructor.js +0 -31
- package/types/src/caching/node-cache-memoize.adapter.d.ts +0 -22
- package/types/src/cli/action.d.ts +0 -36
- package/types/src/cli/command.d.ts +0 -34
- package/types/src/cli/index.d.ts +0 -7
- package/types/src/cli/module.type.d.ts +0 -36
- package/types/src/cli/options.d.ts +0 -28
- package/types/src/diagnostics/index.d.ts +0 -1
- package/types/src/diagnostics/trace.d.ts +0 -10
- package/types/src/interop/docker/docker.d.ts +0 -19
- package/types/src/interop/errors/interop.error.d.ts +0 -2
- package/types/src/interop/git/git.d.ts +0 -16
- package/types/src/interop/git/git.types.d.ts +0 -14
- package/types/src/interop/index.d.ts +0 -14
- package/types/src/interop/node/index.d.ts +0 -1
- package/types/src/interop/node/node.d.ts +0 -5
- package/types/src/interop/npm/npm.d.ts +0 -29
- package/types/src/interop/npm/npm.types.d.ts +0 -24
- package/types/src/interop/pnpm/pnpm.d.ts +0 -9
- package/types/src/interop/pnpm/pnpm.types.d.ts +0 -3
- package/types/src/interop/shell/shell.argv.d.ts +0 -5
- package/types/src/interop/shell/shell.d.ts +0 -6
- package/types/src/interop/shell/shell.types.d.ts +0 -9
- package/types/src/interop/types/detect-package-manager.d.ts +0 -4
- package/types/src/interop/types/package-manager.d.ts +0 -10
- package/types/src/interop/yarn/yarn.d.ts +0 -9
- package/types/src/interop/yarn/yarn.types.d.ts +0 -3
- package/types/src/io/find-directories.d.ts +0 -2
- package/types/src/io/find-file.d.ts +0 -9
- package/types/src/io/watch.d.ts +0 -16
- package/types/src/semver/index.d.ts +0 -1
- package/types/src/semver/semver.d.ts +0 -18
- package/types/src/testing/flush-promises.d.ts +0 -1
- package/types/src/testing/glob-with-memfs.d.ts +0 -3
- package/types/src/testing/index.d.ts +0 -5
- package/types/src/testing/memfs.d.ts +0 -5
- package/types/src/testing/mock-logger.d.ts +0 -13
- package/types/src/testing/spy-on-constructor.d.ts +0 -21
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get ConfigFileOption () {
|
|
13
|
-
return ConfigFileOption;
|
|
14
|
-
},
|
|
15
|
-
get ConfigurationOption () {
|
|
16
|
-
return ConfigurationOption;
|
|
17
|
-
},
|
|
18
|
-
get DryRunOption () {
|
|
19
|
-
return DryRunOption;
|
|
20
|
-
},
|
|
21
|
-
get EnvFileIfExistsOption () {
|
|
22
|
-
return EnvFileIfExistsOption;
|
|
23
|
-
},
|
|
24
|
-
get EnvFileOption () {
|
|
25
|
-
return EnvFileOption;
|
|
26
|
-
},
|
|
27
|
-
get LogLevelOption () {
|
|
28
|
-
return LogLevelOption;
|
|
29
|
-
},
|
|
30
|
-
get NoBuildOptions () {
|
|
31
|
-
return NoBuildOptions;
|
|
32
|
-
},
|
|
33
|
-
get NoCleanOptions () {
|
|
34
|
-
return NoCleanOptions;
|
|
35
|
-
},
|
|
36
|
-
get ProjectOption () {
|
|
37
|
-
return ProjectOption;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const _commander = require("commander");
|
|
41
|
-
function parseOptionalBoolean(input) {
|
|
42
|
-
if (typeof input === "boolean") {
|
|
43
|
-
return input;
|
|
44
|
-
}
|
|
45
|
-
const value = input.trim().toLowerCase();
|
|
46
|
-
if ([
|
|
47
|
-
"true",
|
|
48
|
-
"1",
|
|
49
|
-
"yes",
|
|
50
|
-
"on"
|
|
51
|
-
].includes(value)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
if ([
|
|
55
|
-
"false",
|
|
56
|
-
"0",
|
|
57
|
-
"no",
|
|
58
|
-
"off"
|
|
59
|
-
].includes(value)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
throw new Error(`Invalid boolean value: "${input}". Use true/false.`);
|
|
63
|
-
}
|
|
64
|
-
class ConfigurationOption extends _commander.Option {
|
|
65
|
-
constructor(defaultValue){
|
|
66
|
-
super("--configuration <configuration>", "Configuration name");
|
|
67
|
-
this.default(defaultValue);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
class ConfigFileOption extends _commander.Option {
|
|
71
|
-
constructor(defaultValue = ".decohere.js"){
|
|
72
|
-
super("--config-file <file>", "Path to Decohere config file");
|
|
73
|
-
this.default(defaultValue);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class LogLevelOption extends _commander.Option {
|
|
77
|
-
constructor(){
|
|
78
|
-
super("--log-level <level>", "Log level (trace, debug, info, warn, error)");
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
class EnvFileOption extends _commander.Option {
|
|
82
|
-
constructor(){
|
|
83
|
-
super("--env-file <file>", "Load environment variables from this file before running");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
class EnvFileIfExistsOption extends _commander.Option {
|
|
87
|
-
constructor(){
|
|
88
|
-
super("--env-file-if-exists <file>", "Like --env-file, but skip it when the file is missing");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
class NoCleanOptions extends _commander.Option {
|
|
92
|
-
constructor(defaultValue){
|
|
93
|
-
super("--no-clean", "Will not clean the project directories");
|
|
94
|
-
this.default(defaultValue);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
class NoBuildOptions extends _commander.Option {
|
|
98
|
-
constructor(defaultValue){
|
|
99
|
-
super("--no-build", "Will not run the build step");
|
|
100
|
-
this.default(defaultValue);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
class DryRunOption extends _commander.Option {
|
|
104
|
-
constructor(description, defaultValue = false){
|
|
105
|
-
super("--dry-run [dryRun]", description);
|
|
106
|
-
this.default(defaultValue);
|
|
107
|
-
this.preset(true);
|
|
108
|
-
this.argParser(parseOptionalBoolean);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
class ProjectOption extends _commander.Option {
|
|
112
|
-
constructor(){
|
|
113
|
-
super("--project <project>", "Project name to target");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get Trace () {
|
|
13
|
-
return _trace.Trace;
|
|
14
|
-
},
|
|
15
|
-
get timed () {
|
|
16
|
-
return _trace.timed;
|
|
17
|
-
},
|
|
18
|
-
get trace () {
|
|
19
|
-
return _trace.trace;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _trace = require("./trace.js");
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get Trace () {
|
|
13
|
-
return Trace;
|
|
14
|
-
},
|
|
15
|
-
get timed () {
|
|
16
|
-
return timed;
|
|
17
|
-
},
|
|
18
|
-
get trace () {
|
|
19
|
-
return trace;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _types = require("node:util/types");
|
|
23
|
-
const _scribe = require("@decohere/scribe");
|
|
24
|
-
// Keep existing behavior for now: trace mode is toggled via FORGE_TRACE.
|
|
25
|
-
const isTraceEnabled = process.env.FORGE_TRACE != null;
|
|
26
|
-
if (isTraceEnabled) {
|
|
27
|
-
const hasExplicitLevel = process.env.LOG_LEVEL != null || process.env.SCRIBE_LOG_LEVEL != null || process.env.LOGGING_LEVEL != null;
|
|
28
|
-
if (!hasExplicitLevel) {
|
|
29
|
-
_scribe.scribe.configure({
|
|
30
|
-
adapter: new _scribe.ConsoleAdapter(),
|
|
31
|
-
options: {
|
|
32
|
-
logLevel: "trace"
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function serializeArgs(args) {
|
|
38
|
-
if (args.length === 0) return "";
|
|
39
|
-
return args.map((arg)=>{
|
|
40
|
-
if (Array.isArray(arg)) return `[${arg.map(String).join(", ")}]`;
|
|
41
|
-
const s = String(arg);
|
|
42
|
-
return s.length > 60 ? `${s.slice(0, 57)}...` : s;
|
|
43
|
-
}).join(", ");
|
|
44
|
-
}
|
|
45
|
-
function wrapWithTiming(fn, className, methodName, logLevel) {
|
|
46
|
-
let logger;
|
|
47
|
-
return function(...args) {
|
|
48
|
-
if (logger == null) {
|
|
49
|
-
logger = _scribe.scribe.logger(className);
|
|
50
|
-
}
|
|
51
|
-
const log = logger;
|
|
52
|
-
const label = `${methodName}(${serializeArgs(args)})`;
|
|
53
|
-
const start = performance.now();
|
|
54
|
-
const logDuration = ()=>{
|
|
55
|
-
log[logLevel](`${label}: ${(performance.now() - start).toFixed(2)}ms`);
|
|
56
|
-
};
|
|
57
|
-
const result = fn.apply(this, args);
|
|
58
|
-
if ((0, _types.isPromise)(result)) {
|
|
59
|
-
return result.finally(logDuration);
|
|
60
|
-
}
|
|
61
|
-
logDuration();
|
|
62
|
-
return result;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function trace(target, propertyKey, descriptor) {
|
|
66
|
-
if (!isTraceEnabled) return descriptor;
|
|
67
|
-
const className = target.constructor.name;
|
|
68
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "trace");
|
|
69
|
-
return descriptor;
|
|
70
|
-
}
|
|
71
|
-
function timed(target, propertyKey, descriptor) {
|
|
72
|
-
const className = target.constructor.name;
|
|
73
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "info");
|
|
74
|
-
return descriptor;
|
|
75
|
-
}
|
|
76
|
-
function Trace(constructor) {
|
|
77
|
-
if (!isTraceEnabled) return;
|
|
78
|
-
const className = constructor.name;
|
|
79
|
-
for (const key of Object.getOwnPropertyNames(constructor.prototype)){
|
|
80
|
-
if (key === "constructor") continue;
|
|
81
|
-
const descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, key);
|
|
82
|
-
if (descriptor == null || typeof descriptor.value !== "function") continue;
|
|
83
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, key, "trace");
|
|
84
|
-
Object.defineProperty(constructor.prototype, key, descriptor);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Docker", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Docker;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interoperror = require("../errors/interop.error.js");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
class Docker extends _shell.Shell {
|
|
14
|
-
name = "docker";
|
|
15
|
-
program = "docker";
|
|
16
|
-
async build(contextDir, options = {}) {
|
|
17
|
-
if (contextDir == null || contextDir.trim() === "") {
|
|
18
|
-
throw new _interoperror.InteropError("Docker build context is required");
|
|
19
|
-
}
|
|
20
|
-
const args = [
|
|
21
|
-
"build"
|
|
22
|
-
];
|
|
23
|
-
if (options.dockerfile) {
|
|
24
|
-
args.push("-f", options.dockerfile);
|
|
25
|
-
}
|
|
26
|
-
for (const tag of options.tags ?? []){
|
|
27
|
-
args.push("-t", tag);
|
|
28
|
-
}
|
|
29
|
-
for (const [key, value] of Object.entries(options.buildArgs ?? {})){
|
|
30
|
-
args.push("--build-arg", `${key}=${value}`);
|
|
31
|
-
}
|
|
32
|
-
for (const [id, env] of Object.entries(options.secrets ?? {})){
|
|
33
|
-
args.push("--secret", `id=${id},env=${env}`);
|
|
34
|
-
}
|
|
35
|
-
if (options.noCache) {
|
|
36
|
-
args.push("--no-cache");
|
|
37
|
-
}
|
|
38
|
-
if (options.pull) {
|
|
39
|
-
args.push("--pull");
|
|
40
|
-
}
|
|
41
|
-
args.push(contextDir);
|
|
42
|
-
return await this.run({
|
|
43
|
-
cwd: options.cwd
|
|
44
|
-
}, ...args);
|
|
45
|
-
}
|
|
46
|
-
async push(tag, options = {}) {
|
|
47
|
-
if (tag == null || tag.trim() === "") {
|
|
48
|
-
throw new _interoperror.InteropError("Docker tag is required");
|
|
49
|
-
}
|
|
50
|
-
return await this.run({
|
|
51
|
-
cwd: options.cwd
|
|
52
|
-
}, "push", tag);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Git", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Git;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interoperror = require("../errors/interop.error.js");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
const Commands = {
|
|
14
|
-
stage: "stage",
|
|
15
|
-
tag: "tag",
|
|
16
|
-
add: "add",
|
|
17
|
-
commit: "commit",
|
|
18
|
-
push: "push",
|
|
19
|
-
listFiles: "ls-files"
|
|
20
|
-
};
|
|
21
|
-
const defaultOptions = {
|
|
22
|
-
cwd: "./"
|
|
23
|
-
};
|
|
24
|
-
class Git extends _shell.Shell {
|
|
25
|
-
program = "git";
|
|
26
|
-
async getModifiedFiles(options = defaultOptions) {
|
|
27
|
-
const args = [
|
|
28
|
-
Commands.listFiles,
|
|
29
|
-
"--modified"
|
|
30
|
-
];
|
|
31
|
-
const { cwd } = options;
|
|
32
|
-
const result = await this.run({
|
|
33
|
-
cwd
|
|
34
|
-
}, ...args);
|
|
35
|
-
return result.data;
|
|
36
|
-
}
|
|
37
|
-
async getBranchName(options = defaultOptions) {
|
|
38
|
-
const { cwd } = options;
|
|
39
|
-
const args = [
|
|
40
|
-
"rev-parse",
|
|
41
|
-
"--symbolic-full-name",
|
|
42
|
-
"--abbrev-ref",
|
|
43
|
-
"HEAD"
|
|
44
|
-
];
|
|
45
|
-
const result = await this.run({
|
|
46
|
-
cwd
|
|
47
|
-
}, ...args);
|
|
48
|
-
return result.data[0];
|
|
49
|
-
}
|
|
50
|
-
async tag(tag, options = defaultOptions) {
|
|
51
|
-
const args = [
|
|
52
|
-
Commands.tag,
|
|
53
|
-
tag
|
|
54
|
-
];
|
|
55
|
-
const { cwd } = options;
|
|
56
|
-
const result = await this.run({
|
|
57
|
-
cwd
|
|
58
|
-
}, ...args);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
async pushTag(tag, options = defaultOptions) {
|
|
62
|
-
const { cwd, remote = "origin" } = options;
|
|
63
|
-
const result = await this.run({
|
|
64
|
-
cwd
|
|
65
|
-
}, Commands.push, remote, tag);
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
async commit(message, options) {
|
|
69
|
-
const optionsAndDefaults = {
|
|
70
|
-
...defaultOptions,
|
|
71
|
-
...options
|
|
72
|
-
};
|
|
73
|
-
const { cwd, files = [], all } = optionsAndDefaults;
|
|
74
|
-
const args = [
|
|
75
|
-
Commands.commit
|
|
76
|
-
];
|
|
77
|
-
if (files.length > 0 && all) {
|
|
78
|
-
throw new _interoperror.InteropError("Cannot commit all and files at the same time");
|
|
79
|
-
}
|
|
80
|
-
if (files.length > 0) {
|
|
81
|
-
await this.stage({
|
|
82
|
-
files
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (options.all) {
|
|
86
|
-
args.push("-a");
|
|
87
|
-
}
|
|
88
|
-
args.push("-m", message);
|
|
89
|
-
const result = await this.run({
|
|
90
|
-
cwd
|
|
91
|
-
}, ...args);
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
async push(branch, options) {
|
|
95
|
-
const optionsAndDefaults = {
|
|
96
|
-
...defaultOptions,
|
|
97
|
-
...options
|
|
98
|
-
};
|
|
99
|
-
const { cwd, setUpstream } = optionsAndDefaults;
|
|
100
|
-
const args = [
|
|
101
|
-
Commands.push
|
|
102
|
-
];
|
|
103
|
-
args.push("--set-upstream", setUpstream ?? "origin");
|
|
104
|
-
args.push(branch);
|
|
105
|
-
const result = await this.run({
|
|
106
|
-
cwd
|
|
107
|
-
}, ...args);
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
async pull(branch, options = defaultOptions) {
|
|
111
|
-
const { cwd } = options;
|
|
112
|
-
return this.run({
|
|
113
|
-
cwd
|
|
114
|
-
}, "pull", "--rebase", "origin", branch);
|
|
115
|
-
}
|
|
116
|
-
async stage(options) {
|
|
117
|
-
const optionsAndDefaults = {
|
|
118
|
-
...defaultOptions,
|
|
119
|
-
...options
|
|
120
|
-
};
|
|
121
|
-
const { cwd, files = [], all } = optionsAndDefaults;
|
|
122
|
-
if (all) {
|
|
123
|
-
await this.run({
|
|
124
|
-
cwd
|
|
125
|
-
}, Commands.stage, "-a");
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
for (const file of files){
|
|
129
|
-
await this.run({
|
|
130
|
-
cwd
|
|
131
|
-
}, Commands.stage, file);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// << Git >>
|
|
2
|
-
// << Docker >>
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
function _export(target, all) {
|
|
8
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
_export(exports, {
|
|
14
|
-
get git () {
|
|
15
|
-
return _gittypes;
|
|
16
|
-
},
|
|
17
|
-
get npm () {
|
|
18
|
-
return _npmtypes;
|
|
19
|
-
},
|
|
20
|
-
get pnpm () {
|
|
21
|
-
return _pnpmtypes;
|
|
22
|
-
},
|
|
23
|
-
get shell () {
|
|
24
|
-
return _shelltypes;
|
|
25
|
-
},
|
|
26
|
-
get yarn () {
|
|
27
|
-
return _yarntypes;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
_export_star(require("./docker/docker.js"), exports);
|
|
31
|
-
_export_star(require("./git/git.js"), exports);
|
|
32
|
-
const _gittypes = /*#__PURE__*/ _interop_require_wildcard(require("./git/git.types.js"));
|
|
33
|
-
_export_star(require("./node/node.js"), exports);
|
|
34
|
-
_export_star(require("./npm/npm.js"), exports);
|
|
35
|
-
const _npmtypes = /*#__PURE__*/ _interop_require_wildcard(require("./npm/npm.types.js"));
|
|
36
|
-
_export_star(require("./pnpm/pnpm.js"), exports);
|
|
37
|
-
const _pnpmtypes = /*#__PURE__*/ _interop_require_wildcard(require("./pnpm/pnpm.types.js"));
|
|
38
|
-
_export_star(require("./shell/shell.js"), exports);
|
|
39
|
-
const _shelltypes = /*#__PURE__*/ _interop_require_wildcard(require("./shell/shell.types.js"));
|
|
40
|
-
_export_star(require("./types/detect-package-manager.js"), exports);
|
|
41
|
-
_export_star(require("./types/package-manager.js"), exports);
|
|
42
|
-
_export_star(require("./yarn/yarn.js"), exports);
|
|
43
|
-
const _yarntypes = /*#__PURE__*/ _interop_require_wildcard(require("./yarn/yarn.types.js"));
|
|
44
|
-
function _export_star(from, to) {
|
|
45
|
-
Object.keys(from).forEach(function(k) {
|
|
46
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
47
|
-
Object.defineProperty(to, k, {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function() {
|
|
50
|
-
return from[k];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return from;
|
|
56
|
-
}
|
|
57
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
58
|
-
if (typeof WeakMap !== "function") return null;
|
|
59
|
-
var cacheBabelInterop = new WeakMap();
|
|
60
|
-
var cacheNodeInterop = new WeakMap();
|
|
61
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
62
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
63
|
-
})(nodeInterop);
|
|
64
|
-
}
|
|
65
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
66
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
67
|
-
return obj;
|
|
68
|
-
}
|
|
69
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
70
|
-
return {
|
|
71
|
-
default: obj
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
75
|
-
if (cache && cache.has(obj)) {
|
|
76
|
-
return cache.get(obj);
|
|
77
|
-
}
|
|
78
|
-
var newObj = {
|
|
79
|
-
__proto__: null
|
|
80
|
-
};
|
|
81
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
82
|
-
for(var key in obj){
|
|
83
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
84
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
85
|
-
if (desc && (desc.get || desc.set)) {
|
|
86
|
-
Object.defineProperty(newObj, key, desc);
|
|
87
|
-
} else {
|
|
88
|
-
newObj[key] = obj[key];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
newObj.default = obj;
|
|
93
|
-
if (cache) {
|
|
94
|
-
cache.set(obj, newObj);
|
|
95
|
-
}
|
|
96
|
-
return newObj;
|
|
97
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./node.js"), exports);
|
|
6
|
-
function _export_star(from, to) {
|
|
7
|
-
Object.keys(from).forEach(function(k) {
|
|
8
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
-
Object.defineProperty(to, k, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function() {
|
|
12
|
-
return from[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return from;
|
|
18
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Node", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Node;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _nodechild_process = require("node:child_process");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
class Node extends _shell.Shell {
|
|
14
|
-
program = "node";
|
|
15
|
-
async runScript(script, ...args) {
|
|
16
|
-
const spawnOpt = {
|
|
17
|
-
cwd: ".",
|
|
18
|
-
stdio: "inherit",
|
|
19
|
-
env: {
|
|
20
|
-
...process.env
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return new Promise((resolve, reject)=>{
|
|
24
|
-
const proc = (0, _nodechild_process.spawn)("node", [
|
|
25
|
-
script,
|
|
26
|
-
...args
|
|
27
|
-
], spawnOpt);
|
|
28
|
-
proc.on("exit", (code)=>{
|
|
29
|
-
if (code !== 0) {
|
|
30
|
-
reject();
|
|
31
|
-
}
|
|
32
|
-
resolve(null);
|
|
33
|
-
});
|
|
34
|
-
proc.on("close", (code)=>{
|
|
35
|
-
resolve(null);
|
|
36
|
-
if (code === 0) {
|
|
37
|
-
resolve({
|
|
38
|
-
message: `${script} completed`
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
reject(`Running '${script}' failed with code ${code}`);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|