-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
510 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# Project files | ||
node_modules | ||
dist | ||
src/locale | ||
|
||
# Log files | ||
npm-debug.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const dayjsLocale = './node_modules/dayjs/esm/locale'; | ||
const localeSrc = './src/locale'; | ||
|
||
async function main() { | ||
await fs.remove(localeSrc); | ||
const locales = await fs.readdir(dayjsLocale); | ||
for (const locale of locales) { | ||
await fs.copySync( | ||
`${dayjsLocale}/${locale}`, | ||
path.join(__dirname, `./src/locale/${locale}`) | ||
); | ||
await fs.readFile(`${localeSrc}/${locale}`, 'utf8', function(err, data) { | ||
if (err) return console.log(err); | ||
const result = data.replace(/..\/index/g, 'dayjs'); | ||
|
||
fs.writeFile(`${localeSrc}/${locale}`, result, 'utf8', function(err) { | ||
if (err) return console.log(err); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
main().catch(err => { | ||
console.error(err); | ||
}); |
Oops, something went wrong.