Skip to content

Commit df07ab1

Browse files
alan-agius4dgp1130
authored andcommittedFeb 10, 2023
fix(@angular/cli): convert before option in .npmrc to Date
Previously, the `before` option in the npmrc was not converted properly to a date. See: https://docs.npmjs.com/cli/v8/using-npm/config#before Closes #24685 (cherry picked from commit 545c180)
1 parent 384ad29 commit df07ab1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎packages/angular/cli/src/utilities/package-metadata.ts

+4
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ function normalizeOptions(
212212
} catch {}
213213
}
214214
break;
215+
case 'before':
216+
options['before'] =
217+
typeof substitutedValue === 'string' ? new Date(substitutedValue) : substitutedValue;
218+
break;
215219
default:
216220
options[key] = substitutedValue;
217221
break;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { writeFile } from '../../../utils/fs';
2+
import { ng } from '../../../utils/process';
3+
4+
export default async function () {
5+
// Works with before option
6+
await writeFile('.npmrc', `before=${new Date().toISOString()}`);
7+
await ng('add', '@angular/pwa', '--skip-confirmation');
8+
}

0 commit comments

Comments
 (0)
Please sign in to comment.