{"id":19475460,"url":"https://github.com/artdecocode/bestie","last_synced_at":"2025-08-16T13:36:38.608Z","repository":{"id":57189516,"uuid":"119749570","full_name":"artdecocode/bestie","owner":"artdecocode","description":"Bestie is a Node.js package that can be linked and used to share babel.","archived":false,"fork":false,"pushed_at":"2018-08-16T18:02:41.000Z","size":144,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T07:18:42.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artdecocode.png","metadata":{"files":{"readme":"README-source.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-31T22:04:53.000Z","updated_at":"2018-08-16T18:02:43.000Z","dependencies_parsed_at":"2022-09-15T06:22:06.390Z","dependency_job_id":null,"html_url":"https://github.com/artdecocode/bestie","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fbestie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fbestie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fbestie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fbestie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artdecocode","download_url":"https://codeload.github.com/artdecocode/bestie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240699224,"owners_count":19843509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:32:57.209Z","updated_at":"2025-02-25T15:47:00.737Z","avatar_url":"https://github.com/artdecocode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bestie\n\n%NPM: bestie%\n\n`bestie` is a Node.js package to build Node.js packages with `import` and `export` statements. The goal of this project is to start with using the babel AST parsing to build packages to allow functionality, however then to implement a regular expression transform stream which would update references to `import` into `require` statements. The motivation for this is that a modern Node.js package would only need a single babel transform to allow imports and exports, however all babel dependencies need to be installed and linked (around 5500 dependencies). Also, when transpiling, babel transform will use `requireInterop` expression which VS Code IDE cannot parse, and the JSDoc documentation disappears from all functions _etc_ not exported in the main file.\n\n```sh\nyarn add -DE bestie\n```\n\n## Table Of Contents\n\n%TOC%\n\n### CLI\n\nTo [`install bestie`](t), you need to clone its repository in the working directory, and install it with the dev dependencies from there. Then, `yarn link` it, and again in other projects.\n\n```sh\ncd ~/work\ngit clone https://github.com/artdecocode/bestie.git\ncd bestie\nyarn\nlink\ncd ..\ncd project\nyarn link bestie\n```\n\nBecause the all dependencies that the babel needs are in the bestie directory, they will be used. No need to install them for each individual project.\n\n\u003c!-- Despite this, the process still seems hack-ish and therefore the real aim is to use regular expressions--\u003e\n\nThe usage via the CLI is encouraged and can be achieved by specifying a `script` field in the [`package.json`](t) file, e.g.,\n\n```json\n{\n  \"name\": \"package\",\n  \"scripts\": {\n    \"build\": \"b\"\n  },\n  \"dependencies\": {\n    \"bestie\": \"2.0.0\"\n  }\n}\n```\n\n#### `--init`, `-i`: Init .Babelrc\n\nCreate a `.babelrc` file in the current direcory. The default content is:\n\n%EXAMPLE: .babelrc, json%\n\n#### `--help`, `-h`: Show Help\n\n%FORK-sh src/bin/register -h%\n\n#### `b [src] [--out-dir=build]`: Build Project\n\nThe `b` binary will build the project, taking the files from the `src` directory and transpiling them into files in the `out-dir`.\n\n#### `bestie -e .`: Print `Node_modules` Size\n\nWhen installed globally, `bestie` can report the size of `node_modules` directory with `-e` command. The size is got from the `du` command. It might differ from the `du -sh ./*/node_modules` report.\n\n%FORK-sh src/bin/register -e ..%\n\n#### `bestie -I`: Install `@Babel`\n\nInstalls the modules in the list below in the current package directory with the latest version.\n\n```fs\n@babel/cli\n@babel/core\n@babel/register\n@babel/plugin-syntax-object-rest-spread\n@babel/plugin-transform-modules-commonjs\nbabel-plugin-transform-rename-import\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e[\u003ccode\u003eb -I\u003c/code\u003e log](t)\u003c/summary\u003e\n\n```c\nOffices-iMac:structure zavr$ yarn bI\nyarn run v1.7.0\n$ b -I\n[1/4] Resolving packages...\n[2/4] Fetching packages...\n[3/4] Linking dependencies...\n[4/4] Building fresh packages...\nsuccess Saved lockfile.\nsuccess Saved 134 new dependencies.\ninfo Direct dependencies\n├─ @babel/cli@7.0.0-beta.51\n├─ @babel/core@7.0.0-beta.51\n├─ @babel/plugin-syntax-object-rest-spread@7.0.0-beta.51\n├─ @babel/plugin-transform-modules-commonjs@7.0.0-beta.51\n├─ @babel/register@7.0.0-beta.51\n└─ babel-plugin-transform-rename-import@2.2.0\ninfo All dependencies\n├─ @babel/cli@7.0.0-beta.51\n├─ @babel/core@7.0.0-beta.51\n├─ @babel/helper-function-name@7.0.0-beta.51\n├─ @babel/helper-get-function-arity@7.0.0-beta.51\n├─ @babel/helper-module-imports@7.0.0-beta.51\n├─ @babel/helper-module-transforms@7.0.0-beta.51\n├─ @babel/helpers@7.0.0-beta.51\n├─ @babel/highlight@7.0.0-beta.51\n├─ @babel/plugin-syntax-object-rest-spread@7.0.0-beta.51\n├─ @babel/plugin-transform-modules-commonjs@7.0.0-beta.51\n├─ @babel/register@7.0.0-beta.51\n├─ abbrev@1.1.1\n├─ anymatch@2.0.0\n├─ aproba@1.2.0\n├─ are-we-there-yet@1.1.5\n├─ arr-flatten@1.1.0\n├─ assign-symbols@1.0.0\n├─ async-each@1.0.1\n├─ atob@2.1.1\n├─ babel-plugin-transform-rename-import@2.2.0\n├─ base@0.11.2\n├─ binary-extensions@1.11.0\n├─ braces@2.3.2\n├─ cache-base@1.0.1\n├─ chokidar@2.0.4\n├─ chownr@1.0.1\n├─ class-utils@0.3.6\n├─ code-point-at@1.1.0\n├─ collection-visit@1.0.0\n├─ commander@2.15.1\n├─ commondir@1.0.1\n├─ console-control-strings@1.1.0\n├─ copy-descriptor@0.1.1\n├─ core-js@2.5.7\n├─ debug@2.6.9\n├─ decode-uri-component@0.2.0\n├─ deep-extend@0.6.0\n├─ delegates@1.0.0\n├─ detect-libc@1.0.3\n├─ expand-brackets@2.1.4\n├─ extglob@2.0.4\n├─ fill-range@4.0.0\n├─ find-cache-dir@1.0.0\n├─ find-up@2.1.0\n├─ for-in@1.0.2\n├─ fs-minipass@1.2.5\n├─ fs-readdir-recursive@1.1.0\n├─ fsevents@1.2.4\n├─ gauge@2.7.4\n├─ get-value@2.0.6\n├─ glob-parent@3.1.0\n├─ has-unicode@2.0.1\n├─ has-value@1.0.0\n├─ has-values@1.0.0\n├─ home-or-tmp@3.0.0\n├─ ignore-walk@3.0.1\n├─ ini@1.3.5\n├─ invariant@2.2.4\n├─ is-accessor-descriptor@1.0.0\n├─ is-binary-path@1.0.1\n├─ is-data-descriptor@1.0.0\n├─ is-descriptor@1.0.2\n├─ is-extglob@2.1.1\n├─ is-glob@4.0.0\n├─ is-odd@2.0.0\n├─ is-plain-obj@1.1.0\n├─ is-plain-object@2.0.4\n├─ is-windows@1.0.2\n├─ jsesc@2.5.1\n├─ json5@0.5.1\n├─ kind-of@3.2.2\n├─ locate-path@2.0.0\n├─ lodash.debounce@4.0.8\n├─ loose-envify@1.3.1\n├─ make-dir@1.3.0\n├─ map-visit@1.0.0\n├─ micromatch@3.1.10\n├─ minizlib@1.1.0\n├─ mixin-deep@1.3.1\n├─ nan@2.10.0\n├─ nanomatch@1.2.9\n├─ needle@2.2.1\n├─ node-modules-regexp@1.0.0\n├─ node-pre-gyp@0.10.2\n├─ nopt@4.0.1\n├─ npm-bundled@1.0.3\n├─ npm-packlist@1.1.10\n├─ npmlog@4.1.2\n├─ number-is-nan@1.0.1\n├─ object-copy@0.1.0\n├─ os-homedir@1.0.2\n├─ osenv@0.1.5\n├─ output-file-sync@2.0.1\n├─ p-limit@1.3.0\n├─ p-locate@2.0.0\n├─ p-try@1.0.0\n├─ pascalcase@0.1.1\n├─ path-dirname@1.0.2\n├─ path-exists@3.0.0\n├─ path-parse@1.0.5\n├─ pirates@3.0.2\n├─ pkg-dir@2.0.0\n├─ posix-character-classes@0.1.1\n├─ rc@1.2.8\n├─ readdirp@2.1.0\n├─ remove-trailing-separator@1.1.0\n├─ repeat-element@1.1.2\n├─ resolve-url@0.2.1\n├─ resolve@1.8.1\n├─ ret@0.1.15\n├─ sax@1.2.4\n├─ set-blocking@2.0.0\n├─ set-immediate-shim@1.0.1\n├─ set-value@2.0.0\n├─ slash@1.0.0\n├─ snapdragon-node@2.1.1\n├─ snapdragon-util@3.0.1\n├─ source-map-resolve@0.5.2\n├─ source-map-support@0.4.18\n├─ source-map-url@0.4.0\n├─ source-map@0.5.7\n├─ split-string@3.1.0\n├─ static-extend@0.1.2\n├─ tar@4.4.4\n├─ to-fast-properties@2.0.0\n├─ to-regex-range@2.1.1\n├─ trim-right@1.0.1\n├─ union-value@1.0.0\n├─ unset-value@1.0.0\n├─ upath@1.1.0\n├─ urix@0.1.0\n├─ use@3.1.0\n├─ wide-align@1.1.3\n└─ yallist@3.0.2\n✨  Done in 62.53s.\n```\n\u003c/details\u003e\n\n#### `bestie -U`: Uninstall `@Babel`\n\nRemoves the modules (from the same list as installed), and will ask for confirmation beforehand:\n\n```c\nContinue removing\n @babel/cli@7.0.0-beta.51\n @babel/core@7.0.0-beta.51\n @babel/register@7.0.0-beta.51\n @babel/plugin-syntax-object-rest-spread@7.0.0-beta.51\n @babel/plugin-transform-modules-commonjs@7.0.0-beta.51\n babel-plugin-transform-rename-import@2.2.0\nfrom bestie? [y] n\n```\n\n%GIF doc/uninstall.gif\nUninstalling babel dependencies.\n\u003ccode\u003eb -U\u003c/code\u003e\n%\n\n\u003c!-- When `.` is passed as source directory (`dir`), or not passed at all, it is assumed that `src` and `test` directories in the `cwd` need transpilation. A command to run\n`babel` will be executed, e.g.,: --\u003e\n\n\u003c!-- ```sh\n# bestie build test build --copy-files --include-dotfiles\n./node_modules/.bin/babel test --out-dir build/test --copy-files --include-dotfiles\n``` --\u003e\n\n\u003c!-- Default output directory is `es5`.\n\nSource directories can be separated with a comma, e.g., `bestie build src,test`. --\u003e\n\n\u003c!-- ## ES5 notice\n\nInclude the information about transpiled version in the `README.md` file with\nthe following lines:\n\n````markdown\n## ES5 --\u003e\n\n\u003c!-- The package uses some newer language features. For your convenience, it's been\ntranspiled to be compatible with Node 4. You can use the following snippet.\n\n```js\nconst bestie = require('bestie/es5')\n```\n```` --\u003e\n\n## API\n\n`bestie` can also be used programmatically and has the following API.\n\n```### async bestie\n[\n  [\"config\", {\n    \"from?\": [\"string\", \"src\"],\n    \"to?\": [\"string\", \"build\"],\n    \"args?\": [\"string[]\", \"[]\"],\n    \"stdout?\": [\"Stream\", \"process.stdout\"],\n    \"stderr?\": [\"Stream\", \"process.stderr\"],\n    \"cwd?\": [\"string\", \"process.cwd()\"]\n  }]\n]\n```\n\nCalling the `bestie` function from the source code will return a promise to transpile files. In background, `babel` will be spawned via the `child_process`.\n\n%EXAMPLE: example/example.js, ../src =\u003e bestie, javascript%\n\n%FORK example example/example.js%\n\n## How To Reduce The Size Of Node_modules\n\nBefore upgrading to using `bestie`, a standard package `node_module` directory would occupy ~ 90 MB of disk space, including `@babel/cli`, `@babel/core`, `@babel/register`, `@babel/plugin-syntax-object-rest-spread`, `@babel/plugin-transform-modules-commonjs`, `babel-plugin-transform-rename-import` and `eslint`.\n\nAt first, `@babel` was removed, and then `eslint`. This allowed to save 2 GB of disk space in total.\n\n%EXAMPLE: read-data.json, table%\n\n---\n\n(c) [Art Deco Code][1] 2018\n\n[1]: https://adc.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Fbestie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartdecocode%2Fbestie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Fbestie/lists"}