From ca5ccb3965197bdeaddc1b8bd30375c1ff6301d3 Mon Sep 17 00:00:00 2001 From: Carter Grimmeisen Date: Tue, 25 Jan 2022 17:50:33 +0000 Subject: [PATCH] Attempt to disable auto crlf in CI --- .github/workflows/main.yml | 7 +++++-- src/util.ts | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 966ecb6b..a820a616 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,9 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: + - name: Disable Auto CRLF + run: git config --global core.autocrlf false + - name: Checkout repo uses: actions/checkout@v2 @@ -18,9 +21,9 @@ jobs: uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} - cache: 'npm' + cache: 'yarn' - - name: Install deps (no cache) + - name: Install deps run: yarn install --frozen-lockfile - name: Build diff --git a/src/util.ts b/src/util.ts index 024ea3c5..0f6477c3 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,6 +1,7 @@ import { DMMF } from '@prisma/generator-helper' import type { CodeBlockWriter } from 'ts-morph' import { Config } from './config' +import { sep } from 'path' export const writeArray = (writer: CodeBlockWriter, array: string[], newLine = true) => array.forEach((line) => writer.write(line).conditionalNewLine(newLine)) @@ -34,9 +35,10 @@ export const chunk = (input: T, size: number): T[] => { } export const dotSlash = (path: string) => { - if (path.includes('/node_modules/')) return path.split('/node_modules/').slice(-1)[0] + if (path.includes(`${sep}node_modules${sep}`)) + return path.split(`${sep}node_modules${sep}`).slice(-1)[0] - if (path.startsWith('../')) return path + if (path.startsWith(`..${sep}`)) return path - return './' + path + return `.${sep}${path}` }