@@ -10,6 +10,7 @@ const stringifyModule = require('./node_modules/csv-stringify/dist/cjs/sync.cjs'
|
|||||||
const stringify = typeof stringifyModule === 'function'
|
const stringify = typeof stringifyModule === 'function'
|
||||||
? stringifyModule
|
? stringifyModule
|
||||||
: stringifyModule.default || stringifyModule.stringify || stringifyModule;
|
: stringifyModule.default || stringifyModule.stringify || stringifyModule;
|
||||||
|
const {version: packageVersion} = require('./package.json');
|
||||||
const {loadConfig, resolveOutputPath} = require('./lib/config');
|
const {loadConfig, resolveOutputPath} = require('./lib/config');
|
||||||
const {buildThrottle, applyRateLimitBuffer, getTotalRateLimitPerMinute} = require('./lib/rate');
|
const {buildThrottle, applyRateLimitBuffer, getTotalRateLimitPerMinute} = require('./lib/rate');
|
||||||
const {runOnboarding} = require('./lib/onboarding');
|
const {runOnboarding} = require('./lib/onboarding');
|
||||||
@@ -336,7 +337,7 @@ async function scheduleRuns(config) {
|
|||||||
throw new Error('No sheets configured to pull in config.json');
|
throw new Error('No sheets configured to pull in config.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Google Sheets Rate Assistant');
|
console.log(`Google Sheets Rate Assistant v${packageVersion}`);
|
||||||
|
|
||||||
const firstApiKey = getFirstApiKey(config);
|
const firstApiKey = getFirstApiKey(config);
|
||||||
const titleMap = {};
|
const titleMap = {};
|
||||||
|
|||||||
+10
-2
@@ -1,6 +1,14 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
let isSingleExecutableApp = false;
|
||||||
|
try {
|
||||||
|
const sea = require('node:sea');
|
||||||
|
isSingleExecutableApp = typeof sea.isSea === 'function' && sea.isSea();
|
||||||
|
} catch {
|
||||||
|
isSingleExecutableApp = false;
|
||||||
|
}
|
||||||
|
|
||||||
const CONFIG_FILE_NAME = 'config.json';
|
const CONFIG_FILE_NAME = 'config.json';
|
||||||
const DEFAULT_CONFIG_TEMPLATE = JSON.stringify({
|
const DEFAULT_CONFIG_TEMPLATE = JSON.stringify({
|
||||||
apiKeys: [
|
apiKeys: [
|
||||||
@@ -56,12 +64,12 @@ const DEFAULT_CONFIG_TEMPLATE = JSON.stringify({
|
|||||||
}, null, 2) + '\n';
|
}, null, 2) + '\n';
|
||||||
|
|
||||||
function getDefaultConfigPath() {
|
function getDefaultConfigPath() {
|
||||||
const packagedApp = Boolean(process.pkg);
|
const packagedApp = isSingleExecutableApp;
|
||||||
return path.resolve(packagedApp ? path.dirname(process.execPath) : process.cwd(), CONFIG_FILE_NAME);
|
return path.resolve(packagedApp ? path.dirname(process.execPath) : process.cwd(), CONFIG_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfigPathCandidates() {
|
function getConfigPathCandidates() {
|
||||||
const packagedApp = Boolean(process.pkg);
|
const packagedApp = isSingleExecutableApp;
|
||||||
const externalDefault = getDefaultConfigPath();
|
const externalDefault = getDefaultConfigPath();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
Generated
+459
-1522
File diff suppressed because it is too large
Load Diff
+2
-7
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "google-sheets-rate-assistant",
|
"name": "google-sheets-rate-assistant",
|
||||||
"version": "2.1.10",
|
"version": "2.1.11",
|
||||||
"description": "Pull Google Sheets data and export to CSV with configurable schedules and rate limiting.",
|
"description": "Pull Google Sheets data and export to CSV with configurable schedules and rate limiting.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": "index.js",
|
"bin": "index.js",
|
||||||
@@ -14,11 +14,6 @@
|
|||||||
"p-throttle": "^8.1.0"
|
"p-throttle": "^8.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"pkg": "^5.8.1"
|
"esbuild": "^0.25.9"
|
||||||
},
|
|
||||||
"pkg": {
|
|
||||||
"assets": [
|
|
||||||
"node_modules/csv-stringify/dist/cjs/sync.cjs"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ If `config.json` is missing, the app creates a starter file next to the executab
|
|||||||
|
|
||||||
If you choose the wizard, it will ask for the auth method, credential count, document count, and sheet names. It will not ask for output directories or file names.
|
If you choose the wizard, it will ask for the auth method, credential count, document count, and sheet names. It will not ask for output directories or file names.
|
||||||
|
|
||||||
|
## Build Note
|
||||||
|
|
||||||
|
The Windows packaging script in `scripts/build-win.js` now builds a single executable using Node 26's SEA workflow.
|
||||||
|
|
||||||
## AI Disclosure
|
## AI Disclosure
|
||||||
|
|
||||||
A large chunk of the project was coded using AI, this is the first pass at integrating some AI assistance into my projects. However all code written has been verified and checked before submission. AI use has only been included since the v2 rewrite.
|
A large chunk of the project was coded using AI, this is the first pass at integrating some AI assistance into my projects. However all code written has been verified and checked before submission. AI use has only been included since the v2 rewrite.
|
||||||
|
|||||||
+28
-2
@@ -1,6 +1,8 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {exec} = require('pkg');
|
const {execFileSync} = require('child_process');
|
||||||
|
const esbuild = require('esbuild');
|
||||||
const {version: packageVersion} = require('../package.json');
|
const {version: packageVersion} = require('../package.json');
|
||||||
|
|
||||||
function normalizeBuildVersion(value) {
|
function normalizeBuildVersion(value) {
|
||||||
@@ -14,9 +16,33 @@ async function main() {
|
|||||||
fs.mkdirSync(distDir, {recursive: true});
|
fs.mkdirSync(distDir, {recursive: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsa-sea-'));
|
||||||
|
const bundlePath = path.join(tempDir, 'index.cjs');
|
||||||
|
const seaBlobPath = path.join(tempDir, 'sea-prep.blob');
|
||||||
|
const seaConfigPath = path.join(tempDir, 'sea-config.json');
|
||||||
const buildVersion = normalizeBuildVersion(process.env.BUILD_VERSION);
|
const buildVersion = normalizeBuildVersion(process.env.BUILD_VERSION);
|
||||||
const outputFile = path.join(distDir, `gSheets-Rate-Assistant-${buildVersion}.exe`);
|
const outputFile = path.join(distDir, `gSheets-Rate-Assistant-${buildVersion}.exe`);
|
||||||
await exec(['.', '--targets', 'latest-win-x64', '--output', outputFile]);
|
|
||||||
|
await esbuild.build({
|
||||||
|
entryPoints: [path.resolve(__dirname, '..', 'index.js')],
|
||||||
|
bundle: true,
|
||||||
|
platform: 'node',
|
||||||
|
format: 'cjs',
|
||||||
|
target: 'node26',
|
||||||
|
outfile: bundlePath,
|
||||||
|
logLevel: 'info',
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.writeFileSync(seaConfigPath, JSON.stringify({
|
||||||
|
main: bundlePath,
|
||||||
|
output: outputFile,
|
||||||
|
mainFormat: 'commonjs',
|
||||||
|
disableExperimentalSEAWarning: true,
|
||||||
|
useCodeCache: false,
|
||||||
|
useSnapshot: false,
|
||||||
|
}, null, 2));
|
||||||
|
|
||||||
|
execFileSync(process.execPath, ['--build-sea', seaConfigPath], {stdio: 'inherit'});
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(error => {
|
main().catch(error => {
|
||||||
|
|||||||
Reference in New Issue
Block a user