@cocreate/cli 1.45.2 → 1.45.3
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/commands/upload.js +33 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.45.3](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.45.2...v1.45.3) (2023-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* coc upload with no args ([a638868](https://github.com/CoCreate-app/CoCreate-cli/commit/a638868b991f39c5a3bdcdcf12285d69f43824f6))
|
|
7
|
+
|
|
1
8
|
## [1.45.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.45.1...v1.45.2) (2023-12-01)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.3",
|
|
4
4
|
"description": "Polyrepo management bash CLI tool. Run all git commands and yarn commands on multiple repositories. Also includes a few custom macros for cloning, installing, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
package/src/commands/upload.js
CHANGED
|
@@ -28,65 +28,62 @@ module.exports = async function upload(directory, args) {
|
|
|
28
28
|
console.log('Watching: ', directory)
|
|
29
29
|
fs.watch(directory, { recursive: true }, async (eventType, filename) => {
|
|
30
30
|
if (!filename.includes('CoCreate.config.js')) {
|
|
31
|
-
const filePath =
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (config) {
|
|
38
|
-
await file(config, configPath, filePath)
|
|
39
|
-
} else {
|
|
40
|
-
console.log('Failed to read or parse CoCreate.config.js.');
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
console.log('No CoCreate.config file found in parent directories.');
|
|
44
|
-
}
|
|
31
|
+
const { config, configPath, filePath } = await getConfig(directory, filename);
|
|
32
|
+
if (config) {
|
|
33
|
+
await file(config, configPath, filePath)
|
|
34
|
+
} else {
|
|
35
|
+
console.log('Failed to read or parse CoCreate.config.js.');
|
|
45
36
|
}
|
|
46
37
|
}
|
|
47
38
|
});
|
|
48
39
|
|
|
49
40
|
} else {
|
|
50
|
-
let CoCreateConfig
|
|
51
41
|
if (!args.length) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
directory = process.cwd()
|
|
43
|
+
const { config, configPath, filePath } = await getConfig(directory);
|
|
44
|
+
if (config) {
|
|
45
|
+
await file(config, configPath, filePath)
|
|
55
46
|
} else {
|
|
56
|
-
console.log('CoCreate.config.js
|
|
57
|
-
process.exit()
|
|
47
|
+
console.log('Failed to read or parse CoCreate.config.js.');
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
await file(CoCreateConfig, configPath)
|
|
61
|
-
|
|
62
50
|
} else {
|
|
63
51
|
for (let arg of args) {
|
|
52
|
+
let CoCreateConfig
|
|
53
|
+
|
|
64
54
|
try {
|
|
65
55
|
CoCreateConfig = JSON.parse(arg)
|
|
66
56
|
} catch (error) { }
|
|
67
57
|
|
|
68
58
|
|
|
69
59
|
if (!CoCreateConfig) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
console.log(arg + ' could not be found.')
|
|
79
|
-
process.exit()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
} catch (error) { }
|
|
60
|
+
const { config, configPath, filePath } = await getConfig(arg);
|
|
61
|
+
if (config) {
|
|
62
|
+
await file(config, configPath, filePath)
|
|
63
|
+
} else {
|
|
64
|
+
console.log('Failed to read or parse CoCreate.config.js.');
|
|
65
|
+
}
|
|
83
66
|
}
|
|
84
67
|
}
|
|
85
68
|
}
|
|
86
69
|
}
|
|
87
70
|
|
|
71
|
+
async function getConfig(directory, filename = '') {
|
|
72
|
+
const filePath = path.resolve(directory, filename);
|
|
73
|
+
if (!filePath.includes('node_modules')) {
|
|
74
|
+
const configPath = findClosestConfig(filePath)
|
|
75
|
+
if (configPath) {
|
|
76
|
+
return { config: require(configPath), configPath, filePath };
|
|
77
|
+
|
|
78
|
+
} else {
|
|
79
|
+
console.log('No CoCreate.config file found in parent directories.');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
88
85
|
function findClosestConfig(filePath) {
|
|
89
|
-
let currentDir =
|
|
86
|
+
let currentDir = filePath;
|
|
90
87
|
|
|
91
88
|
while (currentDir !== '/' && currentDir !== '.') {
|
|
92
89
|
let configFile = path.join(currentDir, 'CoCreate.config.js');
|