GithubHelp home page GithubHelp logo

pkg-lib's People

Contributors

alduino avatar github-actions[bot] avatar renovate-bot avatar renovate[bot] avatar

Watchers

 avatar  avatar

pkg-lib's Issues

Use package.json `exports` for entrypoints

This is a more standard way of specifying it. It can mostly work with the current multiple-entrypoints support by replacing the current detection (or using exports if it is defined and use the current detection if it is not), however currently pkg-lib doesn't support the cjs and esm modules pointing to different filenames (i.e. if the cjs entrypoint is dist/index.js, the esm entrypoint must be dist/index.mjs).

Imported packages from same monorepo are included in bundle

If I have a monorepo with two projects a and b, if I import something from b into a, pkg-lib will build the contents of package b into the bundle, even though it should just use an import "b".

The way other projects have fixed this is to check if a package is specified in the project's dependencies. This doesn't seem like a great solution but it may have to do.

Build configuration customisation

We need to let people customise the build configuration more than we currently can, in case something doesn't work properly for them.
We could do this by using that tool's dotfiles and extending it onto the existing configuration, or we could add it into .pkglibrc (and support a pkglib.config.js file as an alternative, to allow importing modules e.g. for esbuild plugins).

Typescript features are very slow

pkg-lib is supposed to be fast!

Not sure how to fix this one, I'm using the official tsc compiler to make the .d.ts files. Maybe there's a faster alternative?

Typescript declarations fail to build with an empty `pkglib.documenter.ts`

Typescript seems to be trying to compile the pkglib.documenter.ts file in the build (which it shouldn't be).

Logs:

 WARN  Aborting task tree, as an exception occurred in Bundle / Typescript features / Declaration / Build declaration, and the task was not set to ignore exceptions                                                                                                                                          18:25:24


 ERROR  Command failed with exit code 2: tsc --declaration --emitDeclarationOnly --rootDir . --project tsconfig.json --outDir /home/alduino/Documents/projects/pkg-lib/example/declarations.a90ccb031afb2.tmp                                                                                                 18:25:24
pkglib.documenter.ts(1,1): error TS1208: 'pkglib.documenter.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.

  pkglib.documenter.ts(1,1): error TS1208: 'pkglib.documenter.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.
  at makeError (/home/alduino/Documents/projects/pkg-lib/node_modules/.pnpm/[email protected]/node_modules/execa/lib/error.js:60:11)
  at handlePromise (/home/alduino/Documents/projects/pkg-lib/node_modules/.pnpm/[email protected]/node_modules/execa/index.js:118:26)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async /home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:740:3
  at async taskWrapper (/home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:156:12)
  at async /home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:775:3
  at async taskWrapper (/home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:156:12)
  at async createStaticTask.cleanup (/home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:1007:3)
  at async taskWrapper (/home/alduino/Documents/projects/pkg-lib/dist/@alduino/pkg-lib.development.js:156:12)
  at async Promise.all (index 2)

Exit cleanly when killed

Currently, if the build process is terminated externally (e.g. by cancelling a script in an IDE), pkg-lib will not clean up the files it creates.

If it's in watch mode, it should do the same thing it does when you press ctrl+c or q. Although maybe the task manager could be the code that handles it instead, because then it would work in the build command too.

TypeError: Cannot read property 'compilerOptions' of null

When there is no tsconfig.json file:

> pkg-lib build

Hint: Add .pkglib-cache.*.tmp to your ignore file to ignore pkg-lib's cache                                                                                                                                                                                                                                   16:54:13
.../@alduino/pkg-lib/dist/development.js:1107
  if (!((_b = tsconfig.compilerOptions) == null ? void 0 : _b.isolatedModules)) {
                       ^

TypeError: Cannot read property 'compilerOptions' of null
    at getListrContext (.../@alduino/pkg-lib/dist/development.js:1107:24)
    at async build4 (.../@alduino/pkg-lib/dist/development.js:1125:6)

API for programmatic usage

This allows people to use pkg-lib without having to run the CLI. Generally people probably won't do this, but it is nice to have the option.

The API should export everthing that people could need, with each thing having good tsdocs as well. This probably includes every task and some of the utility functions. It might include the file watcher too.

We should then enable documentation generation too, which could be put into a website automatically.

Website

pkg-lib should have a website so that people don't have to read through its long readme.

We will probably use Docusaurus for this as it makes it a whole lot easier, but it is still a large task. This issue will double as a tracker for the various tasks for the website:

  • Set up Docusaurus with Vercel or Netlify publishing
  • Create home page
  • Create pages about the various features and how to use them
  • Create pages about CLI usage
  • Create pages about API (depends on #19)

Memory leak with watch mode

(node:624275) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [ReadStream]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:469:17)
    at ReadStream.addListener (node:events:491:10)
    at ReadStream.Readable.on (node:internal/streams/readable:869:35)
    at Watcher.setupManualTrigger (/home/alduino/Documents/projects/radiantpm2/node_modules/.pnpm/@alduino+pkg-lib@0.5.1_typescript@4.4.2/node_modules/@alduino/pkg-lib/dist/development.js:1236:19)
    at handleGotInnerTask (/home/alduino/Documents/projects/radiantpm2/node_modules/.pnpm/@alduino+pkg-lib@0.5.1_typescript@4.4.2/node_modules/@alduino/pkg-lib/dist/development.js:1275:14)

Which appears to be coming from the process.stdin.on("data") line in setupManualTrigger(). Maybe cancel isn't getting called somehow? Might be a better idea to only have one listener and handler, instead of deleting and recreating it every call.

Add hashbang to entrypoints

If an entrypoint is used as a command, in npm the script is just copied to the node_modules/.bin folder and run with the shell, so it needs a hashbang to tell the shell to use node.

I didn't notice this until now because pnpm adds a wrapper shell script that sets up a bunch of stuff and runs it directly with node, but it seems npm doesn't.

Required tsconfig settings are not detected from `extend`ed tsconfigs

pkg-lib should allow (but currently does not) allow a setup similar to the following.

// tsconfig.json
{
  "extends": "../../tsconfig.json"
}
// ../../tsconfig.json
{
  "compilerOptions": {
    "isolatedModules": true
  },
  "include": ["src"],
  "exclude": ["**/node_modules", "**/.*/"]
}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/changesets.yml
  • actions/checkout v3
  • actions/setup-node v3
  • changesets/action master
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
example/monorepo/package.json
example/monorepo/packages/repo-a/package.json
  • @alduino/pkg-lib ../../../../
example/monorepo/packages/repo-b/package.json
  • repo-a workspace:^1.0.0
  • @alduino/pkg-lib ../../../../
example/single/package.json
  • @alduino/pkg-lib file:../..
  • @types/react 17.0.47
  • react 17.0.2
  • react ^17.0.2
package.json
  • @babel/core ^7.15.0
  • @babel/helper-plugin-utils ^7.14.5
  • @babel/plugin-transform-react-jsx ^7.14.9
  • @babel/plugin-transform-react-jsx-development ^7.14.5
  • @babel/plugin-transform-typescript ^7.15.0
  • @babel/traverse ^7.15.0
  • @esbuild-plugins/node-resolve ^0.1.4
  • @microsoft/api-documenter ^7.13.39
  • @microsoft/api-extractor ^7.18.5
  • @microsoft/api-extractor-model ^7.13.5
  • @microsoft/tsdoc ^0.13.2
  • async-mutex ^0.3.1
  • chokidar ^3.5.2
  • consola ^2.15.3
  • esbuild ^0.14.0
  • execa ^5.1.1
  • fast-glob ^3.2.7
  • micromatch ^4.0.4
  • node-abort-controller ^3.0.0
  • resolve-bin ^1.0.0
  • sade ^1.7.4
  • tiny-invariant ^1.1.0
  • tiny-warning ^1.0.3
  • @babel/types 7.18.8
  • @changesets/cli 2.23.1
  • @types/babel__core 7.1.19
  • @types/babel__helper-plugin-utils 7.10.0
  • @types/babel__traverse 7.17.1
  • @types/micromatch 4.0.2
  • @types/node 16.11.43
  • @types/resolve-bin 0.4.1
  • @types/sade 1.7.4
  • @typescript-eslint/eslint-plugin 5.30.5
  • @typescript-eslint/parser 5.30.5
  • eslint 8.19.0
  • eslint-plugin-import 2.26.0
  • eslint-plugin-react 7.30.1
  • husky 7.0.4
  • lint-staged 12.5.0
  • prettier 2.7.1
  • ts-node 10.8.2
  • typescript 4.7.4
  • typescript ^4.3.5

  • Check this box to trigger a request for Renovate to run again on this repository

Cannot read property 'includes' of undefined

When I build a library that doesn't have exclude, I get the error:

 ERROR  Cannot read property 'includes' of undefined                                                                                                                                                                                                                                                          22:15:07

  at .../@alduino/pkg-lib/dist/development.js:548:62
  at Array.every (<anonymous>)
  at .../@alduino/pkg-lib/dist/development.js:548:29
  at async taskWrapper (.../@alduino/pkg-lib/dist/development.js:374:12)
  at async .../@alduino/pkg-lib/dist/development.js:615:3
  at async taskWrapper (.../@alduino/pkg-lib/dist/development.js:374:12)
  at async createStaticTask.cleanup (.../@alduino/pkg-lib/dist/development.js:921:3)
  at async taskWrapper (.../@alduino/pkg-lib/dist/development.js:374:12)
  at async Promise.all (index 2)
  at async .../@alduino/pkg-lib/dist/development.js:940:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.