diff --git a/.github/workflows/build-templates.yml b/.github/workflows/build-templates.yml index df3c0fc45..5865f7ecb 100644 --- a/.github/workflows/build-templates.yml +++ b/.github/workflows/build-templates.yml @@ -42,6 +42,10 @@ jobs: type: name: library language: js + - os: windows-latest + type: + name: library + language: js concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.type.name }}-${{ matrix.type.language }} @@ -61,10 +65,12 @@ jobs: yarn workspace create-react-native-library prepare - name: Get working directory + shell: bash run: | echo "work_dir=${{ matrix.os }}-${{ matrix.type.name }}-${{ matrix.type.language }}" >> $GITHUB_ENV - name: Create library + shell: bash run: | rm -rf ${{ env.work_dir }} # Workaround for tests failing intermittently @@ -102,6 +108,7 @@ jobs: - name: Install dependencies of library if: steps.library-yarn-cache.outputs.cache-hit != 'true' working-directory: ${{ env.work_dir }} + shell: bash run: | touch yarn.lock # Without this Yarn will fail due to the parent directory being a Yarn workspace rm -f example/yarn.lock # Workaround for cached yarn.lock from older version @@ -117,6 +124,7 @@ jobs: key: ${{ steps.library-yarn-cache.outputs.cache-primary-key }} - name: Use local version of react-native-builder-bob + shell: bash run: | cd packages/react-native-builder-bob npm pack @@ -127,6 +135,7 @@ jobs: - name: Get build target working-directory: ${{ env.work_dir }} + shell: bash run: | # Build Android for only some matrices to skip redundant builds if [[ ${{ matrix.os }} =~ ubuntu ]]; then @@ -160,6 +169,7 @@ jobs: - name: Check turborepo cache if: env.android_build == 1 || env.ios_build == 1 working-directory: ${{ env.work_dir }} + shell: bash run: | TURBO_CACHE_STATUS_ANDROID=$(node -p "($(yarn turbo run build:android --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") TURBO_CACHE_STATUS_IOS=$(node -p "($(yarn turbo run build:ios --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") @@ -193,8 +203,9 @@ jobs: yarn prepare - name: Build example (Web) - working-directory: ${{ env.work_dir }} if: matrix.type.language == 'js' + working-directory: ${{ env.work_dir }} + shell: bash run: | # Clean up built JS files # So we test that bundling works without any pre-built files diff --git a/packages/create-react-native-library/src/template.ts b/packages/create-react-native-library/src/template.ts index 69b898877..56e54cda4 100644 --- a/packages/create-react-native-library/src/template.ts +++ b/packages/create-react-native-library/src/template.ts @@ -277,7 +277,10 @@ async function applyTemplate( let result; try { - result = ejs.render(content, config); + result = ejs + .render(content, config) + // Make sure that line endings are 'lf' (Unix style) + .replace(/\r\n/g, '\n'); } catch (e) { throw new Error(`Failed to render template file content: ${f}`, { cause: e, diff --git a/packages/create-react-native-library/templates/common/$.gitattributes b/packages/create-react-native-library/templates/common/$.gitattributes index 030ef1448..e27f70fa4 100644 --- a/packages/create-react-native-library/templates/common/$.gitattributes +++ b/packages/create-react-native-library/templates/common/$.gitattributes @@ -1,3 +1,3 @@ *.pbxproj -text # specific for windows script files -*.bat text eol=crlf \ No newline at end of file +*.bat text eol=crlf diff --git a/packages/create-react-native-library/templates/common/eslint.config.mjs b/packages/create-react-native-library/templates/common/eslint.config.mjs index 84f2a4d11..16b00bbcd 100644 --- a/packages/create-react-native-library/templates/common/eslint.config.mjs +++ b/packages/create-react-native-library/templates/common/eslint.config.mjs @@ -20,22 +20,10 @@ export default defineConfig([ plugins: { prettier }, rules: { 'react/react-in-jsx-scope': 'off', - 'prettier/prettier': [ - 'error', - { - quoteProps: 'consistent', - singleQuote: true, - tabWidth: 2, - trailingComma: 'es5', - useTabs: false, - }, - ], + 'prettier/prettier': 'error', }, }, { - ignores: [ - 'node_modules/', - 'lib/' - ], + ignores: ['node_modules/', 'lib/'], }, ]);