-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cli arguments support and CJS to ESM conversion (#14)
- Loading branch information
Showing
15 changed files
with
5,962 additions
and
23,076 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__tests__/__fixtures__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"printWidth": 100, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"bracketSpacing": true | ||
} |
Binary file renamed
BIN
+20.1 KB
..._/small-project-existing-package-name.zip → .../simple-project-existing-package-name.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,55 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
const path = require('path') | ||
const { argv } = require('process') | ||
const { testProject } = require('../src') | ||
import path from 'path' | ||
import { testProject } from '../src/main.js' | ||
import meow from 'meow' | ||
|
||
const cli = meow( | ||
` | ||
Usage | ||
$ snync --directory ~/projects/my-app [options] | ||
Options | ||
--directory -d Path to a project's source-code directory with a package.json | ||
--private -p Specify name of private packages (repeat as needed) | ||
--debug -x Enable debugging when printing data | ||
Examples | ||
$ snync --directory ~/projects/my-app -p "my-private-package-name" -p "my-other-private-package" | ||
`, | ||
{ | ||
importMeta: import.meta, | ||
flags: { | ||
directory: { | ||
type: 'string', | ||
alias: 'd' | ||
}, | ||
private: { | ||
type: 'string', | ||
alias: 'p' | ||
}, | ||
debug: { | ||
type: 'boolean', | ||
alias: 'x' | ||
} | ||
} | ||
} | ||
) | ||
|
||
main() | ||
|
||
async function main() { | ||
const cmdArguments = argv | ||
let projectPath | ||
|
||
if (cmdArguments[2]) { | ||
projectPath = path.resolve(cmdArguments[2]) | ||
if (cli.flags.directory) { | ||
projectPath = path.resolve(cli.flags.directory) | ||
console.log(`Testing project at: ${projectPath}`) | ||
} else { | ||
console.error(`Please provide a directory path to the git project to test.`) | ||
console.error(` e.g: /home/user/my-app`) | ||
console.error(`error: please provide a directory path to the git project to test.`) | ||
console.error(cli.help) | ||
process.exit(-1) | ||
} | ||
|
||
await testProject({ projectPath, log: console.log }) | ||
await testProject({ projectPath, log: console.log, debug: cli.flags.debug }) | ||
} |
Oops, something went wrong.