@_nazmiforreal/flutter-ota 0.1.23 → 0.1.25
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/bin/flutter-ota-linux-x64 +0 -0
- package/bin/flutter-ota.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +1 -49
|
Binary file
|
package/bin/flutter-ota.js
CHANGED
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -32,7 +32,7 @@ const ext = process.platform === 'win32' ? '.exe' : '';
|
|
|
32
32
|
const pkgDir = path.join(__dirname, '..');
|
|
33
33
|
const binDir = path.join(pkgDir, 'bin');
|
|
34
34
|
const target = path.join(binDir, `flutter-ota-${platformName}-${archName}${ext}`);
|
|
35
|
-
const cliDir = path.join(pkgDir, '
|
|
35
|
+
const cliDir = path.join(pkgDir, 'dart-src', 'packages', 'cli-tools');
|
|
36
36
|
|
|
37
37
|
function chmod(pathname) {
|
|
38
38
|
try {
|
|
@@ -94,51 +94,3 @@ if (res.status !== 0) {
|
|
|
94
94
|
}
|
|
95
95
|
chmod(target);
|
|
96
96
|
console.log(`flutter-ota: built ${target}`);
|
|
97
|
-
|
|
98
|
-
// Ensure the npm bin wrapper exists (entry point for `flutter-ota` command)
|
|
99
|
-
const wrapper = path.join(binDir, 'flutter-ota.js');
|
|
100
|
-
if (!fs.existsSync(wrapper)) {
|
|
101
|
-
const wrapperContent = `#!/usr/bin/env node
|
|
102
|
-
'use strict';
|
|
103
|
-
|
|
104
|
-
// Wrapper entry point for npm bin linking.
|
|
105
|
-
// This file is created by postinstall.js and points to the platform-specific binary.
|
|
106
|
-
|
|
107
|
-
const { spawnSync } = require('child_process');
|
|
108
|
-
const fs = require('fs');
|
|
109
|
-
const path = require('path');
|
|
110
|
-
|
|
111
|
-
function platform() {
|
|
112
|
-
if (process.platform === 'win32') return 'windows';
|
|
113
|
-
if (process.platform === 'darwin') return 'macos';
|
|
114
|
-
return 'linux';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function arch() {
|
|
118
|
-
return process.arch === 'arm64' ? 'arm64' : 'x64';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const platformName = platform();
|
|
122
|
-
const archName = arch();
|
|
123
|
-
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
124
|
-
const binDir = path.join(__dirname);
|
|
125
|
-
const binary = path.join(binDir, \`flutter-ota-\${platformName}-\${archName}\${ext}\`);
|
|
126
|
-
|
|
127
|
-
if (!fs.existsSync(binary)) {
|
|
128
|
-
console.error(\`flutter-ota: binary not found at \${binary}\`);
|
|
129
|
-
console.error('Run \`npm install\` to trigger postinstall build, or build manually:');
|
|
130
|
-
console.error(\` cd \${path.join(__dirname, '..', 'dart-src', 'packages', 'cli-tools')}\`);
|
|
131
|
-
console.error(\` dart compile exe bin/flutter_ota_kit.dart -o \${binary}\`);
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Forward all arguments to the native binary
|
|
136
|
-
const result = spawnSync(binary, process.argv.slice(2), {
|
|
137
|
-
stdio: 'inherit',
|
|
138
|
-
});
|
|
139
|
-
process.exit(result.status ?? 1);
|
|
140
|
-
`;
|
|
141
|
-
fs.writeFileSync(wrapper, wrapperContent);
|
|
142
|
-
chmod(wrapper);
|
|
143
|
-
console.log(`flutter-ota: created npm bin wrapper at ${wrapper}`);
|
|
144
|
-
}
|