From 653c93f0f598c44c73189223b06f5936131eb4a0 Mon Sep 17 00:00:00 2001 From: Yusuke Nemoto Date: Sun, 19 May 2024 12:06:24 +0900 Subject: [PATCH] build: fix missing base_path (#14) --- .github/workflows/setup.yaml | 2 +- package.json | 2 +- scripts/setup-repository.ts | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/setup.yaml b/.github/workflows/setup.yaml index a762e30..ebeb378 100644 --- a/.github/workflows/setup.yaml +++ b/.github/workflows/setup.yaml @@ -23,7 +23,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - run: | npm ci - npm run setup-repository --repository=${{ github.repository }} --pages_baseurl=${{ steps.configure-pages.outputs.base_url }} + npm run setup-repository --repository=${{ github.repository }} --pages_basepath=${{ steps.configure-pages.outputs.base_path }} --pages_baseurl=${{ steps.configure-pages.outputs.base_url }} - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: diff --git a/package.json b/package.json index 3f3ba6e..bd150f1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev": "slidev --open --remote 0.0.0.0", "export": "slidev export --output dist/${npm_config_slide}.pdf --format pdf ${npm_config_slide}/slides.md", "export:dark": "slidev export --dark --output dist/${npm_config_slide}-dark.pdf --format pdf ${npm_config_slide}/slides.md", - "setup-repository": "ts-node scripts/setup-repository.ts ${npm_config_repository} ${npm_config_pages_baseurl}" + "setup-repository": "ts-node scripts/setup-repository.ts ${npm_config_repository} ${npm_config_pages_basepath} ${npm_config_pages_baseurl}" }, "dependencies": { "@slidev/cli": "^0.49.0", diff --git a/scripts/setup-repository.ts b/scripts/setup-repository.ts index 82de86e..c3f7c1e 100644 --- a/scripts/setup-repository.ts +++ b/scripts/setup-repository.ts @@ -1,9 +1,10 @@ import fs from 'fs'; -// ts-node scripts/setup-repository.ts [github.repository] [pages.base_url] +// ts-node scripts/setup-repository.ts [github.repository] [pages.base_path] [pages.base_url] const args = process.argv.slice(2); const repository = args[0] || 'kaakaa/slidev-resources-template'; -const baseUrl = args[1] || '/slidev-resources-template'; +const basePath = args[1] || '/slidev-resources-template'; +const baseUrl = args[2] || 'https://kaakaa.github.cio/slidev-resources-template'; const values: { [key: string]: string } = { 'github.repository': repository, @@ -17,9 +18,9 @@ const filesToRemove = [ 'assets/' ]; -/* replace pages.baseUrl in package.json*/ +/* replace pages.basePath in package.json*/ let pkgjsonFile = fs.readFileSync('package.json', 'utf8'); -pkgjsonFile = pkgjsonFile.replace( /--base \/slidev-resources-template/g, `--baes ${baseUrl}`); +pkgjsonFile = pkgjsonFile.replace( /--base \/slidev-resources-template/g, `--baes ${basePath}`); fs.writeFileSync('package.json', pkgjsonFile, 'utf-8');