Skip to content

Commit

Permalink
chore: Converts package to publishing only .js/.d.ts files
Browse files Browse the repository at this point in the history
scalvert committed May 10, 2021
1 parent 66b8417 commit d602dd8
Showing 12 changed files with 112 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/node_modules/
**/*.js
**/*.d.ts
/lib/
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
"description": "a special purpose fast memoizing way to resolve a node modules package.json",
"version": "3.1.0",
"repository": "git@github.com:stefanpenner/resolve-package-path.git",
"main": "index.js",
"types": "index.d.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"license": "MIT",
"dependencies": {
"path-root": "^0.1.1",
@@ -29,19 +29,23 @@
"mocha": "^8.1.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"ts-mocha": "^8.0.0",
"typescript": "^4.0.3"
},
"scripts": {
"build": "tsc -b .",
"watch": "tsc --watch .",
"clean": "tsc -b --clean .",
"test": "npm-run-all build lint test:js",
"test:js": "mocha tests/*-test.js",
"test:js:debug": "mocha debug tests/*-test.js",
"test": "npm-run-all build lint test:ts",
"test:ts": "ts-mocha tests/*-test.ts",
"test:ts:debug": "ts-mocha debug tests/*-test.ts",
"lint": "eslint ."
},
"files": [
"lib/"
],
"engines": {
"node": "10.* || >= 12"
"node": ">= 12"
},
"volta": {
"node": "12.19.0",
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions index.ts → src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

import path = require('path');
const customResolvePackagePath = require('./lib/resolve-package-path');
import path from 'path';
import customResolvePackagePath from './resolve-package-path';

const ALLOWED_ERROR_CODES: { [key: string]: boolean } = {
// resolve package error codes
MODULE_NOT_FOUND: true,
@@ -12,8 +13,8 @@ const ALLOWED_ERROR_CODES: { [key: string]: boolean } = {
MISSING_DEPENDENCY: true,
};

import CacheGroup = require('./lib/cache-group');
import Cache = require('./lib/cache');
import CacheGroup = require('./cache-group');
import Cache = require('./cache');
const getRealFilePath = customResolvePackagePath._getRealFilePath;
const getRealDirectoryPath = customResolvePackagePath._getRealDirectoryPath;
const __findUpPackagePath = customResolvePackagePath._findUpPackagePath;
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/index-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import resolvePackagePath = require('../index');
import resolvePackagePath = require('../src/index');
import Project = require('fixturify-project');
import Cache = require('../lib/cache');
import Cache = require('../src/cache');
import fixturify = require('fixturify');
import fs = require('fs-extra');
import chai = require('chai');
6 changes: 3 additions & 3 deletions tests/resolve-package-path-test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
import path = require('path');
import chai = require('chai');
import resolvePackagePath = require('../lib/resolve-package-path');
import Cache = require('../lib/cache');
import CacheGroup = require('../lib/cache-group');
import resolvePackagePath = require('../src/resolve-package-path');
import Cache = require('../src/cache');
import CacheGroup = require('../src/cache-group');
import fs = require('fs');
import Project = require('fixturify-project');

2 changes: 1 addition & 1 deletion tests/should-preserve-symlinks-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import shouldPreserveSymlinks = require('../lib/should-preserve-symlinks');
import shouldPreserveSymlinks = require('../src/should-preserve-symlinks');
import chai = require('chai');
const expect = chai.expect;

8 changes: 6 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -5,10 +5,14 @@
"moduleResolution": "node",
"module": "commonjs",
"esModuleInterop": true,
"target": "es5",
"target": "es2018",
"baseUrl": ".",
"outDir": "lib",
"rootDir": "src",
"paths": {
"*": ["types/*"]
}
}
},
"include": ["src"],
"exclude": ["tests"]
}
85 changes: 84 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
@@ -98,6 +98,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==

"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/minimatch@*", "@types/minimatch@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
@@ -280,6 +285,11 @@ array.prototype.map@^1.0.1:
es-array-method-boxes-properly "^1.0.0"
is-string "^1.0.4"

arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=

assertion-error@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
@@ -325,6 +335,11 @@ browser-stdout@1.3.1:
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==

buffer-from@^1.0.0, buffer-from@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==

callsites@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
@@ -499,6 +514,11 @@ diff@4.0.2:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==

diff@^3.1.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==

dir-glob@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
@@ -1240,6 +1260,13 @@ json-stable-stringify-without-jsonify@^1.0.1:
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
dependencies:
minimist "^1.2.0"

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
@@ -1306,6 +1333,11 @@ log-symbols@4.0.0:
dependencies:
chalk "^4.0.0"

make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==

matcher-collection@^2.0.0, matcher-collection@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/matcher-collection/-/matcher-collection-2.0.1.tgz#90be1a4cf58d6f2949864f65bb3b0f3e41303b29"
@@ -1349,7 +1381,7 @@ minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimist@^1.2.5:
minimist@^1.2.0, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
@@ -1835,6 +1867,19 @@ slice-ansi@^2.1.0:
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"

source-map-support@^0.5.6:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"

source-map@^0.6.0:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==

spdx-correct@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
@@ -1998,6 +2043,39 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

ts-mocha@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-8.0.0.tgz#962d0fa12eeb6468aa1a6b594bb3bbc818da3ef0"
integrity sha512-Kou1yxTlubLnD5C3unlCVO7nh0HERTezjoVhVw/M5S1SqoUec0WgllQvPk3vzPMc6by8m6xD1uR1yRf8lnVUbA==
dependencies:
ts-node "7.0.1"
optionalDependencies:
tsconfig-paths "^3.5.0"

ts-node@7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.1.tgz#9562dc2d1e6d248d24bc55f773e3f614337d9baf"
integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==
dependencies:
arrify "^1.0.0"
buffer-from "^1.1.0"
diff "^3.1.0"
make-error "^1.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
source-map-support "^0.5.6"
yn "^2.0.0"

tsconfig-paths@^3.5.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b"
integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==
dependencies:
"@types/json5" "^0.0.29"
json5 "^1.0.1"
minimist "^1.2.0"
strip-bom "^3.0.0"

tslib@^1.8.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@@ -2198,3 +2276,8 @@ yargs@^14.2.3:
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^15.0.1"

yn@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"
integrity sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=

0 comments on commit d602dd8

Please sign in to comment.