|
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') |
4 | 4 |
|
5 | 5 | 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') |
10 | 10 | }
|
11 |
| - repoUrl = pkg.repository.url |
12 |
| -} else { |
13 |
| - repoUrl = pkg.repository |
| 11 | + repoUrl = pkg.repository.ssh |
14 | 12 | }
|
15 | 13 |
|
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 .') |
25 | 19 | exec('git config user.name "Ahmad Al Haddad"')
|
26 | 20 | exec('git config user.email "haddad@ah.sa"')
|
27 | 21 | 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