Use yaml.load

This commit is contained in:
Mimi 2021-01-03 23:19:50 +08:00
parent 8dd993d2aa
commit 278e160f4d
3 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@ try {
} catch (error) {
}
const vendorsFile = fs.readFileSync(path.join(__dirname, '../../../_vendors.yml'));
const dependencies = yaml.safeLoad(vendorsFile);
const dependencies = yaml.load(vendorsFile);
module.exports = hexo => {
const { vendors } = hexo.theme.config;

View File

@ -38,6 +38,8 @@ p {
a {
border-bottom: 1px solid $link-decoration-color;
color: var(--link-color);
// For a:not(:any-link)
cursor: pointer;
outline: 0;
text-decoration: none;
word-wrap();

View File

@ -9,14 +9,14 @@ describe('Validate', () => {
it('config', () => {
const themeConfig = fs.readFileSync(path.join(__dirname, '../../_config.yml'));
should.not.throw(() => {
yaml.safeLoad(themeConfig);
yaml.load(themeConfig);
});
});
it('vendors', () => {
const vendorsFile = fs.readFileSync(path.join(__dirname, '../../_vendors.yml'));
should.not.throw(() => {
yaml.safeLoad(vendorsFile);
yaml.load(vendorsFile);
});
});
@ -26,7 +26,7 @@ describe('Validate', () => {
fs.readdirSync(languagesPath).forEach(lang => {
if (!lang.endsWith('.yml')) return;
const languagePath = path.join(languagesPath, lang);
yaml.safeLoad(fs.readFileSync(languagePath), {
yaml.load(fs.readFileSync(languagePath), {
filename: path.relative(__dirname, languagePath)
});
});