Coder Social home page Coder Social logo

Needs better documentation about pectin HOT 6 CLOSED

evocateur avatar evocateur commented on August 13, 2024
Needs better documentation

from pectin.

Comments (6)

boneskull avatar boneskull commented on August 13, 2024 1

Thanks. That's something that'd be useful to have in the main README.md.

from pectin.

evocateur avatar evocateur commented on August 13, 2024

Could you be more specific, please? What about the current docs is insufficient?

from pectin.

Dudeonyx avatar Dudeonyx commented on August 13, 2024

Everything, I know what your package does but simply adding a script with pectin in the the root package.json does fuck all.

The documentation needs to explain things like:

  • Do I need rollup?
  • How should I set the build script in each individual package.json, will it be rollup -c or pectin -c or something else?
  • Will my previous rollup.config.js still be valid?

Basically an example project, or a migration guide from regular rollup to this

from pectin.

evocateur avatar evocateur commented on August 13, 2024

You ...read the root README, right? npm i -D @pectin/cli is pretty damned prominent.

Do I need rollup?

Not if you're using @pectin/cli, as indicated by the documentation.

How should I set the build script in each individual package.json

You don't. Did you read the root README?

Will my previous rollup.config.js still be valid?

No. Pectin has opinions.

from pectin.

boneskull avatar boneskull commented on August 13, 2024

So this guy was rude, but I'm also confused about how to use this tool. It's not clear to me what some of the opinions are, exactly.

I've removed rollup.config.js, and run pectin in my monorepo root:

$ pectin
pectin notice cli v3.3.0
pectin info building packages

packages/common/src/gnostic-common.cjs.js → packages/common/dist...
[!] Error: Could not resolve entry module (packages/common/src/gnostic-common.cjs.js).
Error: Could not resolve entry module (packages/common/src/gnostic-common.cjs.js).
    at error (/Users/boneskull/projects/boneskull/gnostic/node_modules/rollup/dist/rollup.js:9402:30)
    at /Users/boneskull/projects/boneskull/gnostic/node_modules/rollup/dist/rollup.js:16186:20
    at async Promise.all (index 0)
    at async Promise.all (index 0)
    at async Promise.all (index 0)

In packages/common/package.json:

{
  "browser": "dist/gnostic-common.umd.js",
  "main": "dist/gnostic-common.cjs.js",
  "module": "src/index.js",
}

I'm not sure where rollup gets the idea that packages/common/src/gnostic-common.cjs.js is a thing.

from pectin.

evocateur avatar evocateur commented on August 13, 2024

Pectin infers your "raw" entry by replacing the dirname of main with src, basically. It's pretty dumb (on purpose). The entry can be configured explicitly with a rollup.input package config.

it('overrides input with pkg.rollup.input', async () => {
const pkg = {
name: 'rollup-input',
main: 'dist/rollup-input.js',
rollup: {
input: 'app.js',
},
};
const cwd = createFixture({
'package.json': File(pkg),
'app.js': File(`export default 'app';`),
});

Your module entry should also point to dist, as Pectin expects the value of this field (as well as main) to be pointed to the built output.

from pectin.

Related Issues (7)

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.