Skip to content

Commit

Permalink
Merge pull request #21 from nrccua/feature/github_package
Browse files Browse the repository at this point in the history
[E4E-0]: Make package public under @encoura scope
  • Loading branch information
TheCleric authored Feb 9, 2022
2 parents 0c016ac + e7fda5b commit defdbfa
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 455 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:
- run: npm i
- run: npm run test
- run: npm run build
- run: npm publish
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ npx apollo-rest-utils <path_to_swagger_file_or_url> <output_directory_where_you_
Then you can use those definitions to make GraphQL calls within an Apollo context:

```TypeScript
import { wrapRestQuery } from 'apollo-rest-utils';
import { wrapRestQuery } from '@encoura/apollo-rest-utils';

import ROUTES from 'path/to/directory_specified_in_cli_call/__generatedRestEndpoints';

Expand Down Expand Up @@ -88,8 +88,8 @@ should be requested in camel case format. I.e. if your REST API returns a
#### `HeadersLink` Setup

```ts
import { HeadersLink } from '@encoura/apollo-rest-utils';
import { RestLink } from 'apollo-link-rest';
import { HeadersLink } from 'apollo-rest-utils';

const headersLink = new HeadersLink();
const restLink = new RestLink({ ... });
Expand Down
4 changes: 2 additions & 2 deletions lib/generateRoutes/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('generateTypescript', () => {

const typeImport = await generateTypes(apiPath, path.join(buildFolder, `${randomUUID()}_types.ts`));

const tsData = generateTypescript(api, typeImport).replace(/apollo-rest-utils/g, '../../lib');
const tsData = generateTypescript(api, typeImport).replace(/@encoura\/apollo-rest-utils/g, '../../lib');

expect(tsData).toBeTruthy(); // Not empty, null, or undefined

Expand All @@ -67,7 +67,7 @@ describe('generateTypescript', () => {

const typeImport = await generateTypes(apiPath, path.join(buildFolder, `${randomUUID()}_types.ts`));

const tsData = generateTypescript(api, typeImport, 'TEST').replace(/apollo-rest-utils/g, '../../lib');
const tsData = generateTypescript(api, typeImport, 'TEST').replace(/@encoura\/apollo-rest-utils/g, '../../lib');

expect(tsData).toBeTruthy(); // Not empty, null, or undefined

Expand Down
4 changes: 2 additions & 2 deletions lib/generateRoutes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ export function generateTypescript(api: OpenAPI.Document, typeImportLocation: st
// eslint-disable-next-line lodash/prefer-includes
if (generatedTSEndpoints.indexOf('Input<') > -1) {
// eslint-disable-next-line max-len
generatedTSEndpoints = `${warningHeader}import { paths } from '${typeImportLocation}'\n\nimport { IRestEndpoint, Input } from 'apollo-rest-utils';\n\n\n${generatedTSEndpoints}`;
generatedTSEndpoints = `${warningHeader}import { paths } from '${typeImportLocation}'\n\nimport { IRestEndpoint, Input } from '@encoura/apollo-rest-utils';\n\n\n${generatedTSEndpoints}`;
} else {
// eslint-disable-next-line max-len
generatedTSEndpoints = `${warningHeader}import { paths } from '${typeImportLocation}'\n\nimport { IRestEndpoint } from 'apollo-rest-utils';\n\n\n${generatedTSEndpoints}`;
generatedTSEndpoints = `${warningHeader}import { paths } from '${typeImportLocation}'\n\nimport { IRestEndpoint } from '@encoura/apollo-rest-utils';\n\n\n${generatedTSEndpoints}`;
}

return generatedTSEndpoints;
Expand Down
Loading

0 comments on commit defdbfa

Please sign in to comment.