GithubHelp home page GithubHelp logo

volta-cli / volta Goto Github PK

View Code? Open in Web Editor NEW
10.0K 10.0K 212.0 65.35 MB

Volta: JS Toolchains as Code. ⚡

Home Page: https://volta.sh

License: Other

Rust 94.92% Batchfile 0.01% Shell 5.02% Dockerfile 0.06%
hacktoberfest node nodejs package-manager

volta's People

Contributors

2hu12 avatar bakkot avatar benblank avatar bprog avatar charlespierce avatar chawyehsu avatar chriskrycho avatar dependabot[bot] avatar dherman avatar dschmidt avatar dsully avatar fusion2004 avatar gautamprikshit1 avatar gregjopa avatar haochuan avatar mcarifio avatar mikrostew avatar monshi avatar mrchocolatine avatar mufasa71 avatar muniftanjim avatar rwjblue avatar rytmis avatar scalvert avatar sh4rk avatar sirreal avatar stefanpenner avatar tottoto avatar uasi avatar xg-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

volta's Issues

extract the GUID crate

The guid crate is nice and reusable. It could be extracted to a separate repo and published to crates.io. It'll need API docs.

index of all node versions should be cached.

We should respect the cache headers provided by index.json provided by node.

curl -I https://nodejs.org/download/release/index.json

last-modified: Thu, 05 Apr 2018 05:37:38 GMT
etag: "5ac5b622-1bf31"
access-control-allow-origin: *
expires: Fri, 13 Apr 2018 05:44:24 GMT <--- I think we care about this one.
cache-control: public, max-age=14400

In general, they are about a week. But basically always expire before the next Sunday.

Important Scenarios:

  1. When the file has expired, and https://nodejs.org/download/release/index.json is accessible, we should download the new artifact, and replace it with the exist.
  2. When the file hasn't expired, use the cached version.
  3. to support concurrent accesses of this file, we should be sure to update the cached file atomically.

automated deployment for internal API docs

We now have a reasonable amount of API doc comments, and I would like to start publishing them on a subdomain of notionjs.com. The URL structure I think I would like to use is:

https://impl.notionjs.com/$version/$variant/*
https://impl.notionjs.com/latest/$variant/*
https://impl.notionjs.com/$variant/*

where $version is maybe just "$major.$minor", $variant is either "windows" or "unix", latest is an alias for the current max available version, and the last form is just a shorthand for latest.

Since these are internal docs, I'd like to include all private definitions. I learned recently that the way to do this is currently nonobvious (I've reached out to some Cargo folks about getting a more standard command-line option in cargo doc for this):

% RUSTDOCFLAGS=--document-private-items cargo doc --all --no-deps

We'll want automation in both Appveyor and Travis to generate both the Windows and Unix versions (which do differ in a small number of important places!).

cache installers as they're fetched

notion_core::installer::node::Installer::remote() should put a TeeReader around its input source to save the results to a cache file. The cache file should be stored in a directory specified by notion_core::path::node_cache_dir().

consider using cargo-wix

It might be nice to streamline the build/deploy process to use cargo-wix for generating the Windows installer instead of the current command scripts.

use serde and semver instead of hand-written logic

Path to eliminating the hand-written logic for version data structures and for serialization of various data structures:

  • config should use serde (with an IR if necessary)
  • config should match the structure of RFC1 — just one hook for now
  • catalog should store versions as an ordered, sorted collection
  • catalog should support a resolve method that finds an available version that matches a spec
  • move most Tool logic to Node, for now tailored to specifically being the Node launcher
  • create a new top level Node launcher separate from launchbin/launchscript
  • rename notion/main.rs to notion/notion.rs
  • Node::new() should call session.node(&mut self) and get back the Version, instead of session.node_version()
  • session.node() should check for project and if so get a VersionReq, otherwise use the current catalog Version
  • when session.node() gets a VersionReq, try to find one already in catalog and return that
  • when session.node() gets a VersionReq and there’s none in catalog, either use resolution plugin or default resolution logic
  • config should have an IR for serialization
  • default resolution logic should consult https://nodejs.org/dist/index.json but for now can hard-code a few versions
  • plugin resolution logic should call the executable
  • manifest should parse using serde
  • manifest should just return the VersionReq
  • remove the logic of installing from Manifest
  • kill the lockfile module entirely
  • kill the untoml module entirely
  • kill the version module entirely
  • session.install_node() should ask the catalog to do the fetching if it has a VersionReq
  • catalog should initiate the plugin’s resolution protocol if it needs to resolve a VersionReq

XDG Base Directory Specification

WIP, will flesh this out later:

What?

We should consider abiding by the XDG Base Directory Specification

This makes where notion lives on disk configurable, specifically it would abide by the following ENV variables:

Why?

  • cluttering up $HOME becomes unwieldy
  • simplifies testing (we can sub-shell and simply set up the appropriate $XDG vars (no chroot, containers etc)
  • easier to reset config / clear caches
  • power users can configure to there hearts content, but no cost those who wish to rely on the fallbacks

How

Technically, likely via the XDG crate

Others Using XDG

Mostly just a list of whats in my $XDG_CONFIG_HOME, I suspect there are more.

Unresolved

Where do we put stuff in windows?

Maybe something like:

C:\Users\<username>\AppData\Local\notion-cli\notion\{dirs...}

initial config file support

Need basic functionality for reading user/system configuration. This is where plugins get installed. Should have a basic precedence algorithm for being able to consult the project directory and then the user's configuration directory.

finish the `verbatim` crate

The verbatim crate only has enough implemented to work on a couple manual test cases. It needs to be completed.

And probably extracted into a separate repo and published to crates.io!

notion-core reorg

The notion-core crate is getting pretty unwieldy. A possible reorg to make it a little easier to get a handle on:

installer/

serial/

state/
  path/
    unix.rs
    windows.rs
  catalog.rs
  config.rs
  plugin.rs

shell/
  env.rs
  style.rs

project/
  manifest.rs
  mod.rs // was: project.rs

exec/
  session.rs
  tool.rs

lib.rs

print out config source on syntax errors

When there's an error in a config file, Volta should print out not just the error message but the relevant lines in the actual source code.

This will require maintaining source location information in the parsers, some of which may not be available from the crates we're currently using. So this one could end up being blocked on getting more full-featured TOML and JSON parsers.

exit codes

There should be a single module that contains a full encyclopedia of exit codes, and all the error types throughout notion-core and the main crate should pull their exit codes from that module.

Thanks to @benblank we have an exit codes RFC!

Windows installer UI

The installer doesn't have any UI with it. It would make a more pleasant onboarding experience to see a welcome message and a logo, even though there aren't any particular decisions for the user to make.

Need RFC for npm/yarn link between projects with conflicting node versions

How should notion behave for the npm link usecase?

Imagine project A uses node@6 and project B uses node@8 with project B depending on A

The workflow used would be:

  1. cd projectA
  2. npm link to make it globally available
  3. cd projectB
  4. npm link projectA to link it up.

The npm versions used in 2 and 4 are different and will cause B not to find A

basic rustdoc comments

At least the modules, crates, and primary abstractions should have decent rustdoc comments for MVP.

error handling strategy

We need to tighten up the error handling strategy to be sure we always communicate a high-quality error message.

node resolve hook

notion_core::manifest::resolve_node should consult config file for hooks.

This blocks issue #4.

resolving public node should check OS availability

NodeCatalog::resolve_public scans for available version of node from the public list, but it doesn't make sure each version it checks is actually available for the current OS. Add this logic to the skip_while callback.

visible indication while fetching the public node listing

I believe fetching the public node listing is causing a pause with no visible indication to the user. Test this hypothesis, and if it's true, we should:

  • show an activity and/or progress indicator while fetching it
  • possibly cache it

I'm not sure if the caching semantics works, since it could mean missing new versions. So we should think that through.

projects without `"notion"` key should be global mode

A project without "notion" in its manifest should be treated not as an error but as a project that hasn't opted into using Notion. So in this case it should back off to analogous behavior to existing Node managers, i.e., it should use the globally selected toolchain.

download and cache latest version of yarn

Notion should download and cache the latest version of yarn.

A tarball of the latest version of yarn can be found at https://yarnpkg.com/latest.tar.gz

The version for this is located at https://yarnpkg.com/latest-version, which returns a text string (currently 1.6.0)

From https://yarnpkg.com/en/docs/install#alternatives-stable, this download can be verified like so:

wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --import
wget https://yarnpkg.com/latest.tar.gz.asc
gpg --verify latest.tar.gz.asc
# Look for "Good signature from 'Yarn Packaging'" in the output

use `exec` in unix

For unixes at least, I suspect it would be easier to implement a correct delegation for Tool::exec by using a Unix exec call. But this is an area I need to dig into more. (Expert advice welcome!)

node fetch hook

notion_core::provision::by_version should consult a node fetch hook.

This blocks issue #4.

`session.node()` should return a clearer enum

To avoid the complicated conditionals, the session.node() method should return an enum of which "kind" of Node we got (global vs project). That enum should have a method that produces an Option<Version>.

This maybe wants to be reconciled with the Installed type returned by install_node.

consistent error reporting

The logic for error reporting and exiting is scattered across the main crate and notion_core. These should be consolidated and unified.

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.