git-coco 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.mjs +29 -17
- package/dist/index.js +29 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.esm.mjs
CHANGED
|
@@ -1611,7 +1611,8 @@ function execPromise(command, options = {}) {
|
|
|
1611
1611
|
* @returns {Promise<boolean>} - A promise that resolves to true if the package is installed successfully, false otherwise.
|
|
1612
1612
|
*/
|
|
1613
1613
|
async function installNpmPackage({ name, flags = [], cwd = process.cwd(), }) {
|
|
1614
|
-
const
|
|
1614
|
+
const version = name.includes('@') ? '' : '@latest';
|
|
1615
|
+
const { stdout, stderr } = await execPromise(`npm i ${name}${version} ${flags.join(' ')} --yes`, { cwd });
|
|
1615
1616
|
if (stderr) {
|
|
1616
1617
|
console.error(`Execution error: ${stderr}`);
|
|
1617
1618
|
return false;
|
|
@@ -1695,22 +1696,26 @@ async function createProjectFileAndReturnPath(fileName, contents) {
|
|
|
1695
1696
|
}
|
|
1696
1697
|
|
|
1697
1698
|
const handler = async (argv, logger) => {
|
|
1699
|
+
const options = loadConfig(argv);
|
|
1698
1700
|
logger.log(LOGO);
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1701
|
+
let level = options?.level;
|
|
1702
|
+
if (!level) {
|
|
1703
|
+
level = await select({
|
|
1704
|
+
message: 'configure coco at the system or project level:',
|
|
1705
|
+
choices: [
|
|
1706
|
+
{
|
|
1707
|
+
name: 'system',
|
|
1708
|
+
value: 'system',
|
|
1709
|
+
description: 'add coco config to your global git config',
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
name: 'project',
|
|
1713
|
+
value: 'project',
|
|
1714
|
+
description: 'add coco config to existing git project',
|
|
1715
|
+
},
|
|
1716
|
+
],
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1714
1719
|
let configFilePath = '';
|
|
1715
1720
|
switch (level) {
|
|
1716
1721
|
case 'project':
|
|
@@ -1852,7 +1857,14 @@ const handler = async (argv, logger) => {
|
|
|
1852
1857
|
/**
|
|
1853
1858
|
* Command line options via yargs
|
|
1854
1859
|
*/
|
|
1855
|
-
const options = {
|
|
1860
|
+
const options = {
|
|
1861
|
+
level: {
|
|
1862
|
+
type: 'string',
|
|
1863
|
+
alias: 'l',
|
|
1864
|
+
description: 'Configure coco at the system or project level',
|
|
1865
|
+
choices: ['system', 'project'],
|
|
1866
|
+
},
|
|
1867
|
+
};
|
|
1856
1868
|
const builder = (yargs) => {
|
|
1857
1869
|
return yargs.options(options);
|
|
1858
1870
|
};
|
package/dist/index.js
CHANGED
|
@@ -1632,7 +1632,8 @@ function execPromise(command, options = {}) {
|
|
|
1632
1632
|
* @returns {Promise<boolean>} - A promise that resolves to true if the package is installed successfully, false otherwise.
|
|
1633
1633
|
*/
|
|
1634
1634
|
async function installNpmPackage({ name, flags = [], cwd = process.cwd(), }) {
|
|
1635
|
-
const
|
|
1635
|
+
const version = name.includes('@') ? '' : '@latest';
|
|
1636
|
+
const { stdout, stderr } = await execPromise(`npm i ${name}${version} ${flags.join(' ')} --yes`, { cwd });
|
|
1636
1637
|
if (stderr) {
|
|
1637
1638
|
console.error(`Execution error: ${stderr}`);
|
|
1638
1639
|
return false;
|
|
@@ -1716,22 +1717,26 @@ async function createProjectFileAndReturnPath(fileName, contents) {
|
|
|
1716
1717
|
}
|
|
1717
1718
|
|
|
1718
1719
|
const handler = async (argv, logger) => {
|
|
1720
|
+
const options = loadConfig(argv);
|
|
1719
1721
|
logger.log(LOGO);
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1722
|
+
let level = options?.level;
|
|
1723
|
+
if (!level) {
|
|
1724
|
+
level = await prompts$1.select({
|
|
1725
|
+
message: 'configure coco at the system or project level:',
|
|
1726
|
+
choices: [
|
|
1727
|
+
{
|
|
1728
|
+
name: 'system',
|
|
1729
|
+
value: 'system',
|
|
1730
|
+
description: 'add coco config to your global git config',
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
name: 'project',
|
|
1734
|
+
value: 'project',
|
|
1735
|
+
description: 'add coco config to existing git project',
|
|
1736
|
+
},
|
|
1737
|
+
],
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1735
1740
|
let configFilePath = '';
|
|
1736
1741
|
switch (level) {
|
|
1737
1742
|
case 'project':
|
|
@@ -1873,7 +1878,14 @@ const handler = async (argv, logger) => {
|
|
|
1873
1878
|
/**
|
|
1874
1879
|
* Command line options via yargs
|
|
1875
1880
|
*/
|
|
1876
|
-
const options = {
|
|
1881
|
+
const options = {
|
|
1882
|
+
level: {
|
|
1883
|
+
type: 'string',
|
|
1884
|
+
alias: 'l',
|
|
1885
|
+
description: 'Configure coco at the system or project level',
|
|
1886
|
+
choices: ['system', 'project'],
|
|
1887
|
+
},
|
|
1888
|
+
};
|
|
1877
1889
|
const builder = (yargs) => {
|
|
1878
1890
|
return yargs.options(options);
|
|
1879
1891
|
};
|