Skip to content

Commit da3f873

Browse files
committed
Copy from local features folder
1 parent 202c783 commit da3f873

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

.vscode/launch.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"type": "node",
99
"request": "launch",
10-
"name": "Launch cli - up",
10+
"name": "Launch CLI - up",
1111
"program": "${workspaceFolder}/src/spec-node/devContainersSpecCLI.ts",
1212
"cwd": "${workspaceFolder}",
1313
"args": [
@@ -18,6 +18,23 @@
1818
"debug",
1919
],
2020
"console": "integratedTerminal",
21+
},
22+
{
23+
"type": "node",
24+
"request": "launch",
25+
"name": "Launch Tests",
26+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
27+
"cwd": "${workspaceFolder}",
28+
"args": [
29+
"-r",
30+
"ts-node/register",
31+
"--exit",
32+
"src/test/*.test.ts"
33+
],
34+
"env": {
35+
"TS_NODE_PROJECT": "src/test/tsconfig.json"
36+
},
37+
"console": "integratedTerminal",
2138
}
2239
]
2340
}

src/spec-configuration/containerFeaturesConfiguration.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ function updateFromOldProperties<T extends { features: (Feature & { extensions?:
368368

369369
// Generate a base featuresConfig object with the set of locally-cached features,
370370
// as well as downloading and merging in remote feature definitions.
371-
export async function generateFeaturesConfig(params: { extensionPath: string; cwd: string; output: Log; env: NodeJS.ProcessEnv }, dstFolder: string, config: DevContainerConfig, getLocalFolder: (d: string) => string) {
371+
export async function generateFeaturesConfig(params: { extensionPath: string; cwd: string; output: Log; env: NodeJS.ProcessEnv }, dstFolder: string, config: DevContainerConfig, getLocalFeaturesFolder: (d: string) => string) {
372372
const { output } = params;
373373

374374
const userFeatures = featuresToArray(config);
@@ -385,7 +385,8 @@ export async function generateFeaturesConfig(params: { extensionPath: string; cw
385385

386386
// load local cache of features;
387387
// TODO: Update so that cached features are always version 2
388-
let locallyCachedFeatureSet = await loadFeaturesJsonFromDisk(getLocalFolder(params.extensionPath), output); // TODO: Pass dist folder instead to also work with the devcontainer.json support package.
388+
const localFeaturesFolder = getLocalFeaturesFolder(params.extensionPath);
389+
const locallyCachedFeatureSet = await loadFeaturesJsonFromDisk(localFeaturesFolder, output); // TODO: Pass dist folder instead to also work with the devcontainer.json support package.
389390
if (!locallyCachedFeatureSet) {
390391
output.write('Failed to load locally cached features', LogLevel.Error);
391392
return undefined;
@@ -397,7 +398,7 @@ export async function generateFeaturesConfig(params: { extensionPath: string; cw
397398

398399
// Fetch features and get version information
399400
output.write('--- Fetching User Features ----', LogLevel.Trace);
400-
await fetchFeatures(params, featuresConfig, locallyCachedFeatureSet, dstFolder);
401+
await fetchFeatures(params, featuresConfig, locallyCachedFeatureSet, dstFolder, localFeaturesFolder);
401402

402403
const ordererdFeatures = computeFeatureInstallationOrder(config, featuresConfig.featureSets);
403404

@@ -625,7 +626,7 @@ export function parseFeatureIdentifier(output: Log, userFeature: DevContainerFea
625626
}
626627
}
627628

628-
async function fetchFeatures(params: { extensionPath: string; cwd: string; output: Log; env: NodeJS.ProcessEnv }, featuresConfig: FeaturesConfig, localFeatures: FeatureSet, dstFolder: string) {
629+
async function fetchFeatures(params: { extensionPath: string; cwd: string; output: Log; env: NodeJS.ProcessEnv }, featuresConfig: FeaturesConfig, localFeatures: FeatureSet, dstFolder: string, localFeaturesFolder: string) {
629630
for (const featureSet of featuresConfig.featureSets) {
630631
try {
631632
if (!featureSet || !featureSet.features || !featureSet.sourceInformation)
@@ -652,7 +653,7 @@ async function fetchFeatures(params: { extensionPath: string; cwd: string; outpu
652653
if (sourceInfoType === 'local-cache') {
653654
// create copy of the local features to set the environment variables for them.
654655
await mkdirpLocal(featCachePath);
655-
await cpDirectoryLocal(path.join(dstFolder, 'local-cache'), featCachePath);
656+
await cpDirectoryLocal(localFeaturesFolder, featCachePath);
656657

657658
await parseDevContainerFeature(featureSet, feature, featCachePath);
658659

0 commit comments

Comments
 (0)