Skip to content

Commit b355988

Browse files
committed
feat: add name+version properties
- fix up cli interface - migrate to ts & add tests - add security/contributing/coc docs - add testing & linting scripts - add github workflows - format code
1 parent 8e23b50 commit b355988

21 files changed

+3000
-648
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
research/
5+
.github/

.eslintrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es2022": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module",
14+
"ecmaFeatures": {
15+
"modules": true
16+
}
17+
},
18+
"plugins": [
19+
"@typescript-eslint"
20+
],
21+
"rules": {
22+
"indent": ["error", 2],
23+
"linebreak-style": ["error", "unix"],
24+
"quotes": ["error", "single", { "avoidEscape": true }],
25+
"semi": ["error", "always"],
26+
"no-unused-vars": "off",
27+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
28+
"@typescript-eslint/no-explicit-any": "warn"
29+
}
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
1. Install '...'
15+
2. Run command '....'
16+
3. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**Environment (please complete the following information):**
22+
- OS: [e.g. macOS, Windows, Linux]
23+
- Node.js version: [e.g. 18.12.0]
24+
- Reproduce version: [e.g. 0.0.1-pre.1]
25+
26+
**Additional context**
27+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Questions & Discussions
4+
url: https://github.com/vltpkg/reproduce/discussions
5+
about: Please ask and answer questions here.
6+
- name: Documentation
7+
url: https://github.com/vltpkg/reproduce#readme
8+
about: Check the README for usage information.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Description
2+
3+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
Please delete options that are not relevant.
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] This change requires a documentation update
15+
16+
## How Has This Been Tested?
17+
18+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
19+
20+
## Checklist:
21+
22+
- [ ] My code follows the style guidelines of this project
23+
- [ ] I have performed a self-review of my own code
24+
- [ ] I have commented my code, particularly in hard-to-understand areas
25+
- [ ] I have made corresponding changes to the documentation
26+
- [ ] My changes generate no new warnings
27+
- [ ] I have added tests that prove my fix is effective or that my feature works
28+
- [ ] New and existing unit tests pass locally with my changes

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [22.x]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
npm install
26+
27+
- name: Run lint
28+
run: npm run lint
29+
30+
- name: Build
31+
run: npm run build
32+
33+
- name: Run tests
34+
run: npm run test

CODE_OF_CONDUCT.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Project maintainers are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all community spaces, and also applies when
49+
an individual is officially representing the community in public spaces.
50+
51+
## Enforcement
52+
53+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
54+
reported to the project maintainers. All complaints will be reviewed and
55+
investigated promptly and fairly.
56+
57+
## Attribution
58+
59+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
60+
version 2.0, available at
61+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Contributing to Reproduce
2+
3+
Thank you for your interest in contributing to Reproduce! This document provides guidelines and instructions for contributing.
4+
5+
## Development Setup
6+
7+
1. Fork and clone the repository
8+
2. Install dependencies with `vlt install`
9+
3. Build the project with `vlr build`
10+
4. Run tests with `vlr test`
11+
12+
## TypeScript
13+
14+
This project uses TypeScript. Make sure to:
15+
16+
1. Write all new code in TypeScript
17+
2. Include appropriate type definitions
18+
3. Run `vlx tsc` to check for type errors
19+
20+
## Linting
21+
22+
We use ESLint for code quality. Please follow these guidelines:
23+
24+
1. Run `vlr lint` to check for linting issues
25+
2. Run `vlr lint:fix` to automatically fix linting issues
26+
3. Ensure your code follows the linting rules before submitting a PR
27+
28+
## Testing
29+
30+
We use Node.js's built-in test runner for testing. Please follow these guidelines:
31+
32+
1. Write tests for all new features
33+
2. Ensure all tests pass before submitting a PR
34+
3. Organize tests into appropriate suites (unit tests and integration tests)
35+
36+
## Pull Request Process
37+
38+
1. Create a branch with a descriptive name
39+
2. Make your changes and commit them with clear, concise commit messages
40+
3. Ensure all tests pass and there are no type errors or linting issues
41+
4. Submit a pull request with a clear description of the changes
42+
5. Address any feedback from reviewers
43+
44+
## Code Style
45+
46+
- Use consistent indentation (2 spaces)
47+
- Follow the existing code style
48+
- Use meaningful variable and function names
49+
- Add comments for complex logic
50+
51+
## License
52+
53+
By contributing to Reproduce, you agree that your contributions will be licensed under the project's MIT license.

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# `reproduce`
44

5+
[![Test](https://github.com/darcyclarke/reproduce/actions/workflows/test.yml/badge.svg)](https://github.com/darcyclarke/reproduce/actions/workflows/test.yml)
6+
[![Lint and Type Check](https://github.com/darcyclarke/reproduce/actions/workflows/lint.yml/badge.svg)](https://github.com/darcyclarke/reproduce/actions/workflows/lint.yml)
7+
58
Can we reproduce a package with the _"origin"_ information provided?
69

710
**[Features](#features)**
@@ -36,6 +39,15 @@ Can we reproduce a package with the _"origin"_ information provided?
3639

3740
### Usage
3841

42+
```bash
43+
$ npm i -g reproduce # install globally
44+
$ reproduce axios
45+
```
46+
47+
```bash
48+
$ npx reproduce axios # execute with npx
49+
```
50+
3951
```js
4052
import reproduce from 'reproduce'
4153

@@ -54,15 +66,15 @@ const result = await reproduce('package-name', {
5466
#### CLI
5567

5668
```bash
57-
npx reproduce tsc # exit code 0 - reproducible
69+
reproduce tsc # exit code 0 - reproducible
5870
```
5971

6072
```bash
61-
npx reproduce esbuild # exit code 1 - not reproducible
73+
reproduce esbuild # exit code 1 - not reproducible
6274
```
6375

6476
```bash
65-
npx reproduce axios --json # exit code 1 - not reproducible
77+
reproduce axios --json # exit code 1 - not reproducible
6678
{
6779
"reproduceVersion": "0.0.1-pre.1",
6880
"timestamp": "2025-02-25T10:40:24.947Z",
@@ -71,20 +83,25 @@ npx reproduce axios --json # exit code 1 - not reproducible
7183
"strategy": "npm:10.9.1",
7284
"reproduced": false,
7385
"package": {
74-
"spec": "axios",
86+
"spec": "axios@latest",
87+
"name": "axios",
88+
"version": "1.2.3",
7589
"location": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
7690
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw=="
7791
},
7892
"source": {
7993
"spec": "github:axios/axios#b2cb45d5a533a5465c99559b16987e4d5fc08cbc",
94+
"name": "axios",
95+
"version": "1.2.3",
8096
"location": "git+https://github.com/axios/axios.git",
8197
"integrity": "null"
82-
}
98+
},
99+
"diff": "..."
83100
}
84101
```
85102

86103
```bash
87-
npx reproduce require --json # exit code 0 - reproducible
104+
reproduce require --json # exit code 0 - reproducible
88105
{
89106
"reproduceVersion": "0.0.1-pre.1",
90107
"timestamp": "2025-02-25T10:22:09.303Z",
@@ -93,12 +110,14 @@ npx reproduce require --json # exit code 0 - reproducible
93110
"strategy": "npm:10.9.1",
94111
"reproduced": true,
95112
"package": {
96-
"spec": "sleepover",
113+
"spec": "sleepover@latest",
114+
"version": "1.2.3",
97115
"location": "https://registry.npmjs.org/sleepover/-/sleepover-1.2.3.tgz",
98116
"integrity": "sha512-yNAIVUqbQifyy5+hfzAzK2Zt21wXjwXqPyWLu+tOvhOcYKG2ffUiSoBXwt/yo4KJ51IcJfUS0Uq0ktOoMWy9Yw=="
99117
},
100118
"source": {
101119
"spec": "github:darcyclarke/sleepover#f2586e91b3faf085583c23ed6e00819916e85c28",
120+
"version": "1.2.3",
102121
"location": "git+ssh://git@github.com/darcyclarke/sleepover.git",
103122
"integrity": "sha512-yNAIVUqbQifyy5+hfzAzK2Zt21wXjwXqPyWLu+tOvhOcYKG2ffUiSoBXwt/yo4KJ51IcJfUS0Uq0ktOoMWy9Yw=="
104123
}
@@ -129,9 +148,9 @@ The cache is stored in OS-specific locations:
129148

130149
A strategy is a set of operations to take to recreate a package. Strategies should represent common patterns for preparing/building/packing packages to cast wide nets. If a set successfully recreates a package then its ID will be stored inside the returned metadata.
131150

132-
| UUID | Notes |
151+
| Name | UUID | Description |
133152
| --- | --- |
134-
| `npm:<version>` | clones, checks out ref, installs deps, runs prepare scripts & packs |
153+
| `npm` `npm:<version>` | clones, checks out ref, installs deps & then runs pack |
135154

136155
> Note: one-off/bespoke or complex configurations will not be supported but we will continue to add more strategies as we find common patterns.
137156

0 commit comments

Comments
 (0)