Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/lib/date.js
3520 views
1
"use strict";
2
var __importDefault = (this && this.__importDefault) || function (mod) {
3
return (mod && mod.__esModule) ? mod : { "default": mod };
4
};
5
Object.defineProperty(exports, "__esModule", { value: true });
6
exports.writeISODate = writeISODate;
7
exports.readISODate = readISODate;
8
/*---------------------------------------------------------------------------------------------
9
* Copyright (c) Microsoft Corporation. All rights reserved.
10
* Licensed under the MIT License. See License.txt in the project root for license information.
11
*--------------------------------------------------------------------------------------------*/
12
const path_1 = __importDefault(require("path"));
13
const fs_1 = __importDefault(require("fs"));
14
const root = path_1.default.join(__dirname, '..', '..');
15
/**
16
* Writes a `outDir/date` file with the contents of the build
17
* so that other tasks during the build process can use it and
18
* all use the same date.
19
*/
20
function writeISODate(outDir) {
21
const result = () => new Promise((resolve, _) => {
22
const outDirectory = path_1.default.join(root, outDir);
23
fs_1.default.mkdirSync(outDirectory, { recursive: true });
24
const date = new Date().toISOString();
25
fs_1.default.writeFileSync(path_1.default.join(outDirectory, 'date'), date, 'utf8');
26
resolve();
27
});
28
result.taskName = 'build-date-file';
29
return result;
30
}
31
function readISODate(outDir) {
32
const outDirectory = path_1.default.join(root, outDir);
33
return fs_1.default.readFileSync(path_1.default.join(outDirectory, 'date'), 'utf8');
34
}
35
//# sourceMappingURL=date.js.map
36