Skip to content

Commit

Permalink
Merge branch 'release/v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Aug 31, 2017
2 parents 6987808 + cb60bf1 commit 64aa128
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 833 deletions.
14 changes: 13 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ module.exports = {
'node': true,
'jasmine': true,
},
'extends': ['eslint:recommended'],
'plugins': [
'import'
],
'extends': [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
'parser': 'babel-eslint',
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module'
},
'settings': {
'import/core-modules': [
'vscode'
]
},
'rules': {
'comma-dangle': [
'error',
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"preLaunchTask": "npm: run build",
"preLaunchTask": "npm: build",
"stopOnEntry": false
},
{
Expand All @@ -17,7 +17,7 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/test"],
"preLaunchTask": "npm: run build",
"preLaunchTask": "npm: build",
"stopOnEntry": false
}
]
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release Notes

## 0.7.0 (2017-09-01)

* New in PIO Home:
- New Project
- Import Arduino IDE Project
- Open Project
- Project Examples
* Migrate to "platformio-node-helpers", a common interface for Node.JS based PlatformIO IDE extensions
* Revert back "Run a task" button on the PIO Toolbar

## 0.6.0 (2017-08-10)

* Integrate new PIO Home 2.0
Expand Down
18 changes: 4 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-ide",
"version": "0.6.0",
"version": "0.7.0",
"preview": true,
"displayName": "PlatformIO IDE",
"description": "Official PlatformIO IDE for VSCode: The next generation integrated development environment for IoT. Cross-platform build system and unified debugger. Remote unit testing and firmware updates.",
Expand Down Expand Up @@ -171,11 +171,6 @@
"type": "object",
"title": "PlatformIO IDE configuration",
"properties": {
"platformio-ide.showHomeOnStartup": {
"type": "boolean",
"default": true,
"description": "Show PIO Home on startup"
},
"platformio-ide.useBuiltinPIOCore": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -220,22 +215,17 @@
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.5.2",
"babel-preset-env": "^1.6.0",
"esformatter": "^0.10.0",
"eslint": "^4.1.1",
"eslint-plugin-import": "^2.7.0",
"vsce": "^1.27.0",
"vscode": "^1.1.1"
},
"dependencies": {
"cross-spawn": "^5.1.0",
"fs-plus": "^3.0.0",
"ini": "^1.3.4",
"open": "^0.0.5",
"request": "^2.81.0",
"semver": "^5.3.0",
"tar": "3.1.8",
"tcp-port-used": "^0.1.2",
"tmp": "^0.0.31"
"platformio-node-helpers": "^0.2.0"
},
"extensionDependencies": [
"ms-vscode.cpptools",
Expand Down
7 changes: 4 additions & 3 deletions src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* the root directory of this source tree.
*/

import { runPIOCommand } from '../utils';
import * as pioNodeHelpers from 'platformio-node-helpers';

import vscode from 'vscode';


Expand All @@ -27,7 +28,7 @@ export default async function initCommand() {

try {
const data = JSON.parse(await new Promise((resolve, reject) => {
runPIOCommand(['boards', '--json-output'], (code, stdout, stderr) => {
pioNodeHelpers.core.runPIOCommand(['boards', '--json-output'], (code, stdout, stderr) => {
if (code !== 0) {
reject(stderr);
} else {
Expand Down Expand Up @@ -58,7 +59,7 @@ export default async function initCommand() {
});

await new Promise((resolve, reject) => {
runPIOCommand(['init', '--ide', 'vscode', '--board', selectedBoard.boardId, '--project-dir', vscode.workspace.rootPath], (code, stdout, stderr) => {
pioNodeHelpers.core.runPIOCommand(['init', '--ide', 'vscode', '--board', selectedBoard.boardId, '--project-dir', vscode.workspace.rootPath], (code, stdout, stderr) => {
if (code !== 0) {
reject(stderr);
} else {
Expand Down
28 changes: 1 addition & 27 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,6 @@
* the root directory of this source tree.
*/

import fs from 'fs-plus';
import path from 'path';

export const DEFAULT_PIO_ARGS = ['-f', '-c', 'vscode'];
export const AUTO_REBUILD_DELAY = 3000;
export const IS_WINDOWS = process.platform.startsWith('win');
export const PIO_HOME_DIR = _getPioHomeDir(process.env.PLATFORMIO_HOME_DIR || path.join(fs.getHomeDirectory() || '~', '.platformio'));
export const CACHE_DIR = path.join(PIO_HOME_DIR, '.cache-ide');
export const ENV_DIR = path.join(PIO_HOME_DIR, 'penv');
export const ENV_BIN_DIR = path.join(ENV_DIR, IS_WINDOWS ? 'Scripts' : 'bin');
export const PIO_CORE_MIN_VERSION = '3.5.0-a.4';


function _getPioHomeDir(pioHomeDir) {
if (IS_WINDOWS) {
// Make sure that all path characters have valid ASCII codes.
for (const char of pioHomeDir) {
if (char.charCodeAt(0) > 127) {
// If they don't, put the pio home directory into the root of the disk.
const homeDirPathFormat = path.parse(pioHomeDir);
return path.format({
dir: homeDirPathFormat.root,
base: '.platformio',
});
}
}
}
return pioHomeDir;
}
export const PIO_CORE_MIN_VERSION = '3.5.0-a.6';
51 changes: 14 additions & 37 deletions src/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,32 @@
* the root directory of this source tree.
*/

import request from 'request';
import spawn from 'cross-spawn';
import tcpPortUsed from 'tcp-port-used';
import * as pioNodeHelpers from 'platformio-node-helpers';

import vscode from 'vscode';


export class HomeContentProvider {

static HTTP_HOST = 'localhost';
static HTTP_PORT = 8008;
static shutdownServer() {
pioNodeHelpers.home.shutdownServer();
}

async provideTextDocumentContent(uri) {
await HomeContentProvider.ensureServerStarted();
const params = await pioNodeHelpers.home.ensureServerStarted({
onIDECommand: (command, params) => {
if (command === 'open_project') {
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(params));
}
}
});
return `
<html>
<body style="margin: 0; padding: 0; height: 100%; overflow: hidden; background-color: #fff">
<iframe src="http://${ HomeContentProvider.HTTP_HOST }:${ HomeContentProvider.HTTP_PORT}?start=/${uri.authority}" width="100%" height="100%" frameborder="0" style="position:absolute; left: 0; right: 0; bottom: 0; top: 0px;" />
<iframe src="http://${ params.host }:${ params.port}?start=/${ uri.authority }" width="100%" height="100%" frameborder="0" style="border: 0; left: 0; right: 0; bottom: 0; top: 0; position:absolute;" />
</body>
</html>
`;
}

static isServerStarted() {
return new Promise(resolve => {
tcpPortUsed.check(HomeContentProvider.HTTP_PORT, HomeContentProvider.HTTP_HOST)
.then(inUse => {
resolve(inUse);
}, () => {
return resolve(false);
});
});
}

static async ensureServerStarted() {
if (await HomeContentProvider.isServerStarted()) {
return;
}
return new Promise(resolve => {
spawn('platformio', ['home', '--no-open']);
tcpPortUsed.waitUntilUsed(HomeContentProvider.HTTP_PORT)
.then(() => {
resolve(true);
}, () => {
return resolve(false);
});
});
}

static shutdownServer() {
request.get(`http://${ HomeContentProvider.HTTP_HOST }:${ HomeContentProvider.HTTP_PORT}?__shutdown__=1`);
}

}
160 changes: 0 additions & 160 deletions src/installer/helpers.js

This file was deleted.

Loading

0 comments on commit 64aa128

Please sign in to comment.