Skip to content

ci: build js library template on windows #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion packages/create-react-native-library/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
*.bat text eol=crlf
Original file line number Diff line number Diff line change
Expand Up @@ -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/'],
},
]);
Loading