@cocreate/cli 1.54.2 → 1.56.1
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/.github/workflows/automated.yml +23 -35
- package/CHANGELOG.md +40 -0
- package/CoCreate.config.js +0 -4
- package/package.json +26 -5
- package/release.config.js +11 -3
- package/src/addMeta.js +62 -71
- package/src/coc.js +182 -113
- package/src/commands/clone.js +77 -28
- package/src/commands/delete.js +70 -0
- package/src/commands/download.js +72 -0
- package/src/commands/gitignore.js +57 -0
- package/src/commands/install.js +2 -5
- package/src/commands/link.js +212 -77
- package/src/commands/{symlink.js → other/symlink.js} +1 -1
- package/src/commands/upload.js +123 -89
- package/src/config.template.js +106 -0
- package/src/execute.js +102 -59
- package/src/getConfig.js +79 -19
- package/src/getOS.js +22 -0
- package/src/getPackageManager.js +46 -0
- package/src/postinstall.js +129 -0
- package/src/commands/fs/gitignore.js +0 -32
- /package/src/commands/{symlink-crm.js → other/symlink-crm.js} +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
name: Automated Workflow
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
6
|
- master
|
|
7
|
+
|
|
6
8
|
jobs:
|
|
7
9
|
about:
|
|
8
10
|
runs-on: ubuntu-latest
|
|
@@ -18,51 +20,37 @@ jobs:
|
|
|
18
20
|
with:
|
|
19
21
|
direction: overwrite-github
|
|
20
22
|
githubToken: "${{ secrets.GITHUB }}"
|
|
23
|
+
|
|
21
24
|
release:
|
|
22
25
|
runs-on: ubuntu-latest
|
|
23
26
|
steps:
|
|
24
27
|
- name: Checkout
|
|
25
28
|
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0 # Required so semantic-release can trace git tags/history
|
|
31
|
+
|
|
26
32
|
- name: Setup Node.js
|
|
27
33
|
uses: actions/setup-node@v4
|
|
28
34
|
with:
|
|
29
|
-
node-version: 22
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@semantic-release/changelog
|
|
35
|
+
node-version: 22
|
|
36
|
+
|
|
37
|
+
- name: Install Semantic Release & Plugins
|
|
38
|
+
# Installs semantic-release and its plugins on the runner
|
|
39
|
+
run: |
|
|
40
|
+
npm install -g semantic-release \
|
|
41
|
+
@semantic-release/changelog \
|
|
42
|
+
@semantic-release/npm \
|
|
43
|
+
@semantic-release/github \
|
|
36
44
|
@semantic-release/git
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
- name: Run Semantic Release (Native)
|
|
47
|
+
id: semantic
|
|
48
|
+
# This will automatically pick up your export default config file in the repository root
|
|
49
|
+
run: npx semantic-release
|
|
38
50
|
env:
|
|
39
|
-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
51
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
40
52
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
53
|
+
|
|
41
54
|
outputs:
|
|
42
55
|
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
43
|
-
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
44
|
-
upload:
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
needs: release
|
|
47
|
-
if: needs.release.outputs.new_release_published == 'true'
|
|
48
|
-
env:
|
|
49
|
-
VERSION: "${{ needs.release.outputs.new_release_version }}"
|
|
50
|
-
steps:
|
|
51
|
-
- name: Checkout
|
|
52
|
-
uses: actions/checkout@v3
|
|
53
|
-
- name: Setup Node.js
|
|
54
|
-
uses: actions/setup-node@v3
|
|
55
|
-
with:
|
|
56
|
-
node-version: 16
|
|
57
|
-
- name: Set npm registry auth
|
|
58
|
-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
59
|
-
- name: Install dependencies
|
|
60
|
-
run: yarn install
|
|
61
|
-
|
|
62
|
-
- name: Set Environment Variables
|
|
63
|
-
run: |
|
|
64
|
-
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
65
|
-
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
66
|
-
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
67
|
-
- name: CoCreate Upload
|
|
68
|
-
run: coc upload
|
|
56
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## [1.56.1](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.56.0...v1.56.1) (2026-07-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* correct import paths for getPackageManager and getOS in postinstall.js ([9e19fb7](https://github.com/CoCreate-app/CoCreate-cli/commit/9e19fb788fb0af71bef6ecb3f08e10a255a4a0e4))
|
|
7
|
+
|
|
8
|
+
# [1.56.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.55.0...v1.56.0) (2026-07-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* update automated workflow and release configuration for improved semantic release handling ([434e67a](https://github.com/CoCreate-app/CoCreate-cli/commit/434e67a98071a8d530f020a48b38b1c083f1d04e))
|
|
14
|
+
|
|
15
|
+
# [1.55.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.54.2...v1.55.0) (2026-07-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* correct variable name in download function for clarity in logging ([6273a5a](https://github.com/CoCreate-app/CoCreate-cli/commit/6273a5a8d25223e7bf343a191c7e9e933861211c))
|
|
21
|
+
* improve error handling and package.json loading in execute command ([0214b7e](https://github.com/CoCreate-app/CoCreate-cli/commit/0214b7e23c2bbd448dd8d7c18e52f30c36ab353d))
|
|
22
|
+
* removed post install ([435c87e](https://github.com/CoCreate-app/CoCreate-cli/commit/435c87e80d0733d23b019cb4692f23fa055050eb))
|
|
23
|
+
* replace argument escaping with spawn for real-time output in execute command ([056fdc3](https://github.com/CoCreate-app/CoCreate-cli/commit/056fdc3cd3c304b27aa35da8026cba974caff970))
|
|
24
|
+
* semantic version handling. Reorganize .gitignore for improved clarity and structure ([33fc5d4](https://github.com/CoCreate-app/CoCreate-cli/commit/33fc5d484159d02f00bffee6d1c9f1b6daecb81f))
|
|
25
|
+
* update dependencies to latest compatible versions in package.json ([077d517](https://github.com/CoCreate-app/CoCreate-cli/commit/077d517c999a848862889c88295222370bb16ec9))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* add config template and enhance config generation in coc.js ([ad0bbae](https://github.com/CoCreate-app/CoCreate-cli/commit/ad0bbae9b77e91401cd64b3b9b740d15effbf206))
|
|
31
|
+
* add getOS and getPackageManager functions for OS detection and package manager identification ([e679cff](https://github.com/CoCreate-app/CoCreate-cli/commit/e679cff72222b99b456ec0893b16892d4f06434c))
|
|
32
|
+
* add postinstall script for global linking of the CLI ([e23858b](https://github.com/CoCreate-app/CoCreate-cli/commit/e23858b0b071d82d6d608a18fca1364119d67319))
|
|
33
|
+
* download and delete commands for @cocreate/file integration ([3f354a6](https://github.com/CoCreate-app/CoCreate-cli/commit/3f354a6e524f983572721a89b5789609c3b4818f))
|
|
34
|
+
* enhance CLI configuration handling and repository execution logic ([684d372](https://github.com/CoCreate-app/CoCreate-cli/commit/684d3720e63f2e890884e60a752bf0c69e26ba9c))
|
|
35
|
+
* enhance getConfig function to support dynamic imports and improved error handling ([cc3ec8f](https://github.com/CoCreate-app/CoCreate-cli/commit/cc3ec8fde2e1a4531d2f11e63d49ddc98d7bb708))
|
|
36
|
+
* enhance getTargetNodeModulesPath function with improved error handling and regex matching for config files ([2d421ee](https://github.com/CoCreate-app/CoCreate-cli/commit/2d421eeaac87348802de21d64509c240534d5d25))
|
|
37
|
+
* enhance repository management commands with improved error handling and logging ([e925748](https://github.com/CoCreate-app/CoCreate-cli/commit/e9257482161caca3f00f3ca06abcd8e6820293ac))
|
|
38
|
+
* enhance upload command with debouncing for file watching and improved config handling ([25d9de3](https://github.com/CoCreate-app/CoCreate-cli/commit/25d9de317f8864a57eb101f68a63fa700d37d4ae))
|
|
39
|
+
* implement detection of external node_modules directory and active package manager ([d575a35](https://github.com/CoCreate-app/CoCreate-cli/commit/d575a359c5b1a6490179956af8a185903ab68633))
|
|
40
|
+
|
|
1
41
|
## [1.54.2](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.54.1...v1.54.2) (2026-02-04)
|
|
2
42
|
|
|
3
43
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.1",
|
|
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",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
+
"postinstall": "node src/postinstall.js",
|
|
19
20
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
20
21
|
"automated": "nodejs src/commands/fs/automated.js",
|
|
21
22
|
"bump": "node src/commands/fs/bump.js",
|
|
@@ -47,10 +48,30 @@
|
|
|
47
48
|
"coc": "src/coc.js"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"@cocreate/acme": "^1.3.
|
|
51
|
-
"@cocreate/config": "^1.13.
|
|
52
|
-
"@cocreate/file": "^1.
|
|
53
|
-
"@cocreate/nginx": "^1.4.
|
|
51
|
+
"@cocreate/acme": "^1.3.2",
|
|
52
|
+
"@cocreate/config": "^1.13.4",
|
|
53
|
+
"@cocreate/file": "^1.21.2",
|
|
54
|
+
"@cocreate/nginx": "^1.4.4",
|
|
54
55
|
"@google/generative-ai": "0.24.1"
|
|
56
|
+
},
|
|
57
|
+
"allowScripts": {
|
|
58
|
+
"@cocreate/acme@1.3.2": true,
|
|
59
|
+
"@cocreate/actions@1.21.4": true,
|
|
60
|
+
"@cocreate/api@1.22.5": true,
|
|
61
|
+
"@cocreate/config@1.13.4": true,
|
|
62
|
+
"@cocreate/crud-client@1.34.6": true,
|
|
63
|
+
"@cocreate/element-prototype@1.31.4": true,
|
|
64
|
+
"@cocreate/elements@1.42.9": true,
|
|
65
|
+
"@cocreate/filter@1.33.6": true,
|
|
66
|
+
"@cocreate/indexeddb@1.23.4": true,
|
|
67
|
+
"@cocreate/local-storage@1.16.5": true,
|
|
68
|
+
"@cocreate/nginx@1.4.4": true,
|
|
69
|
+
"@cocreate/observer@1.19.0": true,
|
|
70
|
+
"@cocreate/organizations@1.30.1": true,
|
|
71
|
+
"@cocreate/render@1.46.1": true,
|
|
72
|
+
"@cocreate/socket-client@1.40.5": true,
|
|
73
|
+
"@cocreate/utils@1.42.2": true,
|
|
74
|
+
"@cocreate/uuid@1.12.4": true,
|
|
75
|
+
"@cocreate/webpack@1.4.3": true
|
|
55
76
|
}
|
|
56
77
|
}
|
package/release.config.js
CHANGED
|
@@ -10,12 +10,20 @@ module.exports = {
|
|
|
10
10
|
changelogFile: "CHANGELOG.md",
|
|
11
11
|
},
|
|
12
12
|
],
|
|
13
|
-
"@semantic-release/npm",
|
|
14
|
-
"@semantic-release/github",
|
|
13
|
+
"@semantic-release/npm",
|
|
15
14
|
[
|
|
16
|
-
"@semantic-release/
|
|
15
|
+
"@semantic-release/github",
|
|
17
16
|
{
|
|
17
|
+
successComment: false,
|
|
18
|
+
failTitle: false,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"@semantic-release/git",
|
|
23
|
+
{
|
|
24
|
+
// Only stage and commit the changelog and package.json
|
|
18
25
|
assets: ["CHANGELOG.md", "package.json"],
|
|
26
|
+
message: "chore(release): ${nextRelease.version} [skip ci]",
|
|
19
27
|
},
|
|
20
28
|
],
|
|
21
29
|
],
|
package/src/addMeta.js
CHANGED
|
@@ -1,82 +1,73 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const util = require("node:util");
|
|
4
|
-
const exec = util.promisify(require("node:child_process").exec);
|
|
5
3
|
|
|
4
|
+
/**
|
|
5
|
+
* CLI-compatible function to enrich repository configurations with metadata
|
|
6
|
+
* (e.g. package.json details, dependency maps).
|
|
7
|
+
*
|
|
8
|
+
* @param {Array<Object>} repos - List of repository configuration items.
|
|
9
|
+
* @param {Array<Object>} failed - Reference list to register execution failures.
|
|
10
|
+
* @param {string} [directory] - Optional parent directory to override path resolution.
|
|
11
|
+
* @returns {Promise<Array<Object>>} Enriched repositories array.
|
|
12
|
+
*/
|
|
6
13
|
module.exports = async function addMeta(repos, failed, directory) {
|
|
7
|
-
|
|
8
|
-
for (let i = 0; i < repos.length; i++) {
|
|
9
|
-
repos[i].name = path.basename(repos[i].path);
|
|
10
|
-
repos[i].plainName = repos[i].name.substring(9);
|
|
14
|
+
const cwd = process.cwd();
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
repos[i].directory = parsedPath.dir;
|
|
16
|
-
}
|
|
16
|
+
for (let i = 0; i < repos.length; i++) {
|
|
17
|
+
const repo = repos[i];
|
|
18
|
+
if (!repo) continue;
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: repos[i].name,
|
|
23
|
-
error: "package json not found"
|
|
24
|
-
});
|
|
25
|
-
} else {
|
|
26
|
-
let packageObj;
|
|
27
|
-
try {
|
|
28
|
-
packageObj = require(packagejson);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error("packageObj", err.message);
|
|
31
|
-
}
|
|
20
|
+
const rawPath = repo.path || repo.absolutePath || repo.directory;
|
|
21
|
+
if (!rawPath) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
// Standard clean names resolution
|
|
26
|
+
const pathBasedName = path.basename(rawPath);
|
|
27
|
+
repo.name = repo.name || pathBasedName;
|
|
28
|
+
repo.plainName = repo.name.startsWith("CoCreate-")
|
|
29
|
+
? repo.name.substring(9)
|
|
30
|
+
: repo.name;
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
// Always calculate and resolve absolute paths first, even if package.json doesn't exist yet!
|
|
33
|
+
// This guarantees that commands like gitClone can run without crashing on undefined paths.
|
|
34
|
+
let resolvedAbsolutePath = null;
|
|
35
|
+
if (directory) {
|
|
36
|
+
resolvedAbsolutePath = path.resolve(directory, rawPath);
|
|
37
|
+
} else {
|
|
38
|
+
resolvedAbsolutePath = path.resolve(cwd, rawPath);
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else {
|
|
45
|
-
repos[i].packageManager = "npm";
|
|
46
|
-
let lockFile = path.resolve(
|
|
47
|
-
repos[i].absolutePath,
|
|
48
|
-
"package-lock.json"
|
|
49
|
-
);
|
|
50
|
-
if (!fs.existsSync(lockFile)) {
|
|
51
|
-
lockFile = path.resolve(
|
|
52
|
-
repos[i].absolutePath,
|
|
53
|
-
"pnpm-lock.yaml"
|
|
54
|
-
);
|
|
55
|
-
if (fs.existsSync(lockFile))
|
|
56
|
-
repos[i].packageManager = "pnpm";
|
|
57
|
-
else {
|
|
58
|
-
lockFile = path.resolve(
|
|
59
|
-
repos[i].absolutePath,
|
|
60
|
-
"yarn.lock"
|
|
61
|
-
);
|
|
62
|
-
if (fs.existsSync(lockFile))
|
|
63
|
-
repos[i].packageManager = "yarn";
|
|
64
|
-
else {
|
|
65
|
-
try {
|
|
66
|
-
const { error } = await exec(
|
|
67
|
-
"yarn --version"
|
|
68
|
-
);
|
|
69
|
-
if (!error)
|
|
70
|
-
repos[i].packageManager = "yarn";
|
|
71
|
-
} catch (e) {}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
packageManager = repos[i].packageManager;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
41
|
+
repo.absolutePath = repo.absolutePath || resolvedAbsolutePath;
|
|
42
|
+
repo.directory = repo.directory || path.dirname(resolvedAbsolutePath);
|
|
80
43
|
|
|
81
|
-
|
|
44
|
+
// Check if package.json exists. If not, silently skip metadata extraction.
|
|
45
|
+
const packageJsonPath = path.join(repo.absolutePath, "package.json");
|
|
46
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let packageObj;
|
|
51
|
+
try {
|
|
52
|
+
packageObj = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
53
|
+
} catch (err) {
|
|
54
|
+
// Only log and register real failures, such as corrupted JSON structure
|
|
55
|
+
console.error(`[addMeta] Error reading/parsing package.json at ${packageJsonPath}:`, err.message);
|
|
56
|
+
failed.push({
|
|
57
|
+
name: repo.name,
|
|
58
|
+
error: `[addMeta] failed to parse package.json: ${err.message}`
|
|
59
|
+
});
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
repo.packageName = packageObj.name;
|
|
64
|
+
|
|
65
|
+
repo.deps = Object.keys(packageObj.dependencies || {})
|
|
66
|
+
.filter((packageName) => packageName.startsWith("@cocreate/"));
|
|
67
|
+
|
|
68
|
+
repo.devDeps = Object.keys(packageObj.devDependencies || {})
|
|
69
|
+
.filter((packageName) => packageName.startsWith("@cocreate/"));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return repos;
|
|
82
73
|
};
|