Skip to content

Commit

Permalink
feat(uri): escape module names
Browse files Browse the repository at this point in the history
  • Loading branch information
djMax committed Nov 8, 2023
1 parent ce6e473 commit 731f980
Show file tree
Hide file tree
Showing 6 changed files with 1,754 additions and 2,784 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jest.config.js
.prettierrc.js
.eslintrc.js
.commitlintrc.json
vitest.config.ts
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
.yarnrc.yml
.yarn

src/**/*.spec.ts
src/**/*.test.ts
/__tests__
/__mocks__
__snapshots__
__image_snapshots__

# Stock
*.seed
*.log
Expand Down
8 changes: 6 additions & 2 deletions __tests__/npm_copy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { execFileSync } from 'child_process';

import { describe, expect, test } from 'vitest';

describe('npm-copy', () => {
it('prints usage', () => {
const result = execFileSync('./node_modules/.bin/ts-node', ['./src/bin/npm-copy.ts'], { encoding: 'utf-8' });
test('prints usage', () => {
const result = execFileSync('./node_modules/.bin/ts-node', ['./src/bin/npm-copy.ts'], {
encoding: 'utf-8',
});
expect(result).toContain('usage:');
});
});
45 changes: 21 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,35 @@
"coconfig": "@openapi-typescript-infra/coconfig"
},
"devDependencies": {
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@openapi-typescript-infra/coconfig": "^3.0.2",
"@types/debug": "^4.1.8",
"@types/jest": "^29.5.2",
"@types/libnpmpublish": "^4.0.3",
"@types/lodash.difference": "^4.5.7",
"@types/lodash.omitby": "^4.6.7",
"@types/minimist": "^1.2.2",
"@types/node": "^20.3.1",
"@types/npm-registry-fetch": "^8.0.4",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"coconfig": "^0.12.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^18.1.0",
"@openapi-typescript-infra/coconfig": "^4.2.2",
"@types/debug": "^4.1.11",
"@types/libnpmpublish": "^4.0.6",
"@types/lodash.difference": "^4.5.9",
"@types/lodash.omitby": "^4.6.9",
"@types/minimist": "^1.2.5",
"@types/node": "^20.9.0",
"@types/npm-registry-fetch": "^8.0.7",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"coconfig": "^1.0.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"husky": "^8.0.3",
"jest": "^29.5.0",
"lint-staged": "^13.2.2",
"lint-staged": "^13.3.0",
"pinst": "^3.0.0",
"prettier": "^2.8.8",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"engines": {
"node": ">16.0.0"
},
"scripts": {
"test": "jest",
"test": "vitest",
"build": "tsc --skipLibCheck -p tsconfig.build.json && yarn dlx glob-chmod 755 build/bin/*",
"clean": "yarn dlx rimraf ./build",
"lint": "eslint src",
Expand All @@ -78,7 +75,7 @@
"packageManager": "[email protected]",
"dependencies": {
"debug": "^4.3.4",
"libnpmpublish": "^7.3.0",
"libnpmpublish": "^7.5.0",
"lodash.difference": "^4.5.0",
"lodash.omitby": "^4.6.0",
"minimist": "^1.2.8",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface RepoSpec extends AuthOptions {
}

export async function getVersionInfo(registry: string, auth: Partial<AuthOptions>, module: string): Promise<VersionInfo> {
const response = await registryFetch.json(`/${module}`, {
const response = await registryFetch.json(`/${encodeURIComponent(module)}`, {
registry,
forceAuth: auth,
});
Expand Down
Loading

0 comments on commit 731f980

Please sign in to comment.