@puls-atlas/cli
Version:
The Puls Atlas CLI tool for managing Atlas projects
14 lines • 517 B
JavaScript
import { configStore } from '../utils/configStore.js';
import { authenticateWithGoogleArtifactRegistry } from '../utils/npm.js';
const LAST_NPM_AUTH_ON = 'lastNpmAuthOn';
export default options => {
const now = Date.now();
const lastCheck = configStore.get(LAST_NPM_AUTH_ON) ?? 0;
if (options?.force || lastCheck === 0 || now - lastCheck > 1000 * 60 * 30) {
authenticateWithGoogleArtifactRegistry({
onAuthenticated: () => {
configStore.set(LAST_NPM_AUTH_ON, Date.now());
}
});
}
};