Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modelling devDependencies and scripts #3861

Closed
nayeemrmn opened this issue Feb 2, 2020 · 3 comments
Closed

Modelling devDependencies and scripts #3861

nayeemrmn opened this issue Feb 2, 2020 · 3 comments

Comments

@nayeemrmn
Copy link
Collaborator

nayeemrmn commented Feb 2, 2020

There will never be a need for a project to explicitly tell Deno about its dev dependencies. There is no package manager and this is all handled naturally by imports. However, we should have a convention that documents all of a project's dev dependencies in one place. A dev_deps.ts mirroring the deps.ts.

There was also discussion about how to model the "scripts" field in package.json. We should try to solve this in a way that naturally introduces the above. i.e. combine the "scripts" and "devDependencies" fields into one convention.

The closest suggestion that exists for this, from #2584 (comment), is to have a top-level tools.ts which looks like

import { register } from "https://deno.land/std/tools/mod.ts";
register({
  start: "deno run -A server.ts",
  lint: "eslint src/**/*.ts",
  build: "deno run -A https://deno.land/x/webpack@v0.1.0/mod.ts ..."
});

The webpack dev dependency is "documented" in that string.

One suggestion is to rethink this so that https://deno.land/x/webpack/mod.ts is a static import of tools.ts. We could tell authors of tools to export something like a main(args: String[]). This function could be accepted as a value in the object given to register() instead of just accepting strings. Also, maybe it shouldn't depend on something from std?

import * as eslint from "https://deno.land/x/eslint@v0.1.0/mod.ts";
import * as webpack from "https://deno.land/x/webpack@v0.1.0/mod.ts";

Deno.tools({
  start: "deno run -A server.ts",
  lint: eslint.main,
  build: webpack.main
});
@David-Else
Copy link

Also, maybe it shouldn't depend on something from std?

import * as eslint from "https://deno.land/x/eslint@v0.1.0/mod.ts";
import * as webpack from "https://deno.land/x/webpack@v0.1.0/mod.ts";

Deno.tools({
start: "deno run -A server.ts",
lint: eslint.run,
build: webpack.run
});

This looks great, having to import anything considered a 'built in' feature seems wrong, importing all the dev dependencies in one file up at the top looks good to me. Easy to read and reason about.

I use the VS Code NPM Scripts explorer to run everything. I can see an awesome future where it works with Deno too.

@iAmNathanJ
Copy link

FWIW I have a (rough) task runner I've been working on that somewhat resembles the patterns being suggested here. Might be of interest. https://github.com/iAmNathanJ/devo

@ry
Copy link
Member

ry commented Mar 12, 2020

I think this is something that is better developed outside of std for now (like @iAmNathanJ has done) - since it's experimenting with new patterns. I can imagine this developing into a pattern that many people use and it then making sense to merge into std, but we have finite bandwidth to maintain std and I'd rather focus that on stuff we know we need.

So maybe a good idea - but not something I want to take on right now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants