diff --git a/packages/create/package.json b/packages/create/package.json index da63584..01e4d0d 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/Cretezy/Noderize.git" }, - "version": "0.4.3", + "version": "0.4.4", "license": "MIT", "bin": "dist/index.js", "files": ["src", "dist", "template"], @@ -22,7 +22,7 @@ "prepack": "npm run clean && npm run build -- --env production" }, "dependencies": { - "@noderize/runtime": "^0.4.3", + "@noderize/runtime": "^0.4.4", "chalk": "^2.3.1", "fs-extra": "^5.0.0", "minimist": "^1.2.0" diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 9aed626..16af698 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -8,7 +8,7 @@ "type": "git", "url": "https://github.com/Cretezy/Noderize.git" }, - "version": "0.4.3", + "version": "0.4.4", "license": "MIT", "dependencies": { "@babel/runtime": "^7.0.0-beta.40" diff --git a/packages/scripts/a.js b/packages/scripts/a.js new file mode 100644 index 0000000..3e91ea7 --- /dev/null +++ b/packages/scripts/a.js @@ -0,0 +1 @@ +console.log(process.argv) diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 6d6eb93..7503e16 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -8,9 +8,11 @@ "type": "git", "url": "https://github.com/Cretezy/Noderize.git" }, - "version": "0.4.3", + "version": "0.4.4", "license": "MIT", - "bin": { "noderize-scripts": "dist/index.js" }, + "bin": { + "noderize-scripts": "dist/index.js" + }, "files": ["src", "dist"], "scripts": { "scripts": "node -r source-map-support/register dist/index.js", @@ -23,7 +25,6 @@ "rm -rf dist && noderize-scripts build --env production && npm run build -- --env production" }, "dependencies": { - "@noderize/runtime": "^0.4.3", "@babel/core": "^7.0.0-beta.40", "@babel/plugin-proposal-decorators": "^7.0.0-beta.40", "@babel/plugin-transform-runtime": "^7.0.0-beta.40", @@ -31,12 +32,14 @@ "@babel/preset-env": "^7.0.0-beta.40", "@babel/preset-flow": "^7.0.0-beta.40", "@babel/preset-stage-2": "^7.0.0-beta.40", + "@noderize/runtime": "^0.4.4", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^22.2.2", "babel-loader": "^8.0.0-beta.0", "chalk": "^2.3.1", "chokidar": "^2.0.2", "cosmiconfig": "^4.0.0", + "cross-spawn": "^6.0.5", "fork-ts-checker-webpack-plugin": "^0.3.0", "fs-extra": "^5.0.0", "happypack": "^4.0.1", @@ -55,7 +58,7 @@ "webpack-node-externals": "^1.6.0" }, "devDependencies": { - "@noderize/scripts": "0.4.2" + "@noderize/scripts": "0.4.3" }, "noderize": { "bundles": [ diff --git a/packages/scripts/src/index.js b/packages/scripts/src/index.js index 3df2e8a..9458cae 100755 --- a/packages/scripts/src/index.js +++ b/packages/scripts/src/index.js @@ -22,5 +22,5 @@ if (!Object.keys(commands).includes(script)) { printWarn(`Unknown script.`); process.exit(1); } else { - commands[script](args); + commands[script](args, process.argv); } diff --git a/packages/scripts/src/scripts/format.js b/packages/scripts/src/scripts/format.js index 1c2d8a0..1e742b1 100644 --- a/packages/scripts/src/scripts/format.js +++ b/packages/scripts/src/scripts/format.js @@ -1,10 +1,10 @@ import path from "path"; import { getOptions } from "../options"; import { appDirectory } from "../utils/path"; -import { fork } from "child_process"; +import spawn from "cross-spawn"; import { printInfo, printWarn, printDone } from "../utils/print"; -export default async args => { +export default async (args, fullArgs) => { printInfo("Formatting..."); const options = getOptions(null); @@ -22,9 +22,14 @@ export default async args => { "prettier" ); - const child = fork(prettierPath, ["--write", ...files, ...args], { - cwd: appDirectory - }); + const child = spawn( + fullArgs[0], + [prettierPath, "--write", ...files, ...args], + { + cwd: appDirectory, + stdio: "inherit" + } + ); child.on("exit", code => { const message = "Done formatting!"; diff --git a/packages/scripts/src/scripts/start.js b/packages/scripts/src/scripts/start.js index d7b5e57..91d5cb6 100644 --- a/packages/scripts/src/scripts/start.js +++ b/packages/scripts/src/scripts/start.js @@ -1,4 +1,4 @@ -import { fork } from "child_process"; +import spawn from "cross-spawn"; import { getOptions } from "../options"; import { printError, printInfo, printWarn } from "../utils/print"; import fs from "fs-extra"; @@ -7,7 +7,7 @@ export default async args => { await start(getOptions(args)); }; -export async function start(options) { +export async function start(options, nodePath = process.argv[0]) { printInfo("Starting..."); console.log(); // Padding @@ -17,8 +17,10 @@ export async function start(options) { return; } - const child = fork(options.startFile, options.args._, { - execArgv: ["-r", "source-map-support/register"] + const child = spawn(nodePath, [options.startFile, ...options.args._], { + execArgv: ["-r", "source-map-support/register"], + cwd: appDirectory, + stdio: "inherit" }); child.on("exit", (code, signal) => { diff --git a/packages/scripts/src/scripts/test.js b/packages/scripts/src/scripts/test.js index 39a19b0..31ced5d 100644 --- a/packages/scripts/src/scripts/test.js +++ b/packages/scripts/src/scripts/test.js @@ -1,13 +1,13 @@ import path from "path"; import { appDirectory } from "../utils/path"; import { execSync } from "child_process"; -import { fork } from "child_process"; +import spawn from "cross-spawn"; import { getOptions } from "../options"; import cosmiconfig from "cosmiconfig"; import merge from "lodash.merge"; import { printError, printInfo } from "../utils/print"; -export default async args => { +export default async (args, fullArgs) => { printInfo("Testing..."); const options = getOptions(null, "test"); @@ -81,7 +81,8 @@ export default async args => { ); // Run Jest - fork(jestPath, args, { - cwd: appDirectory + spawn(fullArgs[0], [jestPath, ...args], { + cwd: appDirectory, + stdio: "inherit" }); }; diff --git a/yarn.lock b/yarn.lock index 4f456c2..6a7e767 100644 --- a/yarn.lock +++ b/yarn.lock @@ -563,15 +563,9 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@noderize/runtime@^0.3.16": - version "0.3.16" - resolved "https://registry.yarnpkg.com/@noderize/runtime/-/runtime-0.3.16.tgz#651169c72b750373e29d421782fd6e48f8de044f" - dependencies: - "@babel/runtime" "^7.0.0-beta.40" - -"@noderize/scripts@0.3.16": - version "0.3.16" - resolved "https://registry.yarnpkg.com/@noderize/scripts/-/scripts-0.3.16.tgz#4ad9dca90a19ff45884cec1ffb36db161f4a114e" +"@noderize/scripts@0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@noderize/scripts/-/scripts-0.4.3.tgz#3b2dfcc8f726ff7ca9cc7c734dacfc12b5395eac" dependencies: "@babel/core" "^7.0.0-beta.40" "@babel/plugin-proposal-decorators" "^7.0.0-beta.40" @@ -580,7 +574,7 @@ "@babel/preset-env" "^7.0.0-beta.40" "@babel/preset-flow" "^7.0.0-beta.40" "@babel/preset-stage-2" "^7.0.0-beta.40" - "@noderize/runtime" "^0.3.16" + "@noderize/runtime" "^0.4.3" babel-core "^7.0.0-bridge.0" babel-jest "^22.2.2" babel-loader "^8.0.0-beta.0" @@ -1503,6 +1497,16 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -3452,6 +3456,10 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +nice-try@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -3755,7 +3763,7 @@ path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" -path-key@^2.0.0: +path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -4245,7 +4253,7 @@ schema-utils@^0.4.2: ajv "^6.1.0" ajv-keywords "^3.1.0" -"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.4.1: +"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"