Skip to content

Commit

Permalink
Merge branch 'main' into fix-relative-types-path
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Sep 25, 2023
2 parents d4bd456 + fdd7210 commit 84332bc
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 15 deletions.
6 changes: 6 additions & 0 deletions packages/amplify-codegen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.6.1](https://github.com/aws-amplify/amplify-codegen/compare/[email protected]@4.6.1) (2023-09-25)

### Bug Fixes

- multiple swift file names ([#713](https://github.com/aws-amplify/amplify-codegen/issues/713)) ([a901362](https://github.com/aws-amplify/amplify-codegen/commit/a90136266944812001913b4b49972dda87750763))

# [4.6.0](https://github.com/aws-amplify/amplify-codegen/compare/[email protected]@4.6.0) (2023-09-19)

### Features
Expand Down
6 changes: 3 additions & 3 deletions packages/amplify-codegen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-codegen",
"version": "4.6.0",
"version": "4.6.1",
"description": "Amplify Code Generator",
"repository": {
"type": "git",
Expand All @@ -21,8 +21,8 @@
"extract-api": "ts-node ../../scripts/extract-api.ts"
},
"dependencies": {
"@aws-amplify/graphql-generator": "0.1.1",
"@aws-amplify/graphql-types-generator": "3.4.0",
"@aws-amplify/graphql-generator": "0.1.2",
"@aws-amplify/graphql-types-generator": "3.4.1",
"@graphql-codegen/core": "2.6.6",
"chalk": "^3.0.0",
"fs-extra": "^8.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-codegen/src/commands/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async function generateTypes(context, forceDownloadSchema, withoutInit = false,
queries,
target,
introspection,
multipleSwiftFiles: false,
});
const outputs = Object.entries(output);

Expand Down
28 changes: 28 additions & 0 deletions packages/amplify-codegen/tests/commands/types.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { sync } = require('glob-all');
const path = require('path');
const { generateTypes: generateTypesHelper } = require('@aws-amplify/graphql-generator');
const { generate: legacyGenerate } = require('@aws-amplify/graphql-types-generator');
const fs = require('fs-extra');

const { loadConfig } = require('../../src/codegen-config');
Expand All @@ -20,6 +21,7 @@ const MOCK_CONTEXT = {

jest.mock('glob-all');
jest.mock('@aws-amplify/graphql-generator');
jest.mock('@aws-amplify/graphql-types-generator');
jest.mock('../../src/codegen-config');
jest.mock('../../src/utils');
jest.mock('fs-extra');
Expand Down Expand Up @@ -81,9 +83,35 @@ describe('command - types', () => {
schema: 'schema',
target: 'TYPE_SCRIPT_OR_FLOW_OR_ANY_OTHER_LANGUAGE',
introspection: false,
multipleSwiftFiles: false,
});
});

it('should use legacy types generation when generating multiple swift files', async () => {
MOCK_PROJECT.amplifyExtension.codeGenTarget = 'swift';
MOCK_PROJECT.amplifyExtension.generatedFileName = 'typesDirectory';
const forceDownload = false;
fs.readFileSync
.mockReturnValueOnce('query 1')
.mockReturnValueOnce('query 2')
.mockReturnValueOnce('schema');
fs.existsSync.mockReturnValueOnce(true);
fs.statSync.mockReturnValueOnce({
isDirectory: jest.fn().mockReturnValue(true),
});
await generateTypes(MOCK_CONTEXT, forceDownload);
expect(generateTypesHelper).not.toHaveBeenCalled();
expect(legacyGenerate).toHaveBeenCalledWith(
['q1.gql', 'q2.gql'],
'MOCK_PROJECT_ROOT/INTROSPECTION_SCHEMA.JSON',
'MOCK_PROJECT_ROOT/typesDirectory',
'',
'swift',
'',
{ addTypename: true, complexObjectSupport: 'auto' },
);
});

it('should not generate type if the frontend is android', async () => {
const forceDownload = false;
getFrontEndHandler.mockReturnValue('android');
Expand Down
6 changes: 6 additions & 0 deletions packages/appsync-modelgen-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.7.2](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-25)

### Bug Fixes

- move types from runtime deps to dev deps ([#708](https://github.com/aws-amplify/amplify-codegen/issues/708)) ([f7a024d](https://github.com/aws-amplify/amplify-codegen/commit/f7a024d9ec4f7b0156c72b7f7d05139bbb339cbd))

## [2.7.1](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-19)

### Bug Fixes
Expand Down
8 changes: 4 additions & 4 deletions packages/appsync-modelgen-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/appsync-modelgen-plugin",
"version": "2.7.1",
"version": "2.7.2",
"repository": {
"type": "git",
"url": "https://github.com/aws-amplify/amplify-codegen.git",
Expand Down Expand Up @@ -39,11 +39,11 @@
"devDependencies": {
"@graphql-codegen/testing": "^1.17.7",
"@graphql-codegen/typescript": "^2.8.3",
"@types/node": "^12.12.6",
"@types/pluralize": "0.0.29",
"graphql": "^15.5.0",
"java-ast": "^0.3.0",
"ts-json-schema-generator": "1.0.0",
"@types/node": "^12.12.6",
"@types/pluralize": "0.0.29"
"ts-json-schema-generator": "1.0.0"
},
"peerDependencies": {
"graphql": "^15.5.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/graphql-generator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.1.2](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-25)

### Bug Fixes

- typo in graphql-generator arg ([#709](https://github.com/aws-amplify/amplify-codegen/issues/709)) ([756c375](https://github.com/aws-amplify/amplify-codegen/commit/756c3751bf236a64a5f028f61523cb96e0d7a7fa))

## [0.1.1](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-19)

**Note:** Version bump only for package @aws-amplify/graphql-generator
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/graphql-generator",
"version": "0.1.1",
"version": "0.1.2",
"description": "GraphQL API code generator",
"repository": {
"type": "git",
Expand All @@ -24,9 +24,9 @@
"extract-api": "ts-node ../../scripts/extract-api.ts"
},
"dependencies": {
"@aws-amplify/appsync-modelgen-plugin": "2.7.1",
"@aws-amplify/appsync-modelgen-plugin": "2.7.2",
"@aws-amplify/graphql-docs-generator": "4.2.0",
"@aws-amplify/graphql-types-generator": "3.4.0",
"@aws-amplify/graphql-types-generator": "3.4.1",
"@graphql-codegen/core": "^2.6.6",
"@graphql-tools/apollo-engine-loader": "^8.0.0",
"graphql": "^15.5.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/graphql-types-generator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.4.1](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-25)

### Bug Fixes

- move types from runtime deps to dev deps ([#708](https://github.com/aws-amplify/amplify-codegen/issues/708)) ([f7a024d](https://github.com/aws-amplify/amplify-codegen/commit/f7a024d9ec4f7b0156c72b7f7d05139bbb339cbd))

# [3.4.0](https://github.com/aws-amplify/amplify-codegen/compare/@aws-amplify/[email protected]...@aws-amplify/[email protected]) (2023-09-12)

### Features
Expand Down
10 changes: 5 additions & 5 deletions packages/graphql-types-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/graphql-types-generator",
"version": "3.4.0",
"version": "3.4.1",
"description": "Generate API code or type annotations based on a GraphQL schema and statements",
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,15 +52,15 @@
"yargs": "^15.1.0"
},
"devDependencies": {
"@types/babel-generator": "^6.25.0",
"@types/common-tags": "^1.8.0",
"@types/fs-extra": "^8.1.0",
"@types/glob": "^7.1.1",
"@types/inflected": "^1.1.29",
"@types/node": "^10.17.13",
"@types/yargs": "^15.0.1",
"@types/babel-generator": "^6.25.0",
"@types/fs-extra": "^8.1.0",
"@types/prettier": "^1.19.0",
"@types/rimraf": "^3.0.0"
"@types/rimraf": "^3.0.0",
"@types/yargs": "^15.0.1"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 84332bc

Please sign in to comment.