@cocreate/cli 1.60.0 → 1.62.0
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/CoCreate.config.js +4 -157
- package/package.json +2 -20
- package/src/commands/link.js +268 -92
- package/src/commands/fs/automated.js +0 -159
- package/src/commands/fs/config.js +0 -133
- package/src/commands/fs/manual.js +0 -81
- package/src/commands/fs/prettier.config.js +0 -99
- package/src/commands/fs/readme.js +0 -138
- package/src/commands/fs/remove.js +0 -24
- package/src/commands/fs/replace.js +0 -35
package/CoCreate.config.js
CHANGED
|
@@ -28,9 +28,9 @@ module.exports = {
|
|
|
28
28
|
"fs/webpack"
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
path: "../../CoCreate-
|
|
33
|
-
repo: "github.com/CoCreate-app/CoCreate-
|
|
31
|
+
app: {
|
|
32
|
+
path: "../../CoCreate-app",
|
|
33
|
+
repo: "github.com/CoCreate-app/CoCreate-app.git",
|
|
34
34
|
exclude: [
|
|
35
35
|
"fs/webpack"
|
|
36
36
|
]
|
|
@@ -155,10 +155,6 @@ module.exports = {
|
|
|
155
155
|
path: "../CoCreate-indexeddb",
|
|
156
156
|
repo: "github.com/CoCreate-app/CoCreate-indexeddb.git"
|
|
157
157
|
},
|
|
158
|
-
industry: {
|
|
159
|
-
path: "../CoCreate-industry",
|
|
160
|
-
repo: "github.com/CoCreate-app/CoCreate-industry.git"
|
|
161
|
-
},
|
|
162
158
|
"lazy-loader": {
|
|
163
159
|
path: "../CoCreate-lazy-loader",
|
|
164
160
|
repo: "github.com/CoCreate-app/CoCreate-lazy-loader.git"
|
|
@@ -288,154 +284,6 @@ module.exports = {
|
|
|
288
284
|
path: "../CoCreate-vdom",
|
|
289
285
|
repo: "github.com/CoCreate-app/CoCreate-vdom.git"
|
|
290
286
|
},
|
|
291
|
-
|
|
292
|
-
builder: {
|
|
293
|
-
path: "../../CoCreate-apps/CoCreate-builder",
|
|
294
|
-
repo: "github.com/CoCreate-app/CoCreate-builder.git",
|
|
295
|
-
exclude: [
|
|
296
|
-
"fs/webpack"
|
|
297
|
-
]
|
|
298
|
-
},
|
|
299
|
-
dashboard: {
|
|
300
|
-
path: "../../CoCreate-apps/CoCreate-dashboard",
|
|
301
|
-
repo: "github.com/CoCreate-app/CoCreate-dashboard.git",
|
|
302
|
-
exclude: [
|
|
303
|
-
"fs/webpack"
|
|
304
|
-
]
|
|
305
|
-
},
|
|
306
|
-
datatable: {
|
|
307
|
-
path: "../../CoCreate-apps/CoCreate-datatable",
|
|
308
|
-
repo: "github.com/CoCreate-app/CoCreate-datatable.git",
|
|
309
|
-
exclude: [
|
|
310
|
-
"fs/webpack"
|
|
311
|
-
]
|
|
312
|
-
},
|
|
313
|
-
kanban: {
|
|
314
|
-
path: "../../CoCreate-apps/CoCreate-kanban",
|
|
315
|
-
repo: "github.com/CoCreate-app/CoCreate-kanban.git",
|
|
316
|
-
exclude: [
|
|
317
|
-
"fs/webpack"
|
|
318
|
-
]
|
|
319
|
-
},
|
|
320
|
-
sandbox: {
|
|
321
|
-
path: "../../CoCreate-apps/CoCreate-sandbox",
|
|
322
|
-
repo: "github.com/CoCreate-app/CoCreate-sandbox.git",
|
|
323
|
-
exclude: [
|
|
324
|
-
"fs/webpack"
|
|
325
|
-
]
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
charts: {
|
|
329
|
-
path: "../../CoCreate-plugins/CoCreate-charts",
|
|
330
|
-
repo: "github.com/CoCreate-app/CoCreate-charts.git"
|
|
331
|
-
},
|
|
332
|
-
"alpha-vantage": {
|
|
333
|
-
path: "../../CoCreate-plugins/CoCreate-alpha-vantage",
|
|
334
|
-
repo: "github.com/CoCreate-app/CoCreate-alpha-vantage.git"
|
|
335
|
-
},
|
|
336
|
-
aos: {
|
|
337
|
-
path: "../../CoCreate-plugins/CoCreate-aos",
|
|
338
|
-
repo: "github.com/CoCreate-app/CoCreate-aos.git"
|
|
339
|
-
},
|
|
340
|
-
croppie: {
|
|
341
|
-
path: "../../CoCreate-plugins/CoCreate-croppie",
|
|
342
|
-
repo: "github.com/CoCreate-app/CoCreate-croppie.git"
|
|
343
|
-
},
|
|
344
|
-
domain: {
|
|
345
|
-
path: "../../CoCreate-plugins/CoCreate-domain",
|
|
346
|
-
repo: "github.com/CoCreate-app/CoCreate-domain.git"
|
|
347
|
-
},
|
|
348
|
-
fabric: {
|
|
349
|
-
path: "../../CoCreate-plugins/CoCreate-fabric",
|
|
350
|
-
repo: "github.com/CoCreate-app/CoCreate-fabric.git"
|
|
351
|
-
},
|
|
352
|
-
facebook: {
|
|
353
|
-
path: "../../CoCreate-plugins/CoCreate-facebook",
|
|
354
|
-
repo: "github.com/CoCreate-app/CoCreate-facebook.git"
|
|
355
|
-
},
|
|
356
|
-
fullcalendar: {
|
|
357
|
-
path: "../../CoCreate-plugins/CoCreate-fullcalendar",
|
|
358
|
-
repo: "github.com/CoCreate-app/CoCreate-fullcalendar.git"
|
|
359
|
-
},
|
|
360
|
-
ffmpeg: {
|
|
361
|
-
path: "../../CoCreate-plugins/CoCreate-ffmpeg",
|
|
362
|
-
repo: "github.com/CoCreate-app/CoCreate-ffmpeg.git",
|
|
363
|
-
exclude: [
|
|
364
|
-
"fs/webpack"
|
|
365
|
-
]
|
|
366
|
-
},
|
|
367
|
-
"google-maps": {
|
|
368
|
-
path: "../../CoCreate-plugins/CoCreate-google-maps",
|
|
369
|
-
repo: "github.com/CoCreate-app/CoCreate-google-maps.git"
|
|
370
|
-
},
|
|
371
|
-
"google-auth": {
|
|
372
|
-
path: "../../CoCreate-plugins/CoCreate-google-auth",
|
|
373
|
-
repo: "github.com/CoCreate-app/CoCreate-google-auth.git"
|
|
374
|
-
},
|
|
375
|
-
instagram: {
|
|
376
|
-
path: "../../CoCreate-plugins/CoCreate-instagram",
|
|
377
|
-
repo: "github.com/CoCreate-app/CoCreate-instagram.git"
|
|
378
|
-
},
|
|
379
|
-
lighthouse: {
|
|
380
|
-
path: "../../CoCreate-plugins/CoCreate-lighthouse",
|
|
381
|
-
repo: "github.com/CoCreate-app/CoCreate-lighthouse.git"
|
|
382
|
-
},
|
|
383
|
-
linkedin: {
|
|
384
|
-
path: "../../CoCreate-plugins/CoCreate-linkedin",
|
|
385
|
-
repo: "github.com/CoCreate-app/CoCreate-linkedin.git"
|
|
386
|
-
},
|
|
387
|
-
marked: {
|
|
388
|
-
path: "../../CoCreate-plugins/CoCreate-marked",
|
|
389
|
-
repo: "github.com/CoCreate-app/CoCreate-marked.git"
|
|
390
|
-
},
|
|
391
|
-
mongodb: {
|
|
392
|
-
path: "../../CoCreate-plugins/CoCreate-mongodb",
|
|
393
|
-
repo: "github.com/CoCreate-app/CoCreate-mongodb.git",
|
|
394
|
-
exclude: [
|
|
395
|
-
"fs/webpack"
|
|
396
|
-
]
|
|
397
|
-
},
|
|
398
|
-
openai: {
|
|
399
|
-
path: "../../CoCreate-plugins/CoCreate-openai",
|
|
400
|
-
repo: "github.com/CoCreate-app/CoCreate-openai.git"
|
|
401
|
-
},
|
|
402
|
-
pickr: {
|
|
403
|
-
path: "../../CoCreate-plugins/CoCreate-pickr",
|
|
404
|
-
repo: "github.com/CoCreate-app/CoCreate-pickr.git"
|
|
405
|
-
},
|
|
406
|
-
pinterest: {
|
|
407
|
-
path: "../../CoCreate-plugins/CoCreate-pinterest",
|
|
408
|
-
repo: "github.com/CoCreate-app/CoCreate-pinterest.git"
|
|
409
|
-
},
|
|
410
|
-
plaid: {
|
|
411
|
-
path: "../../CoCreate-plugins/CoCreate-plaid",
|
|
412
|
-
repo: "github.com/CoCreate-app/CoCreate-plaid.git"
|
|
413
|
-
},
|
|
414
|
-
prism: {
|
|
415
|
-
path: "../../CoCreate-plugins/CoCreate-prism",
|
|
416
|
-
repo: "github.com/CoCreate-app/CoCreate-prism.git"
|
|
417
|
-
},
|
|
418
|
-
sendgrid: {
|
|
419
|
-
path: "../../CoCreate-plugins/CoCreate-sendgrid",
|
|
420
|
-
repo: "github.com/CoCreate-app/CoCreate-sendgrid.git"
|
|
421
|
-
},
|
|
422
|
-
shipengine: {
|
|
423
|
-
path: "../../CoCreate-plugins/CoCreate-shipengine",
|
|
424
|
-
repo: "github.com/CoCreate-app/CoCreate-shipengine.git"
|
|
425
|
-
},
|
|
426
|
-
stripe: {
|
|
427
|
-
path: "../../CoCreate-plugins/CoCreate-stripe",
|
|
428
|
-
repo: "github.com/CoCreate-app/CoCreate-stripe.git"
|
|
429
|
-
},
|
|
430
|
-
twilio: {
|
|
431
|
-
path: "../../CoCreate-plugins/CoCreate-twilio",
|
|
432
|
-
repo: "github.com/CoCreate-app/CoCreate-twilio.git"
|
|
433
|
-
},
|
|
434
|
-
twitter: {
|
|
435
|
-
path: "../../CoCreate-plugins/CoCreate-twitter",
|
|
436
|
-
repo: "github.com/CoCreate-app/CoCreate-twitter.git"
|
|
437
|
-
},
|
|
438
|
-
|
|
439
287
|
cocreatews: {
|
|
440
288
|
path: "../../CoCreateWS",
|
|
441
289
|
repo: "github.com/CoCreate-app/CoCreateWS.git",
|
|
@@ -541,6 +389,5 @@ module.exports = {
|
|
|
541
389
|
"fs/webpack"
|
|
542
390
|
]
|
|
543
391
|
}
|
|
544
|
-
}
|
|
545
|
-
"hideMessage": false
|
|
392
|
+
}
|
|
546
393
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
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",
|
|
@@ -48,27 +48,9 @@
|
|
|
48
48
|
"coc": "src/coc.js"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cocreate/certificates": "^1.
|
|
51
|
+
"@cocreate/certificates": "^1.10.0",
|
|
52
52
|
"@cocreate/config": "^1.17.0",
|
|
53
53
|
"@cocreate/file": "^1.23.0",
|
|
54
54
|
"@google/genai": "2.15.0"
|
|
55
|
-
},
|
|
56
|
-
"allowScripts": {
|
|
57
|
-
"@cocreate/certificates@1.3.2": true,
|
|
58
|
-
"@cocreate/actions@1.21.4": true,
|
|
59
|
-
"@cocreate/api@1.22.5": true,
|
|
60
|
-
"@cocreate/config@1.13.4": true,
|
|
61
|
-
"@cocreate/crud-client@1.34.6": true,
|
|
62
|
-
"@cocreate/element-prototype@1.31.4": true,
|
|
63
|
-
"@cocreate/elements@1.42.9": true,
|
|
64
|
-
"@cocreate/filter@1.33.6": true,
|
|
65
|
-
"@cocreate/indexeddb@1.23.4": true,
|
|
66
|
-
"@cocreate/local-storage@1.16.5": true,
|
|
67
|
-
"@cocreate/observer@1.19.0": true,
|
|
68
|
-
"@cocreate/organizations@1.30.1": true,
|
|
69
|
-
"@cocreate/render@1.46.1": true,
|
|
70
|
-
"@cocreate/socket-client@1.40.5": true,
|
|
71
|
-
"@cocreate/utils@1.42.2": true,
|
|
72
|
-
"@cocreate/webpack@1.4.3": true
|
|
73
55
|
}
|
|
74
56
|
}
|
package/src/commands/link.js
CHANGED
|
@@ -10,21 +10,20 @@ const { isWindows } = getOS();
|
|
|
10
10
|
* Resolves the configured target node_modules directory path.
|
|
11
11
|
* Targeted check: parses RC files only associated with the active package manager.
|
|
12
12
|
*
|
|
13
|
+
* @param {string} targetDir - Base directory to check for package manager configuration.
|
|
13
14
|
* @param {string} packageManager - The active package manager name (npm, pnpm, yarn-classic, yarn-berry, bun).
|
|
14
15
|
* @returns {string} Fully resolved path to the node_modules folder.
|
|
15
16
|
*/
|
|
16
|
-
function getTargetNodeModulesPath(packageManager) {
|
|
17
|
-
const cwd = process.cwd();
|
|
18
|
-
|
|
17
|
+
function getTargetNodeModulesPath(targetDir, packageManager) {
|
|
19
18
|
// Check .npmrc config if utilizing npm or pnpm
|
|
20
19
|
if (packageManager === "npm" || packageManager === "pnpm") {
|
|
21
|
-
const npmrcPath = path.join(
|
|
20
|
+
const npmrcPath = path.join(targetDir, ".npmrc");
|
|
22
21
|
if (fs.existsSync(npmrcPath)) {
|
|
23
22
|
try {
|
|
24
23
|
const content = fs.readFileSync(npmrcPath, "utf-8");
|
|
25
24
|
const match = content.match(/^\s*modules-dir\s*=\s*["']?([^"'\r\n#;]+)["']?/m);
|
|
26
25
|
if (match && match[1]) {
|
|
27
|
-
return path.resolve(
|
|
26
|
+
return path.resolve(targetDir, match[1].trim());
|
|
28
27
|
}
|
|
29
28
|
} catch (e) {
|
|
30
29
|
// Gracefully ignore reading errors
|
|
@@ -34,13 +33,13 @@ function getTargetNodeModulesPath(packageManager) {
|
|
|
34
33
|
|
|
35
34
|
// Check .yarnrc config if utilizing Yarn (Classic or Berry configured for custom folders)
|
|
36
35
|
if (packageManager === "yarn-classic" || packageManager === "yarn-berry") {
|
|
37
|
-
const yarnrcPath = path.join(
|
|
36
|
+
const yarnrcPath = path.join(targetDir, ".yarnrc");
|
|
38
37
|
if (fs.existsSync(yarnrcPath)) {
|
|
39
38
|
try {
|
|
40
39
|
const content = fs.readFileSync(yarnrcPath, "utf-8");
|
|
41
40
|
const match = content.match(/^\s*--(?:install\.)?modules-folder\s+["']?([^"'\r\n#]+)["']?/m);
|
|
42
41
|
if (match && match[1]) {
|
|
43
|
-
return path.resolve(
|
|
42
|
+
return path.resolve(targetDir, match[1].trim());
|
|
44
43
|
}
|
|
45
44
|
} catch (e) {
|
|
46
45
|
// Gracefully ignore reading errors
|
|
@@ -49,29 +48,221 @@ function getTargetNodeModulesPath(packageManager) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
// Fallback to default
|
|
52
|
-
return path.resolve(
|
|
51
|
+
return path.resolve(targetDir, "node_modules");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Builds a fast lookup dictionary mapping package names (e.g. "@cocreate/utils")
|
|
56
|
+
* to their absolute local filesystem paths.
|
|
57
|
+
*
|
|
58
|
+
* @param {Array<Object>} repos - Array of repository configurations.
|
|
59
|
+
* @param {string} cwd - Active working directory.
|
|
60
|
+
* @returns {Map<string, Object>} Map of package names to repo objects.
|
|
61
|
+
*/
|
|
62
|
+
function buildWorkspaceMap(repos, cwd) {
|
|
63
|
+
const map = new Map();
|
|
64
|
+
|
|
65
|
+
for (const repo of repos) {
|
|
66
|
+
if (!repo) continue;
|
|
67
|
+
const rawPath = repo.path || repo.absolutePath || repo.directory;
|
|
68
|
+
if (!rawPath) continue;
|
|
69
|
+
|
|
70
|
+
const absolutePath = repo.absolutePath || path.resolve(cwd, rawPath);
|
|
71
|
+
if (!fs.existsSync(absolutePath)) continue;
|
|
72
|
+
|
|
73
|
+
let packageName = repo.packageName;
|
|
74
|
+
const packageJsonPath = path.join(absolutePath, "package.json");
|
|
75
|
+
|
|
76
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
77
|
+
try {
|
|
78
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
79
|
+
packageName = pkg.name || packageName;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
// Ignore parse errors
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
packageName = packageName || path.basename(absolutePath);
|
|
86
|
+
|
|
87
|
+
const repoMeta = {
|
|
88
|
+
...repo,
|
|
89
|
+
packageName,
|
|
90
|
+
absolutePath,
|
|
91
|
+
directory: path.dirname(absolutePath),
|
|
92
|
+
name: repo.name || path.basename(absolutePath)
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
map.set(packageName, repoMeta);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return map;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Reads a directory's package.json and extracts all declared dependencies
|
|
103
|
+
* (dependencies, devDependencies, and peerDependencies).
|
|
104
|
+
*
|
|
105
|
+
* @param {string} repoPath - Absolute path to package repository.
|
|
106
|
+
* @returns {Array<string>} List of declared dependency names.
|
|
107
|
+
*/
|
|
108
|
+
function getPackageDependencies(repoPath) {
|
|
109
|
+
const packageJsonPath = path.join(repoPath, "package.json");
|
|
110
|
+
if (!fs.existsSync(packageJsonPath)) return [];
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
114
|
+
const deps = new Set([
|
|
115
|
+
...Object.keys(pkg.dependencies || {}),
|
|
116
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
117
|
+
...Object.keys(pkg.peerDependencies || {})
|
|
118
|
+
]);
|
|
119
|
+
return Array.from(deps);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Recursively links a local repository and its local sibling dependencies.
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} repo - Target repository object.
|
|
129
|
+
* @param {Map<string, Object>} workspaceMap - Available local workspace repos.
|
|
130
|
+
* @param {Object} options - Command options (useSymlink, packageManager, binName, failed, linkedPairs, depth).
|
|
131
|
+
* @param {Set<string>} visited - Track visited packages to prevent circular loops.
|
|
132
|
+
*/
|
|
133
|
+
async function linkRepoAndDependencies(repo, workspaceMap, options, visited = new Set()) {
|
|
134
|
+
const { useSymlink, packageManager, binName, failed, linkedPairs, stats, depth = 1 } = options;
|
|
135
|
+
|
|
136
|
+
// Circular dependency prevention guard
|
|
137
|
+
if (visited.has(repo.absolutePath)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
visited.add(repo.absolutePath);
|
|
141
|
+
|
|
142
|
+
const declaredDeps = getPackageDependencies(repo.absolutePath);
|
|
143
|
+
const localDepsToLink = [];
|
|
144
|
+
|
|
145
|
+
// Identify which declared dependencies exist in local workspace
|
|
146
|
+
for (const depName of declaredDeps) {
|
|
147
|
+
if (workspaceMap.has(depName)) {
|
|
148
|
+
const depRepo = workspaceMap.get(depName);
|
|
149
|
+
// Avoid self-linking
|
|
150
|
+
if (depRepo.absolutePath !== repo.absolutePath) {
|
|
151
|
+
localDepsToLink.push(depRepo);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (localDepsToLink.length === 0) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const targetNodeModules = getTargetNodeModulesPath(repo.absolutePath, packageManager);
|
|
161
|
+
const indent = " ".repeat(depth);
|
|
162
|
+
|
|
163
|
+
for (let i = 0; i < localDepsToLink.length; i++) {
|
|
164
|
+
const depRepo = localDepsToLink[i];
|
|
165
|
+
const pairKey = `${repo.packageName}->${depRepo.packageName}`;
|
|
166
|
+
|
|
167
|
+
// Skip re-linking identical pairs to avoid redundant I/O and console clutter
|
|
168
|
+
if (linkedPairs.has(pairKey)) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
linkedPairs.add(pairKey);
|
|
172
|
+
|
|
173
|
+
const isLast = i === localDepsToLink.length - 1;
|
|
174
|
+
const branchChar = isLast ? "└─" : "├─";
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
if (useSymlink) {
|
|
178
|
+
// Direct Symlink Mode
|
|
179
|
+
const linkDestination = path.join(targetNodeModules, depRepo.packageName);
|
|
180
|
+
const sourcePath = path.resolve(depRepo.absolutePath);
|
|
181
|
+
|
|
182
|
+
await fs.promises.mkdir(path.dirname(linkDestination), { recursive: true });
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
const stat = await fs.promises.lstat(linkDestination);
|
|
186
|
+
if (stat.isSymbolicLink() || stat.isFile()) {
|
|
187
|
+
await fs.promises.unlink(linkDestination);
|
|
188
|
+
} else {
|
|
189
|
+
await fs.promises.rm(linkDestination, { recursive: true, force: true });
|
|
190
|
+
}
|
|
191
|
+
} catch (e) {
|
|
192
|
+
// Path does not exist yet
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const type = isWindows ? "junction" : "dir";
|
|
196
|
+
await fs.promises.symlink(sourcePath, linkDestination, type);
|
|
197
|
+
|
|
198
|
+
console.log(`${indent}${branchChar} 🔗 ${depRepo.packageName}`);
|
|
199
|
+
stats.totalSymlinks++;
|
|
200
|
+
} else {
|
|
201
|
+
// Package Manager CLI Link Mode
|
|
202
|
+
if (packageManager === "pnpm" || packageManager === "yarn-berry") {
|
|
203
|
+
let linkCode = await spawn(binName, ["link", depRepo.absolutePath], {
|
|
204
|
+
cwd: repo.absolutePath,
|
|
205
|
+
shell: true,
|
|
206
|
+
stdio: "pipe"
|
|
207
|
+
});
|
|
208
|
+
if (linkCode !== 0) throw new Error(`Link execution failed`);
|
|
209
|
+
} else {
|
|
210
|
+
// 2-Step linking for npm / Yarn Classic / Bun
|
|
211
|
+
let regCode = await spawn(binName, ["link"], {
|
|
212
|
+
cwd: depRepo.absolutePath,
|
|
213
|
+
shell: true,
|
|
214
|
+
stdio: "pipe"
|
|
215
|
+
});
|
|
216
|
+
if (regCode !== 0) throw new Error(`Global registration failed`);
|
|
217
|
+
|
|
218
|
+
let linkCode = await spawn(binName, ["link", depRepo.packageName], {
|
|
219
|
+
cwd: repo.absolutePath,
|
|
220
|
+
shell: true,
|
|
221
|
+
stdio: "pipe"
|
|
222
|
+
});
|
|
223
|
+
if (linkCode !== 0) throw new Error(`Link command failed`);
|
|
224
|
+
}
|
|
225
|
+
console.log(`${indent}${branchChar} 🔗 ${depRepo.packageName}`);
|
|
226
|
+
stats.totalSymlinks++;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Recurse down the dependency tree for the nested dependency
|
|
230
|
+
await linkRepoAndDependencies(depRepo, workspaceMap, {
|
|
231
|
+
...options,
|
|
232
|
+
depth: depth + 1
|
|
233
|
+
}, visited);
|
|
234
|
+
|
|
235
|
+
} catch (err) {
|
|
236
|
+
failed.push({
|
|
237
|
+
name: `${repo.packageName} -> ${depRepo.packageName}`,
|
|
238
|
+
error: err.message
|
|
239
|
+
});
|
|
240
|
+
console.error(`${indent}${branchChar} ❌ ${depRepo.packageName} (${err.message})`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
53
243
|
}
|
|
54
244
|
|
|
55
245
|
/**
|
|
56
246
|
* CLI-compatible link command that establishes local connections using
|
|
57
|
-
* direct symlinking (fast mode) or the host system's package manager
|
|
247
|
+
* direct symlinking (fast mode) or the host system's package manager,
|
|
248
|
+
* recursively traversing and linking local dependencies tree-wide.
|
|
58
249
|
*
|
|
59
250
|
* @param {Array<Object>} repos - Array of repository configurations.
|
|
60
251
|
* @param {Array<string>} args - Process arguments passed to the CLI command.
|
|
61
252
|
* @returns {Promise<Array<Object>>} List of packages that encountered real errors.
|
|
62
253
|
*/
|
|
63
254
|
module.exports = async (repos, args) => {
|
|
255
|
+
const startTime = Date.now();
|
|
64
256
|
const failed = [];
|
|
65
257
|
const packageManager = getPackageManager();
|
|
66
258
|
const cwd = process.cwd();
|
|
67
|
-
|
|
68
|
-
// Convert generic internal yarn manager labels to
|
|
259
|
+
|
|
260
|
+
// Convert generic internal yarn manager labels to standard executable binary name
|
|
69
261
|
const binName = (packageManager === "yarn-classic" || packageManager === "yarn-berry")
|
|
70
262
|
? "yarn"
|
|
71
263
|
: packageManager;
|
|
72
|
-
|
|
264
|
+
|
|
73
265
|
const useSymlink = args && args.includes("--symlink");
|
|
74
|
-
let targetNodeModules = null;
|
|
75
266
|
|
|
76
267
|
// --- PLUG'N'PLAY DETECTION & SHORT-CIRCUIT ---
|
|
77
268
|
const isPnp = packageManager === "yarn-berry" && (
|
|
@@ -85,20 +276,17 @@ module.exports = async (repos, args) => {
|
|
|
85
276
|
return failed;
|
|
86
277
|
}
|
|
87
278
|
|
|
88
|
-
console.log(
|
|
279
|
+
console.log(`\n==================================================`);
|
|
280
|
+
console.log(` Active Package Manager: ${packageManager.toUpperCase()}`);
|
|
281
|
+
console.log(` Linking Strategy: ${useSymlink ? "Direct Symlink (Fast)" : "Package Manager CLI"}`);
|
|
282
|
+
console.log(`==================================================\n`);
|
|
89
283
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
console.log(`[Symlink Mode] Target: ${relativeTargetDir}\n`);
|
|
284
|
+
const workspaceMap = buildWorkspaceMap(repos, cwd);
|
|
285
|
+
const linkedPairs = new Set();
|
|
286
|
+
const stats = { primaryPackages: 0, totalSymlinks: 0 };
|
|
95
287
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
console.log("");
|
|
101
|
-
}
|
|
288
|
+
const filterableRepos = repos.filter(r => r && (!r.exclude || !r.exclude.includes("link")));
|
|
289
|
+
let currentIdx = 0;
|
|
102
290
|
|
|
103
291
|
for (let repo of repos) {
|
|
104
292
|
if (!repo) continue;
|
|
@@ -107,42 +295,33 @@ module.exports = async (repos, args) => {
|
|
|
107
295
|
const rawPath = repo.path || repo.absolutePath || repo.directory;
|
|
108
296
|
if (!rawPath) continue;
|
|
109
297
|
|
|
110
|
-
|
|
111
|
-
repo.absolutePath = repo.absolutePath || path.resolve(cwd, rawPath);
|
|
112
|
-
repo.directory = repo.directory || path.dirname(repo.absolutePath);
|
|
113
|
-
repo.name = repo.name || path.basename(repo.absolutePath);
|
|
298
|
+
const absolutePath = repo.absolutePath || path.resolve(cwd, rawPath);
|
|
114
299
|
|
|
115
|
-
// Do not process current execution folder inside
|
|
116
|
-
if (cwd ===
|
|
300
|
+
// Do not process current execution folder directly inside root loop
|
|
301
|
+
if (cwd === absolutePath) continue;
|
|
117
302
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// Verify package directory exists on local disk
|
|
121
|
-
if (!fs.existsSync(repo.absolutePath)) {
|
|
122
|
-
console.log(`Skipped (not found): ${relativeRepoPath}`);
|
|
303
|
+
if (!fs.existsSync(absolutePath)) {
|
|
304
|
+
console.log(`Skipped (not found): ${path.relative(cwd, absolutePath)}`);
|
|
123
305
|
continue;
|
|
124
306
|
}
|
|
125
307
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
repo.packageName = packageObj.name;
|
|
133
|
-
} catch (e) {
|
|
134
|
-
// Ignore reading errors
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
repo.packageName = repo.packageName || repo.name;
|
|
138
|
-
}
|
|
308
|
+
currentIdx++;
|
|
309
|
+
const repoMeta = workspaceMap.get(repo.packageName) || {
|
|
310
|
+
...repo,
|
|
311
|
+
absolutePath,
|
|
312
|
+
packageName: repo.packageName || path.basename(absolutePath)
|
|
313
|
+
};
|
|
139
314
|
|
|
315
|
+
stats.primaryPackages++;
|
|
316
|
+
console.log(`[${currentIdx}/${filterableRepos.length}] 📦 ${repoMeta.packageName}`);
|
|
317
|
+
|
|
318
|
+
// Perform top-level link into current workspace root
|
|
140
319
|
try {
|
|
320
|
+
const rootNodeModules = getTargetNodeModulesPath(cwd, packageManager);
|
|
141
321
|
if (useSymlink) {
|
|
142
|
-
const linkDestination = path.join(
|
|
143
|
-
const sourcePath = path.resolve(repo.absolutePath);
|
|
144
|
-
|
|
322
|
+
const linkDestination = path.join(rootNodeModules, repoMeta.packageName);
|
|
145
323
|
await fs.promises.mkdir(path.dirname(linkDestination), { recursive: true });
|
|
324
|
+
|
|
146
325
|
try {
|
|
147
326
|
const stat = await fs.promises.lstat(linkDestination);
|
|
148
327
|
if (stat.isSymbolicLink() || stat.isFile()) {
|
|
@@ -153,65 +332,62 @@ module.exports = async (repos, args) => {
|
|
|
153
332
|
} catch (e) {}
|
|
154
333
|
|
|
155
334
|
const type = isWindows ? "junction" : "dir";
|
|
156
|
-
await fs.promises.symlink(
|
|
157
|
-
|
|
158
|
-
console.log(`Successfully symlinked: ${relativeRepoPath} -> node_modules/${repo.packageName}`);
|
|
335
|
+
await fs.promises.symlink(repoMeta.absolutePath, linkDestination, type);
|
|
336
|
+
stats.totalSymlinks++;
|
|
159
337
|
} else {
|
|
160
|
-
|
|
161
|
-
// --- 1-STEP DIRECT PATH LINKING (pnpm & Yarn Berry) ---
|
|
162
338
|
if (packageManager === "pnpm" || packageManager === "yarn-berry") {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
let linkCode = await spawn(binName, ["link", repo.absolutePath], {
|
|
166
|
-
cwd: cwd,
|
|
339
|
+
let linkCode = await spawn(binName, ["link", repoMeta.absolutePath], {
|
|
340
|
+
cwd,
|
|
167
341
|
shell: true,
|
|
168
|
-
stdio: "
|
|
342
|
+
stdio: "pipe"
|
|
169
343
|
});
|
|
170
|
-
|
|
171
|
-
if (linkCode !== 0) {
|
|
172
|
-
throw new Error(`Execution failed`);
|
|
173
|
-
}
|
|
174
|
-
|
|
344
|
+
if (linkCode !== 0) throw new Error("Execution failed");
|
|
175
345
|
} else {
|
|
176
|
-
// --- 2-STEP GLOBAL REGISTRY LINKING (npm, Yarn Classic, Bun) ---
|
|
177
|
-
console.log(`Registering: ${repo.packageName}...`);
|
|
178
|
-
|
|
179
346
|
let regCode = await spawn(binName, ["link"], {
|
|
180
|
-
cwd:
|
|
347
|
+
cwd: repoMeta.absolutePath,
|
|
181
348
|
shell: true,
|
|
182
|
-
stdio: "
|
|
349
|
+
stdio: "pipe"
|
|
183
350
|
});
|
|
351
|
+
if (regCode !== 0) throw new Error("Global registration failed");
|
|
184
352
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
console.log(`Linking: ${repo.packageName}...`);
|
|
190
|
-
|
|
191
|
-
let linkCode = await spawn(binName, ["link", repo.packageName], {
|
|
192
|
-
cwd: cwd,
|
|
353
|
+
let linkCode = await spawn(binName, ["link", repoMeta.packageName], {
|
|
354
|
+
cwd,
|
|
193
355
|
shell: true,
|
|
194
|
-
stdio: "
|
|
356
|
+
stdio: "pipe"
|
|
195
357
|
});
|
|
196
|
-
|
|
197
|
-
if (linkCode !== 0) {
|
|
198
|
-
throw new Error(`Host linkage failed`);
|
|
199
|
-
}
|
|
358
|
+
if (linkCode !== 0) throw new Error("Host linkage failed");
|
|
200
359
|
}
|
|
201
|
-
|
|
202
|
-
console.log(`Successfully linked: ${repo.packageName}`);
|
|
203
|
-
console.log("");
|
|
360
|
+
stats.totalSymlinks++;
|
|
204
361
|
}
|
|
205
|
-
|
|
206
362
|
} catch (err) {
|
|
207
|
-
// Log failure message and append package metadata for downstream retrying steps
|
|
208
363
|
failed.push({
|
|
209
|
-
name:
|
|
364
|
+
name: repoMeta.packageName,
|
|
210
365
|
error: err.message
|
|
211
366
|
});
|
|
212
|
-
console.error(`Failed
|
|
367
|
+
console.error(` ❌ Failed primary link: ${repoMeta.packageName} (${err.message})`);
|
|
213
368
|
}
|
|
369
|
+
|
|
370
|
+
const visited = new Set();
|
|
371
|
+
await linkRepoAndDependencies(repoMeta, workspaceMap, {
|
|
372
|
+
useSymlink,
|
|
373
|
+
packageManager,
|
|
374
|
+
binName,
|
|
375
|
+
failed,
|
|
376
|
+
linkedPairs,
|
|
377
|
+
stats,
|
|
378
|
+
depth: 1
|
|
379
|
+
}, visited);
|
|
214
380
|
}
|
|
215
381
|
|
|
382
|
+
const durationSec = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
383
|
+
|
|
384
|
+
console.log(`\n--------------------------------------------------`);
|
|
385
|
+
console.log(`✨ Linking Complete!`);
|
|
386
|
+
console.log(` Primary Packages Processed: ${stats.primaryPackages}`);
|
|
387
|
+
console.log(` Total Connections Linked: ${stats.totalSymlinks}`);
|
|
388
|
+
console.log(` Errors Encountered: ${failed.length}`);
|
|
389
|
+
console.log(` Time Elapsed: ${durationSec}s`);
|
|
390
|
+
console.log(`--------------------------------------------------\n`);
|
|
391
|
+
|
|
216
392
|
return failed;
|
|
217
393
|
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
function findDirectories(startPath, callback, fileName) {
|
|
5
|
-
// Resolve relative paths to absolute paths if needed
|
|
6
|
-
const resolvedPath =
|
|
7
|
-
startPath.startsWith("./") || startPath.startsWith("../")
|
|
8
|
-
? path.resolve(startPath)
|
|
9
|
-
: startPath;
|
|
10
|
-
|
|
11
|
-
const segments = resolvedPath.split("/"); // Split path by '/'
|
|
12
|
-
let currentPath = "/"; // Start from root
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < segments.length; i++) {
|
|
15
|
-
const segment = segments[i];
|
|
16
|
-
const isWildcard = segment === "*";
|
|
17
|
-
|
|
18
|
-
if (isWildcard) {
|
|
19
|
-
// Get all directories at this level
|
|
20
|
-
const directories = fs
|
|
21
|
-
.readdirSync(currentPath)
|
|
22
|
-
.filter((file) =>
|
|
23
|
-
fs.statSync(path.join(currentPath, file)).isDirectory()
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
// Process each directory and continue along the path
|
|
27
|
-
directories.forEach((dir) => {
|
|
28
|
-
findDirectories(
|
|
29
|
-
path.join(currentPath, dir, ...segments.slice(i + 1)),
|
|
30
|
-
callback,
|
|
31
|
-
fileName
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
return; // Stop further processing in the loop for wildcard case
|
|
35
|
-
} else {
|
|
36
|
-
// Continue to the next part of the path
|
|
37
|
-
currentPath = path.join(currentPath, segment);
|
|
38
|
-
|
|
39
|
-
// If a segment doesn’t exist or isn’t a directory, log an error and stop
|
|
40
|
-
if (
|
|
41
|
-
!fs.existsSync(currentPath) ||
|
|
42
|
-
!fs.statSync(currentPath).isDirectory()
|
|
43
|
-
) {
|
|
44
|
-
console.log(`Directory not found: ${currentPath}`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If we reach the end of the path without wildcards, we have a valid directory
|
|
51
|
-
callback(currentPath, fileName);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function createOrUpdateFile(directoryPath, fileName) {
|
|
55
|
-
let buildStep = `- name: Build\n run: yarn build`;
|
|
56
|
-
|
|
57
|
-
// Check if webpack config exists to include build step
|
|
58
|
-
const webpackPath = filePath.replace(fileName, "webpack.config.js");
|
|
59
|
-
if (!fs.existsSync(webpackPath)) buildStep = "";
|
|
60
|
-
|
|
61
|
-
// Define file content (e.g., for YAML or other configuration)
|
|
62
|
-
const fileContent = `name: Automated Workflow
|
|
63
|
-
on:
|
|
64
|
-
push:
|
|
65
|
-
branches:
|
|
66
|
-
- main
|
|
67
|
-
jobs:
|
|
68
|
-
about:
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
steps:
|
|
71
|
-
- name: Checkout
|
|
72
|
-
uses: actions/checkout@v3
|
|
73
|
-
- name: Setup Node.js
|
|
74
|
-
uses: actions/setup-node@v3
|
|
75
|
-
with:
|
|
76
|
-
node-version: 16
|
|
77
|
-
- name: Jaid/action-sync-node-meta
|
|
78
|
-
uses: jaid/action-sync-node-meta@v1.4.0
|
|
79
|
-
with:
|
|
80
|
-
direction: overwrite-github
|
|
81
|
-
githubToken: "\${{ secrets.GITHUB }}"
|
|
82
|
-
release:
|
|
83
|
-
runs-on: ubuntu-latest
|
|
84
|
-
steps:
|
|
85
|
-
- name: Checkout
|
|
86
|
-
uses: actions/checkout@v3
|
|
87
|
-
- name: Setup Node.js
|
|
88
|
-
uses: actions/setup-node@v3
|
|
89
|
-
with:
|
|
90
|
-
node-version: 14
|
|
91
|
-
- name: Semantic Release
|
|
92
|
-
uses: cycjimmy/semantic-release-action@v3
|
|
93
|
-
id: semantic
|
|
94
|
-
with:
|
|
95
|
-
extra_plugins: |
|
|
96
|
-
@semantic-release/changelog
|
|
97
|
-
@semantic-release/git
|
|
98
|
-
@semantic-release/github
|
|
99
|
-
env:
|
|
100
|
-
GITHUB_TOKEN: "\${{ secrets.GITHUB }}"
|
|
101
|
-
NPM_TOKEN: "\${{ secrets.NPM_TOKEN }}"
|
|
102
|
-
outputs:
|
|
103
|
-
new_release_published: "\${{ steps.semantic.outputs.new_release_published }}"
|
|
104
|
-
new_release_version: "\${{ steps.semantic.outputs.new_release_version }}"
|
|
105
|
-
upload:
|
|
106
|
-
runs-on: ubuntu-latest
|
|
107
|
-
needs: release
|
|
108
|
-
if: needs.release.outputs.new_release_published == 'true'
|
|
109
|
-
env:
|
|
110
|
-
VERSION: "\${{ needs.release.outputs.new_release_version }}"
|
|
111
|
-
steps:
|
|
112
|
-
- name: Checkout
|
|
113
|
-
uses: actions/checkout@v3
|
|
114
|
-
- name: Setup Node.js
|
|
115
|
-
uses: actions/setup-node@v3
|
|
116
|
-
with:
|
|
117
|
-
node-version: 16
|
|
118
|
-
- name: Set npm registry auth
|
|
119
|
-
run: echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
120
|
-
- name: Install dependencies
|
|
121
|
-
run: yarn install
|
|
122
|
-
${buildStep}
|
|
123
|
-
- name: Set Environment Variables
|
|
124
|
-
run: |
|
|
125
|
-
echo "organization_id=\${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
126
|
-
echo "key=\${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
127
|
-
echo "host=\${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
128
|
-
- name: CoCreate Upload
|
|
129
|
-
run: coc upload
|
|
130
|
-
`;
|
|
131
|
-
|
|
132
|
-
const filePath = path.join(directoryPath, fileName);
|
|
133
|
-
// Create or update the file
|
|
134
|
-
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
135
|
-
fs.writeFileSync(filePath, fileContent);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Define the directories with wildcards
|
|
139
|
-
const directories = [
|
|
140
|
-
"../../../../../CoCreate-modules/*/",
|
|
141
|
-
"../../../../../CoCreate-apps/*/",
|
|
142
|
-
"../../../../../CoCreate-plugins/*/",
|
|
143
|
-
"../../../../../CoCreateCSS/",
|
|
144
|
-
"../../../../../CoCreateJS/",
|
|
145
|
-
"../../../../../CoCreateWS/",
|
|
146
|
-
"../../../../../YellowOracle/",
|
|
147
|
-
"../../../../../CoCreate-website/",
|
|
148
|
-
"../../../../../CoCreate-admin/",
|
|
149
|
-
"../../../../../CoCreate-website-old/",
|
|
150
|
-
"../../../../../CoCreate-superadmin/",
|
|
151
|
-
];
|
|
152
|
-
const fileName = "automated.yml";
|
|
153
|
-
|
|
154
|
-
// Execute directory search and create/update file if the directory exists
|
|
155
|
-
directories.forEach((directory) => {
|
|
156
|
-
findDirectories(directory, createOrUpdateFile, fileName);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
console.log("Finished");
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
function findDirectories(startPath, callback, fileName) {
|
|
5
|
-
// Resolve relative paths to absolute paths if needed
|
|
6
|
-
const resolvedPath =
|
|
7
|
-
startPath.startsWith("./") || startPath.startsWith("../")
|
|
8
|
-
? path.resolve(startPath)
|
|
9
|
-
: startPath;
|
|
10
|
-
|
|
11
|
-
const segments = resolvedPath.split("/"); // Split path by '/'
|
|
12
|
-
let currentPath = "/"; // Start from root
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < segments.length; i++) {
|
|
15
|
-
const segment = segments[i];
|
|
16
|
-
const isWildcard = segment === "*";
|
|
17
|
-
|
|
18
|
-
if (isWildcard) {
|
|
19
|
-
// Get all directories at this level
|
|
20
|
-
const directories = fs
|
|
21
|
-
.readdirSync(currentPath)
|
|
22
|
-
.filter((file) =>
|
|
23
|
-
fs.statSync(path.join(currentPath, file)).isDirectory()
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
// Process each directory and continue along the path
|
|
27
|
-
directories.forEach((dir) => {
|
|
28
|
-
findDirectories(
|
|
29
|
-
path.join(currentPath, dir, ...segments.slice(i + 1)),
|
|
30
|
-
callback,
|
|
31
|
-
fileName
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
return; // Stop further processing in the loop for wildcard case
|
|
35
|
-
} else {
|
|
36
|
-
// Continue to the next part of the path
|
|
37
|
-
currentPath = path.join(currentPath, segment);
|
|
38
|
-
|
|
39
|
-
// If a segment doesn’t exist or isn’t a directory, log an error and stop
|
|
40
|
-
if (
|
|
41
|
-
!fs.existsSync(currentPath) ||
|
|
42
|
-
!fs.statSync(currentPath).isDirectory()
|
|
43
|
-
) {
|
|
44
|
-
console.log(`Directory not found: ${currentPath}`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If we reach the end of the path without wildcards, we have a valid directory
|
|
51
|
-
callback(currentPath, fileName);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function createOrUpdateFile(directoryPath, fileName) {
|
|
55
|
-
let name = path
|
|
56
|
-
.basename(path.resolve(path.dirname(directoryPath), "./"))
|
|
57
|
-
.substring(9);
|
|
58
|
-
let object = "";
|
|
59
|
-
let replaceContent = fs.readFileSync(directoryPath).toString();
|
|
60
|
-
|
|
61
|
-
// Parse content to extract `object`
|
|
62
|
-
let content_source = replaceContent.substring(
|
|
63
|
-
replaceContent.indexOf("sources")
|
|
64
|
-
);
|
|
65
|
-
let content1 = content_source.substring(content_source.indexOf("object"));
|
|
66
|
-
let content2 = content1.substring(content1.indexOf(":"));
|
|
67
|
-
object = content2.substring(3, content2.indexOf(",") - 4);
|
|
68
|
-
|
|
69
|
-
let fileContent = `module.exports = {
|
|
70
|
-
"config": {
|
|
71
|
-
"organization_id": "5ff747727005da1c272740ab",
|
|
72
|
-
"key": "2061acef-0451-4545-f754-60cf8160",
|
|
73
|
-
"host": "general.cocreate.app"
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
"sources": [
|
|
77
|
-
{
|
|
78
|
-
"array": "files",
|
|
79
|
-
"object": {
|
|
80
|
-
"_id": "${object}",
|
|
81
|
-
"name": "index.html",
|
|
82
|
-
"path": "/docs/${name}",
|
|
83
|
-
"pathname": "/docs/${name}/index.html",
|
|
84
|
-
"src": "{{./docs/index.html}}",
|
|
85
|
-
"host": [
|
|
86
|
-
"general.cocreate.app"
|
|
87
|
-
],
|
|
88
|
-
"directory": "${name}",
|
|
89
|
-
"content-type": "{{content-type}}",
|
|
90
|
-
"public": "true"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
if (!object.length) {
|
|
98
|
-
console.log("object Undefined: ", directoryPath);
|
|
99
|
-
} else if (object.length !== 24) {
|
|
100
|
-
console.log("object not valid! Please check your config: ", directoryPath);
|
|
101
|
-
} else {
|
|
102
|
-
const filePath = path.join(directoryPath, fileName);
|
|
103
|
-
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
104
|
-
fs.writeFileSync(filePath, fileContent);
|
|
105
|
-
}
|
|
106
|
-
const filePath = path.join(directoryPath, fileName);
|
|
107
|
-
// Create or update the file
|
|
108
|
-
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
109
|
-
fs.writeFileSync(filePath, fileContent);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Define the directories with wildcards
|
|
113
|
-
const directories = [
|
|
114
|
-
"../../../../../CoCreate-modules/*/",
|
|
115
|
-
"../../../../../CoCreate-apps/*/",
|
|
116
|
-
"../../../../../CoCreate-plugins/*/",
|
|
117
|
-
"../../../../../CoCreateCSS/",
|
|
118
|
-
"../../../../../CoCreateJS/",
|
|
119
|
-
"../../../../../CoCreateWS/",
|
|
120
|
-
"../../../../../YellowOracle/",
|
|
121
|
-
"../../../../../CoCreate-website/",
|
|
122
|
-
"../../../../../CoCreate-admin/",
|
|
123
|
-
"../../../../../CoCreate-website-old/",
|
|
124
|
-
"../../../../../CoCreate-superadmin/",
|
|
125
|
-
];
|
|
126
|
-
const fileName = "CoCreate.config.js";
|
|
127
|
-
|
|
128
|
-
// Execute directory search and create/update file if the directory exists
|
|
129
|
-
directories.forEach((directory) => {
|
|
130
|
-
findDirectories(directory, createOrUpdateFile, fileName);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
console.log("Finished");
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
function globUpdater(er, files) {
|
|
6
|
-
if (er) console.log(files, "glob resolving issue");
|
|
7
|
-
else
|
|
8
|
-
files.forEach((filename) => {
|
|
9
|
-
console.log(filename + "/manual.yml", "glob resolving issue");
|
|
10
|
-
update(filename + "/manual.yml");
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function update(Path) {
|
|
15
|
-
// component name
|
|
16
|
-
let name = path
|
|
17
|
-
.basename(path.resolve(path.dirname(Path), "../.."))
|
|
18
|
-
.substring(9);
|
|
19
|
-
let fileContent = `name: Manual Workflow
|
|
20
|
-
on:
|
|
21
|
-
workflow_dispatch:
|
|
22
|
-
inputs:
|
|
23
|
-
invalidations:
|
|
24
|
-
description: |
|
|
25
|
-
If set to 'true', invalidates previous upload.
|
|
26
|
-
default: 'true'
|
|
27
|
-
required: true
|
|
28
|
-
|
|
29
|
-
jobs:
|
|
30
|
-
cdn:
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
env:
|
|
33
|
-
DRY_RUN: \${{ github.event.inputs.dry_run }}
|
|
34
|
-
GITHUB_TOKEN: '\${{ secrets.GITHUB_TOKEN }}'
|
|
35
|
-
NPM_TOKEN: '\${{ secrets.NPM_TOKEN }}'
|
|
36
|
-
|
|
37
|
-
steps:
|
|
38
|
-
- name: Checkout
|
|
39
|
-
uses: actions/checkout@v3
|
|
40
|
-
- name: setup nodejs
|
|
41
|
-
uses: actions/setup-node@v3
|
|
42
|
-
with:
|
|
43
|
-
node-version: 16
|
|
44
|
-
- name: yarn install
|
|
45
|
-
run: >
|
|
46
|
-
echo "//registry.npmjs.org/:_authToken=\${{ secrets.NPM_TOKEN }}" >
|
|
47
|
-
.npmrc
|
|
48
|
-
|
|
49
|
-
yarn install
|
|
50
|
-
- name: yarn build
|
|
51
|
-
run: yarn build
|
|
52
|
-
- name: upload latest bundle
|
|
53
|
-
uses: CoCreate-app/CoCreate-s3@master
|
|
54
|
-
with:
|
|
55
|
-
aws-key-id: '\${{ secrets.AWSACCESSKEYID }}'
|
|
56
|
-
aws-access-key: '\${{ secrets.AWSSECERTACCESSKEY }}'
|
|
57
|
-
distributionId: '\${{ secrets.DISTRIBUTION_ID }}'
|
|
58
|
-
bucket: testcrudbucket
|
|
59
|
-
source: ./dist
|
|
60
|
-
destination: /${name}/latest
|
|
61
|
-
acl: public-read
|
|
62
|
-
invalidations: \${{ github.event.inputs.invalidations }}
|
|
63
|
-
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
if (fs.existsSync(Path)) fs.unlinkSync(Path);
|
|
67
|
-
fs.writeFileSync(Path, fileContent);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// glob("../CoCreate-modules/CoCreate-action/.github/workflows", globUpdater)
|
|
71
|
-
glob("../CoCreate-modules/*/.github/workflows/", globUpdater);
|
|
72
|
-
glob("../CoCreate-apps/*/.github/workflows/", globUpdater);
|
|
73
|
-
glob("../CoCreate-plugins/*/.github/workflows/", globUpdater);
|
|
74
|
-
|
|
75
|
-
// substrin (9) removes CoCreateC leving namme as SS
|
|
76
|
-
// glob("../CoCreateCSS/.github/workflows/", globUpdater)
|
|
77
|
-
|
|
78
|
-
// does not need to add name... will require for name to be removed from destination
|
|
79
|
-
// glob("../CoCreateJS/.github/workflows/", globUpdater)
|
|
80
|
-
|
|
81
|
-
console.log("finished");
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
function findDirectories(startPath, callback, fileName) {
|
|
5
|
-
// Resolve relative paths to absolute paths if needed
|
|
6
|
-
const resolvedPath =
|
|
7
|
-
startPath.startsWith("./") || startPath.startsWith("../")
|
|
8
|
-
? path.resolve(startPath)
|
|
9
|
-
: startPath;
|
|
10
|
-
|
|
11
|
-
const segments = resolvedPath.split("/"); // Split path by '/'
|
|
12
|
-
let currentPath = "/"; // Start from root
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < segments.length; i++) {
|
|
15
|
-
const segment = segments[i];
|
|
16
|
-
const isWildcard = segment === "*";
|
|
17
|
-
|
|
18
|
-
if (isWildcard) {
|
|
19
|
-
// Get all directories at this level
|
|
20
|
-
const directories = fs
|
|
21
|
-
.readdirSync(currentPath)
|
|
22
|
-
.filter((file) =>
|
|
23
|
-
fs.statSync(path.join(currentPath, file)).isDirectory()
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
// Process each directory and continue along the path
|
|
27
|
-
directories.forEach((dir) => {
|
|
28
|
-
findDirectories(
|
|
29
|
-
path.join(currentPath, dir, ...segments.slice(i + 1)),
|
|
30
|
-
callback,
|
|
31
|
-
fileName
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
return; // Stop further processing in the loop for wildcard case
|
|
35
|
-
} else {
|
|
36
|
-
// Continue to the next part of the path
|
|
37
|
-
currentPath = path.join(currentPath, segment);
|
|
38
|
-
|
|
39
|
-
// If a segment doesn’t exist or isn’t a directory, log an error and stop
|
|
40
|
-
if (
|
|
41
|
-
!fs.existsSync(currentPath) ||
|
|
42
|
-
!fs.statSync(currentPath).isDirectory()
|
|
43
|
-
) {
|
|
44
|
-
console.log(`Directory not found: ${currentPath}`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If we reach the end of the path without wildcards, we have a valid directory
|
|
51
|
-
callback(currentPath, fileName);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function createOrUpdateFile(directoryPath, fileName) {
|
|
55
|
-
const fileContent = `module.exports = {
|
|
56
|
-
tabWidth: 4,
|
|
57
|
-
semi: true,
|
|
58
|
-
trailingComma: "none",
|
|
59
|
-
bracketSameLine: true,
|
|
60
|
-
useTabs: true,
|
|
61
|
-
overrides: [
|
|
62
|
-
{
|
|
63
|
-
files: ["*.json", "*.yml", "*.yaml"],
|
|
64
|
-
options: {
|
|
65
|
-
tabWidth: 2,
|
|
66
|
-
useTabs: false
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
};`;
|
|
71
|
-
|
|
72
|
-
const filePath = path.join(directoryPath, fileName);
|
|
73
|
-
// Create or update the file
|
|
74
|
-
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
75
|
-
fs.writeFileSync(filePath, fileContent);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Define the directories with wildcards
|
|
79
|
-
const directories = [
|
|
80
|
-
"../../../../../CoCreate-modules/*/",
|
|
81
|
-
"../../../../../CoCreate-apps/*/",
|
|
82
|
-
"../../../../../CoCreate-plugins/*/",
|
|
83
|
-
"../../../../../CoCreateCSS/",
|
|
84
|
-
"../../../../../CoCreateJS/",
|
|
85
|
-
"../../../../../CoCreateWS/",
|
|
86
|
-
"../../../../../YellowOracle/",
|
|
87
|
-
"../../../../../CoCreate-website/",
|
|
88
|
-
"../../../../../CoCreate-admin/",
|
|
89
|
-
"../../../../../CoCreate-website-old/",
|
|
90
|
-
"../../../../../CoCreate-superadmin/",
|
|
91
|
-
];
|
|
92
|
-
const fileName = "prettier.config.js";
|
|
93
|
-
|
|
94
|
-
// Execute directory search and create/update file if the directory exists
|
|
95
|
-
directories.forEach((directory) => {
|
|
96
|
-
findDirectories(directory, createOrUpdateFile, fileName);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
console.log("Finished");
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
let fs = require('fs');
|
|
2
|
-
const prettier = require("prettier");
|
|
3
|
-
const path = require("path")
|
|
4
|
-
const { promisify } = require('util');
|
|
5
|
-
let list = require('../repositories.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let metaYarnLink = list.map(meta => {
|
|
10
|
-
let name = path.basename(meta.path).toLowerCase();
|
|
11
|
-
try {
|
|
12
|
-
let absolutePath = path.resolve(meta.path);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let packagejson = path.resolve(absolutePath, 'package.json');
|
|
16
|
-
if (!fs.existsSync(packagejson)) {
|
|
17
|
-
console.error('package json not found for', name);
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
let packageObj = require(packagejson);
|
|
21
|
-
|
|
22
|
-
let packageName = name.startsWith('cocreate-') ?
|
|
23
|
-
'@cocreate/' + name.substring(9) : packageObj.name;
|
|
24
|
-
|
|
25
|
-
return { ...meta, name, packageName, absolutePath, packageObj }
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
console.error('error: ', name, err.message);
|
|
29
|
-
return meta;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
(async() => {
|
|
35
|
-
for (let meta of metaYarnLink) {
|
|
36
|
-
await update(meta)
|
|
37
|
-
}
|
|
38
|
-
})();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function update(param) {
|
|
42
|
-
// component name
|
|
43
|
-
if (!param) return;
|
|
44
|
-
let { packageObj, absolutePath } = param;
|
|
45
|
-
let { name, description } = packageObj;
|
|
46
|
-
let shortName = name.substring(10);
|
|
47
|
-
let fileContent = `# CoCreate-${shortName}
|
|
48
|
-
${description} Take it for a spin in our [playground!](https://cocreate.app/docs/${shortName})
|
|
49
|
-
|
|
50
|
-

|
|
51
|
-

|
|
52
|
-

|
|
53
|
-

|
|
54
|
-

|
|
55
|
-

|
|
56
|
-
|
|
57
|
-

|
|
58
|
-
|
|
59
|
-
## [Docs & Demo](https://cocreate.app/docs/${shortName})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
For a complete guide and working demo refer to the [doumentation](https://cocreate.app/docs/${shortName})
|
|
63
|
-
|
|
64
|
-
## CDN
|
|
65
|
-
\`\`\`html
|
|
66
|
-
<script src="https://cdn.cocreate.app/${shortName}/latest/CoCreate-${shortName}.min.js"></script>
|
|
67
|
-
\`\`\`
|
|
68
|
-
\`\`\`html
|
|
69
|
-
<script src="https://cdn.cocreate.app/${shortName}/latest/CoCreate-${shortName}.min.css"></script>
|
|
70
|
-
\`\`\`
|
|
71
|
-
|
|
72
|
-
## NPM
|
|
73
|
-
\`\`\`shell
|
|
74
|
-
$ npm i @cocreate/${shortName}
|
|
75
|
-
\`\`\`
|
|
76
|
-
|
|
77
|
-
## yarn
|
|
78
|
-
\`\`\`shell
|
|
79
|
-
$ yarn install @cocreate/${shortName}
|
|
80
|
-
\`\`\`
|
|
81
|
-
|
|
82
|
-
# Table of Contents
|
|
83
|
-
|
|
84
|
-
- [Table of Contents](#table-of-contents)
|
|
85
|
-
- [Announcements](#announcements)
|
|
86
|
-
- [Roadmap](#roadmap)
|
|
87
|
-
- [How to Contribute](#how-to-contribute)
|
|
88
|
-
- [About](#about)
|
|
89
|
-
- [License](#license)
|
|
90
|
-
|
|
91
|
-
<a name="announcements"></a>
|
|
92
|
-
# Announcements
|
|
93
|
-
|
|
94
|
-
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreate-app/CoCreate-${shortName}/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreate-app/CoCreate-${shortName}/releases). You may also subscribe to email for releases and breaking changes.
|
|
95
|
-
|
|
96
|
-
<a name="roadmap"></a>
|
|
97
|
-
# Roadmap
|
|
98
|
-
|
|
99
|
-
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreate-app/CoCreate-${shortName}/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-${shortName}/pulls). We would love to hear your feedback.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<a name="about"></a>
|
|
103
|
-
# About
|
|
104
|
-
|
|
105
|
-
CoCreate-${shortName} is guided and supported by the CoCreate Developer Experience Team.
|
|
106
|
-
|
|
107
|
-
Please Email the Developer Experience Team [here](mailto:develop@cocreate.app) in case of any queries.
|
|
108
|
-
|
|
109
|
-
CoCreate-${shortName} is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
|
|
110
|
-
|
|
111
|
-
<a name="contribute"></a>
|
|
112
|
-
# How to Contribute
|
|
113
|
-
|
|
114
|
-
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreate-app/CoCreate-${shortName}/blob/master/CONTRIBUTING.md) guide for details.
|
|
115
|
-
|
|
116
|
-
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/CoCreate-app/CoCreate-${shortName}/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-${shortName}/pulls) or merely upvote or comment on existing issues or pull requests.
|
|
117
|
-
|
|
118
|
-
We appreciate your continued support, thank you!
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<a name="license"></a>
|
|
122
|
-
# License
|
|
123
|
-
[The MIT License (MIT)](https://github.com/CoCreate-app/CoCreate-${shortName}/blob/master/LICENSE)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
let MdPath = path.resolve(absolutePath, 'README.md')
|
|
129
|
-
let formated = prettier.format(fileContent, { semi: false, parser: "markdown" });
|
|
130
|
-
if (fs.existsSync(MdPath))
|
|
131
|
-
fs.unlinkSync(MdPath)
|
|
132
|
-
fs.writeFileSync(MdPath, formated)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
console.log('finished')
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require("fs");
|
|
3
|
-
|
|
4
|
-
function globUpdater(er, files) {
|
|
5
|
-
if (er) console.log(files, "glob resolving issue");
|
|
6
|
-
else files.forEach((filename) => update(filename));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function update(YmlPath) {
|
|
10
|
-
if (fs.existsSync(YmlPath)) fs.unlinkSync(YmlPath);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
glob("../CoCreate-modules/CoCreate-action/dist", globUpdater);
|
|
14
|
-
// glob("../CoCreate-modules/*/.github/workflows/automation.yml", globUpdater)
|
|
15
|
-
// glob("../CoCreate-apps/*/.github/workflows/automation.yml", globUpdater)
|
|
16
|
-
// glob("../CoCreate-plugins/*/.github/workflows/automation.yml", globUpdater)
|
|
17
|
-
|
|
18
|
-
// substrin (9) removes CoCreateC leving namme as SS
|
|
19
|
-
// glob("../CoCreateCSS/.github/workflows/automation.yml", globUpdater)
|
|
20
|
-
|
|
21
|
-
// does not need to add name... will require for name to be removed from destination
|
|
22
|
-
// glob("../CoCreateJS/.github/workflows/automation.yml", globUpdater)
|
|
23
|
-
|
|
24
|
-
console.log("finished");
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
let glob = require("glob");
|
|
2
|
-
let fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
function globUpdater(er, files) {
|
|
6
|
-
if (er) console.log(files, "glob resolving issue");
|
|
7
|
-
else files.forEach((filename) => update(filename));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function update(mdPath) {
|
|
11
|
-
// component name
|
|
12
|
-
// console.log(mdPath);
|
|
13
|
-
let nameDir = mdPath;
|
|
14
|
-
do {
|
|
15
|
-
nameDir = path.dirname(nameDir);
|
|
16
|
-
} while (!path.basename(nameDir).startsWith("CoCreate-"));
|
|
17
|
-
let name = path.basename(nameDir).substring(9);
|
|
18
|
-
// console.log(name);
|
|
19
|
-
// process.exit();
|
|
20
|
-
let replaceContent = fs.readFileSync(mdPath).toString();
|
|
21
|
-
|
|
22
|
-
console.log(replaceContent, name);
|
|
23
|
-
let replaced = replaceContent.replace(/boilerplate/gi, name);
|
|
24
|
-
|
|
25
|
-
if (fs.existsSync(mdPath)) fs.unlinkSync(mdPath);
|
|
26
|
-
fs.writeFileSync(mdPath, replaced);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
glob("./docs/", globUpdater);
|
|
30
|
-
// glob("../CoCreate-docs/docs/*.html", globUpdater)
|
|
31
|
-
// glob("../CoCreate-modules/*/docs/*.html", globUpdater)
|
|
32
|
-
// glob("../CoCreate-apps/*/docs/*.html", globUpdater)
|
|
33
|
-
// glob("../CoCreate-plugins/*/docs/*.html", globUpdater)
|
|
34
|
-
|
|
35
|
-
console.log("finished");
|