Skip to content

Commit 545c180

Browse files
alan-agius4angular-robot[bot]
authored andcommitted
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
1 parent 8356240 commit 545c180

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
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;
Lines changed: 8 additions & 0 deletions
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)