diff --git a/.github/workflows/pr/test-integration.bash b/.github/workflows/pr/test-integration.bash index 04b85d51..989f8383 100644 --- a/.github/workflows/pr/test-integration.bash +++ b/.github/workflows/pr/test-integration.bash @@ -13,4 +13,4 @@ export MACH_SKIP_POST_INSTALL="true" profile=release os=linux arch=amd64 just build -just test-integration \ No newline at end of file +just integration-tests \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 14e5a643..822e552d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,8 +2,7 @@ resolver = "2" members = [ - "./mach", - "./mach-nodejs", + "./crates/*", ] [profile.release] diff --git a/mach-nodejs/Cargo.toml b/crates/mach-nodejs/Cargo.toml similarity index 100% rename from mach-nodejs/Cargo.toml rename to crates/mach-nodejs/Cargo.toml diff --git a/mach-nodejs/build.rs b/crates/mach-nodejs/build.rs similarity index 100% rename from mach-nodejs/build.rs rename to crates/mach-nodejs/build.rs diff --git a/mach-nodejs/jsconfig.json b/crates/mach-nodejs/jsconfig.json similarity index 100% rename from mach-nodejs/jsconfig.json rename to crates/mach-nodejs/jsconfig.json diff --git a/mach-nodejs/lib/main.js b/crates/mach-nodejs/lib/main.js similarity index 100% rename from mach-nodejs/lib/main.js rename to crates/mach-nodejs/lib/main.js diff --git a/mach-nodejs/lib/napi/index.cjs b/crates/mach-nodejs/lib/napi/index.cjs similarity index 100% rename from mach-nodejs/lib/napi/index.cjs rename to crates/mach-nodejs/lib/napi/index.cjs diff --git a/mach-nodejs/lib/package.json b/crates/mach-nodejs/lib/package.json similarity index 100% rename from mach-nodejs/lib/package.json rename to crates/mach-nodejs/lib/package.json diff --git a/mach-nodejs/lib/plugins/dependency.js b/crates/mach-nodejs/lib/plugins/dependency.js similarity index 100% rename from mach-nodejs/lib/plugins/dependency.js rename to crates/mach-nodejs/lib/plugins/dependency.js diff --git a/mach-nodejs/lib/plugins/mutable_asset.js b/crates/mach-nodejs/lib/plugins/mutable_asset.js similarity index 100% rename from mach-nodejs/lib/plugins/mutable_asset.js rename to crates/mach-nodejs/lib/plugins/mutable_asset.js diff --git a/mach-nodejs/lib/plugins/resolver.js b/crates/mach-nodejs/lib/plugins/resolver.js similarity index 100% rename from mach-nodejs/lib/plugins/resolver.js rename to crates/mach-nodejs/lib/plugins/resolver.js diff --git a/mach-nodejs/lib/plugins/transformer.js b/crates/mach-nodejs/lib/plugins/transformer.js similarity index 100% rename from mach-nodejs/lib/plugins/transformer.js rename to crates/mach-nodejs/lib/plugins/transformer.js diff --git a/mach-nodejs/lib/types/actions.d.ts b/crates/mach-nodejs/lib/types/actions.d.ts similarity index 100% rename from mach-nodejs/lib/types/actions.d.ts rename to crates/mach-nodejs/lib/types/actions.d.ts diff --git a/mach-nodejs/lib/types/index.d.ts b/crates/mach-nodejs/lib/types/index.d.ts similarity index 100% rename from mach-nodejs/lib/types/index.d.ts rename to crates/mach-nodejs/lib/types/index.d.ts diff --git a/mach-nodejs/lib/types/index.js b/crates/mach-nodejs/lib/types/index.js similarity index 100% rename from mach-nodejs/lib/types/index.js rename to crates/mach-nodejs/lib/types/index.js diff --git a/mach-nodejs/lib/worker.js b/crates/mach-nodejs/lib/worker.js similarity index 100% rename from mach-nodejs/lib/worker.js rename to crates/mach-nodejs/lib/worker.js diff --git a/mach-nodejs/package.json b/crates/mach-nodejs/package.json similarity index 100% rename from mach-nodejs/package.json rename to crates/mach-nodejs/package.json diff --git a/mach-nodejs/src/lib.rs b/crates/mach-nodejs/src/lib.rs similarity index 89% rename from mach-nodejs/src/lib.rs rename to crates/mach-nodejs/src/lib.rs index 9188e0bd..e2010a48 100644 --- a/mach-nodejs/src/lib.rs +++ b/crates/mach-nodejs/src/lib.rs @@ -5,10 +5,10 @@ use std::thread; use ipc_channel_adapter::child::sync::HostReceiver; use ipc_channel_adapter::child::sync::HostSender; -use mach::public::nodejs::client::NodejsClientRequest; -use mach::public::nodejs::client::NodejsClientResponse; -use mach::public::nodejs::NodejsHostRequest; -use mach::public::nodejs::NodejsHostResponse; +use libmach::public::nodejs::client::NodejsClientRequest; +use libmach::public::nodejs::client::NodejsClientResponse; +use libmach::public::nodejs::NodejsHostRequest; +use libmach::public::nodejs::NodejsHostResponse; use napi::threadsafe_function::ThreadSafeCallContext; use napi::threadsafe_function::ThreadsafeFunctionCallMode; use napi::Env; diff --git a/mach-nodejs/src/napi_utils/await_promise.rs b/crates/mach-nodejs/src/napi_utils/await_promise.rs similarity index 100% rename from mach-nodejs/src/napi_utils/await_promise.rs rename to crates/mach-nodejs/src/napi_utils/await_promise.rs diff --git a/mach-nodejs/src/napi_utils/mod.rs b/crates/mach-nodejs/src/napi_utils/mod.rs similarity index 100% rename from mach-nodejs/src/napi_utils/mod.rs rename to crates/mach-nodejs/src/napi_utils/mod.rs diff --git a/mach/Cargo.toml b/crates/mach/Cargo.toml similarity index 98% rename from mach/Cargo.toml rename to crates/mach/Cargo.toml index dab33655..eac30260 100644 --- a/mach/Cargo.toml +++ b/crates/mach/Cargo.toml @@ -12,7 +12,7 @@ name = "mach" path = "src/main.rs" [lib] -name = "mach" +name = "libmach" path = "src/lib.rs" [dependencies] diff --git a/mach/src/cmd/build/config.rs b/crates/mach/src/cmd/build/config.rs similarity index 100% rename from mach/src/cmd/build/config.rs rename to crates/mach/src/cmd/build/config.rs diff --git a/mach/src/cmd/build/main.rs b/crates/mach/src/cmd/build/main.rs similarity index 100% rename from mach/src/cmd/build/main.rs rename to crates/mach/src/cmd/build/main.rs diff --git a/mach/src/cmd/build/mod.rs b/crates/mach/src/cmd/build/mod.rs similarity index 100% rename from mach/src/cmd/build/mod.rs rename to crates/mach/src/cmd/build/mod.rs diff --git a/mach/src/cmd/build/reporter.rs b/crates/mach/src/cmd/build/reporter.rs similarity index 100% rename from mach/src/cmd/build/reporter.rs rename to crates/mach/src/cmd/build/reporter.rs diff --git a/mach/src/cmd/dev/config.rs b/crates/mach/src/cmd/dev/config.rs similarity index 100% rename from mach/src/cmd/dev/config.rs rename to crates/mach/src/cmd/dev/config.rs diff --git a/mach/src/cmd/dev/main.rs b/crates/mach/src/cmd/dev/main.rs similarity index 100% rename from mach/src/cmd/dev/main.rs rename to crates/mach/src/cmd/dev/main.rs diff --git a/mach/src/cmd/dev/mod.rs b/crates/mach/src/cmd/dev/mod.rs similarity index 100% rename from mach/src/cmd/dev/mod.rs rename to crates/mach/src/cmd/dev/mod.rs diff --git a/mach/src/cmd/mod.rs b/crates/mach/src/cmd/mod.rs similarity index 100% rename from mach/src/cmd/mod.rs rename to crates/mach/src/cmd/mod.rs diff --git a/mach/src/cmd/version/main.rs b/crates/mach/src/cmd/version/main.rs similarity index 100% rename from mach/src/cmd/version/main.rs rename to crates/mach/src/cmd/version/main.rs diff --git a/mach/src/cmd/version/mod.rs b/crates/mach/src/cmd/version/mod.rs similarity index 100% rename from mach/src/cmd/version/mod.rs rename to crates/mach/src/cmd/version/mod.rs diff --git a/mach/src/cmd/watch/config.rs b/crates/mach/src/cmd/watch/config.rs similarity index 100% rename from mach/src/cmd/watch/config.rs rename to crates/mach/src/cmd/watch/config.rs diff --git a/mach/src/cmd/watch/main.rs b/crates/mach/src/cmd/watch/main.rs similarity index 100% rename from mach/src/cmd/watch/main.rs rename to crates/mach/src/cmd/watch/main.rs diff --git a/mach/src/cmd/watch/mod.rs b/crates/mach/src/cmd/watch/mod.rs similarity index 100% rename from mach/src/cmd/watch/mod.rs rename to crates/mach/src/cmd/watch/mod.rs diff --git a/mach/src/kit/hash/hash.rs b/crates/mach/src/kit/hash/hash.rs similarity index 100% rename from mach/src/kit/hash/hash.rs rename to crates/mach/src/kit/hash/hash.rs diff --git a/mach/src/kit/hash/mod.rs b/crates/mach/src/kit/hash/mod.rs similarity index 100% rename from mach/src/kit/hash/mod.rs rename to crates/mach/src/kit/hash/mod.rs diff --git a/mach/src/kit/html/mod.rs b/crates/mach/src/kit/html/mod.rs similarity index 100% rename from mach/src/kit/html/mod.rs rename to crates/mach/src/kit/html/mod.rs diff --git a/mach/src/kit/json/mod.rs b/crates/mach/src/kit/json/mod.rs similarity index 100% rename from mach/src/kit/json/mod.rs rename to crates/mach/src/kit/json/mod.rs diff --git a/mach/src/kit/mod.rs b/crates/mach/src/kit/mod.rs similarity index 100% rename from mach/src/kit/mod.rs rename to crates/mach/src/kit/mod.rs diff --git a/mach/src/kit/profiler/mod.rs b/crates/mach/src/kit/profiler/mod.rs similarity index 100% rename from mach/src/kit/profiler/mod.rs rename to crates/mach/src/kit/profiler/mod.rs diff --git a/mach/src/kit/swc/convert.rs b/crates/mach/src/kit/swc/convert.rs similarity index 100% rename from mach/src/kit/swc/convert.rs rename to crates/mach/src/kit/swc/convert.rs diff --git a/mach/src/kit/swc/lookup_property_access.rs b/crates/mach/src/kit/swc/lookup_property_access.rs similarity index 100% rename from mach/src/kit/swc/lookup_property_access.rs rename to crates/mach/src/kit/swc/lookup_property_access.rs diff --git a/mach/src/kit/swc/mod.rs b/crates/mach/src/kit/swc/mod.rs similarity index 100% rename from mach/src/kit/swc/mod.rs rename to crates/mach/src/kit/swc/mod.rs diff --git a/mach/src/kit/swc/parse_module.rs b/crates/mach/src/kit/swc/parse_module.rs similarity index 100% rename from mach/src/kit/swc/parse_module.rs rename to crates/mach/src/kit/swc/parse_module.rs diff --git a/mach/src/kit/swc/parse_program.rs b/crates/mach/src/kit/swc/parse_program.rs similarity index 100% rename from mach/src/kit/swc/parse_program.rs rename to crates/mach/src/kit/swc/parse_program.rs diff --git a/mach/src/kit/swc/parse_script.rs b/crates/mach/src/kit/swc/parse_script.rs similarity index 100% rename from mach/src/kit/swc/parse_script.rs rename to crates/mach/src/kit/swc/parse_script.rs diff --git a/mach/src/kit/swc/render_module.rs b/crates/mach/src/kit/swc/render_module.rs similarity index 100% rename from mach/src/kit/swc/render_module.rs rename to crates/mach/src/kit/swc/render_module.rs diff --git a/mach/src/kit/swc/render_program.rs b/crates/mach/src/kit/swc/render_program.rs similarity index 100% rename from mach/src/kit/swc/render_program.rs rename to crates/mach/src/kit/swc/render_program.rs diff --git a/mach/src/kit/swc/render_script.rs b/crates/mach/src/kit/swc/render_script.rs similarity index 100% rename from mach/src/kit/swc/render_script.rs rename to crates/mach/src/kit/swc/render_script.rs diff --git a/mach/src/kit/swc/render_stmts.rs b/crates/mach/src/kit/swc/render_stmts.rs similarity index 100% rename from mach/src/kit/swc/render_stmts.rs rename to crates/mach/src/kit/swc/render_stmts.rs diff --git a/crates/mach/src/lib.rs b/crates/mach/src/lib.rs new file mode 100644 index 00000000..0848c6ce --- /dev/null +++ b/crates/mach/src/lib.rs @@ -0,0 +1,4 @@ +pub mod kit; +pub mod public; +pub mod platform; +pub mod cmd; diff --git a/mach/src/main.rs b/crates/mach/src/main.rs similarity index 100% rename from mach/src/main.rs rename to crates/mach/src/main.rs diff --git a/mach/src/platform/adapters/mod.rs b/crates/mach/src/platform/adapters/mod.rs similarity index 100% rename from mach/src/platform/adapters/mod.rs rename to crates/mach/src/platform/adapters/mod.rs diff --git a/mach/src/platform/adapters/nodejs/mod.rs b/crates/mach/src/platform/adapters/nodejs/mod.rs similarity index 100% rename from mach/src/platform/adapters/nodejs/mod.rs rename to crates/mach/src/platform/adapters/nodejs/mod.rs diff --git a/mach/src/platform/adapters/nodejs/nodejs_adapter.rs b/crates/mach/src/platform/adapters/nodejs/nodejs_adapter.rs similarity index 100% rename from mach/src/platform/adapters/nodejs/nodejs_adapter.rs rename to crates/mach/src/platform/adapters/nodejs/nodejs_adapter.rs diff --git a/mach/src/platform/adapters/nodejs/nodejs_instance.rs b/crates/mach/src/platform/adapters/nodejs/nodejs_instance.rs similarity index 100% rename from mach/src/platform/adapters/nodejs/nodejs_instance.rs rename to crates/mach/src/platform/adapters/nodejs/nodejs_instance.rs diff --git a/mach/src/platform/adapters/nodejs/nodejs_worker.rs b/crates/mach/src/platform/adapters/nodejs/nodejs_worker.rs similarity index 100% rename from mach/src/platform/adapters/nodejs/nodejs_worker.rs rename to crates/mach/src/platform/adapters/nodejs/nodejs_worker.rs diff --git a/mach/src/platform/bundling/bundle.rs b/crates/mach/src/platform/bundling/bundle.rs similarity index 100% rename from mach/src/platform/bundling/bundle.rs rename to crates/mach/src/platform/bundling/bundle.rs diff --git a/mach/src/platform/bundling/bundle_single.rs b/crates/mach/src/platform/bundling/bundle_single.rs similarity index 100% rename from mach/src/platform/bundling/bundle_single.rs rename to crates/mach/src/platform/bundling/bundle_single.rs diff --git a/mach/src/platform/bundling/bundle_splitting.rs b/crates/mach/src/platform/bundling/bundle_splitting.rs similarity index 100% rename from mach/src/platform/bundling/bundle_splitting.rs rename to crates/mach/src/platform/bundling/bundle_splitting.rs diff --git a/mach/src/platform/bundling/infer_exports.rs b/crates/mach/src/platform/bundling/infer_exports.rs similarity index 100% rename from mach/src/platform/bundling/infer_exports.rs rename to crates/mach/src/platform/bundling/infer_exports.rs diff --git a/mach/src/platform/bundling/mod.rs b/crates/mach/src/platform/bundling/mod.rs similarity index 100% rename from mach/src/platform/bundling/mod.rs rename to crates/mach/src/platform/bundling/mod.rs diff --git a/mach/src/platform/config/constants.rs b/crates/mach/src/platform/config/constants.rs similarity index 100% rename from mach/src/platform/config/constants.rs rename to crates/mach/src/platform/config/constants.rs diff --git a/mach/src/platform/config/load_plugins.rs b/crates/mach/src/platform/config/load_plugins.rs similarity index 100% rename from mach/src/platform/config/load_plugins.rs rename to crates/mach/src/platform/config/load_plugins.rs diff --git a/mach/src/platform/config/mod.rs b/crates/mach/src/platform/config/mod.rs similarity index 100% rename from mach/src/platform/config/mod.rs rename to crates/mach/src/platform/config/mod.rs diff --git a/mach/src/platform/config/plugin_container.rs b/crates/mach/src/platform/config/plugin_container.rs similarity index 100% rename from mach/src/platform/config/plugin_container.rs rename to crates/mach/src/platform/config/plugin_container.rs diff --git a/mach/src/platform/emit/mod.rs b/crates/mach/src/platform/emit/mod.rs similarity index 100% rename from mach/src/platform/emit/mod.rs rename to crates/mach/src/platform/emit/mod.rs diff --git a/mach/src/platform/mod.rs b/crates/mach/src/platform/mod.rs similarity index 100% rename from mach/src/platform/mod.rs rename to crates/mach/src/platform/mod.rs diff --git a/mach/src/platform/packaging/css/mod.rs b/crates/mach/src/platform/packaging/css/mod.rs similarity index 100% rename from mach/src/platform/packaging/css/mod.rs rename to crates/mach/src/platform/packaging/css/mod.rs diff --git a/mach/src/platform/packaging/css/package_css.rs b/crates/mach/src/platform/packaging/css/package_css.rs similarity index 100% rename from mach/src/platform/packaging/css/package_css.rs rename to crates/mach/src/platform/packaging/css/package_css.rs diff --git a/mach/src/platform/packaging/html/mod.rs b/crates/mach/src/platform/packaging/html/mod.rs similarity index 100% rename from mach/src/platform/packaging/html/mod.rs rename to crates/mach/src/platform/packaging/html/mod.rs diff --git a/mach/src/platform/packaging/html/package_html.rs b/crates/mach/src/platform/packaging/html/package_html.rs similarity index 100% rename from mach/src/platform/packaging/html/package_html.rs rename to crates/mach/src/platform/packaging/html/package_html.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/default_decl.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/default_decl.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/default_decl.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/default_decl.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/js_runtime.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/js_runtime.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/js_runtime.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/js_runtime.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/mod.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/mod.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/mod.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/mod.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/read_exports.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/read_exports.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/read_exports.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/read_exports.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/read_exports_named.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/read_exports_named.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/read_exports_named.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/read_exports_named.rs diff --git a/mach/src/platform/packaging/javascript/js_runtime/read_import_assignments.rs b/crates/mach/src/platform/packaging/javascript/js_runtime/read_import_assignments.rs similarity index 100% rename from mach/src/platform/packaging/javascript/js_runtime/read_import_assignments.rs rename to crates/mach/src/platform/packaging/javascript/js_runtime/read_import_assignments.rs diff --git a/mach/src/platform/packaging/javascript/mod.rs b/crates/mach/src/platform/packaging/javascript/mod.rs similarity index 100% rename from mach/src/platform/packaging/javascript/mod.rs rename to crates/mach/src/platform/packaging/javascript/mod.rs diff --git a/mach/src/platform/packaging/javascript/package_javascript.rs b/crates/mach/src/platform/packaging/javascript/package_javascript.rs similarity index 100% rename from mach/src/platform/packaging/javascript/package_javascript.rs rename to crates/mach/src/platform/packaging/javascript/package_javascript.rs diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/define_export.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/define_export.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/define_export.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/define_export.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_classic.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_classic.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/import_script_classic.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_classic.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_esm.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_esm.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/import_script_esm.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/import_script_esm.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/mach_require.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/mach_require.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/mach_require.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/mach_require.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/manifest.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/manifest.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/manifest.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/manifest.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/module.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/module.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/module.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/module.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/prelude.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/prelude.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/prelude.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/prelude.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/prelude_require.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/prelude_require.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/prelude_require.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/prelude_require.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/js/wrapper.js b/crates/mach/src/platform/packaging/javascript/runtime_factory/js/wrapper.js similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/js/wrapper.js rename to crates/mach/src/platform/packaging/javascript/runtime_factory/js/wrapper.js diff --git a/mach/src/platform/packaging/javascript/runtime_factory/mod.rs b/crates/mach/src/platform/packaging/javascript/runtime_factory/mod.rs similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/mod.rs rename to crates/mach/src/platform/packaging/javascript/runtime_factory/mod.rs diff --git a/mach/src/platform/packaging/javascript/runtime_factory/scratch.rs b/crates/mach/src/platform/packaging/javascript/runtime_factory/scratch.rs similarity index 100% rename from mach/src/platform/packaging/javascript/runtime_factory/scratch.rs rename to crates/mach/src/platform/packaging/javascript/runtime_factory/scratch.rs diff --git a/mach/src/platform/packaging/mod.rs b/crates/mach/src/platform/packaging/mod.rs similarity index 100% rename from mach/src/platform/packaging/mod.rs rename to crates/mach/src/platform/packaging/mod.rs diff --git a/mach/src/platform/packaging/package.rs b/crates/mach/src/platform/packaging/package.rs similarity index 100% rename from mach/src/platform/packaging/package.rs rename to crates/mach/src/platform/packaging/package.rs diff --git a/mach/src/platform/plugins/mod.rs b/crates/mach/src/platform/plugins/mod.rs similarity index 100% rename from mach/src/platform/plugins/mod.rs rename to crates/mach/src/platform/plugins/mod.rs diff --git a/mach/src/platform/plugins/resolver_javascript/mod.rs b/crates/mach/src/platform/plugins/resolver_javascript/mod.rs similarity index 100% rename from mach/src/platform/plugins/resolver_javascript/mod.rs rename to crates/mach/src/platform/plugins/resolver_javascript/mod.rs diff --git a/mach/src/platform/plugins/resolver_javascript/resolve.rs b/crates/mach/src/platform/plugins/resolver_javascript/resolve.rs similarity index 100% rename from mach/src/platform/plugins/resolver_javascript/resolve.rs rename to crates/mach/src/platform/plugins/resolver_javascript/resolve.rs diff --git a/mach/src/platform/plugins/resolver_javascript/resolver.rs b/crates/mach/src/platform/plugins/resolver_javascript/resolver.rs similarity index 100% rename from mach/src/platform/plugins/resolver_javascript/resolver.rs rename to crates/mach/src/platform/plugins/resolver_javascript/resolver.rs diff --git a/mach/src/platform/plugins/resolver_nodejs/mod.rs b/crates/mach/src/platform/plugins/resolver_nodejs/mod.rs similarity index 100% rename from mach/src/platform/plugins/resolver_nodejs/mod.rs rename to crates/mach/src/platform/plugins/resolver_nodejs/mod.rs diff --git a/mach/src/platform/plugins/resolver_nodejs/resolver.rs b/crates/mach/src/platform/plugins/resolver_nodejs/resolver.rs similarity index 100% rename from mach/src/platform/plugins/resolver_nodejs/resolver.rs rename to crates/mach/src/platform/plugins/resolver_nodejs/resolver.rs diff --git a/mach/src/platform/plugins/transformer_css/mod.rs b/crates/mach/src/platform/plugins/transformer_css/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_css/mod.rs rename to crates/mach/src/platform/plugins/transformer_css/mod.rs diff --git a/mach/src/platform/plugins/transformer_css/transformer.rs b/crates/mach/src/platform/plugins/transformer_css/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_css/transformer.rs rename to crates/mach/src/platform/plugins/transformer_css/transformer.rs diff --git a/mach/src/platform/plugins/transformer_drop/mod.rs b/crates/mach/src/platform/plugins/transformer_drop/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_drop/mod.rs rename to crates/mach/src/platform/plugins/transformer_drop/mod.rs diff --git a/mach/src/platform/plugins/transformer_drop/transformer.rs b/crates/mach/src/platform/plugins/transformer_drop/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_drop/transformer.rs rename to crates/mach/src/platform/plugins/transformer_drop/transformer.rs diff --git a/mach/src/platform/plugins/transformer_html/mod.rs b/crates/mach/src/platform/plugins/transformer_html/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_html/mod.rs rename to crates/mach/src/platform/plugins/transformer_html/mod.rs diff --git a/mach/src/platform/plugins/transformer_html/transformer.rs b/crates/mach/src/platform/plugins/transformer_html/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_html/transformer.rs rename to crates/mach/src/platform/plugins/transformer_html/transformer.rs diff --git a/mach/src/platform/plugins/transformer_javascript/mod.rs b/crates/mach/src/platform/plugins/transformer_javascript/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_javascript/mod.rs rename to crates/mach/src/platform/plugins/transformer_javascript/mod.rs diff --git a/mach/src/platform/plugins/transformer_javascript/node_env_replacer.rs b/crates/mach/src/platform/plugins/transformer_javascript/node_env_replacer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_javascript/node_env_replacer.rs rename to crates/mach/src/platform/plugins/transformer_javascript/node_env_replacer.rs diff --git a/mach/src/platform/plugins/transformer_javascript/read_imports.rs b/crates/mach/src/platform/plugins/transformer_javascript/read_imports.rs similarity index 100% rename from mach/src/platform/plugins/transformer_javascript/read_imports.rs rename to crates/mach/src/platform/plugins/transformer_javascript/read_imports.rs diff --git a/mach/src/platform/plugins/transformer_javascript/transformer.rs b/crates/mach/src/platform/plugins/transformer_javascript/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_javascript/transformer.rs rename to crates/mach/src/platform/plugins/transformer_javascript/transformer.rs diff --git a/mach/src/platform/plugins/transformer_json/mod.rs b/crates/mach/src/platform/plugins/transformer_json/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_json/mod.rs rename to crates/mach/src/platform/plugins/transformer_json/mod.rs diff --git a/mach/src/platform/plugins/transformer_json/transformer.rs b/crates/mach/src/platform/plugins/transformer_json/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_json/transformer.rs rename to crates/mach/src/platform/plugins/transformer_json/transformer.rs diff --git a/mach/src/platform/plugins/transformer_nodejs/mod.rs b/crates/mach/src/platform/plugins/transformer_nodejs/mod.rs similarity index 100% rename from mach/src/platform/plugins/transformer_nodejs/mod.rs rename to crates/mach/src/platform/plugins/transformer_nodejs/mod.rs diff --git a/mach/src/platform/plugins/transformer_nodejs/transformer.rs b/crates/mach/src/platform/plugins/transformer_nodejs/transformer.rs similarity index 100% rename from mach/src/platform/plugins/transformer_nodejs/transformer.rs rename to crates/mach/src/platform/plugins/transformer_nodejs/transformer.rs diff --git a/mach/src/platform/transformation/mod.rs b/crates/mach/src/platform/transformation/mod.rs similarity index 100% rename from mach/src/platform/transformation/mod.rs rename to crates/mach/src/platform/transformation/mod.rs diff --git a/mach/src/platform/transformation/resolve_and_transform.rs b/crates/mach/src/platform/transformation/resolve_and_transform.rs similarity index 100% rename from mach/src/platform/transformation/resolve_and_transform.rs rename to crates/mach/src/platform/transformation/resolve_and_transform.rs diff --git a/mach/src/platform/transformation/resolve_and_transform_worker.rs b/crates/mach/src/platform/transformation/resolve_and_transform_worker.rs similarity index 100% rename from mach/src/platform/transformation/resolve_and_transform_worker.rs rename to crates/mach/src/platform/transformation/resolve_and_transform_worker.rs diff --git a/mach/src/platform/transformation/run_graph_update.rs b/crates/mach/src/platform/transformation/run_graph_update.rs similarity index 100% rename from mach/src/platform/transformation/run_graph_update.rs rename to crates/mach/src/platform/transformation/run_graph_update.rs diff --git a/mach/src/platform/transformation/run_resolvers.rs b/crates/mach/src/platform/transformation/run_resolvers.rs similarity index 100% rename from mach/src/platform/transformation/run_resolvers.rs rename to crates/mach/src/platform/transformation/run_resolvers.rs diff --git a/mach/src/platform/transformation/run_transformers.rs b/crates/mach/src/platform/transformation/run_transformers.rs similarity index 100% rename from mach/src/platform/transformation/run_transformers.rs rename to crates/mach/src/platform/transformation/run_transformers.rs diff --git a/mach/src/public/asset.rs b/crates/mach/src/public/asset.rs similarity index 100% rename from mach/src/public/asset.rs rename to crates/mach/src/public/asset.rs diff --git a/mach/src/public/asset_graph.rs b/crates/mach/src/public/asset_graph.rs similarity index 100% rename from mach/src/public/asset_graph.rs rename to crates/mach/src/public/asset_graph.rs diff --git a/mach/src/public/asset_id.rs b/crates/mach/src/public/asset_id.rs similarity index 100% rename from mach/src/public/asset_id.rs rename to crates/mach/src/public/asset_id.rs diff --git a/mach/src/public/asset_map.rs b/crates/mach/src/public/asset_map.rs similarity index 100% rename from mach/src/public/asset_map.rs rename to crates/mach/src/public/asset_map.rs diff --git a/mach/src/public/bundle.rs b/crates/mach/src/public/bundle.rs similarity index 100% rename from mach/src/public/bundle.rs rename to crates/mach/src/public/bundle.rs diff --git a/mach/src/public/bundle_behavior.rs b/crates/mach/src/public/bundle_behavior.rs similarity index 100% rename from mach/src/public/bundle_behavior.rs rename to crates/mach/src/public/bundle_behavior.rs diff --git a/mach/src/public/bundle_graph.rs b/crates/mach/src/public/bundle_graph.rs similarity index 100% rename from mach/src/public/bundle_graph.rs rename to crates/mach/src/public/bundle_graph.rs diff --git a/mach/src/public/bundle_id.rs b/crates/mach/src/public/bundle_id.rs similarity index 100% rename from mach/src/public/bundle_id.rs rename to crates/mach/src/public/bundle_id.rs diff --git a/mach/src/public/bundle_manifest.rs b/crates/mach/src/public/bundle_manifest.rs similarity index 100% rename from mach/src/public/bundle_manifest.rs rename to crates/mach/src/public/bundle_manifest.rs diff --git a/mach/src/public/bundle_map.rs b/crates/mach/src/public/bundle_map.rs similarity index 100% rename from mach/src/public/bundle_map.rs rename to crates/mach/src/public/bundle_map.rs diff --git a/mach/src/public/config.rs b/crates/mach/src/public/config.rs similarity index 100% rename from mach/src/public/config.rs rename to crates/mach/src/public/config.rs diff --git a/mach/src/public/constants.rs b/crates/mach/src/public/constants.rs similarity index 100% rename from mach/src/public/constants.rs rename to crates/mach/src/public/constants.rs diff --git a/mach/src/public/dependency.rs b/crates/mach/src/public/dependency.rs similarity index 100% rename from mach/src/public/dependency.rs rename to crates/mach/src/public/dependency.rs diff --git a/mach/src/public/dependency_id.rs b/crates/mach/src/public/dependency_id.rs similarity index 100% rename from mach/src/public/dependency_id.rs rename to crates/mach/src/public/dependency_id.rs diff --git a/mach/src/public/dependency_map.rs b/crates/mach/src/public/dependency_map.rs similarity index 100% rename from mach/src/public/dependency_map.rs rename to crates/mach/src/public/dependency_map.rs diff --git a/mach/src/public/dependency_options.rs b/crates/mach/src/public/dependency_options.rs similarity index 100% rename from mach/src/public/dependency_options.rs rename to crates/mach/src/public/dependency_options.rs diff --git a/mach/src/public/dependency_priority.rs b/crates/mach/src/public/dependency_priority.rs similarity index 100% rename from mach/src/public/dependency_priority.rs rename to crates/mach/src/public/dependency_priority.rs diff --git a/mach/src/public/hash.rs b/crates/mach/src/public/hash.rs similarity index 100% rename from mach/src/public/hash.rs rename to crates/mach/src/public/hash.rs diff --git a/mach/src/public/import_symbol.rs b/crates/mach/src/public/import_symbol.rs similarity index 100% rename from mach/src/public/import_symbol.rs rename to crates/mach/src/public/import_symbol.rs diff --git a/mach/src/public/internal_id.rs b/crates/mach/src/public/internal_id.rs similarity index 100% rename from mach/src/public/internal_id.rs rename to crates/mach/src/public/internal_id.rs diff --git a/mach/src/public/machrc.rs b/crates/mach/src/public/machrc.rs similarity index 100% rename from mach/src/public/machrc.rs rename to crates/mach/src/public/machrc.rs diff --git a/mach/src/public/mod.rs b/crates/mach/src/public/mod.rs similarity index 100% rename from mach/src/public/mod.rs rename to crates/mach/src/public/mod.rs diff --git a/mach/src/public/mutable_asset.rs b/crates/mach/src/public/mutable_asset.rs similarity index 100% rename from mach/src/public/mutable_asset.rs rename to crates/mach/src/public/mutable_asset.rs diff --git a/mach/src/public/nodejs/client/mod.rs b/crates/mach/src/public/nodejs/client/mod.rs similarity index 100% rename from mach/src/public/nodejs/client/mod.rs rename to crates/mach/src/public/nodejs/client/mod.rs diff --git a/mach/src/public/nodejs/client/nodejs_client_request.rs b/crates/mach/src/public/nodejs/client/nodejs_client_request.rs similarity index 100% rename from mach/src/public/nodejs/client/nodejs_client_request.rs rename to crates/mach/src/public/nodejs/client/nodejs_client_request.rs diff --git a/mach/src/public/nodejs/client/nodejs_client_response.rs b/crates/mach/src/public/nodejs/client/nodejs_client_response.rs similarity index 100% rename from mach/src/public/nodejs/client/nodejs_client_response.rs rename to crates/mach/src/public/nodejs/client/nodejs_client_response.rs diff --git a/mach/src/public/nodejs/host_request.rs b/crates/mach/src/public/nodejs/host_request.rs similarity index 100% rename from mach/src/public/nodejs/host_request.rs rename to crates/mach/src/public/nodejs/host_request.rs diff --git a/mach/src/public/nodejs/mod.rs b/crates/mach/src/public/nodejs/mod.rs similarity index 100% rename from mach/src/public/nodejs/mod.rs rename to crates/mach/src/public/nodejs/mod.rs diff --git a/mach/src/public/package_json.rs b/crates/mach/src/public/package_json.rs similarity index 100% rename from mach/src/public/package_json.rs rename to crates/mach/src/public/package_json.rs diff --git a/mach/src/public/packages.rs b/crates/mach/src/public/packages.rs similarity index 100% rename from mach/src/public/packages.rs rename to crates/mach/src/public/packages.rs diff --git a/mach/src/public/programmatic/action.rs b/crates/mach/src/public/programmatic/action.rs similarity index 100% rename from mach/src/public/programmatic/action.rs rename to crates/mach/src/public/programmatic/action.rs diff --git a/mach/src/public/programmatic/build_report.rs b/crates/mach/src/public/programmatic/build_report.rs similarity index 100% rename from mach/src/public/programmatic/build_report.rs rename to crates/mach/src/public/programmatic/build_report.rs diff --git a/mach/src/public/programmatic/mod.rs b/crates/mach/src/public/programmatic/mod.rs similarity index 100% rename from mach/src/public/programmatic/mod.rs rename to crates/mach/src/public/programmatic/mod.rs diff --git a/mach/src/public/programmatic/programmatic_reporter.rs b/crates/mach/src/public/programmatic/programmatic_reporter.rs similarity index 100% rename from mach/src/public/programmatic/programmatic_reporter.rs rename to crates/mach/src/public/programmatic/programmatic_reporter.rs diff --git a/mach/src/public/resolver.rs b/crates/mach/src/public/resolver.rs similarity index 100% rename from mach/src/public/resolver.rs rename to crates/mach/src/public/resolver.rs diff --git a/mach/src/public/specifier_type.rs b/crates/mach/src/public/specifier_type.rs similarity index 100% rename from mach/src/public/specifier_type.rs rename to crates/mach/src/public/specifier_type.rs diff --git a/mach/src/public/transformer.rs b/crates/mach/src/public/transformer.rs similarity index 100% rename from mach/src/public/transformer.rs rename to crates/mach/src/public/transformer.rs diff --git a/justfile b/justfile index 44735f63..4176d8f2 100644 --- a/justfile +++ b/justfile @@ -84,7 +84,7 @@ _default: build: # Build mach and napi cargo build {{profile_cargo}} {{target_cargo}} - @cp ./target/.cargo/{{target}}/{{profile}}/libmach_nodejs.{{dylib}} ./mach-nodejs/lib/napi/index.node + @cp ./target/.cargo/{{target}}/{{profile}}/libmach_nodejs.{{dylib}} ./crates/mach-nodejs/lib/napi/index.node # Copy output to target @rm -rf {{out_dir}} @@ -92,7 +92,7 @@ build: @mkdir -p {{out_dir}} @mkdir -p {{out_dir}}/bin @cp ./target/.cargo/{{target}}/{{profile}}/mach {{out_dir}}/bin - @cp -r ./mach-nodejs/lib {{out_dir}}/nodejs + @cp -r ./crates/mach-nodejs/lib {{out_dir}}/nodejs @ln -s {{out_dir}} {{out_dir_link}} # Prepare local npm package to use local binary @@ -105,7 +105,7 @@ build: build: # Build mach and napi cargo build {{profile_cargo}} {{target_cargo}} - @Copy-Item ".\target\.cargo\{{target}}\{{profile}}\mach_nodejs.{{dylib}}" -Destination ".\mach-nodejs\lib\napi\index.node" | Out-Null + @Copy-Item ".\target\.cargo\{{target}}\{{profile}}\mach_nodejs.{{dylib}}" -Destination ".\crates\mach-nodejs\lib\napi\index.node" | Out-Null # Copy output to target @if (Test-Path {{out_dir}}) { Remove-Item -Recurse -Force {{out_dir}} | Out-Null } @@ -113,7 +113,7 @@ build: @New-Item -ItemType "directory" -Force -Path "{{out_dir}}" | Out-Null @New-Item -ItemType "directory" -Force -Path "{{out_dir}}\bin" | Out-Null @Copy-Item ".\target\.cargo\{{target}}\{{profile}}\mach.exe" -Destination "{{out_dir}}\bin" | Out-Null - @Copy-Item ".\mach-nodejs\lib" -Destination "{{out_dir}}\nodejs" -Recurse | Out-Null + @Copy-Item ".\crates\mach-nodejs\lib" -Destination "{{out_dir}}\nodejs" -Recurse | Out-Null @New-Item -ItemType SymbolicLink -Path "{{out_dir_link}}" -Target "{{out_dir}}" | Out-Null # Prepare local npm package to use local binary @@ -144,7 +144,7 @@ example cmd fixture *ARGS: serve: npx http-server -p 3000 ./examples -test-integration: +integration-tests: cd testing && node --import tsx setup.ts test: @@ -180,7 +180,7 @@ build-publish: [private] build-publish-common: node {{justfile_directory()}}/.github/scripts/ci/string-replace.mjs \ - "./mach/Cargo.toml" \ + "./crates/mach/Cargo.toml" \ "0.0.0-local" \ {{MACH_VERSION}} diff --git a/mach/src/lib.rs b/mach/src/lib.rs deleted file mode 100644 index eaa8d05b..00000000 --- a/mach/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod kit; -pub mod public; diff --git a/npm/mach/lib/mach.js b/npm/mach/lib/mach.js index 61982cd3..7335a112 100644 --- a/npm/mach/lib/mach.js +++ b/npm/mach/lib/mach.js @@ -105,8 +105,7 @@ export class Mach { }) let result = await on_complete - server.close() - child.kill() + await new Promise(res => server.close(() => res())) return result } diff --git a/testing/setup.ts b/testing/setup.ts index 5dca6eca..04cee271 100644 --- a/testing/setup.ts +++ b/testing/setup.ts @@ -11,6 +11,22 @@ import { CHROME_EXECUTABLE_PATH } from './utils/browser/executable.js'; const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) void async function() { + const browser = await puppeteer.launch({ + executablePath: CHROME_EXECUTABLE_PATH, + headless: true, + devtools: true, + ignoreHTTPSErrors: true, + args: [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-sync', + '--ignore-certificate-errors', + '--disable-gpu' + ], + }) + + process.env.PUPPETEER_WS_ENDPOINT = browser.wsEndpoint() + const files = fs.readdirSync(path.join(__dirname, 'tests')) .filter(test => !test.startsWith('_')) .map(test => path.join(__dirname, 'tests', test)) @@ -26,4 +42,5 @@ void async function() { test_stream.pipe(process.stdout) await new Promise(res => finished(test_stream, res)) + await browser.close() }() diff --git a/testing/tests/commonjs-basic.ts b/testing/tests/commonjs-basic.ts index 68f95ba4..09da5b45 100644 --- a/testing/tests/commonjs-basic.ts +++ b/testing/tests/commonjs-basic.ts @@ -11,7 +11,7 @@ describe('commonjs-basic', { concurrency: true }, () => { let report: BuildReport before(async () => { - await install_npm(FIXTURE()) + install_npm(FIXTURE()) report = await Mach.build({ projectRoot: FIXTURE(), diff --git a/testing/tests/web-html-ts-css.ts b/testing/tests/web-html-ts-css.ts index 18fd222a..6106e39f 100644 --- a/testing/tests/web-html-ts-css.ts +++ b/testing/tests/web-html-ts-css.ts @@ -2,7 +2,7 @@ import {test, describe, before, after} from 'node:test'; import * as assert from 'node:assert'; import { BuildReport, Mach } from '@alshdavid/mach'; import { FIXTURES_FN } from '../utils/paths/index.js'; -import { CHROME_EXECUTABLE_PATH, ClientContext } from '../utils/browser/index.js'; +import { ClientContext } from '../utils/browser/index.js'; import { install_npm } from '../utils/npm/index.js'; import * as puppeteer from 'puppeteer-core'; @@ -14,36 +14,25 @@ describe('web-html-ts-css', { concurrency: true }, async () => { let report: BuildReport before(async () => { - await install_npm(FIXTURE()) + install_npm(FIXTURE()) report = await Mach.build({ projectRoot: FIXTURE(), entries: ['src/index.html'] }) - browser = await puppeteer.launch({ - executablePath: CHROME_EXECUTABLE_PATH, - headless: true, - devtools: true, - ignoreHTTPSErrors: true, - args: [ - '--no-sandbox', - '--disable-setuid-sandbox', - '--disable-sync', - '--ignore-certificate-errors', - '--disable-gpu' - ], + browser = await puppeteer.connect({ + browserWSEndpoint: process.env.PUPPETEER_WS_ENDPOINT }) client = await ClientContext.new({ - browser, serve_path: FIXTURE('dist') }) }) after(async () => { - await browser.close() - client.close() + await browser.disconnect() + await client.close() }) test('Should set exports correctly ', async (t) => { diff --git a/testing/utils/browser/client_context.ts b/testing/utils/browser/client_context.ts index e989efba..0c2600ca 100644 --- a/testing/utils/browser/client_context.ts +++ b/testing/utils/browser/client_context.ts @@ -5,45 +5,31 @@ import * as fs from "node:fs" import * as fsAsync from "node:fs/promises" export type ClientContextOptions = { - browser: puppeteer.Browser serve_path: string } export class ClientContext { #server - #browser constructor( server: http.Server, - browser: puppeteer.Browser, ) { this.#server = server - this.#browser = browser } static async new(options: ClientContextOptions): Promise { const server = http.createServer(serve_static(options.serve_path)) await new Promise(res => server.listen(0, "0.0.0.0", () => res())) - return new ClientContext(server, options.browser) + return new ClientContext(server) } - // async newPage(): Promise { - // const page = await this.#browser.newPage() - - // await page.goto(`http://localhost:${this.#server.address().port}`) - - - - // return page as puppeteer.Page & AsyncDisposable & Disposable - // } - address() { // @ts-expect-error return `http://localhost:${this.#server.address().port}` } - close() { - this.#server.close() + async close() { + await new Promise(res => this.#server.close(() => res())) } } diff --git a/testing/utils/npm/index.ts b/testing/utils/npm/index.ts index 17c21484..1ed67b73 100644 --- a/testing/utils/npm/index.ts +++ b/testing/utils/npm/index.ts @@ -2,17 +2,12 @@ import path from 'node:path'; import child_process from 'node:child_process'; import fs from 'node:fs'; -export async function install_npm(cwd: string): Promise { +export function install_npm(cwd: string): void { if (!fs.existsSync(cwd)) { throw new Error(`Error Does Not Exist: ${cwd}`) } if (!fs.existsSync(path.join(cwd, 'node_modules'))) { - await new Promise((resolve, reject) => { - child_process.exec(`npm install --no-package-lock`, { cwd }, (err, stdout) => { - if (err) return reject(err) - resolve(stdout) - }) - }) + child_process.execSync(`npm install --no-package-lock`, { cwd }) } }