@cocreate/cli 1.48.0 → 1.50.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/.github/workflows/automated.yml +0 -1
- package/CHANGELOG.md +40 -0
- package/CoCreate.config.js +499 -420
- package/docs/index.html +250 -250
- package/package.json +5 -7
- package/prettier.config.js +18 -0
- package/src/addMeta.js +74 -67
- package/src/coc.js +129 -114
- package/src/commands/acme.js +19 -22
- package/src/commands/bump.js +149 -87
- package/src/commands/clone.js +26 -22
- package/src/commands/fs/automated.js +81 -31
- package/src/commands/fs/config.js +94 -38
- package/src/commands/fs/gitignore.js +13 -22
- package/src/commands/fs/manual.js +17 -27
- package/src/commands/fs/prettier.config.js +99 -0
- package/src/commands/fs/remove.js +7 -12
- package/src/commands/fs/replace.js +23 -31
- package/src/commands/fs/webpack.js +143 -149
- package/src/commands/install.js +18 -22
- package/src/commands/link.js +73 -60
- package/src/commands/nginx.js +19 -22
- package/src/commands/symlink.js +132 -115
- package/src/execute.js +63 -50
- package/src/index.js +3 -0
- package/src/spinner.js +85 -0
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
let glob = require("glob");
|
|
2
|
-
let fs = require(
|
|
3
|
-
const path = require("path")
|
|
2
|
+
let fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
4
|
|
|
5
5
|
function globUpdater(er, files) {
|
|
6
|
-
|
|
7
|
-
if (er)
|
|
8
|
-
console.log(files, 'glob resolving issue')
|
|
6
|
+
if (er) console.log(files, "glob resolving issue");
|
|
9
7
|
else
|
|
10
|
-
files.forEach(filename => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
|
|
8
|
+
files.forEach((filename) => {
|
|
9
|
+
console.log(filename + "/manual.yml", "glob resolving issue");
|
|
10
|
+
update(filename + "/manual.yml");
|
|
11
|
+
});
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
14
|
function update(Path) {
|
|
22
15
|
// component name
|
|
23
|
-
let name = path
|
|
16
|
+
let name = path
|
|
17
|
+
.basename(path.resolve(path.dirname(Path), "../.."))
|
|
18
|
+
.substring(9);
|
|
24
19
|
let fileContent = `name: Manual Workflow
|
|
25
20
|
on:
|
|
26
21
|
workflow_dispatch:
|
|
@@ -68,19 +63,14 @@ jobs:
|
|
|
68
63
|
|
|
69
64
|
`;
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
fs.unlinkSync(Path)
|
|
74
|
-
fs.writeFileSync(Path, fileContent)
|
|
75
|
-
|
|
66
|
+
if (fs.existsSync(Path)) fs.unlinkSync(Path);
|
|
67
|
+
fs.writeFileSync(Path, fileContent);
|
|
76
68
|
}
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
glob("../CoCreate-
|
|
82
|
-
glob("../CoCreate-apps/*/.github/workflows/", globUpdater)
|
|
83
|
-
glob("../CoCreate-plugins/*/.github/workflows/", globUpdater)
|
|
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);
|
|
84
74
|
|
|
85
75
|
// substrin (9) removes CoCreateC leving namme as SS
|
|
86
76
|
// glob("../CoCreateCSS/.github/workflows/", globUpdater)
|
|
@@ -88,4 +78,4 @@ glob("../CoCreate-plugins/*/.github/workflows/", globUpdater)
|
|
|
88
78
|
// does not need to add name... will require for name to be removed from destination
|
|
89
79
|
// glob("../CoCreateJS/.github/workflows/", globUpdater)
|
|
90
80
|
|
|
91
|
-
console.log(
|
|
81
|
+
console.log("finished");
|
|
@@ -0,0 +1,99 @@
|
|
|
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,22 +1,17 @@
|
|
|
1
1
|
let glob = require("glob");
|
|
2
|
-
let fs = require(
|
|
2
|
+
let fs = require("fs");
|
|
3
3
|
|
|
4
4
|
function globUpdater(er, files) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
else
|
|
8
|
-
files.forEach(filename => update(filename))
|
|
5
|
+
if (er) console.log(files, "glob resolving issue");
|
|
6
|
+
else files.forEach((filename) => update(filename));
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
|
|
12
9
|
function update(YmlPath) {
|
|
13
|
-
|
|
14
|
-
fs.unlinkSync(YmlPath)
|
|
10
|
+
if (fs.existsSync(YmlPath)) fs.unlinkSync(YmlPath);
|
|
15
11
|
}
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
glob("../CoCreate-
|
|
19
|
-
// glob("../CoCreate-components/*/.github/workflows/automation.yml", globUpdater)
|
|
13
|
+
glob("../CoCreate-modules/CoCreate-action/dist", globUpdater);
|
|
14
|
+
// glob("../CoCreate-modules/*/.github/workflows/automation.yml", globUpdater)
|
|
20
15
|
// glob("../CoCreate-apps/*/.github/workflows/automation.yml", globUpdater)
|
|
21
16
|
// glob("../CoCreate-plugins/*/.github/workflows/automation.yml", globUpdater)
|
|
22
17
|
|
|
@@ -26,4 +21,4 @@ glob("../CoCreate-components/CoCreate-action/dist", globUpdater)
|
|
|
26
21
|
// does not need to add name... will require for name to be removed from destination
|
|
27
22
|
// glob("../CoCreateJS/.github/workflows/automation.yml", globUpdater)
|
|
28
23
|
|
|
29
|
-
console.log(
|
|
24
|
+
console.log("finished");
|
|
@@ -1,43 +1,35 @@
|
|
|
1
1
|
let glob = require("glob");
|
|
2
|
-
let fs = require(
|
|
3
|
-
const path = require("path")
|
|
2
|
+
let fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
4
|
|
|
5
5
|
function globUpdater(er, files) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
else
|
|
9
|
-
files.forEach(filename => update(filename))
|
|
6
|
+
if (er) console.log(files, "glob resolving issue");
|
|
7
|
+
else files.forEach((filename) => update(filename));
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
13
10
|
function update(mdPath) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
fs.unlinkSync(mdPath)
|
|
31
|
-
fs.writeFileSync(mdPath, replaced)
|
|
32
|
-
|
|
33
|
-
|
|
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);
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
glob("./docs/", globUpdater)
|
|
29
|
+
glob("./docs/", globUpdater);
|
|
38
30
|
// glob("../CoCreate-docs/docs/*.html", globUpdater)
|
|
39
|
-
// glob("../CoCreate-
|
|
31
|
+
// glob("../CoCreate-modules/*/docs/*.html", globUpdater)
|
|
40
32
|
// glob("../CoCreate-apps/*/docs/*.html", globUpdater)
|
|
41
33
|
// glob("../CoCreate-plugins/*/docs/*.html", globUpdater)
|
|
42
34
|
|
|
43
|
-
console.log(
|
|
35
|
+
console.log("finished");
|
|
@@ -1,191 +1,185 @@
|
|
|
1
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { execSync } = require("child_process");
|
|
2
4
|
|
|
5
|
+
module.exports = async function generateWebpackConfigs(repos, args) {
|
|
6
|
+
console.log("Generating webpack configs for specified repositories...");
|
|
3
7
|
|
|
8
|
+
if (!Array.isArray(repos) || repos.length === 0) {
|
|
9
|
+
console.warn("No repositories specified.");
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
let fs = require('fs');
|
|
7
|
-
const prettier = require("prettier");
|
|
8
|
-
const path = require("path")
|
|
9
|
-
|
|
10
|
-
function globUpdater(er, files) {
|
|
11
|
-
if (er)
|
|
12
|
-
console.log(files, 'glob resolving issue')
|
|
13
|
-
else
|
|
14
|
-
files.forEach(filename => update(filename))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function update(webpackPath) {
|
|
21
|
-
|
|
13
|
+
const failed = [];
|
|
22
14
|
|
|
15
|
+
for (const repo of repos) {
|
|
16
|
+
if (!repo || typeof repo.path !== "string") {
|
|
17
|
+
repo.error = "Invalid repository data provided";
|
|
18
|
+
failed.push(repo);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
const result = updateWebpackConfigForModule(repo);
|
|
23
|
+
if (!result) {
|
|
24
|
+
repo.error = `${repo.path}/webpack.config.js`;
|
|
25
|
+
failed.push(repo);
|
|
26
|
+
} else {
|
|
27
|
+
console.log(`Generated: ${repo.path}/webpack.config.js`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
let name = path.basename(dir);
|
|
28
|
-
// component entry
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let entry;
|
|
32
|
-
|
|
33
|
-
if (fs.existsSync( path.resolve(dir, './src/index.js') ))
|
|
34
|
-
entry = "./src/index.js";
|
|
35
|
-
else
|
|
36
|
-
entry = './src/' + name + '.js';
|
|
31
|
+
console.log(`\nWebpack config generation process finished.`);
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (componentName.startsWith('CoCreate'))
|
|
41
|
-
componentName = componentName.substring(8);
|
|
33
|
+
return failed;
|
|
34
|
+
};
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
componentName = lowerCaseFirstChar(componentName)
|
|
36
|
+
function updateWebpackConfigForModule(repo) {
|
|
37
|
+
try {
|
|
38
|
+
repo.path = path.resolve(process.cwd(), repo.path);
|
|
47
39
|
|
|
40
|
+
if (!fs.existsSync(repo.path) || !fs.lstatSync(repo.path).isDirectory()) {
|
|
41
|
+
repo.error = `The path "${repo.path}" does not exist or is not a directory.`;
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (fs.existsSync(path.resolve(dir, './src/index.html')))
|
|
52
|
-
hasTemplate = true;
|
|
53
|
-
let fileContent = `const path = require("path");
|
|
54
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
55
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
56
|
-
let isProduction = process.env.NODE_ENV === "production";
|
|
57
|
-
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
58
|
-
${ hasTemplate ? "const HtmlWebpackPlugin = require('html-webpack-plugin');" : ''}
|
|
45
|
+
const webpackPath = path.resolve(repo.path, "webpack.config.js");
|
|
46
|
+
let name = path.basename(repo.path);
|
|
59
47
|
|
|
48
|
+
if (!fs.existsSync(path.resolve(repo.path, repo.entry))) {
|
|
49
|
+
repo.error = `Entry file ${repo.entry} does not exist in ${repo.path}`;
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
60
52
|
|
|
53
|
+
let componentName = toCamelCase(name);
|
|
54
|
+
if (componentName === componentName.toUpperCase()) {
|
|
55
|
+
componentName = componentName.toLowerCase();
|
|
56
|
+
} else {
|
|
57
|
+
componentName = lowerCaseFirstChar(componentName);
|
|
58
|
+
}
|
|
61
59
|
|
|
60
|
+
let hasTemplate = false;
|
|
61
|
+
if (fs.existsSync(path.resolve(repo.path, "./src/index.html"))) {
|
|
62
|
+
hasTemplate = true;
|
|
63
|
+
}
|
|
64
|
+
let fileContent = `
|
|
65
|
+
const path = require("path");
|
|
66
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
67
|
+
const { EsbuildPlugin } = require("esbuild-loader");
|
|
68
|
+
const { FileUploader } = require("@cocreate/webpack");
|
|
69
|
+
${
|
|
70
|
+
hasTemplate ? 'const HtmlWebpackPlugin = require("html-webpack-plugin");' : ""
|
|
71
|
+
}
|
|
62
72
|
|
|
63
|
-
module.exports = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
module.exports = async (env, argv) => {
|
|
74
|
+
const isProduction = argv && argv.mode === "production";
|
|
75
|
+
const config = {
|
|
76
|
+
entry: {
|
|
77
|
+
"${name}": "${repo.entry}"
|
|
78
|
+
},
|
|
79
|
+
output: {
|
|
80
|
+
path: path.resolve(__dirname, "dist"),
|
|
81
|
+
filename: isProduction ? "[name].min.js" : "[name]${
|
|
82
|
+
hasTemplate ? ".[contenthash]" : ""
|
|
83
|
+
}.js",
|
|
84
|
+
libraryExport: "default",
|
|
85
|
+
library: ["CoCreate", "${componentName}"],
|
|
86
|
+
clean: true
|
|
87
|
+
},
|
|
88
|
+
plugins: [
|
|
78
89
|
new MiniCssExtractPlugin({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
filename: isProduction ? "[name].min.css" : "[name].css",
|
|
91
|
+
}),
|
|
92
|
+
new FileUploader(env, argv),
|
|
93
|
+
${
|
|
94
|
+
hasTemplate
|
|
95
|
+
? `
|
|
82
96
|
new HtmlWebpackPlugin({
|
|
83
97
|
template: "./src/index.html"
|
|
84
98
|
})
|
|
85
|
-
|
|
99
|
+
`
|
|
100
|
+
: ""
|
|
101
|
+
}
|
|
86
102
|
],
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
|
103
|
+
mode: isProduction ? "production" : "development",
|
|
104
|
+
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
105
|
+
module: {
|
|
106
|
+
rules: [
|
|
107
|
+
{
|
|
108
|
+
test: /\.js$/,
|
|
109
|
+
exclude: /node_modules/,
|
|
110
|
+
use: {
|
|
111
|
+
loader: "esbuild-loader",
|
|
112
|
+
options: {
|
|
113
|
+
loader: "js",
|
|
114
|
+
target: "es2017"
|
|
115
|
+
}
|
|
101
116
|
},
|
|
102
117
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
use: [
|
|
107
|
-
{ loader: "style-loader", options: { injectType: "linkTag" } },
|
|
108
|
-
"file-loader",
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// add source map
|
|
116
|
-
...(isProduction ? {} : { devtool: 'eval-source-map' }),
|
|
117
|
-
|
|
118
|
-
optimization: {
|
|
119
|
-
minimize: true,
|
|
120
|
-
minimizer: [
|
|
121
|
-
new TerserPlugin({
|
|
122
|
-
extractComments: true,
|
|
123
|
-
// cache: true,
|
|
124
|
-
parallel: true,
|
|
125
|
-
// sourceMap: true, // Must be set to true if using source-maps in production
|
|
126
|
-
terserOptions: {
|
|
127
|
-
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
|
128
|
-
// extractComments: 'all',
|
|
129
|
-
compress: {
|
|
130
|
-
drop_console: true,
|
|
131
|
-
},
|
|
118
|
+
{
|
|
119
|
+
test: /\.css$/i,
|
|
120
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"]
|
|
132
121
|
},
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
optimization: {
|
|
125
|
+
minimize: isProduction,
|
|
126
|
+
minimizer: [
|
|
127
|
+
new EsbuildPlugin({
|
|
128
|
+
target: "es2017",
|
|
129
|
+
css: true
|
|
130
|
+
})
|
|
131
|
+
],
|
|
135
132
|
splitChunks: {
|
|
136
|
-
chunks: 'all',
|
|
137
|
-
minSize: 200,
|
|
138
|
-
// maxSize: 99999,
|
|
139
|
-
//minChunks: 1,
|
|
140
|
-
${ !hasTemplate ? `
|
|
141
133
|
cacheGroups: {
|
|
142
134
|
defaultVendors: false
|
|
143
135
|
},
|
|
144
|
-
` : ''}
|
|
145
|
-
|
|
146
136
|
}
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
},
|
|
138
|
+
performance: {
|
|
139
|
+
hints: isProduction ? "warning" : false
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return config;
|
|
143
|
+
};
|
|
149
144
|
`;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// process.exit()
|
|
157
|
-
|
|
145
|
+
fs.writeFileSync(webpackPath, fileContent);
|
|
146
|
+
execSync(`npx prettier --write "${webpackPath}"`).toString();
|
|
147
|
+
return true;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
158
151
|
}
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
glob("../CoCreate-components/*/webpack.config.js", globUpdater)
|
|
163
|
-
glob("../CoCreate-apps/*/webpack.config.js", globUpdater)
|
|
164
|
-
glob("../CoCreate-plugins/*/webpack.config.js", globUpdater)
|
|
165
|
-
glob("../CoCreateCSS/webpack.config.js", globUpdater)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
153
|
function toCamelCase(str) {
|
|
172
154
|
let index = 0;
|
|
155
|
+
str = str.replace(/^CoCreate-/, "");
|
|
173
156
|
do {
|
|
174
157
|
index = str.indexOf("-", index);
|
|
175
158
|
if (index !== -1) {
|
|
176
159
|
let t = str.substring(0, index);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
160
|
+
if (
|
|
161
|
+
index + 1 < str.length &&
|
|
162
|
+
str[index + 1] >= "a" &&
|
|
163
|
+
str[index + 1] <= "z"
|
|
164
|
+
) {
|
|
165
|
+
t += String.fromCharCode(str.charCodeAt(index + 1) - 32);
|
|
166
|
+
t += str.substring(index + 2);
|
|
167
|
+
str = t;
|
|
168
|
+
} else if (index + 1 < str.length) {
|
|
169
|
+
t += str.substring(index + 1);
|
|
170
|
+
str = t;
|
|
171
|
+
} else {
|
|
172
|
+
str = t;
|
|
173
|
+
}
|
|
174
|
+
} else break;
|
|
182
175
|
} while (true);
|
|
183
176
|
return str;
|
|
184
177
|
}
|
|
185
178
|
|
|
186
179
|
function lowerCaseFirstChar(str) {
|
|
187
|
-
|
|
180
|
+
if (!str) return str;
|
|
181
|
+
if (str.charCodeAt(0) >= 65 && str.charCodeAt(0) <= 90) {
|
|
182
|
+
return String.fromCharCode(str.charCodeAt(0) + 32) + str.substring(1);
|
|
183
|
+
}
|
|
184
|
+
return str;
|
|
188
185
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
//
|
package/src/commands/install.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
const addMeta = require(
|
|
1
|
+
const addMeta = require("../addMeta");
|
|
2
2
|
|
|
3
|
-
module.exports = async function(repos, args) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
failed.push(cloneFailed)
|
|
3
|
+
module.exports = async function (repos, args) {
|
|
4
|
+
let failed = [];
|
|
5
|
+
try {
|
|
6
|
+
let cloneFailed = await require("./clone.js")(repos, args);
|
|
7
|
+
if (cloneFailed) failed.push(cloneFailed);
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
repos = await addMeta(repos, failed);
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return failed;
|
|
25
|
-
}
|
|
11
|
+
let symlinkFailed = await require("./symlink.js")(repos, args);
|
|
12
|
+
if (symlinkFailed) failed.push(symlinkFailed);
|
|
13
|
+
|
|
14
|
+
let linkFailed = await require("./link.js")(repos, args);
|
|
15
|
+
if (linkFailed) failed.push(linkFailed);
|
|
16
|
+
} catch (err) {
|
|
17
|
+
console.error(err);
|
|
18
|
+
failed.push({ name: "general", error: err.message });
|
|
19
|
+
}
|
|
20
|
+
return failed;
|
|
21
|
+
};
|