Skip to content

Commit b102c5f

Browse files
committed
Update gh-pages config
1 parent 78cbe55 commit b102c5f

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"author": "Ahmad Al Haddad <haddad@ah.sa>",
2222
"repository": {
2323
"type": "git",
24-
"url": ""
24+
"url": "https://github.com/cdes/react-headless-nested-menu/",
25+
"ssh": "git@github.com:cdes/react-headless-nested-menu.git"
2526
},
2627
"license": "MIT",
2728
"engines": {

tools/gh-pages-publish.ts

+15-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
const { cd, exec, echo, touch } = require("shelljs")
2-
const { readFileSync } = require("fs")
3-
const url = require("url")
1+
const { cd, exec, echo, touch } = require('shelljs')
2+
const { readFileSync } = require('fs')
3+
const url = require('url')
44

55
let repoUrl
6-
let pkg = JSON.parse(readFileSync("package.json") as any)
7-
if (typeof pkg.repository === "object") {
8-
if (!pkg.repository.hasOwnProperty("url")) {
9-
throw new Error("URL does not exist in repository section")
6+
let pkg = JSON.parse(readFileSync('package.json'))
7+
if (typeof pkg.repository === 'object') {
8+
if (!pkg.repository.hasOwnProperty('ssh')) {
9+
throw new Error('URL does not exist in repository section')
1010
}
11-
repoUrl = pkg.repository.url
12-
} else {
13-
repoUrl = pkg.repository
11+
repoUrl = pkg.repository.ssh
1412
}
1513

16-
let parsedUrl = url.parse(repoUrl)
17-
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
18-
let ghToken = process.env.GH_TOKEN
19-
20-
echo("Deploying docs!!!")
21-
cd("docs")
22-
touch(".nojekyll")
23-
exec("git init")
24-
exec("git add .")
14+
echo('Deploying docs!!!')
15+
cd('docs')
16+
touch('.nojekyll')
17+
exec('git init')
18+
exec('git add .')
2519
exec('git config user.name "Ahmad Al Haddad"')
2620
exec('git config user.email "haddad@ah.sa"')
2721
exec('git commit -m "docs(docs): update gh-pages"')
28-
exec(
29-
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
30-
)
31-
echo("Docs deployed!!")
22+
exec(`git push --force --quiet "${repoUrl}" master:gh-pages`)
23+
echo('Docs deployed!!')

0 commit comments

Comments
 (0)