Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype of removing resolve-tspaths #44

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/app/electron/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as dotenv from "dotenv";
import * as electron from "electron";
import * as fse from "fs-extra";
import * as log from "app/server/lib/log";
import * as packageJson from "ext/desktop.package.json";
import * as packageJson from "desktop.package.json";
import * as path from "path";
import { commonUrls } from "app/common/gristUrls";
import { getAvailablePort } from "app/server/lib/serverUtils";
Expand Down
13 changes: 7 additions & 6 deletions ext/app/electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import * as electron from "electron";
import * as path from "path";
import { program } from "commander";

//process.env.NODE_PATH = __dirname + ":" + process.env.NODE_PATH;
process.env.APP_ROOT_PATH = path.resolve(__dirname, "../../../..");
console.log(process.env.APP_ROOT_PATH);

// A temporary hack to make `yarn start` work.
// TODO: Create a script that actually calls resolve-tspaths when source code changes, and ditch this.
if (!electron.app.isPackaged) {
process.env.NODE_PATH =
path.resolve(process.cwd(), 'core/_build') +
':' +
path.resolve(process.cwd(), 'core/_build/ext') +
':' +
path.resolve(process.cwd(), 'core/_build/stubs') +
':' + process.env.NODE_PATH;
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('module').Module._initPaths();
}
// eslint-disable-next-line sort-imports
import * as log from "app/server/lib/log";
import * as packageJson from "ext/desktop.package.json";
import * as packageJson from "desktop.package.json";
import * as version from "app/common/version";
import { FileToOpen, GristApp } from "app/electron/GristApp";
import { loadConfig } from "app/electron/config";
import { setupLogging } from "./logging";
import { setupLogging } from "app/electron/logging";

// Mimic the behavior of a packaged app, where argv will not include "electron" and its arguments.
// Example:
Expand Down
2 changes: 1 addition & 1 deletion ext/app/server/lib/create.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ICreate, makeSimpleCreator } from "app/server/lib/ICreate";
import { GristApp } from "ext/app/electron/GristApp";
import { GristApp } from "app/electron/GristApp";
import { IDocStorageManager } from "app/server/lib/IDocStorageManager";
import { getElectronLoginSystem } from "app/electron/LoginSystem";
import log from "app/server/lib/log";
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"productName": "Grist Desktop",
"description": "Grist Desktop",
"version": "0.2.10",
"main": "core/_build/ext/app/electron/main.js",
"main": "core/_build/node_modules/app/electron/main.js",
"repository": "https://github.com/gristlabs/grist-desktop",
"author": "Grist Labs Inc. <[email protected]>",
"license": "Apache-2.0",
Expand All @@ -23,9 +23,9 @@
},
"scripts": {
"setup": "./scripts/setup.sh && cd core && yarn run install:python",
"build": "cd core && yarn run build:prod && resolve-tspaths",
"build": "cd core && yarn run build:prod",
"paths": "cd core && resolve-tspaths",
"electron:preview": "electron --trace-warnings core/_build/ext/app/electron/main.js",
"electron:preview": "electron --trace-warnings core/_build/node_modules/app/electron/main.js",
"electron:dir": "electron-builder build --linux --dir",
"electron:linux": "electron-builder build --linux",
"electron:ci": "./scripts/ci.sh",
Expand Down
Loading