From e2aee5ccfabee80026820e70c37f43909adad339 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 22 Sep 2023 16:15:11 +0200 Subject: [PATCH] Fixed file copy erroring --- .changeset/config.json | 18 +++++----- .changeset/dry-candles-cover.md | 5 +++ .github/workflows/publish.yml | 58 ++++++++++++++++----------------- index.js | 10 ++++-- 4 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 .changeset/dry-candles-cover.md diff --git a/.changeset/config.json b/.changeset/config.json index ab848d1..34dfc8e 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,11 @@ { - "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", - "changelog": "@changesets/cli/changelog", - "commit": false, - "fixed": [], - "linked": [], - "access": "restricted", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [] + "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] } diff --git a/.changeset/dry-candles-cover.md b/.changeset/dry-candles-cover.md new file mode 100644 index 0000000..68f91eb --- /dev/null +++ b/.changeset/dry-candles-cover.md @@ -0,0 +1,5 @@ +--- +'capkit': patch +--- + +Fixed files not being copied correctly diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bb3d7da..acc6bf4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,29 +1,29 @@ -name: Publish -on: - push: - branches: - - 'main' - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 - - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: 'pnpm' - - run: pnpm install --frozen-lockfile - - name: Create Release Pull Request or Publish - id: changets - uses: changesets/action@v1 - with: - publish: pnpm release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file +name: Publish +on: + push: + branches: + - 'main' + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'pnpm' + - run: pnpm install --frozen-lockfile + - name: Create Release Pull Request or Publish + id: changets + uses: changesets/action@v1 + with: + publish: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/index.js b/index.js index ddf5cbe..b989acf 100644 --- a/index.js +++ b/index.js @@ -211,11 +211,15 @@ async function initializeProject({ start: 'Copying hotreload scripts', stop: 'Successfully copied hotreload scripts', task: async () => { - if (existsSync('/scripts')) await fs.mkdir('./scripts'); + const root = process.cwd() + '/'; + if (existsSync(`${root}/scripts`)) await fs.mkdir(`${root}/scripts`); return Promise.all([ - fs.writeFile('./scripts/hotreload.js', String(await fs.readFile('./scripts/hotreload.js'))), fs.writeFile( - './scripts/hotreload-cleanup.js', + `${root}/scripts/hotreload.js`, + String(await fs.readFile('./scripts/hotreload.js')) + ), + fs.writeFile( + `${root}/scripts/hotreload-cleanup.js`, String(await fs.readFile('./scripts/hotreload-cleanup.js')) ) ]);