Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __MACOSX
/.idea/
/node_modules/
/dist/
.env
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ test: node_modules
node_modules:
npm install

build:
npm run build

publish: test version upload unversion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the build command should be added as part of the publish command. I think

publish: test version build upload unversion should work?

In addition, we should define a .npmignore file with the following lines in order to not publish unecessary files npm (not for privacy reasons, but just for keeping things tidy)

src/
tests/
node_modules/
examples/

.env
.vscode/
.idea/
.DS_Store
.eslintignore
.eslintrc.json
.git/
.github/
.gitignore
.prettierignore
.prettierrc

*.log

You can test out what will be published to npm with npm publish --dry-run

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camiblanch @maxwellpothier I agree with reducing the package size. When I first looked at the project, I wasn't sure why all the code was being exported in the package, so I left it as it was. However, in this case, it would be better to specify which files to include rather than excluding them. In the package.json, you can do something like this:

{
  "files": [
    "dist",
    "README.md",
    "LICENSE"
  ]
}

This way, you’re only including the necessary build folder (dist), which is meant for publishing the package to npm, and other relevant files like the README and license.

tagit -p
git push origin --tags
Expand Down
41 changes: 0 additions & 41 deletions index.js

This file was deleted.

93 changes: 93 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/**
* this files is the entry point for rollup to bundle the library
* it exports all the classes and functions as named exports
*/
import Batch from "./src/Batch.js";
import ClientBuilder from "./src/ClientBuilder.js";
import buildClient from "./src/util/buildClients.js";
import SharedCredentials from "./src/SharedCredentials.js";
import StaticCredentials from "./src/StaticCredentials.js";
import Errors from "./src/Errors.js";

import LookupUSStreet from "./src/us_street/Lookup.js";
import CandidateUSStreet from "./src/us_street/Candidate.js";

import LookupUSZipcode from "./src/us_zipcode/Lookup.js";
import ResultUSZipcode from "./src/us_zipcode/Result.js";

import LookupUSAutocompletePro from "./src/us_autocomplete_pro/Lookup.js";
import SuggestionUSAutocompletePro from "./src/us_autocomplete_pro/Suggestion.js";

import LookupUSExtract from "./src/us_extract/Lookup.js";
import ResultUSExtract from "./src/us_extract/Result.js";

import LookupInternationalStreet from "./src/international_street/Lookup.js";
import CandidateInternationalStreet from "./src/international_street/Candidate.js";

import LookupUSReverseGeo from "./src/us_reverse_geo/Lookup.js";

import LookupInternationalAddressAutocomplete from "./src/international_address_autocomplete/Lookup.js";
import SuggestionInternationalAddressAutocomplete from "./src/international_address_autocomplete/Suggestion.js";

import LookupUSEnrichment from "./src/us_enrichment/Lookup.js";
import ResponseUSEnrichment from "./src/us_enrichment/Response.js";

export const core = {
Batch,
ClientBuilder,
buildClient,
SharedCredentials,
StaticCredentials,
Errors,
};

export const usStreet = {
Lookup: LookupUSStreet,
Candidate: CandidateUSStreet,
};

export const usZipcode = {
Lookup: LookupUSZipcode,
Result: ResultUSZipcode,
};

export const usAutocompletePro = {
Lookup: LookupUSAutocompletePro,
Suggestion: SuggestionUSAutocompletePro,
};

export const usExtract = {
Lookup: LookupUSExtract,
Result: ResultUSExtract,
};

export const internationalStreet = {
Lookup: LookupInternationalStreet,
Candidate: CandidateInternationalStreet,
};

export const usReverseGeo = {
Lookup: LookupUSReverseGeo,
};

export const internationalAddressAutocomplete = {
Lookup: LookupInternationalAddressAutocomplete,
Suggestion: SuggestionInternationalAddressAutocomplete,
};

export const usEnrichment = {
Lookup: LookupUSEnrichment,
Response: ResponseUSEnrichment,
};

export default {
core,
usStreet,
usZipcode,
usAutocompletePro,
usExtract,
internationalStreet,
usReverseGeo,
internationalAddressAutocomplete,
usEnrichment,
};
Loading
Loading