| // Copyright 2020 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| import fs from 'node:fs'; |
| import path from 'node:path'; |
| |
| import {writeIfChanged} from './write-if-changed.js'; |
| |
| const [, , outputDirectory, entrypointName] = process.argv; |
| |
| const rawFileName = path.basename(entrypointName, path.extname(entrypointName)); |
| const inputLocation = path.join( |
| outputDirectory, |
| `${rawFileName}.prebundle.d.ts`, |
| ); |
| const outputLocation = path.join(outputDirectory, `${rawFileName}.d.ts`); |
| |
| // We can't use copy here, as that would maintain the original file timestamps. |
| // This can throw off Ninja, which verifies that timestamps of generated files |
| // are the same as the timestamp it ran the action on. |
| writeIfChanged(outputLocation, fs.readFileSync(inputLocation)); |