create-devc
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -16,2 +16,4 @@ "use strict"; | ||
exports.code = void 0; | ||
const process_1 = __importDefault(require("process")); | ||
const chalk_1 = __importDefault(require("chalk")); | ||
const debug_1 = __importDefault(require("debug")); | ||
@@ -28,3 +30,9 @@ const container_js_1 = require("../container.js"); | ||
} | ||
yield (0, container_js_1.openCodeWithDevContainer)((_a = options.path) !== null && _a !== void 0 ? _a : '.', options.insiders); | ||
try { | ||
yield (0, container_js_1.openCodeWithDevContainer)((_a = options.path) !== null && _a !== void 0 ? _a : '.', options.insiders); | ||
} | ||
catch (error) { | ||
process_1.default.exitCode = -1; | ||
console.error(chalk_1.default.red(`Error: ${error.message}`)); | ||
} | ||
}); | ||
@@ -31,0 +39,0 @@ } |
@@ -17,2 +17,3 @@ "use strict"; | ||
const process_1 = __importDefault(require("process")); | ||
const chalk_1 = __importDefault(require("chalk")); | ||
const debug_1 = __importDefault(require("debug")); | ||
@@ -25,3 +26,9 @@ const docker_js_1 = require("../docker.js"); | ||
debug('Options: %o', options); | ||
yield (0, docker_js_1.runInDevContainer)(process_1.default.cwd(), options.exec); | ||
try { | ||
yield (0, docker_js_1.runInDevContainer)(process_1.default.cwd(), options.exec); | ||
} | ||
catch (error) { | ||
process_1.default.exitCode = -1; | ||
console.error(chalk_1.default.red(`Error: ${error.message}`)); | ||
} | ||
}); | ||
@@ -28,0 +35,0 @@ } |
@@ -22,2 +22,3 @@ "use strict"; | ||
const util_js_1 = require("./util.js"); | ||
const wsl_js_1 = require("./wsl.js"); | ||
const debug = (0, debug_1.default)('container'); | ||
@@ -44,3 +45,7 @@ const devcontainerTemplate = path_1.default.join(__dirname, '../template/.devcontainer'); | ||
if (!(yield (0, util_js_1.supportsBinary)(codeBin))) { | ||
throw new Error(`${codeBin} is not installed.\nIn VS Code, run the command "Shell Command: Install 'code' command in PATH."`); | ||
let message = `${codeBin} is not installed.\n`; | ||
message += (0, wsl_js_1.isWsl)() | ||
? 'Run the command "code" in a terminal to install it first.' | ||
: `In VS Code, run the command "Shell Command: Install 'code' command in PATH".`; | ||
throw new Error(message); | ||
} | ||
@@ -63,4 +68,4 @@ const workspace = yield getDevContainerWorkspace(projectPath); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// TODO: check projectPath compatibility with WSL | ||
try { | ||
projectPath = yield (0, wsl_js_1.convertToWslPathIfNeeded)(projectPath); | ||
const devContainerPath = yield getDevContainerRootFolder(projectPath); | ||
@@ -113,4 +118,5 @@ if (!devContainerPath) { | ||
const absolutePath = path_1.default.resolve(projectPath); | ||
debug('Project path: %s', absolutePath); | ||
return `${remoteUri}${toHex(absolutePath)}${workspace}`; | ||
const launchPath = yield (0, wsl_js_1.convertToWindowsPathIfNeeded)(absolutePath); | ||
debug('Project path: %s', launchPath); | ||
return `${remoteUri}${toHex(launchPath)}${workspace}`; | ||
}); | ||
@@ -117,0 +123,0 @@ } |
@@ -19,2 +19,3 @@ "use strict"; | ||
const util_js_1 = require("./util.js"); | ||
const wsl_js_1 = require("./wsl.js"); | ||
const debug = (0, debug_1.default)('docker'); | ||
@@ -45,2 +46,3 @@ // Either pick the currently running container or the most recently started one | ||
return __awaiter(this, void 0, void 0, function* () { | ||
projectPath = yield (0, wsl_js_1.convertToWindowsPathIfNeeded)(projectPath, true); | ||
const command = `docker ps -q -a --filter label=vsch.local.folder="${projectPath}"`; | ||
@@ -47,0 +49,0 @@ debug(`Running: ${command}`); |
@@ -7,2 +7,3 @@ export * from './cli.js'; | ||
export * from './docker.js'; | ||
export * from './wsl.js'; | ||
export * from './commands/index.js'; |
@@ -23,3 +23,4 @@ "use strict"; | ||
__exportStar(require("./docker.js"), exports); | ||
__exportStar(require("./wsl.js"), exports); | ||
__exportStar(require("./commands/index.js"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -6,4 +6,4 @@ "use strict"; | ||
containerSetup: '# Install Azure CLI\n' + | ||
'RUN bash <(curl -sfL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/azcli-debian.sh") && apt-get clean -y && rm -rf /var/lib/apt/lists/*' | ||
'RUN curl -sfL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/azcli-debian.sh" | bash && apt-get clean -y && rm -rf /var/lib/apt/lists/*' | ||
}; | ||
//# sourceMappingURL=cli.js.map |
{ | ||
"name": "create-devc", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Quickly add .devcontainer configuration to any JavaScript project, and more!", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132619
206
2031