@atom-js-org/cli 0.5.2-alpha.0 → 0.5.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/build.cjs +19 -5
- package/src/doctor.cjs +11 -3
- package/src/init.cjs +10 -9
- package/src/run.cjs +10 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atom-js-org/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3-alpha.1",
|
|
4
4
|
"description": "CLI for running and building AtomJS desktop applications.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"atom": "bin/atom.cjs"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=24"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"archiver": "7.0.1",
|
package/src/build.cjs
CHANGED
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
sanitizeFilename
|
|
19
19
|
} = require('./utils.cjs');
|
|
20
20
|
const { resolveElectronCompatibilityRoot } = require('./electron-compat.cjs');
|
|
21
|
+
const cliPackageVersion = require('../package.json').version;
|
|
21
22
|
|
|
22
23
|
async function buildCommand(targetInput, options = {}) {
|
|
23
24
|
const target = validateTarget(targetInput);
|
|
@@ -108,7 +109,7 @@ async function localBuild(project, target, options = {}) {
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
const manifest = {
|
|
111
|
-
atomjsVersion:
|
|
112
|
+
atomjsVersion: cliPackageVersion,
|
|
112
113
|
target,
|
|
113
114
|
productName,
|
|
114
115
|
appId: project.config.appId,
|
|
@@ -188,11 +189,18 @@ async function vendorFramework(appDir, project, target) {
|
|
|
188
189
|
'@atom-js-org/runtime': 'file:vendor/atomjs',
|
|
189
190
|
electron: 'file:vendor/electron-compat'
|
|
190
191
|
};
|
|
191
|
-
if (target
|
|
192
|
+
if (target === 'windows') {
|
|
193
|
+
pkg.dependencies['@webviewjs/webview'] = '0.4.0';
|
|
194
|
+
delete pkg.dependencies['webview-nodejs'];
|
|
195
|
+
if (pkg.optionalDependencies) delete pkg.optionalDependencies['webview-nodejs'];
|
|
196
|
+
} else if (target === 'linux' && process.env.ATOM_SKIP_WEBVIEW_CHECK !== '1') {
|
|
192
197
|
pkg.dependencies['webview-nodejs'] = '0.5.0';
|
|
198
|
+
delete pkg.dependencies['@webviewjs/webview'];
|
|
199
|
+
if (pkg.optionalDependencies) delete pkg.optionalDependencies['webview-nodejs'];
|
|
200
|
+
} else {
|
|
201
|
+
delete pkg.dependencies['webview-nodejs'];
|
|
202
|
+
delete pkg.dependencies['@webviewjs/webview'];
|
|
193
203
|
if (pkg.optionalDependencies) delete pkg.optionalDependencies['webview-nodejs'];
|
|
194
|
-
} else if (pkg.optionalDependencies) {
|
|
195
|
-
delete pkg.optionalDependencies['webview-nodejs'];
|
|
196
204
|
}
|
|
197
205
|
pkg.overrides = { ...(pkg.overrides || {}), tar: '7.5.20' };
|
|
198
206
|
delete pkg.devDependencies;
|
|
@@ -228,7 +236,12 @@ async function installProductionDependencies(appDir, skipInstall, target) {
|
|
|
228
236
|
throw new Error('The AtomJS Electron compatibility facade was not installed in the staged application.');
|
|
229
237
|
}
|
|
230
238
|
|
|
231
|
-
if (target
|
|
239
|
+
if (target === 'windows') {
|
|
240
|
+
const bindingPath = path.join(appDir, 'node_modules', '@webviewjs', 'webview');
|
|
241
|
+
if (!fs.existsSync(bindingPath)) {
|
|
242
|
+
throw new Error('@webviewjs/webview was not installed. Remove node_modules and package-lock.json, then retry the build.');
|
|
243
|
+
}
|
|
244
|
+
} else if (target === 'linux') {
|
|
232
245
|
const bindingPath = path.join(appDir, 'node_modules', 'webview-nodejs');
|
|
233
246
|
if (!fs.existsSync(bindingPath) && process.env.ATOM_SKIP_WEBVIEW_CHECK !== '1') {
|
|
234
247
|
throw new Error('webview-nodejs was not installed. Run `atom doctor`, install the platform prerequisites, and retry the build.');
|
|
@@ -455,6 +468,7 @@ process.chdir(appDir);
|
|
|
455
468
|
process.env.ATOM_PROJECT_ROOT = appDir;
|
|
456
469
|
process.env.ATOM_APP_NAME = productName;
|
|
457
470
|
process.env.ATOM_APP_ID = appId;
|
|
471
|
+
process.title = productName;
|
|
458
472
|
process.env.ATOM_BUILD = '1';
|
|
459
473
|
process.env.ATOM_EMBEDDED_RUNTIME = '1';
|
|
460
474
|
process.env.ATOM_WINDOW_HOST_ENTRY = path.join(appDir, 'vendor', 'atomjs', 'src', 'runtime', 'window-host.mjs');
|
package/src/doctor.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const { loadProject, commandExists } = require('./utils.cjs');
|
|
|
7
7
|
|
|
8
8
|
async function doctorCommand(options = {}) {
|
|
9
9
|
const rows = [];
|
|
10
|
-
rows.push(check('Node.js >=
|
|
10
|
+
rows.push(check('Node.js >= 24', isNodeSupported(), process.version));
|
|
11
11
|
rows.push(check('npm', commandExists(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['--version'])));
|
|
12
12
|
|
|
13
13
|
if (process.platform === 'win32') {
|
|
@@ -31,6 +31,14 @@ async function doctorCommand(options = {}) {
|
|
|
31
31
|
|
|
32
32
|
if (process.platform === 'darwin') {
|
|
33
33
|
rows.push(check('macOS WKWebView backend', true, 'shared native Cocoa host; no osascript process'));
|
|
34
|
+
} else if (process.platform === 'win32') {
|
|
35
|
+
try {
|
|
36
|
+
const project = loadProject(options.project);
|
|
37
|
+
const binding = require.resolve('@webviewjs/webview/package.json', { paths: [project.root, process.cwd()] });
|
|
38
|
+
rows.push(check('Windows prebuilt WebView binding', true, path.dirname(binding)));
|
|
39
|
+
} catch {
|
|
40
|
+
rows.push(check('Windows prebuilt WebView binding', false, 'run npm install; CMake and Visual Studio are not required'));
|
|
41
|
+
}
|
|
34
42
|
} else {
|
|
35
43
|
try {
|
|
36
44
|
const project = loadProject(options.project);
|
|
@@ -57,8 +65,8 @@ async function doctorCommand(options = {}) {
|
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
function isNodeSupported() {
|
|
60
|
-
const [major
|
|
61
|
-
return major
|
|
68
|
+
const [major] = process.versions.node.split('.').map(Number);
|
|
69
|
+
return major >= 24;
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
function check(name, ok, detail = '') {
|
package/src/init.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const fs = require('node:fs');
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const fse = require('fs-extra');
|
|
6
|
+
const cliPackageVersion = require('../package.json').version;
|
|
6
7
|
|
|
7
8
|
async function initCommand(directory, options = {}) {
|
|
8
9
|
const root = path.resolve(directory);
|
|
@@ -30,14 +31,14 @@ async function initCommand(directory, options = {}) {
|
|
|
30
31
|
start: 'atom run build'
|
|
31
32
|
},
|
|
32
33
|
dependencies: {
|
|
33
|
-
'@atom-js-org/runtime':
|
|
34
|
-
electron:
|
|
35
|
-
},
|
|
36
|
-
optionalDependencies: {
|
|
37
|
-
'webview-nodejs': '0.5.0'
|
|
34
|
+
'@atom-js-org/runtime': cliPackageVersion,
|
|
35
|
+
electron: `npm:@atom-js-org/electron@${cliPackageVersion}`
|
|
38
36
|
},
|
|
39
37
|
devDependencies: {
|
|
40
|
-
'@atom-js-org/cli':
|
|
38
|
+
'@atom-js-org/cli': cliPackageVersion
|
|
39
|
+
},
|
|
40
|
+
engines: {
|
|
41
|
+
node: '>=24'
|
|
41
42
|
},
|
|
42
43
|
overrides: {
|
|
43
44
|
tar: '7.5.20'
|
|
@@ -209,7 +210,7 @@ jobs:
|
|
|
209
210
|
- uses: actions/checkout@v4
|
|
210
211
|
- uses: actions/setup-node@v4
|
|
211
212
|
with:
|
|
212
|
-
node-version:
|
|
213
|
+
node-version: 24
|
|
213
214
|
cache: npm
|
|
214
215
|
- run: choco install nsis -y
|
|
215
216
|
- run: npm ci
|
|
@@ -229,7 +230,7 @@ jobs:
|
|
|
229
230
|
- uses: actions/checkout@v4
|
|
230
231
|
- uses: actions/setup-node@v4
|
|
231
232
|
with:
|
|
232
|
-
node-version:
|
|
233
|
+
node-version: 24
|
|
233
234
|
cache: npm
|
|
234
235
|
- run: npm ci
|
|
235
236
|
working-directory: \${{ inputs.project }}
|
|
@@ -249,7 +250,7 @@ jobs:
|
|
|
249
250
|
- run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev zenity rpm
|
|
250
251
|
- uses: actions/setup-node@v4
|
|
251
252
|
with:
|
|
252
|
-
node-version:
|
|
253
|
+
node-version: 24
|
|
253
254
|
cache: npm
|
|
254
255
|
- run: |
|
|
255
256
|
sudo curl -L -o /usr/local/bin/appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
package/src/run.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
const fs = require('node:fs');
|
|
5
5
|
const { spawn } = require('node:child_process');
|
|
6
|
+
const { pathToFileURL } = require('node:url');
|
|
6
7
|
const { loadProject, hostTarget } = require('./utils.cjs');
|
|
7
8
|
const { ensureElectronCompatibility } = require('./electron-compat.cjs');
|
|
8
9
|
|
|
@@ -26,26 +27,16 @@ async function runDev(options) {
|
|
|
26
27
|
const iconPath = project.config.icon
|
|
27
28
|
? path.resolve(project.root, project.config.icon)
|
|
28
29
|
: null;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ATOM_APP_ID: project.config.appId,
|
|
36
|
-
...(iconPath && fs.existsSync(iconPath) ? { ATOM_APP_ICON: iconPath } : {}),
|
|
37
|
-
ATOM_DEV: '1'
|
|
38
|
-
},
|
|
39
|
-
stdio: 'inherit'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
await new Promise((resolve, reject) => {
|
|
43
|
-
child.once('error', reject);
|
|
44
|
-
child.once('exit', (code, signal) => {
|
|
45
|
-
if (code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') resolve();
|
|
46
|
-
else reject(new Error(`Application exited with code ${code}`));
|
|
47
|
-
});
|
|
30
|
+
Object.assign(process.env, {
|
|
31
|
+
ATOM_PROJECT_ROOT: project.root,
|
|
32
|
+
ATOM_APP_NAME: project.config.productName,
|
|
33
|
+
ATOM_APP_ID: project.config.appId,
|
|
34
|
+
...(iconPath && fs.existsSync(iconPath) ? { ATOM_APP_ICON: iconPath } : {}),
|
|
35
|
+
ATOM_DEV: '1'
|
|
48
36
|
});
|
|
37
|
+
process.title = project.config.productName;
|
|
38
|
+
process.chdir(project.root);
|
|
39
|
+
await import(pathToFileURL(mainPath).href);
|
|
49
40
|
}
|
|
50
41
|
|
|
51
42
|
async function runBuild(options) {
|