Fixed the packager for the new folder structure.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2019-09-02 14:57:28 +02:00
parent e8e3c3dc4c
commit 6d590cd111
2 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ git clone https://github.com/bcmi-labs/arduino-editor
cd arduino-editor cd arduino-editor
yarn yarn
yarn rebuild:electron yarn rebuild:electron
yarn --cwd arduino-ide-electron start yarn --cwd electron-app start
``` ```
If you want to switch back to the browser-based example, execute the following in the repository root If you want to switch back to the browser-based example, execute the following in the repository root

View File

@ -14,7 +14,7 @@
const workingCopy = 'working-copy'; const workingCopy = 'working-copy';
/** /**
* Relative path from the `__dirname` to the root where the `arduino-ide-extension` and the `arduino-ide-electron` folders are. * Relative path from the `__dirname` to the root where the `arduino-ide-extension` and the `electron-app` folders are.
* This could come handy when moving the location of the `electron/packager`. * This could come handy when moving the location of the `electron/packager`.
*/ */
const rootPath = join('..', '..'); const rootPath = join('..', '..');
@ -42,7 +42,7 @@
// Copy the following items into the `working-copy` folder. Make sure to reuse the `yarn.lock`. | // Copy the following items into the `working-copy` folder. Make sure to reuse the `yarn.lock`. |
//----------------------------------------------------------------------------------------------+ //----------------------------------------------------------------------------------------------+
mkdir('-p', path('..', workingCopy)); mkdir('-p', path('..', workingCopy));
for (const name of ['arduino-ide-extension', 'arduino-ide-electron', 'yarn.lock', 'package.json', 'lerna.json']) { for (const name of ['arduino-ide-extension', 'electron-app', 'yarn.lock', 'package.json', 'lerna.json']) {
cp('-rf', path(rootPath, name), path('..', workingCopy)); cp('-rf', path(rootPath, name), path('..', workingCopy));
} }
@ -52,7 +52,7 @@
//@ts-ignore //@ts-ignore
let pkg = require('../working-copy/package.json'); let pkg = require('../working-copy/package.json');
const workspaces = pkg.workspaces; const workspaces = pkg.workspaces;
// We cannot remove the `arduino-ide-electron`. Otherwise, there is not way to collect the unused dependencies. // We cannot remove the `electron-app`. Otherwise, there is not way to collect the unused dependencies.
const dependenciesToRemove = ['browser-app']; const dependenciesToRemove = ['browser-app'];
for (const dependencyToRemove of dependenciesToRemove) { for (const dependencyToRemove of dependenciesToRemove) {
const index = workspaces.indexOf(dependencyToRemove); const index = workspaces.indexOf(dependencyToRemove);
@ -70,13 +70,13 @@
// Collect all unused dependencies by the backend. We have to remove them from the electron app. // Collect all unused dependencies by the backend. We have to remove them from the electron app.
// The `bundle.js` already contains everything we need for the frontend. // The `bundle.js` already contains everything we need for the frontend.
// We have to do it before changing the dependencies to `local-path`. // We have to do it before changing the dependencies to `local-path`.
const unusedDependencies = await utils.collectUnusedDependencies('../working-copy/arduino-ide-electron/'); const unusedDependencies = await utils.collectUnusedDependencies('../working-copy/electron-app/');
//------------------------------------------------------------------------------------+ //------------------------------------------------------------------------------------+
// Merge the `working-copy/package.json` with `electron/build/template-package.json`. | // Merge the `working-copy/package.json` with `electron/build/template-package.json`. |
//------------------------------------------------------------------------------------+ //------------------------------------------------------------------------------------+
// @ts-ignore // @ts-ignore
pkg = require('../working-copy/arduino-ide-electron/package.json'); pkg = require('../working-copy/electron-app/package.json');
// @ts-ignore // @ts-ignore
const template = require('../build/template-package.json'); const template = require('../build/template-package.json');
template.build.files = [ ...template.build.files, ...unusedDependencies.map(name => `!node_modules/${name}`) ]; template.build.files = [ ...template.build.files, ...unusedDependencies.map(name => `!node_modules/${name}`) ];