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

Ported Javascript build, test and clean tasks to Windows #468

Merged
merged 1 commit into from
Mar 6, 2019
Merged
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ env:
install:
- if [ "$TEST" = "CPP_OSX" ]; then brew install yarn; fi
- yarn

script:
- if [ "$TEST" = "WASM" ]; then PSP_DOCKER=1 yarn lint; fi
- if [ "$TEST" = "WASM" ]; then PSP_DOCKER=1 yarn build; fi
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
],
"devDependencies": {
"@apache-arrow/es5-esm": "^0.4.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-decorators": "^7.1.2",
"@babel/plugin-transform-for-of": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.5",
"babel-plugin-transform-custom-element-classes": "^0.1.0",
"@babel/cli": "^7.2.3",
"babel-polyfill": "^6.26.0",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.6.0",
"babel-plugin-transform-custom-element-classes": "^0.1.0",
"babel-polyfill": "^6.26.0",
"chart.js": "^2.7.1",
"codemirror": "^5.30.0",
"codemirror-javascript": "^0.2.0",
"cpx": "^1.5.0",
"documentation": "^5.3.3",
"eslint": "^4.19.1",
"eslint-config-prettier": "^3.0.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/perspective-viewer-d3fc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"prebuild": "mkdir -p cjs",
"build:babel": "cp -r src/* cjs && babel src/js --source-maps --out-dir cjs/js",
"prebuild": "mkdirp cjs",
"build:babel": "cpx \"src/**/*\" cjs && babel src/js --source-maps --out-dir cjs/js",
"build:webpack": "webpack --color --config src/config/d3fc.plugin.config.js",
"build": "npm-run-all build:babel build:webpack",
"test:build": "cp test/html/* build",
"watch": "webpack --color --watch --config src/config/d3fc.watch.config.js",
"test:build": "cpx \"test/html/*\" build",
"watch": "webpack --color --watch --config src/config/d3fc.plugin.config.js",
"test:run": "jest --silent --color 2>&1",
"test": "npm-run-all test:build test:run",
"clean": "find build -mindepth 1 -delete && find cjs -mindepth 1 -delete",
"clean:screenshots": "find screenshots/ \\( -name *.diff.png -o -name *.failed.png \\) -mindepth 1 -delete"
"clean": "rimraf build && rimraf cjs",
"clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\""
},
"jest": {
"roots": [
Expand Down
10 changes: 5 additions & 5 deletions packages/perspective-viewer-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"prebuild": "mkdir -p cjs",
"build:babel": "cp -r src/* cjs && babel src/js --source-maps --out-dir cjs/js",
"prebuild": "mkdirp cjs",
"build:babel": "cpx \"src/**/*\" cjs && babel src/js --source-maps --out-dir cjs/js",
"build:webpack": "webpack --color --config src/config/highcharts.plugin.config.js",
"build": "npm-run-all build:babel build:webpack",
"test:build": "cp test/html/* build",
"test:build": "cpx \"test/html/*\" build",
"watch": "webpack --color --watch --config src/config/highcharts.plugin.config.js",
"test:run": "jest --silent --color 2>&1",
"test": "npm-run-all test:build test:run",
"clean": "find build -mindepth 1 -delete && find cjs -mindepth 1 -delete",
"clean:screenshots": "find screenshots/ \\( -name *.diff.png -o -name *.failed.png \\) -mindepth 1 -delete"
"clean": "rimraf build && rimraf cjs",
"clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\""
},
"jest": {
"roots": [
Expand Down
10 changes: 5 additions & 5 deletions packages/perspective-viewer-hypergrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"prebuild": "mkdir -p cjs",
"build:babel": "cp -r src/* cjs && babel src/js --source-maps --out-dir cjs/js",
"prebuild": "mkdirp cjs",
"build:babel": "cpx \"src/**/*\" cjs && babel src/js --source-maps --out-dir cjs/js",
"build:webpack": "webpack --color --config src/config/hypergrid.plugin.config.js",
"build": "npm-run-all build:babel build:webpack",
"test:build": "cp test/html/* build",
"test:build": "cpx \"test/html/*\" build",
"test:run": "jest --silent --color",
"test": "npm-run-all test:build test:run",
"clean": "find build -mindepth 1 -delete && find cjs -mindepth 1 -delete",
"clean:screenshots": "find screenshots/ \\( -name *.diff.png -o -name *.failed.png \\) -mindepth 1 -delete"
"clean": "rimraf build && rimraf cjs",
"clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\""
},
"jest": {
"roots": [
Expand Down
12 changes: 6 additions & 6 deletions packages/perspective-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"prebuild": "mkdir -p cjs",
"build:babel": "cp -r src/* cjs && babel src/js --source-maps --out-dir cjs/js",
"prebuild": "mkdirp cjs",
"build:babel": "cpx \"src/**/*\" cjs && babel src/js --source-maps --out-dir cjs/js",
"build:webpack:viewer": "webpack --color --config src/config/view.config.js",
"build:webpack:themes": "webpack --color --config src/config/themes.config.js && rm build/__themes.js",
"build:webpack:themes": "webpack --color --config src/config/themes.config.js && rimraf build/__themes.js",
"build": "npm-run-all build:babel build:webpack:*",
"watch": "webpack --color --watch --config src/config/view.config.js",
"test:build": "cp test/html/* build && cp test/csv/* build && cp test/css/* build",
"test:build": "cpx \"test/html/*\" build && cpx \"test/csv/*\" build && cpx \"test/css/*\" build",
"test:run": "jest --silent --color",
"test": "npm-run-all test:build test:run",
"clean": "find build -mindepth 1 -delete",
"clean:screenshots": "find screenshots/ \\( -name *.failed.png -o -name *.diff.png \\) -mindepth 1 -delete",
"clean": "rimraf build",
"clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\"",
"docs": "documentation build src/js/viewer.js -f md --shallow > README.md && cp README.md ../../docs/perspective-viewer.md"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.default = function loader(content) {
inputPath = inputPath
.replace(path.join("perspective", "build"), "perspective")
.replace(/\.js/, ".worker.js")
.replace(/(cjs\/js)/, "build");
.replace(path.join("cjs", "js"), "build");
}
content = fs.readFileSync(inputPath).toString();
if (!options.inline) {
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-webpack-plugin/src/js/wasm-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports.pitch = function pitch(request) {
validateOptions(schema, options, "Cross Origin File Loader");

var context = options.context || this.rootContext || (this.options && this.options.context);
var content = fs.readFileSync(request.replace("cjs/js", "build").replace("wasm.js", "wasm"));
var content = fs.readFileSync(request.replace(path.join("cjs", "js"), "build").replace("wasm.js", "wasm"));
var emitPath = loaderUtils.interpolateName(this, options.name, {
context,
content,
Expand Down
6 changes: 3 additions & 3 deletions packages/perspective/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"typings": "index.d.ts",
"scripts": {
"bench": "node ../../scripts/bench.js",
"prebuild": "mkdir -p build && mkdir -p obj",
"prebuild": "mkdirp build && mkdirp obj",
"cpp": "npm-run-all build:cpp test:cpp",
"build": "npm-run-all build:babel build:webpack",
"build:babel": "babel src/js --source-maps --out-dir cjs/js",
"build:webpack": "npm-run-all -p build:webpack:*",
"build:webpack:umd": "webpack --color --config src/config/perspective.config.js",
"build:webpack:node": "webpack --color --config src/config/perspective.node.config.js",
"docs": "documentation build src/js/perspective.js -f md --shallow > README.md && cp README.md ../../docs/perspective.md",
"test:build": "cp test/html/* build",
"test:build": "cpx \"test/html/*\" build",
"test:run": "jest --color --ci",
"test": "npm-run-all test:build test:run",
"clean": "find build -mindepth 1 -delete && find obj -mindepth 1 -delete && find cjs -mindepth 1 -delete"
"clean": "rimraf build && rimraf obj && rimraf cjs"
},
"jest": {
"roots": [
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function docker(image = "emsdk") {
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += ` -v $(pwd):/src -e PACKAGE=${process.env.PACKAGE} perspective/${image}`;
cmd += ` -v ${process.cwd()}:/src -e PACKAGE=${process.env.PACKAGE} perspective/${image}`;
return cmd;
}

Expand All @@ -127,7 +127,7 @@ function compileCPP(packageName) {
}
cmd += `&& emmake make -j${process.env.PSP_CPU_COUNT || os.cpus().length}`;
if (process.env.PSP_DOCKER) {
cmd = `${docker()} bash -c 'cd cpp/${packageName}/obj && ${cmd}'`;
cmd = `${docker()} bash -c "cd cpp/${packageName}/obj && ${cmd}"`;
} else {
cmd = `cd ${BASE_DIRECTORY} && ${cmd}`;
}
Expand All @@ -144,7 +144,7 @@ function lerna() {

try {
if (!process.env.PACKAGE || minimatch("perspective", process.env.PACKAGE)) {
execute("mkdir -p cpp/perspective/obj");
mkdirp("cpp/perspective/obj");
compileCPP("perspective");
RUNTIMES.map(compileRuntime);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function clean(dir) {
}

function clean_screenshots() {
execute("lerna exec -- mkdir -p screenshots");
execute("lerna exec -- mkdirp screenshots");
execute(`lerna run clean:screenshots --ignore-missing ${process.env.PACKAGE ? `--scope=@jpmorganchase/${process.env.PACKAGE}` : ""}`);
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/lint_cpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function docker(image = "emsdk") {

function lint(dir) {
if (process.env.PSP_DOCKER) {
execute(docker() + ` bash -c 'diff -u <(cat ${dir}/*) <(clang-format -style=file ${dir}/*)'`);
execute(docker() + ` bash -c "diff -u <(cat ${dir}/*) <(clang-format -style=file ${dir}/*)"`);
} else {
execute(`bash -c 'diff -u <(cat ${dir}/*) <(clang-format -style=file ${dir}/*)'`);
execute(`bash -c "diff -u <(cat ${dir}/*) <(clang-format -style=file ${dir}/*)"`);
}
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function slow_jest() {

function docker() {
console.log("-- Creating puppeteer docker image");
let cmd = "docker run -it --rm --shm-size=2g -u root -e PACKAGE=${PACKAGE} -v $(pwd):/src -w /src";
let cmd = `docker run -it --rm --shm-size=2g -u root ${process.env.PACKAGE ? `-e PACKAGE=${process.env.PACKAGE}` : ""} -v ${process.cwd()}:/src -w /src`;
if (IS_WRITE) {
console.log("-- Running the test suite in Write mode");
cmd += " -e WRITE_TESTS=1";
Expand All @@ -74,7 +74,7 @@ function emsdk() {
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += " -v $(pwd):/src -e PACKAGE=${PACKAGE} perspective/emsdk node scripts/test.js --private-emsdk " + args.join(" ");
cmd += ` -v ${process.cwd()}:/src ${process.env.PACKAGE ? `-e PACKAGE=${process.env.PACKAGE}` : ""} perspective/emsdk node scripts/test.js --private-emsdk ` + args.join(" ");
return cmd;
}

Expand Down
Loading