@magmonium/cli 0.7.8
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/README.md +392 -0
- package/bin/README.md +244 -0
- package/bin/cli.js +55 -0
- package/bin/commands/assets-wc.js +249 -0
- package/bin/commands/assets.js +943 -0
- package/bin/commands/build.js +242 -0
- package/bin/commands/clean.js +621 -0
- package/bin/commands/compile-i18n.js +91 -0
- package/bin/commands/config-ci.js +266 -0
- package/bin/commands/configure-wc.js +167 -0
- package/bin/commands/connect.js +188 -0
- package/bin/commands/create-app.js +946 -0
- package/bin/commands/deploy.js +100 -0
- package/bin/commands/fix-i18n.js +40 -0
- package/bin/commands/generate.js +765 -0
- package/bin/commands/init/config-files.js +1114 -0
- package/bin/commands/init/mag-assets.js +541 -0
- package/bin/commands/init/mag-cli-config.js +120 -0
- package/bin/commands/init/monorepo-structure.js +735 -0
- package/bin/commands/init/package-json.js +308 -0
- package/bin/commands/init/project-structure.js +189 -0
- package/bin/commands/init/pwa-files.js +204 -0
- package/bin/commands/init/source-files.js +2596 -0
- package/bin/commands/init.js +591 -0
- package/bin/commands/lib.js +508 -0
- package/bin/commands/patch-wc-env.js +136 -0
- package/bin/commands/refractor.js +51 -0
- package/bin/commands/sanitize-i18n.js +41 -0
- package/bin/commands/translate.js +32 -0
- package/bin/commands/zip.js +540 -0
- package/package.json +53 -0
- package/src/compilers/button-group-compiler.d.ts +18 -0
- package/src/compilers/button-group-compiler.d.ts.map +1 -0
- package/src/compilers/button-group-compiler.js +151 -0
- package/src/compilers/button-group-compiler.js.map +1 -0
- package/src/compilers/copy-compiler.d.ts +14 -0
- package/src/compilers/copy-compiler.d.ts.map +1 -0
- package/src/compilers/copy-compiler.js +170 -0
- package/src/compilers/copy-compiler.js.map +1 -0
- package/src/compilers/field-compiler.d.ts +15 -0
- package/src/compilers/field-compiler.d.ts.map +1 -0
- package/src/compilers/field-compiler.js +153 -0
- package/src/compilers/field-compiler.js.map +1 -0
- package/src/compilers/form-compiler.d.ts +15 -0
- package/src/compilers/form-compiler.d.ts.map +1 -0
- package/src/compilers/form-compiler.js +220 -0
- package/src/compilers/form-compiler.js.map +1 -0
- package/src/compilers/logo-compiler.d.ts +14 -0
- package/src/compilers/logo-compiler.d.ts.map +1 -0
- package/src/compilers/logo-compiler.js +114 -0
- package/src/compilers/logo-compiler.js.map +1 -0
- package/src/compilers/options-compiler.d.ts +46 -0
- package/src/compilers/options-compiler.d.ts.map +1 -0
- package/src/compilers/options-compiler.js +329 -0
- package/src/compilers/options-compiler.js.map +1 -0
- package/src/compilers/pwa-build.d.ts +7 -0
- package/src/compilers/pwa-build.d.ts.map +1 -0
- package/src/compilers/pwa-build.js +62 -0
- package/src/compilers/pwa-build.js.map +1 -0
- package/src/compilers/svg-compiler.d.ts +12 -0
- package/src/compilers/svg-compiler.d.ts.map +1 -0
- package/src/compilers/svg-compiler.js +123 -0
- package/src/compilers/svg-compiler.js.map +1 -0
- package/src/compilers/tabs-compiler.d.ts +25 -0
- package/src/compilers/tabs-compiler.d.ts.map +1 -0
- package/src/compilers/tabs-compiler.js +422 -0
- package/src/compilers/tabs-compiler.js.map +1 -0
- package/src/compilers/theme-compiler.d.ts +14 -0
- package/src/compilers/theme-compiler.d.ts.map +1 -0
- package/src/compilers/theme-compiler.js +144 -0
- package/src/compilers/theme-compiler.js.map +1 -0
- package/src/compilers/translation-compiler.d.ts +17 -0
- package/src/compilers/translation-compiler.d.ts.map +1 -0
- package/src/compilers/translation-compiler.js +232 -0
- package/src/compilers/translation-compiler.js.map +1 -0
- package/src/compilers/web-component/index.d.ts +3 -0
- package/src/compilers/web-component/index.d.ts.map +1 -0
- package/src/compilers/web-component/index.js +6 -0
- package/src/compilers/web-component/index.js.map +1 -0
- package/src/compilers/web-component/lib/builder.d.ts +45 -0
- package/src/compilers/web-component/lib/builder.d.ts.map +1 -0
- package/src/compilers/web-component/lib/builder.js +341 -0
- package/src/compilers/web-component/lib/builder.js.map +1 -0
- package/src/compilers/web-component/lib/class-name.d.ts +4 -0
- package/src/compilers/web-component/lib/class-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/class-name.js +24 -0
- package/src/compilers/web-component/lib/class-name.js.map +1 -0
- package/src/compilers/web-component/lib/config-data.d.ts +9 -0
- package/src/compilers/web-component/lib/config-data.d.ts.map +1 -0
- package/src/compilers/web-component/lib/config-data.js +14 -0
- package/src/compilers/web-component/lib/config-data.js.map +1 -0
- package/src/compilers/web-component/lib/ng-build.d.ts +8 -0
- package/src/compilers/web-component/lib/ng-build.d.ts.map +1 -0
- package/src/compilers/web-component/lib/ng-build.js +685 -0
- package/src/compilers/web-component/lib/ng-build.js.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts +9 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.js +355 -0
- package/src/compilers/web-component/lib/resource-inliner.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.js +47 -0
- package/src/compilers/web-component/lib/web-component-name.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js +335 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -0
- package/src/compilers/web-component/model/type.d.ts +29 -0
- package/src/compilers/web-component/model/type.d.ts.map +1 -0
- package/src/compilers/web-component/model/type.js +3 -0
- package/src/compilers/web-component/model/type.js.map +1 -0
- package/src/compilers/worker-compiler.d.ts +12 -0
- package/src/compilers/worker-compiler.d.ts.map +1 -0
- package/src/compilers/worker-compiler.js +123 -0
- package/src/compilers/worker-compiler.js.map +1 -0
- package/src/compilers/yaml-compiler.d.ts +18 -0
- package/src/compilers/yaml-compiler.d.ts.map +1 -0
- package/src/compilers/yaml-compiler.js +139 -0
- package/src/compilers/yaml-compiler.js.map +1 -0
- package/src/core/base-compiler.d.ts +17 -0
- package/src/core/base-compiler.d.ts.map +1 -0
- package/src/core/base-compiler.js +78 -0
- package/src/core/base-compiler.js.map +1 -0
- package/src/core/config.d.ts +640 -0
- package/src/core/config.d.ts.map +1 -0
- package/src/core/config.js +432 -0
- package/src/core/config.js.map +1 -0
- package/src/core/file-watcher.d.ts +23 -0
- package/src/core/file-watcher.d.ts.map +1 -0
- package/src/core/file-watcher.js +63 -0
- package/src/core/file-watcher.js.map +1 -0
- package/src/index.d.ts +31 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +34 -0
- package/src/index.js.map +1 -0
- package/src/types/asset-configs.d.ts +189 -0
- package/src/types/asset-configs.d.ts.map +1 -0
- package/src/types/asset-configs.js +7 -0
- package/src/types/asset-configs.js.map +1 -0
- package/src/types/theme.d.ts +67 -0
- package/src/types/theme.d.ts.map +1 -0
- package/src/types/theme.js +3 -0
- package/src/types/theme.js.map +1 -0
- package/src/utils/file-utils.d.ts +16 -0
- package/src/utils/file-utils.d.ts.map +1 -0
- package/src/utils/file-utils.js +58 -0
- package/src/utils/file-utils.js.map +1 -0
- package/src/utils/i18n-compile-validator.d.ts +20 -0
- package/src/utils/i18n-compile-validator.d.ts.map +1 -0
- package/src/utils/i18n-compile-validator.js +198 -0
- package/src/utils/i18n-compile-validator.js.map +1 -0
- package/src/utils/i18n-fixer.d.ts +39 -0
- package/src/utils/i18n-fixer.d.ts.map +1 -0
- package/src/utils/i18n-fixer.js +396 -0
- package/src/utils/i18n-fixer.js.map +1 -0
- package/src/utils/i18n-sanitizer.d.ts +17 -0
- package/src/utils/i18n-sanitizer.d.ts.map +1 -0
- package/src/utils/i18n-sanitizer.js +101 -0
- package/src/utils/i18n-sanitizer.js.map +1 -0
- package/src/utils/i18n-utils.d.ts +21 -0
- package/src/utils/i18n-utils.d.ts.map +1 -0
- package/src/utils/i18n-utils.js +89 -0
- package/src/utils/i18n-utils.js.map +1 -0
- package/src/utils/interactive-translator.d.ts +18 -0
- package/src/utils/interactive-translator.d.ts.map +1 -0
- package/src/utils/interactive-translator.js +401 -0
- package/src/utils/interactive-translator.js.map +1 -0
- package/src/utils/llama-cpp-translator.d.ts +33 -0
- package/src/utils/llama-cpp-translator.d.ts.map +1 -0
- package/src/utils/llama-cpp-translator.js +267 -0
- package/src/utils/llama-cpp-translator.js.map +1 -0
- package/src/utils/logger.d.ts +14 -0
- package/src/utils/logger.d.ts.map +1 -0
- package/src/utils/logger.js +42 -0
- package/src/utils/logger.js.map +1 -0
- package/src/utils/ollama-translator.d.ts +38 -0
- package/src/utils/ollama-translator.d.ts.map +1 -0
- package/src/utils/ollama-translator.js +371 -0
- package/src/utils/ollama-translator.js.map +1 -0
- package/src/utils/option-utils.d.ts +58 -0
- package/src/utils/option-utils.d.ts.map +1 -0
- package/src/utils/option-utils.js +123 -0
- package/src/utils/option-utils.js.map +1 -0
- package/src/utils/platform-utils.d.ts +33 -0
- package/src/utils/platform-utils.d.ts.map +1 -0
- package/src/utils/platform-utils.js +114 -0
- package/src/utils/platform-utils.js.map +1 -0
- package/src/utils/pwa-utils.d.ts +28 -0
- package/src/utils/pwa-utils.d.ts.map +1 -0
- package/src/utils/pwa-utils.js +48 -0
- package/src/utils/pwa-utils.js.map +1 -0
- package/src/utils/translation-manager.d.ts +43 -0
- package/src/utils/translation-manager.d.ts.map +1 -0
- package/src/utils/translation-manager.js +302 -0
- package/src/utils/translation-manager.js.map +1 -0
- package/src/utils/web-translation-providers.d.ts +53 -0
- package/src/utils/web-translation-providers.d.ts.map +1 -0
- package/src/utils/web-translation-providers.js +190 -0
- package/src/utils/web-translation-providers.js.map +1 -0
- package/src/utils/yaml-utils.d.ts +9 -0
- package/src/utils/yaml-utils.d.ts.map +1 -0
- package/src/utils/yaml-utils.js +26 -0
- package/src/utils/yaml-utils.js.map +1 -0
- package/templates/mag-compile.config.js +77 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const YAML = require('yaml');
|
|
5
|
+
const { WebComponentBuilder, buildPwa } = require('../../src/index.js');
|
|
6
|
+
|
|
7
|
+
function extractVersion(yamlContent) {
|
|
8
|
+
const match = yamlContent.match(/^version:\s*(.+)$/m);
|
|
9
|
+
return match ? match[1].trim() : '';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function bumpPatchVersion(version) {
|
|
13
|
+
const parts = String(version).split('.');
|
|
14
|
+
const major = parseInt(parts[0], 10) || 0;
|
|
15
|
+
const minor = parseInt(parts[1], 10) || 0;
|
|
16
|
+
const patch = (parseInt(parts[2], 10) || 0) + 1;
|
|
17
|
+
return `${major}.${minor}.${patch}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function assetsWcCommand(program) {
|
|
21
|
+
program
|
|
22
|
+
.command('assets-wc')
|
|
23
|
+
.description(
|
|
24
|
+
"Compile all assets then copy each WC app's public/assets to dist/apps/{appName}-wc/"
|
|
25
|
+
)
|
|
26
|
+
.option('-c, --config <path>', 'Config file path', './mag-cli.config.js')
|
|
27
|
+
.option('-a, --app <name>', 'Target app name (e.g., m-comics)')
|
|
28
|
+
.option(
|
|
29
|
+
'--version-check',
|
|
30
|
+
'Skip apps whose version has not changed since last commit',
|
|
31
|
+
false
|
|
32
|
+
)
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const configPath = path.resolve(options.config);
|
|
35
|
+
|
|
36
|
+
// āā 1. Load config āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
37
|
+
let config = {};
|
|
38
|
+
try {
|
|
39
|
+
config = require(configPath);
|
|
40
|
+
} catch {
|
|
41
|
+
/* ignore config load error */
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const allPaths = Array.isArray(config.paths) ? config.paths : [];
|
|
45
|
+
|
|
46
|
+
// āā 2. Run assets compile (filtered to target app + libs/one) āāāāāāāā
|
|
47
|
+
const cliScript = process.argv[1];
|
|
48
|
+
let compileConfigPath = configPath;
|
|
49
|
+
let tempConfigPath = null;
|
|
50
|
+
|
|
51
|
+
if (options.app && allPaths.length > 0) {
|
|
52
|
+
const filteredPaths = allPaths.filter(({ source }) => {
|
|
53
|
+
const appDir = path.dirname(source);
|
|
54
|
+
const appName = path.basename(appDir);
|
|
55
|
+
// Always include libs/one assets; include only the target app
|
|
56
|
+
return appName === 'one' || appName === options.app;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (filteredPaths.length > 0) {
|
|
60
|
+
tempConfigPath = path.resolve(`mag-cli.config.wc-${options.app}.tmp.js`);
|
|
61
|
+
const filteredConfig = { ...config, paths: filteredPaths };
|
|
62
|
+
fs.writeFileSync(
|
|
63
|
+
tempConfigPath,
|
|
64
|
+
`module.exports = ${JSON.stringify(filteredConfig, null, 2)};\n`
|
|
65
|
+
);
|
|
66
|
+
compileConfigPath = tempConfigPath;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log(
|
|
71
|
+
options.app
|
|
72
|
+
? `šØ Compiling assets for ${options.app} + libs/one...\n`
|
|
73
|
+
: 'šØ Compiling all assets...\n'
|
|
74
|
+
);
|
|
75
|
+
try {
|
|
76
|
+
execSync(`node "${cliScript}" assets --config "${compileConfigPath}"`, {
|
|
77
|
+
stdio: 'inherit',
|
|
78
|
+
});
|
|
79
|
+
} catch {
|
|
80
|
+
if (tempConfigPath && fs.existsSync(tempConfigPath)) fs.unlinkSync(tempConfigPath);
|
|
81
|
+
console.error('\nā Asset compilation failed ā see errors above.');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (tempConfigPath && fs.existsSync(tempConfigPath)) fs.unlinkSync(tempConfigPath);
|
|
86
|
+
|
|
87
|
+
// āā 3. Reload config and find WC-enabled apps āāāāāāāāāāāāāāāāāāāāāāāāā
|
|
88
|
+
try {
|
|
89
|
+
// Clear require cache so we get fresh config after compile
|
|
90
|
+
delete require.cache[configPath];
|
|
91
|
+
config = require(configPath);
|
|
92
|
+
} catch {
|
|
93
|
+
/* ignore config load error */
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const paths = Array.isArray(config.paths) ? config.paths : [];
|
|
97
|
+
const results = []; // { appName, status: 'ok'|'skipped'|'failed', error? }
|
|
98
|
+
|
|
99
|
+
console.log('\nš¦ Checking for WC-enabled apps...');
|
|
100
|
+
|
|
101
|
+
for (const { source, output } of paths) {
|
|
102
|
+
const remoteDir = path.join(source, 'remote');
|
|
103
|
+
if (!fs.existsSync(remoteDir)) continue;
|
|
104
|
+
|
|
105
|
+
// Derive appName: apps/m-comics/mag_assets ā m-comics
|
|
106
|
+
const appDir = path.dirname(source);
|
|
107
|
+
const appName = path.basename(appDir);
|
|
108
|
+
|
|
109
|
+
if (options.app && options.app !== appName) continue;
|
|
110
|
+
|
|
111
|
+
const expectedYml = `${appName}.yml`;
|
|
112
|
+
const remoteFiles = fs.readdirSync(remoteDir);
|
|
113
|
+
if (!remoteFiles.includes(expectedYml)) continue;
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
if (!process.env.CI) {
|
|
117
|
+
const yamlFile = path.join(remoteDir, expectedYml);
|
|
118
|
+
const content = fs.readFileSync(yamlFile, 'utf8');
|
|
119
|
+
const currVersion = extractVersion(content);
|
|
120
|
+
const newVersion = bumpPatchVersion(currVersion);
|
|
121
|
+
fs.writeFileSync(
|
|
122
|
+
yamlFile,
|
|
123
|
+
content.replace(/^(version:\s*)(.+)$/m, `$1${newVersion}`),
|
|
124
|
+
'utf8'
|
|
125
|
+
);
|
|
126
|
+
console.log(
|
|
127
|
+
`\n š ${appName}: version bumped ${currVersion} ā ${newVersion}`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (options.versionCheck) {
|
|
132
|
+
const yamlFile = path.join(remoteDir, expectedYml);
|
|
133
|
+
const currVersion = extractVersion(
|
|
134
|
+
fs.readFileSync(yamlFile, 'utf8')
|
|
135
|
+
);
|
|
136
|
+
let prevVersion = '';
|
|
137
|
+
try {
|
|
138
|
+
const relPath = path
|
|
139
|
+
.relative(process.cwd(), yamlFile)
|
|
140
|
+
.replace(/\\/g, '/');
|
|
141
|
+
const out = execSync(`git show HEAD~1:${relPath}`, {
|
|
142
|
+
encoding: 'utf8',
|
|
143
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
144
|
+
});
|
|
145
|
+
prevVersion = extractVersion(out);
|
|
146
|
+
} catch {
|
|
147
|
+
/* first commit or new file ā treat as changed */
|
|
148
|
+
}
|
|
149
|
+
if (currVersion === prevVersion) {
|
|
150
|
+
console.log(
|
|
151
|
+
`\n āļø ${appName}: version unchanged (${currVersion}), skipping`
|
|
152
|
+
);
|
|
153
|
+
results.push({ appName, status: 'skipped' });
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
console.log(
|
|
157
|
+
`\n š ${appName}: version ${prevVersion || 'new'} ā ${currVersion}`
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Destination: dist/apps/m-comics-wc (for CI/CD bundle)
|
|
162
|
+
const distDestDir = path.join('dist', 'apps', `${appName}-wc`);
|
|
163
|
+
|
|
164
|
+
console.log(`\n ${appName}`);
|
|
165
|
+
console.log(` source : ${output}`);
|
|
166
|
+
console.log(` dist : ${distDestDir}`);
|
|
167
|
+
|
|
168
|
+
if (!fs.existsSync(output)) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
`assets source dir not found: ${output} ā run assets:compile first`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Clean and recreate dist destination
|
|
175
|
+
if (fs.existsSync(distDestDir))
|
|
176
|
+
fs.rmSync(distDestDir, { recursive: true, force: true });
|
|
177
|
+
fs.mkdirSync(distDestDir, { recursive: true });
|
|
178
|
+
|
|
179
|
+
copyDirSync(output, distDestDir);
|
|
180
|
+
console.log(` ā
assets copied to ${distDestDir}`);
|
|
181
|
+
|
|
182
|
+
// āā WC JS bundle āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
183
|
+
const remoteDistDir = path.join(distDestDir, 'remote');
|
|
184
|
+
console.log(` š§ Building WC JS bundle...`);
|
|
185
|
+
await new WebComponentBuilder(remoteDir, remoteDistDir).compile();
|
|
186
|
+
console.log(` ā
WC bundle ā ${remoteDistDir}`);
|
|
187
|
+
|
|
188
|
+
// āā PWA build (if pwa: key present in YAML) āāāāāāāāāāāāāāāāāāāāā
|
|
189
|
+
const yamlFilePath = path.join(remoteDir, expectedYml);
|
|
190
|
+
const yamlContent = fs.readFileSync(yamlFilePath, 'utf8');
|
|
191
|
+
const appConfig = YAML.parse(yamlContent);
|
|
192
|
+
if (appConfig.pwa) {
|
|
193
|
+
await buildPwa(appName, appConfig);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
results.push({ appName, status: 'ok' });
|
|
197
|
+
} catch (err) {
|
|
198
|
+
console.error(` ā ${appName}: failed ā ${err.message}`);
|
|
199
|
+
results.push({ appName, status: 'failed', error: err.message });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// āā Summary āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
204
|
+
const built = results.filter((r) => r.status === 'ok');
|
|
205
|
+
const skipped = results.filter((r) => r.status === 'skipped');
|
|
206
|
+
const failed = results.filter((r) => r.status === 'failed');
|
|
207
|
+
|
|
208
|
+
console.log('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
209
|
+
if (results.length === 0) {
|
|
210
|
+
console.log(' ā¹ļø No WC-enabled apps found.');
|
|
211
|
+
} else {
|
|
212
|
+
for (const r of results) {
|
|
213
|
+
if (r.status === 'ok') console.log(` ā
${r.appName}`);
|
|
214
|
+
else if (r.status === 'skipped')
|
|
215
|
+
console.log(` āļø ${r.appName} (skipped ā version unchanged)`);
|
|
216
|
+
else console.log(` ā ${r.appName} ā ${r.error}`);
|
|
217
|
+
}
|
|
218
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
219
|
+
const parts = [];
|
|
220
|
+
if (built.length) parts.push(`${built.length} built`);
|
|
221
|
+
if (skipped.length) parts.push(`${skipped.length} skipped`);
|
|
222
|
+
if (failed.length) parts.push(`${failed.length} failed`);
|
|
223
|
+
console.log(
|
|
224
|
+
failed.length
|
|
225
|
+
? `\nā ļø Done with errors: ${parts.join(', ')}`
|
|
226
|
+
: `\nš Done: ${parts.join(', ')}`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (failed.length > 0) process.exit(1);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function copyDirSync(src, dest) {
|
|
235
|
+
if (!fs.existsSync(src)) return;
|
|
236
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
237
|
+
for (const entry of entries) {
|
|
238
|
+
const srcPath = path.join(src, entry.name);
|
|
239
|
+
const destPath = path.join(dest, entry.name);
|
|
240
|
+
if (entry.isDirectory()) {
|
|
241
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
242
|
+
copyDirSync(srcPath, destPath);
|
|
243
|
+
} else {
|
|
244
|
+
fs.copyFileSync(srcPath, destPath);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
module.exports = assetsWcCommand;
|