Skip to content

Commit

Permalink
Renamed app and client to backend and frontend. Fixed example steps.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <kittaakos@gmail.com>
  • Loading branch information
kittaakos committed May 16, 2017
1 parent c693368 commit aa48cc7
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 48 deletions.
2 changes: 1 addition & 1 deletion config/webpack/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (dirname) {
PROJECT_ROOT: path.resolve(dirname, '.'),
SRC: path.resolve(dirname, 'src'),
BUILD_ROOT: path.resolve(dirname, 'lib'),
ENTRY: path.resolve(dirname, 'src/client/index.ts'),
ENTRY: path.resolve(dirname, 'src/frontend/index.ts'),
NODE_MODULES: path.resolve(dirname, 'node_modules')
};
};
43 changes: 18 additions & 25 deletions doc/Developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ This command does a few things:
- runs the Typescript linter
- runs the unit tests

## Build the `file-dependency-updater` tool

Before building the examples, we need to build a small utility that helps
handling the dependency of the example applications on the main `theia`
package. This tool watches for any change in the build artifacts of `theia`
and propagates them to the examples' `node_modules` directories. It helps
keeping our edit-build-test cycle short when doing changes to `theia`.

$ cd $THEIA/config/file-dependency-updater
$ npm install

## Build and run the browser-based example application

Now that the `theia` package is built, we can do the same with the browser
Expand All @@ -53,7 +42,7 @@ example.

Note that because of the dependency that the example has on `file:../.., the
`prepare` step of `theia` will be called, causing its build process to run
again. This is expected.
again. This is expected.

Once this is done, we can start the application with:

Expand All @@ -73,22 +62,26 @@ It can also be started with:

$ npm start

## tldr
## tl;dr

To build and run the browser example:

$ git clone https://github.com/theia-ide/theia && \
cd theia && \
npm install && \
cd examples/browser && \
npm install && \
npm start
$ git clone https://github.com/theia-ide/theia \
&& cd theia \
&& npm install \
&& npm run build \
&& cd examples/browser \
&& npm install \
&& npm run build \
&& npm run start

To build and run the electron example:

$ git clone https://github.com/theia-ide/theia && \
cd theia && \
npm install && \
cd examples/electron && \
npm install && \
npm start
$ git clone https://github.com/theia-ide/theia \
&& cd theia \
&& npm install \
&& npm run build \
&& cd examples/electron \
&& npm install \
&& npm run build \
&& npm run start
20 changes: 10 additions & 10 deletions examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"scripts": {
"clean": "rimraf lib",
"prepare": "npm run clean && npm run build",
"build": "npm run build:app && npm run build:browser",
"build:app": "tsc && npm run lint",
"build:browser": "webpack && cp src/client/index.html lib/client",
"build": "npm run build:backend && npm run build:frontend",
"build:backend": "tsc && npm run lint",
"build:frontend": "webpack && cp src/frontend/index.html lib/frontend",
"lint": "tslint -c ../../config/tslint/tslint.json --project ./tsconfig.json",
"start": "concurrently --names watch-deps,backend,webpack-server --prefix \"[{name}]\" \"npm run watch:dependencies\" \"npm run start:app\" \"npm run start:browser\"",
"start:app": "node ./lib/app/app.js",
"start:browser": "webpack-dev-server --open",
"cold:start:browser": "cd ../../ && npm run clean && npm run build && cd examples/browser && npm run clean && npm run build && npm start",
"watch:app": "tsc --watch",
"watch:browser": "npm run build:browser && webpack --watch",
"start": "concurrently --names watch-deps,backend,webpack-server --prefix \"[{name}]\" \"npm run watch:dependencies\" \"npm run start:backend\" \"npm run start:frontend\"",
"start:backend": "node ./lib/backend/main.js",
"start:frontend": "webpack-dev-server --open",
"cold:start": "npm run clean && npm run build && npm start",
"watch:backend": "tsc --watch",
"watch:frontend": "npm run build:frontend && webpack --watch",
"watch:dependencies": "node ../../config/file-dependency-updater/index.js",
"test:ui": "wdio wdio.conf.js"
},
Expand Down Expand Up @@ -54,4 +54,4 @@
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process.on('uncaughtException', function (err: any) {
class StaticServer implements BackendApplicationContribution {
configure(app: express.Application): void {
app.use(express.static(path.join(__dirname, '..'), {
index: path.join('client', 'index.html')
index: path.join('frontend', 'index.html')
}));
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"clean": "rimraf lib",
"postinstall": "electron-rebuild",
"prepare": "npm run clean && npm run build",
"build": "npm run build:app && npm run build:electron",
"build:app": "tsc && npm run lint",
"build:electron": "npm run build:app && webpack --target electron && cp src/client/index.html lib/client",
"build": "npm run build:backend && npm run build:frontend",
"build:backend": "tsc && npm run lint",
"build:frontend": "npm run build:backend && webpack --target electron && cp src/frontend/index.html lib/frontend",
"lint": "tslint -c ../../config/tslint/tslint.json --project ./tsconfig.json",
"start": "npm run start:electron",
"start:app": "node ./lib/app.js",
"start:electron": "electron ./lib/client/electron-main.js",
"cold:start:electron": "cd ../../ && npm run clean && npm run build && cd examples/electron && npm run clean && npm run build && npm start",
"watch:app": "tsc --watch",
"start": "npm run start:frontend",
"start:backend": "node ./lib/backend/main.js",
"start:frontend": "electron ./lib/frontend/electron-main.js",
"cold:start": "npm run clean && npm run build && npm start",
"watch:backend": "tsc --watch",
"test:ui": "wdio wdio.conf.js"
},
"devDependencies": {
Expand Down Expand Up @@ -55,4 +55,4 @@
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ process.on('uncaughtException', function (err: any) {
@injectable()
class StaticServer implements BackendApplicationContribution {
configure(app: express.Application): void {
app.use(express.static(path.join(__dirname, '../client')));
app.use(express.static(path.join(__dirname, '..'), {
index: path.join('frontend', 'index.html')
}));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ electron.app.on('window-all-closed', () => {
});

electron.app.on('ready', () => {
require("../app/app"); // start the express server
require("../backend/main"); // start the express server
mainWindow = new electron.BrowserWindow({ width: 1024, height: 728 });
mainWindow.webContents.openDevTools();
mainWindow.loadURL(`file://${path.join(__dirname, 'index.html')}`);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit aa48cc7

Please sign in to comment.