Skip to content

Commit

Permalink
debug windows
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Nov 18, 2024
1 parent 7eec9d5 commit ffcbbd8
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [windows-latest]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -35,4 +35,20 @@ jobs:
npm ci
npx playwright install --with-deps
npm run format package.json
npm run test:all
- name: compile
run: npm run compile
- name: mono-vir-test
run: |
npx mono-vir for-each-async echo bye
- name: coverage
run: npm run test:coverage
- name: spelling
run: npm run test:spelling
- name: format
run: npm run test:format
- name: docs
run: npm run test:docs
- name: deps
run: npm run test:deps
- name: lint
run: npm run test:lint
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"compile": "virmator compile",
"docs": "virmator docs",
"format": "virmator format",
"postinstall": "npm run debug --workspace @virmator/scripts",
"lint": "virmator lint fix",
"publish": "virmator publish npm run test:all",
"test": "mono-vir for-each-async npm run test",
Expand Down
3 changes: 3 additions & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
},
"type": "module",
"scripts": {
"debug": "tsx src/debug.ts",
"start": "tsx src/cli.ts",
"test": "tsx src/cli.ts check",
"test:coverage": "npm test",
"test:update": "npm start"
},
"dependencies": {
"@augment-vir/assert": "^30.7.0",
"@augment-vir/common": "^30.7.0",
"@augment-vir/node": "^30.7.0",
"mri": "^1.2.0",
"tsx": "^4.19.2",
"virmator": "^13.8.1"
},
"devDependencies": {
Expand Down
38 changes: 38 additions & 0 deletions packages/scripts/src/debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {assert} from '@augment-vir/assert';
import {log, type MaybePromise} from '@augment-vir/common';
import {existsSync} from 'fs';
import {readFile, writeFile} from 'fs/promises';
import {dirname, resolve} from 'path';

const monoVirPackageJsonPath = resolve(
import.meta.dirname,
'..',
'..',
'..',
'node_modules',
'mono-vir',
'package.json',
);

const monoVirBinFile = resolve(dirname(monoVirPackageJsonPath), 'bin.sh');

await fixContents(monoVirPackageJsonPath, (original) =>
original.replace('"./bin.sh"', '"bash bin.sh"'),
);

await fixContents(monoVirBinFile, (original) => original.replace('npx', 'echo "hi";\nnpx'));

log.success('overwrote mono-vir bin');

async function fixContents(
filePath: string,
fixCallback: (original: string) => MaybePromise<string>,
) {
assert(existsSync(filePath));

const original = String(await readFile(filePath));

const fixed = await fixCallback(original);

await writeFile(filePath, fixed);
}

0 comments on commit ffcbbd8

Please sign in to comment.