Skip to content

Commit

Permalink
adds scripts for easy remote/local npm switching
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook committed Feb 24, 2021
1 parent f349941 commit c033761
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 130 deletions.
202 changes: 102 additions & 100 deletions bsc-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,106 @@
{
"name": "rooibos-roku",
"version": "4.0.9",
"description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
"files": [
"dist/**/!(*.spec.*)*"
],
"main": "dist/plugin.js",
"directories": {
"test": "test"
},
"dependencies": {
"@types/node": "^14.14.16",
"source-map": "^0.7.3",
"stringify-object": "^3.3.0",
"vscode-languageserver": "~6.1.1",
"vscode-languageserver-protocol": "~3.15.3"
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/expect": "^24.3.0",
"@types/mocha": "^5.2.7",
"@types/sinon": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "^0.30.4",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"chai-subset": "^1.6.0",
"eslint": "^7.11.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-no-only-tests": "^2.4.0",
"fs-extra": "^9.0.1",
"minimatch": "^3.0.4",
"mocha": "^7.1.1",
"nyc": "^15.1.0",
"roku-deploy": "^3.2.4",
"sinon": "^9.0.2",
"source-map-support": "^0.5.13",
"ts-node": "^9.0.0",
"typescript": "^3.8.3",
"typescript-formatter": "^7.2.2"
},
"scripts": {
"clean": "rm -rf ./dist && mkdir dist",
"compile": "npm run clean && tsc -p .",
"prepublishOnly": "npm run build",
"lint": "eslint \"src/**\"",
"build": "npm run compile && cp -r ../framework/src/source ./dist/lib/framework",
"test": "TS_NODE_TRANSPILE_ONLY=true mocha --full-trace --bail",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"publish-npm": "npm run test && npm publish",
"publish-npm:beta": "npm run test && npm publish --tag=beta"
},
"preferGlobal": true,
"keywords": [
"brightscript",
"scenegraph",
"roku",
"rooibos",
"britherscript"
],
"author": "George Cook",
"license": "ISC",
"watch": {
"test": {
"extensions": "ts",
"patterns": [
"src"
]
}
},
"nyc": {
"include": [
"src/**/!(*.spec).ts"
],
"extension": [
".ts"
"name": "rooibos-roku",
"version": "4.1.0",
"description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
"files": [
"dist/**/!(*.spec.*)*"
],
"require": [
"ts-node/register",
"source-map-support/register"
"main": "dist/plugin.js",
"directories": {
"test": "test"
},
"dependencies": {
"@types/node": "^14.14.16",
"source-map": "^0.7.3",
"stringify-object": "^3.3.0",
"vscode-languageserver": "~6.1.1",
"vscode-languageserver-protocol": "~3.15.3"
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/expect": "^24.3.0",
"@types/mocha": "^5.2.7",
"@types/sinon": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "^0.32.2",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"chai-subset": "^1.6.0",
"eslint": "^7.11.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-no-only-tests": "^2.4.0",
"fs-extra": "^9.1.0",
"minimatch": "^3.0.4",
"mocha": "^7.1.1",
"nyc": "^15.1.0",
"roku-deploy": "^3.2.4",
"sinon": "^9.0.2",
"source-map-support": "^0.5.13",
"ts-node": "^9.0.0",
"typescript": "^3.8.3",
"typescript-formatter": "^7.2.2"
},
"scripts": {
"clean": "rm -rf ./dist && mkdir dist",
"compile": "npm run clean && tsc -p .",
"prepublishOnly": "npm run build",
"lint": "eslint \"src/**\"",
"build": "npm run compile && cp -r ../framework/src/source ./dist/lib/framework",
"test": "TS_NODE_TRANSPILE_ONLY=true mocha --full-trace --bail",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"publish-npm": "npm run test && npm publish",
"publish-npm:beta": "npm run test && npm publish --tag=beta",
"local": "ts-node scripts/install-local.js",
"remote": "ts-node scripts/install-npm.js"
},
"preferGlobal": true,
"keywords": [
"brightscript",
"scenegraph",
"roku",
"rooibos",
"britherscript"
],
"reporter": [
"text-summary",
"html"
],
"sourceMap": true,
"instrument": true,
"check-coverage": true,
"lines": 5,
"statements": 5,
"functions": 5,
"branches": 5
},
"mocha": {
"spec": "src/**/*.spec.ts",
"fullTrace": true,
"require": [
"source-map-support/register",
"ts-node/register"
]
}
"author": "George Cook",
"license": "ISC",
"watch": {
"test": {
"extensions": "ts",
"patterns": [
"src"
]
}
},
"nyc": {
"include": [
"src/**/!(*.spec).ts"
],
"extension": [
".ts"
],
"require": [
"ts-node/register",
"source-map-support/register"
],
"reporter": [
"text-summary",
"html"
],
"sourceMap": true,
"instrument": true,
"check-coverage": true,
"lines": 5,
"statements": 5,
"functions": 5,
"branches": 5
},
"mocha": {
"spec": "src/**/*.spec.ts",
"fullTrace": true,
"require": [
"source-map-support/register",
"ts-node/register"
]
}
}
33 changes: 33 additions & 0 deletions bsc-plugin/scripts/install-local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Installs a local version of all the rokucommunity dependent packages into this project
*/

import * as fsExtra from 'fs-extra';
import * as path from 'path';
import * as childProcess from 'child_process';
import * as rimraf from 'rimraf';

//set the cwd to the root of this project
let thisProjectRootPath = path.join(__dirname, '..');
process.chdir(thisProjectRootPath);
let packageJson = JSON.parse(fsExtra.readFileSync('package.json').toString());

let devPackages = {
'brighterscript': '/home/george/hope/open-source/vsc/brighterscript'
};

for (let packageName in devPackages) {
console.log(`adding dev package: '${packageName}' to package.json`);
packageJson.devDependencies[packageName] = `${devPackages[packageName]}`;
rimraf.sync(path.join('node_modules', packageName));
}

console.log('saving package.json changes');
fsExtra.writeFileSync('package.json', JSON.stringify(packageJson, null, 4));
if (fsExtra.existsSync('package-lock.json')) {
fsExtra.rmSync('package-lock.json');
}
console.log('install packages');
childProcess.execSync('npm i', {
stdio: 'inherit'
});
21 changes: 21 additions & 0 deletions bsc-plugin/scripts/install-npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Installs a local version of all the rokucommunity dependent packages into this project
*/

import * as fsExtra from 'fs-extra';
import * as path from 'path';
import * as childProcess from 'child_process';
import * as rimraf from 'rimraf';

//set the cwd to the root of this project
let thisProjectRootPath = path.join(__dirname, '..');
process.chdir(thisProjectRootPath);

rimraf.sync(path.join('node_modules/brighterscript'));
if (fsExtra.existsSync('package-lock.json')) {
fsExtra.rmSync('package-lock.json');
}
console.log('install packages');
childProcess.execSync('npm i brighterscript@latest --save-dev', {
stdio: 'inherit'
});
2 changes: 1 addition & 1 deletion bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ end function`).trim());

});

describe.only('run a local project', () => {
describe.skip('run a local project', () => {
it('sanity checks on parsing - only run this outside of ci', () => {
let programBuilder = new ProgramBuilder();
let swv = {
Expand Down
47 changes: 18 additions & 29 deletions bsc-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
{
"compilerOptions": {
"noImplicitAny": false,
"target": "ES2017",
"module": "commonjs",
"sourceMap": true,
"rootDir": "src",
"outDir": "dist",
"declaration": true,
"strict": true,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"preserveConstEnums": true,
"downlevelIteration": true,
"noUnusedLocals": true,
"allowSyntheticDefaultImports": true,
"lib": [
"es2017",
"es2019.array"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules/**/*"
],
"ts-node": {
"transpileOnly": true
}
"compilerOptions": {
"noImplicitAny": false,
"module": "commonjs",
"sourceMap": true,
"rootDir": "src",
"outDir": "./dist",
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"preserveConstEnums": true,
"allowJs": true,
"target": "ES2017",
"downlevelIteration": true
},
"allowSyntheticDefaultImports": true,
"lib": ["es2017", "es2019.array", "esnext", "dom"],
"outDir": "./dist",
"exclude": ["node_modules/**/*"],
"include": ["./src/**/*"]
}

0 comments on commit c033761

Please sign in to comment.