Skip to content
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
88 changes: 88 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"html": {
"formatter": {
"enabled": true
}
},
"formatter": {
"enabled": true,
"indentWidth": 2,
"lineEnding": "lf",
"formatWithErrors": true,
"lineWidth": 140,
"indentStyle": "space",
"includes": [
"**",
"!**/.cache",
"!**/dist/**",
"!**/*.json",
"!**/node_modules/**"
]
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"arrowParentheses": "asNeeded",
"quoteProperties": "asNeeded",
"semicolons": "always",
"indentStyle": "space",
"quoteStyle": "single"
}
},
"json": {
"formatter": {
"indentStyle": "space"
},
"parser": {
"allowComments": true
}
},
"linter": {
"enabled": true,
"includes": [
"**",
"!**/.cache",
"!**/dist/**",
"!**/*.json",
"!**/node_modules/**"
],
"rules": {
"correctness": {
"useImportExtensions": "error"
},
"recommended": true,
"complexity": {
"noForEach": "off",
"noStaticOnlyClass": "off"
},
"performance": {
"noBarrelFile": "off",
"noDelete": "off"
},
"suspicious": {
"noExplicitAny": "off",
"noPrototypeBuiltins": "off"
},
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"useExponentiationOperator": "off"
}
}
},
"vcs": {
"clientKind": "git",
"enabled": false,
"root": "./"
}
}
167 changes: 167 additions & 0 deletions package-lock.json

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

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
"url": "https://github.com/ghiscoding/native-copyfiles/issues"
},
"scripts": {
"prebuild": "npm run biome:lint:write && npm run biome:format:write",
"build": "tsc --outDir dist",
"biome:lint:check": "biome lint ./src",
"biome:lint:write": "biome lint --write ./src",
"biome:format:check": "biome format ./src",
"biome:format:write": "biome format --write ./src",
"preview:copy": "node dist/cli.js test-copyin test-copyout --flat --verbose",
"preview:release": "release-it --only-version --dry-run",
"release": "release-it --only-version",
Expand All @@ -48,6 +53,7 @@
"yargs": "^18.0.0"
},
"devDependencies": {
"@biomejs/biome": "^2.0.0-beta.6",
"@release-it/conventional-changelog": "^10.0.1",
"@types/node": "^22.15.30",
"@types/yargs": "^17.0.33",
Expand All @@ -59,4 +65,4 @@
"engines": {
"node": "^20.0.0 || >=22.0.0"
}
}
}
39 changes: 20 additions & 19 deletions src/__tests__/cli-fail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@ import { beforeEach, describe, expect, test, vi } from 'vitest';

describe('copyfiles', () => {
beforeEach(() => {
vi.spyOn(process, 'exit').mockImplementation((() => { }) as any);
vi.spyOn(process, 'exit').mockImplementation((() => {}) as any);
});

test('CLI entry failure (no valid process.argv)', () => new Promise((done: any) => {
const errorSpy = vi.spyOn(global.console, 'error').mockReturnValue();
const exitSpy = vi.spyOn(process, 'exit');
test('CLI entry failure (no valid process.argv)', () =>
new Promise((done: any) => {
const errorSpy = vi.spyOn(global.console, 'error').mockReturnValue();
const exitSpy = vi.spyOn(process, 'exit');

import('../cli')
.then((cli: any) => {
cli();
})
.catch(e => {
expect(errorSpy).toHaveBeenCalledWith(
new Error('Please make sure to provide both <inFile> and <outDirectory>, i.e.: "copyfiles <inFile> <outDirectory>"')
);
expect(exitSpy).toHaveBeenCalledWith(1);
process.exitCode = undefined;
done();
process.exit(0);
});
}));
});
import('../cli.js')
.then((cli: any) => {
cli();
})
.catch(_ => {
expect(errorSpy).toHaveBeenCalledWith(
new Error('Please make sure to provide both <inFile> and <outDirectory>, i.e.: "copyfiles <inFile> <outDirectory>"'),
);
expect(exitSpy).toHaveBeenCalledWith(1);
process.exitCode = undefined;
done();
process.exit(0);
});
}));
});
Loading