-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-sync vendor assets & Hugo module versions + copyedits to README …
…and CONTRIBUTING (#1733)
- Loading branch information
Showing
10 changed files
with
89 additions
and
29 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
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,5 @@ | ||
This `_vendor` folder exists to work around a known bug in Go’s module | ||
management. For details, see <https://github.com/golang/go/issues/37397>. | ||
|
||
DO NOT EDIT or manually override the files in this folder. They are | ||
automatically synchronized at installation time. |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,56 @@ | ||
// Runs `hugo mod get <module>@<vers>` for Docsy module dependencies. | ||
// It gets dependency versions from `package.json`. | ||
|
||
import fs from 'fs'; | ||
import { execSync } from 'child_process'; | ||
|
||
const packageJson = readPackageJson(); | ||
let exitStatus = 0; | ||
|
||
const exit = () => process.exit(exitStatus); | ||
|
||
function getHugoModule(npmPkgNm, hugoModuleRefAtV) { | ||
try { | ||
// Extract module version | ||
const pkgVers = packageJson.dependencies[npmPkgNm]; | ||
if (!pkgVers) { | ||
throw new Error(`${npmPkgNm} not found in dependencies`); | ||
} | ||
if (!/^\d/.test(pkgVers)) { | ||
const msg = `${npmPkgNm} version must be exact (start with a number), not: ${pkgVers}`; | ||
throw new Error(msg); | ||
} | ||
|
||
const command = `hugo mod get ${hugoModuleRefAtV}${pkgVers}`; | ||
console.log(`> ${command}`); | ||
const output = execSync(command); | ||
console.log(output.toString()); | ||
} catch (error) { | ||
console.error(`ERROR: ${error.message}\n`); | ||
exitStatus = 1; | ||
} | ||
} | ||
|
||
function readPackageJson() { | ||
try { | ||
const packageJsonData = fs.readFileSync('package.json', 'utf8'); | ||
return JSON.parse(packageJsonData); | ||
} catch (error) { | ||
console.error('FAILED to read package.json:', error.message); | ||
exit(); | ||
} | ||
} | ||
|
||
const packagesToUpdate = [ | ||
// NPM package name, `Hugo module name@` optionally follow by `v` if needed | ||
['@fortawesome/fontawesome-free', 'github.com/FortAwesome/Font-Awesome@'], | ||
['bootstrap', 'github.com/twbs/bootstrap@v'] | ||
]; | ||
|
||
packagesToUpdate.forEach(([npmPkgNm, hugoModuleRefAtV]) => { | ||
getHugoModule(npmPkgNm, hugoModuleRefAtV, packageJson); | ||
}); | ||
|
||
exit(); | ||
|
||
// cSpell:ignore hugo twbs |