Skip to content

Commit

Permalink
ci?
Browse files Browse the repository at this point in the history
  • Loading branch information
zibs committed Dec 11, 2024
1 parent fa8adf2 commit a26ad15
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"build": "rm -rf dist && tsc -p ./tsconfig.build.json",
"typecheck": "tsc --noEmit",
"test": "jest",
"postinstall": "node ./dist/scripts/create-config.js"
"postinstall": "node ./src/postinstall.js"
},
"dependencies": {
"@react-native-ama/internal": "~1.1.1"
Expand Down
18 changes: 18 additions & 0 deletions packages/core/src/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const path = require('path');

// INIT_CWD points to where `npm install` or `yarn install` was invoked
const initCwd = process.env.INIT_CWD || '';
const packageRoot = __dirname;

// Detect if this is running as part of the monorepo installation
const isMonorepo = initCwd.includes(path.join(packageRoot, '..', '..'));

// If running in the monorepo context, skip the postinstall script
if (isMonorepo) {
console.log('Skipping postinstall: Running within monorepo');
process.exit(0);
}

// If installed as a standalone dependency, run the postinstall logic
console.log('Running postinstall: User installation');
require('./../dist/scripts/create-config.js');

0 comments on commit a26ad15

Please sign in to comment.