@faststore/core 2.2.0-alpha.2 → 2.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  $ yarn partytown & yarn generate && next build
2
- $ ./generate.sh
2
+ $ faststore generate-graphql -c
3
3
  $ partytown copylib ./public/~partytown
4
4
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
5
- GraphQL schema, types, and optimizations successfully generated 🎉
5
+ success - GraphQL schema, types, and optimizations successfully generated 🎉
6
6
  warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
7
7
  Attention: Next.js now collects completely anonymous telemetry regarding usage.
8
8
  This information is used to shape Next.js' roadmap and prioritize features.
@@ -43,7 +43,7 @@ Route (pages) Size First Load JS
43
43
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
44
44
  ├ chunks/main-fd466221927468fd.js 23.9 kB
45
45
  ├ chunks/pages/_app-6d0e6ab9a4dd8106.js 6.45 kB
46
- ├ chunks/webpack-2e9da2bb669ad415.js 2.29 kB
46
+ ├ chunks/webpack-88d120cefa1c4c09.js 2.29 kB
47
47
  └ css/9e76fef1c9ca89af.css 3.06 kB
48
48
 
49
49
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,25 +1,25 @@
1
1
  $ tsdx test
2
2
  ts-jest[versions] (WARN) Version 29.1.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
3
3
  ts-jest[versions] (WARN) Version 4.9.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.4.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
4
- PASS test/server/index.test.ts (17.219s)
4
+ PASS test/server/index.test.ts (7.999s)
5
5
  FastStore GraphQL Layer
6
6
  @faststore/api
7
- ✓ should return a valid GraphQL schema (7ms)
8
- ✓ should return a valid GraphQL schema contain all expected types (53ms)
9
- ✓ should return a valid GraphQL schema contain all expected queries (1ms)
7
+ ✓ should return a valid GraphQL schema (6ms)
8
+ ✓ should return a valid GraphQL schema contain all expected types (13ms)
9
+ ✓ should return a valid GraphQL schema contain all expected queries (2ms)
10
10
  ✓ should return a valid GraphQL schema contain all expected mutations
11
11
  VTEX API Extension
12
- ✓ getTypeDefsFromFolder function should return an Array (14ms)
12
+ ✓ getTypeDefsFromFolder function should return an Array (6ms)
13
13
  Third Party API Extension
14
14
  ✓ getTypeDefsFromFolder function should return an Array (6ms)
15
15
  Final Schema after merging
16
- ✓ should return a valid merged GraphQL schema (111ms)
16
+ ✓ should return a valid merged GraphQL schema (31ms)
17
17
  Envelop
18
- ✓ should exist with its plugins (65ms)
19
- ✓ should handle options and execute (226ms)
18
+ ✓ should exist with its plugins (38ms)
19
+ ✓ should handle options and execute (126ms)
20
20
 
21
21
  Test Suites: 1 passed, 1 total
22
22
  Tests: 9 passed, 9 total
23
23
  Snapshots: 0 total
24
- Time: 18.262s
24
+ Time: 8.583s
25
25
  Ran all test suites.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.2.0-alpha.2",
3
+ "version": "2.2.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "exports": {
@@ -8,7 +8,8 @@
8
8
  },
9
9
  "scripts": {
10
10
  "generate:schema": "tsx src/server/generator/generateGraphQLSchemaFile.ts",
11
- "generate": "./generate.sh",
11
+ "generate:codegen": "graphql-codegen",
12
+ "generate": "faststore generate-graphql -c",
12
13
  "build": "yarn partytown & yarn generate && next build",
13
14
  "dev": "yarn partytown & yarn generate && next dev",
14
15
  "clean": "rm -r .next",
@@ -78,6 +79,7 @@
78
79
  "devDependencies": {
79
80
  "@cypress/code-coverage": "^3.9.10",
80
81
  "@envelop/testing": "^6.0.0",
82
+ "@faststore/cli": "^2.2.0-alpha.3",
81
83
  "@faststore/eslint-config": "^2.2.0-alpha.1",
82
84
  "@faststore/lighthouse": "^1.12.32",
83
85
  "@lhci/cli": "^0.9.0",
@@ -125,5 +127,5 @@
125
127
  "msw": {
126
128
  "workerDirectory": "public"
127
129
  },
128
- "gitHead": "e7c49e9acbd86b8501badc384476a10d4f39054f"
130
+ "gitHead": "3f6a1bf0ab1c6cc7804c4f8752bf82457e8aad67"
129
131
  }
@@ -1,3 +1,4 @@
1
+ import path from 'path'
1
2
  import { writeFileSync } from 'fs-extra'
2
3
  import { getSchema, getTypeDefs } from '@faststore/api'
3
4
  import { printSchemaWithDirectives } from '@graphql-tools/utils'
@@ -69,7 +70,7 @@ export const getMergedSchema = (): GraphQLSchema =>
69
70
  export function writeGraphqlSchemaFile(apiSchema: GraphQLSchema) {
70
71
  try {
71
72
  writeFileSync(
72
- [process.cwd(), '@generated', 'graphql', 'schema.graphql'].join('/'),
73
+ path.join(process.cwd(), '@generated', 'graphql', 'schema.graphql'),
73
74
  printSchemaWithDirectives(apiSchema)
74
75
  )
75
76
 
package/generate.sh DELETED
@@ -1,71 +0,0 @@
1
- #!/bin/sh
2
-
3
- # ANSI color codes
4
- RED='\033[0;31m'
5
- YELLOW='\033[1;33m'
6
- PURPLE='\033[0;35m'
7
- GREEN='\033[0;32m'
8
- NC='\033[0m' # No Color
9
-
10
- # Initialize debug flag to false
11
- DEBUG_FLAG=false
12
-
13
- # Check for --debug flag
14
- if [ "$1" = "--debug" ]; then
15
- DEBUG_FLAG=true
16
- fi
17
-
18
- # Function to display errors with readable messages
19
- show_error() {
20
- local cmd="$3"
21
-
22
- echo "${RED}error${NC} $1"
23
- if [ "$DEBUG_FLAG" = "true" ]; then
24
- echo "${PURPLE}DEBUG - \$ $cmd ${RED}error root ↓${NC}\n$2"
25
- fi
26
- exit 1
27
- }
28
-
29
- # Function to display warnings
30
- show_warning() {
31
- local cmd="$3"
32
-
33
- echo "${YELLOW}warn${NC} $1"
34
- if [ "$DEBUG_FLAG" = "true" ]; then
35
- echo "${PURPLE}DEBUG - \$ $cmd ${YELLOW}warn root ↓${NC}\n$2"
36
- fi
37
- }
38
-
39
- # Function to run a command and handle errors and warnings
40
- run_command() {
41
- local cmd="$1"
42
- local error_message="$2"
43
- local warn="$3"
44
- local output
45
-
46
- if [ "$DEBUG_FLAG" = "true" ]; then
47
- output="$($cmd --debug --verbose 2>&1)"
48
- else
49
- output="$($cmd 2>&1)"
50
- fi
51
-
52
- local exit_code="$?"
53
- if [ "$warn" = "true" ]; then
54
- if [ "$exit_code" -ne 0 ]; then
55
- show_warning "$error_message" "$output" "$cmd"
56
- fi
57
- elif [ "$exit_code" -ne 0 ]; then
58
- show_error "$error_message" "$output" "$cmd"
59
- fi
60
- }
61
-
62
- # Run "yarn generate:schema" without outputting logs and errors
63
- run_command "yarn generate:schema" "Failed to run 'yarn generate:schema'. Please check your setup." "false"
64
-
65
- # Run "yarn graphql-codegen" and capture the output
66
- run_command "yarn graphql-codegen" "GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect" "false"
67
-
68
- # Run "yarn format:generated" and display a warning if it produces output
69
- run_command "yarn format:generated" "Failed to format generated files. 'yarn format:generated' thrown errors" "true"
70
-
71
- echo "${GREEN}GraphQL schema, types, and optimizations successfully generated 🎉${NC}"