This repository was archived by the owner on Dec 29, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-for-gh-pages.js
More file actions
47 lines (44 loc) · 1.44 KB
/
build-for-gh-pages.js
File metadata and controls
47 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*!
* Angular の URL と同じ階層に転送用 `index.html` を配置する
*
* GitHub Pages では SPA によるルーティングが動作しないため、既に `404.html` を利用した転送設定を行っている
* これでも機能的には問題ないのだが、404 だと Google Search Console などでエラー扱いになるので
* 正常なレスポンスになるよう、対象の階層に `404.html` と同じ内容の `index.html` を用意しておく
*/
const fs = require('fs');
const templateHtml = './src/404.html';
const distDirectoryPath = './dist';
const urls = [
'index',
'font-family-tester',
'multiple-diff',
'calculator',
'regexp',
'epoch-time-converter',
'encoder-decoder',
'detect-character',
'date-time-countdown',
'draw-triangle-svg',
'text-converter',
'text-converter/add-line-number',
'text-converter/case-converter',
'text-converter/normalize-to-nfc',
'text-converter/shuffle-lines',
'beautifier',
'beautifier/javascript',
'beautifier/html',
'beautifier/css',
'colour-converter',
'colour-converter/colour-converter',
'csv-file-to-table',
'touch-friendly-dnd',
'dynamic-generate-form',
'guitar-scale-generator'
];
console.log('Build For GitHub Pages');
urls.forEach(url => {
console.log(` ${url}`);
fs.mkdirSync(`${distDirectoryPath}/${url}`, { recursive: true });
fs.copyFileSync(templateHtml, `${distDirectoryPath}/${url}/index.html`);
});
console.log('Finished');