containless 0.1.0
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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +81 -0
- package/dist/config.js.map +1 -0
- package/dist/installer.d.ts +2 -0
- package/dist/installer.d.ts.map +1 -0
- package/dist/installer.js +237 -0
- package/dist/installer.js.map +1 -0
- package/dist/runner.d.ts +11 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +88 -0
- package/dist/runner.js.map +1 -0
- package/dist/runtimes/go.d.ts +8 -0
- package/dist/runtimes/go.d.ts.map +1 -0
- package/dist/runtimes/go.js +44 -0
- package/dist/runtimes/go.js.map +1 -0
- package/dist/runtimes/index.d.ts +11 -0
- package/dist/runtimes/index.d.ts.map +1 -0
- package/dist/runtimes/index.js +55 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/runtimes/java.d.ts +14 -0
- package/dist/runtimes/java.d.ts.map +1 -0
- package/dist/runtimes/java.js +49 -0
- package/dist/runtimes/java.js.map +1 -0
- package/dist/runtimes/node.d.ts +9 -0
- package/dist/runtimes/node.d.ts.map +1 -0
- package/dist/runtimes/node.js +45 -0
- package/dist/runtimes/node.js.map +1 -0
- package/dist/runtimes/python.d.ts +22 -0
- package/dist/runtimes/python.d.ts.map +1 -0
- package/dist/runtimes/python.js +115 -0
- package/dist/runtimes/python.js.map +1 -0
- package/dist/utils.d.ts +29 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +170 -0
- package/dist/utils.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uses python-build-standalone release assets.
|
|
3
|
+
* Example URL pattern:
|
|
4
|
+
* https://github.com/indygreg/python-build-standalone/releases/download/
|
|
5
|
+
* 20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
6
|
+
*
|
|
7
|
+
* Since release tags change, we use the GitHub API to find the latest release
|
|
8
|
+
* that contains the requested Python version. This function returns a
|
|
9
|
+
* *pattern* that the installer will resolve at download time.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPythonDownloadUrl(version: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the actual download URL from GitHub releases.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolvePythonDownloadUrl(version: string): Promise<string>;
|
|
16
|
+
export declare function getPythonArchiveName(version: string): string;
|
|
17
|
+
export declare function getPythonBinaryName(): string;
|
|
18
|
+
/**
|
|
19
|
+
* python-build-standalone tarballs contain a top-level `python/` directory.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PYTHON_STRIP_LEVEL = 1;
|
|
22
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/runtimes/python.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC/E;AAID,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5D;AAID,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PYTHON_STRIP_LEVEL = void 0;
|
|
37
|
+
exports.getPythonDownloadUrl = getPythonDownloadUrl;
|
|
38
|
+
exports.resolvePythonDownloadUrl = resolvePythonDownloadUrl;
|
|
39
|
+
exports.getPythonArchiveName = getPythonArchiveName;
|
|
40
|
+
exports.getPythonBinaryName = getPythonBinaryName;
|
|
41
|
+
const utils_1 = require("../utils");
|
|
42
|
+
// ── Platform/Arch Mapping ───────────────────────────────────────────────────
|
|
43
|
+
function mapPlatformArch(p, a) {
|
|
44
|
+
if (p === 'linux' && a === 'x64')
|
|
45
|
+
return 'x86_64-unknown-linux-gnu';
|
|
46
|
+
if (p === 'linux' && a === 'arm64')
|
|
47
|
+
return 'aarch64-unknown-linux-gnu';
|
|
48
|
+
if (p === 'darwin' && a === 'x64')
|
|
49
|
+
return 'x86_64-apple-darwin';
|
|
50
|
+
if (p === 'darwin' && a === 'arm64')
|
|
51
|
+
return 'aarch64-apple-darwin';
|
|
52
|
+
if (p === 'win32' && a === 'x64')
|
|
53
|
+
return 'x86_64-pc-windows-msvc';
|
|
54
|
+
throw new Error(`Unsupported platform/arch for Python: ${p}/${a}`);
|
|
55
|
+
}
|
|
56
|
+
// ── Download URL ────────────────────────────────────────────────────────────
|
|
57
|
+
/**
|
|
58
|
+
* Uses python-build-standalone release assets.
|
|
59
|
+
* Example URL pattern:
|
|
60
|
+
* https://github.com/indygreg/python-build-standalone/releases/download/
|
|
61
|
+
* 20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
62
|
+
*
|
|
63
|
+
* Since release tags change, we use the GitHub API to find the latest release
|
|
64
|
+
* that contains the requested Python version. This function returns a
|
|
65
|
+
* *pattern* that the installer will resolve at download time.
|
|
66
|
+
*/
|
|
67
|
+
function getPythonDownloadUrl(version) {
|
|
68
|
+
const triple = mapPlatformArch((0, utils_1.getPlatform)(), (0, utils_1.getArch)());
|
|
69
|
+
const ext = (0, utils_1.isWindows)() ? 'tar.gz' : 'tar.gz'; // python-build-standalone also uses tar.gz on Windows
|
|
70
|
+
// We use GitHub releases API to resolve the actual URL at install time.
|
|
71
|
+
// Return a placeholder that the installer knows to resolve via the API.
|
|
72
|
+
return `RESOLVE_PYTHON:${version}:${triple}:${ext}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolve the actual download URL from GitHub releases.
|
|
76
|
+
*/
|
|
77
|
+
async function resolvePythonDownloadUrl(version) {
|
|
78
|
+
const { default: axios } = await Promise.resolve().then(() => __importStar(require('axios')));
|
|
79
|
+
const triple = mapPlatformArch((0, utils_1.getPlatform)(), (0, utils_1.getArch)());
|
|
80
|
+
// The python-build-standalone project publishes releases with assets matching:
|
|
81
|
+
// cpython-{version}+{date}-{triple}-install_only.tar.gz
|
|
82
|
+
const apiUrl = 'https://api.github.com/repos/indygreg/python-build-standalone/releases';
|
|
83
|
+
const { data: releases } = await axios.get(apiUrl, {
|
|
84
|
+
params: { per_page: 30 },
|
|
85
|
+
headers: { Accept: 'application/vnd.github.v3+json' },
|
|
86
|
+
});
|
|
87
|
+
for (const release of releases) {
|
|
88
|
+
for (const asset of release.assets) {
|
|
89
|
+
const name = asset.name;
|
|
90
|
+
// Match pattern: cpython-3.11.0+...-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
91
|
+
if (name.startsWith(`cpython-${version}`) &&
|
|
92
|
+
name.includes(triple) &&
|
|
93
|
+
name.includes('install_only') &&
|
|
94
|
+
name.endsWith('.tar.gz')) {
|
|
95
|
+
return asset.browser_download_url;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
throw new Error(`Could not find python-build-standalone release for Python ${version} on ${triple}. ` +
|
|
100
|
+
`Check available versions at https://github.com/indygreg/python-build-standalone/releases`);
|
|
101
|
+
}
|
|
102
|
+
// ── Archive Name (cache key) ────────────────────────────────────────────────
|
|
103
|
+
function getPythonArchiveName(version) {
|
|
104
|
+
const triple = mapPlatformArch((0, utils_1.getPlatform)(), (0, utils_1.getArch)());
|
|
105
|
+
return `python-${version}-${triple}-install_only.tar.gz`;
|
|
106
|
+
}
|
|
107
|
+
// ── Binary Path ─────────────────────────────────────────────────────────────
|
|
108
|
+
function getPythonBinaryName() {
|
|
109
|
+
return (0, utils_1.isWindows)() ? 'python.exe' : 'python3';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* python-build-standalone tarballs contain a top-level `python/` directory.
|
|
113
|
+
*/
|
|
114
|
+
exports.PYTHON_STRIP_LEVEL = 1;
|
|
115
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/runtimes/python.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,oDAOC;AAKD,4DAgCC;AAID,oDAGC;AAID,kDAEC;AAnFD,oCAAqF;AAErF,+EAA+E;AAE/E,SAAS,eAAe,CAAC,CAAW,EAAE,CAAO;IAC3C,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK;QAAK,OAAO,0BAA0B,CAAC;IACvE,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,OAAO;QAAG,OAAO,2BAA2B,CAAC;IACxE,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,KAAK;QAAI,OAAO,qBAAqB,CAAC;IAClE,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,sBAAsB,CAAC;IACnE,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK;QAAI,OAAO,wBAAwB,CAAC;IAEpE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAA,mBAAW,GAAE,EAAE,IAAA,eAAO,GAAE,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,IAAA,iBAAS,GAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,sDAAsD;IAErG,wEAAwE;IACxE,wEAAwE;IACxE,OAAO,kBAAkB,OAAO,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC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M,sBAAsB,CAAC;AAC3D,CAAC;AAED,+EAA+E;AAE/E,SAAgB,mBAAmB;IACjC,OAAO,IAAA,iBAAS,GAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AAED;;GAEG;AACU,QAAA,kBAAkB,GAAG,CAAC,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type Platform = 'linux' | 'darwin' | 'win32';
|
|
2
|
+
export type Arch = 'x64' | 'arm64';
|
|
3
|
+
export declare function getPlatform(): Platform;
|
|
4
|
+
export declare function getArch(): Arch;
|
|
5
|
+
export declare function isWindows(): boolean;
|
|
6
|
+
export declare function pathSeparator(): string;
|
|
7
|
+
export declare function containlessDir(cwd?: string): string;
|
|
8
|
+
export declare function runtimesDir(cwd?: string): string;
|
|
9
|
+
export declare function cacheDir(cwd?: string): string;
|
|
10
|
+
export declare function runtimeDir(name: string, version: string, cwd?: string): string;
|
|
11
|
+
export declare function runtimeBinDir(name: string, version: string, cwd?: string): string;
|
|
12
|
+
export interface ParsedRuntime {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse a string like "node@18.17.0" into { name: "node", version: "18.17.0" }
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseRuntimeSpec(spec: string): ParsedRuntime;
|
|
20
|
+
export declare function logSuccess(msg: string): void;
|
|
21
|
+
export declare function logInfo(msg: string): void;
|
|
22
|
+
export declare function logWarn(msg: string): void;
|
|
23
|
+
export declare function logError(msg: string): void;
|
|
24
|
+
export declare function checkGitignore(cwd?: string): Promise<void>;
|
|
25
|
+
export declare function formatBytes(bytes: number): string;
|
|
26
|
+
export declare const SUPPORTED_RUNTIMES: readonly ["node", "python", "java", "go"];
|
|
27
|
+
export type RuntimeName = (typeof SUPPORTED_RUNTIMES)[number];
|
|
28
|
+
export declare function isSupportedRuntime(name: string): name is Ru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QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE1C;AAID,wBAAsB,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhE;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD;AAID,eAAO,MAAM,kBAAkB,2CAA4C,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,WAAW,CAEpE"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SUPPORTED_RUNTIMES = void 0;
|
|
40
|
+
exports.getPlatform = getPlatform;
|
|
41
|
+
exports.getArch = getArch;
|
|
42
|
+
exports.isWindows = isWindows;
|
|
43
|
+
exports.pathSeparator = pathSeparator;
|
|
44
|
+
exports.containlessDir = containlessDir;
|
|
45
|
+
exports.runtimesDir = runtimesDir;
|
|
46
|
+
exports.cacheDir = cacheDir;
|
|
47
|
+
exports.runtimeDir = runtimeDir;
|
|
48
|
+
exports.runtimeBinDir = runtimeBinDir;
|
|
49
|
+
exports.parseRuntimeSpec = parseRuntimeSpec;
|
|
50
|
+
exports.logSuccess = logSuccess;
|
|
51
|
+
exports.logInfo = logInfo;
|
|
52
|
+
exports.logWarn = logWarn;
|
|
53
|
+
exports.logError = logError;
|
|
54
|
+
exports.checkGitignore = checkGitignore;
|
|
55
|
+
exports.formatBytes = formatBytes;
|
|
56
|
+
exports.isSupportedRuntime = isSupportedRuntime;
|
|
57
|
+
const path = __importStar(require("path"));
|
|
58
|
+
const fs = __importStar(require("fs-extra"));
|
|
59
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
60
|
+
function getPlatform() {
|
|
61
|
+
const p = process.platform;
|
|
62
|
+
if (p === 'linux' || p === 'darwin' || p === 'win32')
|
|
63
|
+
return p;
|
|
64
|
+
throw new Error(`Unsupported platform: ${p}`);
|
|
65
|
+
}
|
|
66
|
+
function getArch() {
|
|
67
|
+
const a = process.arch;
|
|
68
|
+
if (a === 'x64' || a === 'arm64')
|
|
69
|
+
return a;
|
|
70
|
+
throw new Error(`Unsupported architecture: ${a}`);
|
|
71
|
+
}
|
|
72
|
+
function isWindows() {
|
|
73
|
+
return process.platform === 'win32';
|
|
74
|
+
}
|
|
75
|
+
function pathSeparator() {
|
|
76
|
+
return isWindows() ? ';' : ':';
|
|
77
|
+
}
|
|
78
|
+
// ── Paths ───────────────────────────────────────────────────────────────────
|
|
79
|
+
function containlessDir(cwd) {
|
|
80
|
+
return path.resolve(cwd || process.cwd(), '.containless');
|
|
81
|
+
}
|
|
82
|
+
function runtimesDir(cwd) {
|
|
83
|
+
return path.join(containlessDir(cwd), 'runtimes');
|
|
84
|
+
}
|
|
85
|
+
function cacheDir(cwd) {
|
|
86
|
+
return path.join(containlessDir(cwd), 'cache');
|
|
87
|
+
}
|
|
88
|
+
function runtimeDir(name, version, cwd) {
|
|
89
|
+
return path.join(runtimesDir(cwd), `${name}-${version}`);
|
|
90
|
+
}
|
|
91
|
+
function runtimeBinDir(name, version, cwd) {
|
|
92
|
+
const base = runtimeDir(name, version, cwd);
|
|
93
|
+
const win = isWindows();
|
|
94
|
+
if (name === 'node') {
|
|
95
|
+
// Windows Node.js zip has node.exe at root level (no bin/ subdirectory)
|
|
96
|
+
return win ? base : path.join(base, 'bin');
|
|
97
|
+
}
|
|
98
|
+
if (name === 'python') {
|
|
99
|
+
// Windows python-build-standalone puts python.exe at root or in python/ dir
|
|
100
|
+
return win ? base : path.join(base, 'bin');
|
|
101
|
+
}
|
|
102
|
+
if (name === 'java') {
|
|
103
|
+
// Adoptium JDK layout varies by platform
|
|
104
|
+
if (getPlatform() === 'darwin') {
|
|
105
|
+
return path.join(base, 'Contents', 'Home', 'bin');
|
|
106
|
+
}
|
|
107
|
+
return path.join(base, 'bin');
|
|
108
|
+
}
|
|
109
|
+
if (name === 'go') {
|
|
110
|
+
// Go on Windows still uses bin/ subdirectory
|
|
111
|
+
return path.join(base, 'bin');
|
|
112
|
+
}
|
|
113
|
+
return path.join(base, 'bin');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Parse a string like "node@18.17.0" into { name: "node", version: "18.17.0" }
|
|
117
|
+
*/
|
|
118
|
+
function parseRuntimeSpec(spec) {
|
|
119
|
+
const parts = spec.split('@');
|
|
120
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
121
|
+
throw new Error(`Invalid runtime spec: "${spec}". Expected format: name@version (e.g. node@18.17.0)`);
|
|
122
|
+
}
|
|
123
|
+
return { name: parts[0].toLowerCase(), version: parts[1] };
|
|
124
|
+
}
|
|
125
|
+
// ── Logging Helpers ─────────────────────────────────────────────────────────
|
|
126
|
+
function logSuccess(msg) {
|
|
127
|
+
console.log(chalk_1.default.green('✔') + ' ' + msg);
|
|
128
|
+
}
|
|
129
|
+
function logInfo(msg) {
|
|
130
|
+
console.log(chalk_1.default.blue('ℹ') + ' ' + msg);
|
|
131
|
+
}
|
|
132
|
+
function logWarn(msg) {
|
|
133
|
+
console.log(chalk_1.default.yellow('⚠') + ' ' + chalk_1.default.yellow(msg));
|
|
134
|
+
}
|
|
135
|
+
function logError(msg) {
|
|
136
|
+
console.error(chalk_1.default.red('✖') + ' ' + chalk_1.default.red(msg));
|
|
137
|
+
}
|
|
138
|
+
// ── Gitignore Check ─────────────────────────────────────────────────────────
|
|
139
|
+
async function checkGitignore(cwd) {
|
|
140
|
+
const gitignorePath = path.resolve(cwd || process.cwd(), '.gitignore');
|
|
141
|
+
try {
|
|
142
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
143
|
+
const content = await fs.readFile(gitignorePath, 'utf-8');
|
|
144
|
+
if (!content.includes('.containless')) {
|
|
145
|
+
logWarn('The .containless/ directory is not in your .gitignore. ' +
|
|
146
|
+
'Consider adding ".containless/" to avoid committing runtimes.');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
logWarn('No .gitignore found. Consider creating one and adding ".containless/" to it.');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Non-critical — silently skip
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ── File Size Formatting ────────────────────────────────────────────────────
|
|
158
|
+
function formatBytes(bytes) {
|
|
159
|
+
if (bytes === 0)
|
|
160
|
+
return '0 B';
|
|
161
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
162
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
163
|
+
return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i]}`;
|
|
164
|
+
}
|
|
165
|
+
// ── Supported Runtimes ──────────────────────────────────────────────────────
|
|
166
|
+
exports.SUPPORTED_RUNTIMES = ['node', 'python', 'java', 'go'];
|
|
167
|
+
function isSupportedRuntime(name) {
|
|
168
|
+
return exports.SUPPORTED_RUNTIMES.includes(name);
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,kCAIC;AAED,0BAIC;AAED,8BAEC;AAED,sCAEC;AAID,wCAEC;AAED,kCAEC;AAED,4BAEC;AAED,gCAEC;AAED,sCA4BC;AAYD,4CAQC;AAID,gCAEC;AAED,0BAEC;AAED,0BAEC;AAED,4BAEC;AAID,wCAmBC;AAID,kCAKC;AAOD,gDAEC;AA1JD,2CAA6B;AAC7B,6CAA+B;AAC/B,kDAA0B;AAO1B,SAAgB,WAAW;IACzB,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC3B,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,QAAQ,IAAI,C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AA+D,CAChE,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CACL,8EAA8E,CAC/E,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;AACH,CAAC;AAED,+EAA+E;AAE/E,SAAgB,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9B,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACjE,CAAC;AAED,+EAA+E;AAElE,QAAA,kBAAkB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAU,CAAC;AAG5E,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAQ,0BAAwC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "containless",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Docker-like CLI for runtime environments — install and run Node.js, Python, Java, and Go locally inside your project folder, completely isolated from global installs.",
|
|
5
|
+
"main": "./dist/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"containless": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "ts-node src/cli.ts",
|
|
12
|
+
"clean": "rimraf dist",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"lint": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"cli",
|
|
23
|
+
"runtime",
|
|
24
|
+
"docker",
|
|
25
|
+
"container",
|
|
26
|
+
"node",
|
|
27
|
+
"python",
|
|
28
|
+
"java",
|
|
29
|
+
"go",
|
|
30
|
+
"environment",
|
|
31
|
+
"isolated",
|
|
32
|
+
"local",
|
|
33
|
+
"version-manager"
|
|
34
|
+
],
|
|
35
|
+
"author": "",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/AngheloDeArroz/Containless.git"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/AngheloDeArroz/Containless#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/AngheloDeArroz/Containless/issues"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"axios": "^1.7.0",
|
|
50
|
+
"chalk": "^4.1.2",
|
|
51
|
+
"cli-progress": "^3.12.0",
|
|
52
|
+
"cli-table3": "^0.6.5",
|
|
53
|
+
"commander": "^12.1.0",
|
|
54
|
+
"fs-extra": "^11.2.0",
|
|
55
|
+
"tar": "^7.4.0",
|
|
56
|
+
"unzipper": "^0.12.3"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/cli-progress": "^3.11.6",
|
|
60
|
+
"@types/fs-extra": "^11.0.4",
|
|
61
|
+
"@types/node": "^20.14.0",
|
|
62
|
+
"@types/unzipper": "^0.10.10",
|
|
63
|
+
"rimraf": "^5.0.7",
|
|
64
|
+
"ts-node": "^10.9.2",
|
|
65
|
+
"typescript": "^5.5.0"
|
|
66
|
+
}
|
|
67
|
+
}
|