element-plus/build/crowdin-credentials.ts
jeremywu 16f069ebbe
Revert "build!: simplify build & support native esm import (#3900)" (#3945)
* Revert "build!: simplify build & support native esm import (#3900)"

This reverts commit fb94222bb4.

* remove module

* Fix linter

* Add @element-plus/icons as dependency

* update pnpm lock file

* temporary lock element-plus at 1.1.0-beta.20
2021-10-20 09:42:32 +08:00

26 lines
689 B
TypeScript

import path from 'path'
import fs from 'fs'
import chalk from 'chalk'
import { errorAndExit } from './utils/log'
const credentialPlaceholder = 'API_TOKEN_PLACEHOLDER'
const CREDENTIAL = process.env.CROWDIN_TOKEN
;(async () => {
console.info(chalk.cyan('Fetching Crowdin credential'))
const configPath = path.resolve(__dirname, '../docs/crowdin.yml')
try {
const file = await fs.promises.readFile(configPath, {
encoding: 'utf-8',
})
await fs.promises.writeFile(
configPath,
file.replace(credentialPlaceholder, CREDENTIAL!)
)
console.info(chalk.green('Crowdin credential update successfully'))
} catch (e: any) {
errorAndExit(e)
}
})()