Skip to content

Commit 4856212

Browse files
committed
feat(WIP): new canary
1 parent 0b6b185 commit 4856212

171 files changed

Lines changed: 5884 additions & 11876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codesandbox/ci.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"packages/api",
55
"packages/cli",
66
"packages/core",
7-
"packages/graphql-utils",
87
"packages/lighthouse",
98
"packages/sdk",
109
"packages/ui",
1110
"packages/components"
1211
],
1312
"sandboxes": ["store-ui-typescript-0gd9u"],
14-
"node": "18"
13+
"node": "20"
1514
}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Node.js environment
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: 18
32+
node-version: 20
3333

3434
- name: Install dependencies
3535
run: pnpm i

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Setup Node.js environment
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: 18
34+
node-version: 20
3535
cache: "pnpm"
3636
registry-url: "https://registry.npmjs.org"
3737

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ build/Release
3939
dist/
4040
build/
4141
storybook-static/
42+
.faststore
4243

4344
# Dependency directories
4445
node_modules/

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"source.organizeImports.biome": "explicit"
1313
},
1414
"[json]": {
15-
"editor.defaultFormatter": "biomejs.biome"
15+
"editor.defaultFormatter": "vscode.json-language-features"
1616
},
1717
"[javascript]": {
1818
"editor.defaultFormatter": "biomejs.biome"
@@ -25,5 +25,6 @@
2525
},
2626
"[typescriptreact]": {
2727
"editor.defaultFormatter": "biomejs.biome"
28-
}
28+
},
29+
"editor.fontFamily": "'MesloLGS NF', Menlo, Monaco, 'Courier New', monospace"
2930
}

makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
clean:
2+
-rm -rf ./packages/*/dist
3+
-rm -rf ./apps/*/.next
4+
-rm -rf ./packages/api/src/__generated__
5+
-rm -rf ./packages/core/@generated/*
6+
-rm -rf ./apps/*/.faststore
7+
-rm -rf ./packages/*/.faststore
8+
-rm -rf ./packages/*/.next
9+
10+
clean-modules: clean
11+
-rm -rf ./packages/*/node_modules
12+
-rm -rf ./apps/*/node_modules
13+
-rm -rf ./node_modules
14+
-rm -rf ./pnpm-lock.yaml
15+
-pnpm cache delete
16+
-pnpm install --force
17+
-$(MAKE) build
18+
19+
build: clean
20+
(cd ./packages/components && pnpm build)
21+
(cd ./packages/ui && pnpm build)
22+
(cd ./packages/sdk && pnpm build)
23+
(cd ./packages/api && pnpm build)
24+
(cd ./packages/cli && pnpm build)
25+
26+
clean-e2e: clean-modules env-e2e
27+
-pnpm dlx playwright uninstall
28+
-(cd ./apps/starter && pnpm playwright install --with-deps)
29+
-pnpm run test:e2e
30+
31+
env-e2e:
32+
-export DEBUG=pw:api
33+
-export CI=true

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
"stylelint-order": "^5.0.0",
3333
"stylelint-scss": "^4.0.1",
3434
"turbo": "^2.3.4",
35-
"typescript": "5.3.2"
35+
"typescript": "catalog:"
3636
},
3737
"version": "0.0.0",
38-
"volta": {
39-
"node": "18.19.0",
40-
"pnpm": "9.15.5"
41-
},
42-
"packageManager": "pnpm@9.15.5",
38+
"packageManager": "pnpm@10.20.0",
4339
"lint-staged": {
4440
"*.{ts,js,tsx,jsx,json}": "pnpm lint:fix",
4541
"*.scss": "stylelint --fix"

packages/api/local/server.mjs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { useLogger, useMaskedErrors } from '@envelop/core'
2+
import { useGraphQlJit } from '@envelop/graphql-jit'
3+
import { useParserCache } from '@envelop/parser-cache'
4+
import { useValidationCache } from '@envelop/validation-cache'
5+
import { GraphqlVtexContextFactory, GraphqlVtexSchema } from '@faststore/api'
6+
import { createYoga } from 'graphql-yoga'
7+
import { createServer } from 'node:http'
8+
const serverPort = process.env.PORT ?? '4000'
9+
10+
/** @type {import("../src").Options} */
11+
const apiOptions = {
12+
platform: 'vtex',
13+
account: 'storeframework',
14+
locale: 'en-US',
15+
environment: 'vtexcommercestable',
16+
channel:
17+
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true"}',
18+
showSponsored: false,
19+
}
20+
21+
const yoga = createYoga({
22+
schema: GraphqlVtexSchema(),
23+
context: GraphqlVtexContextFactory(apiOptions),
24+
plugins: [
25+
useMaskedErrors({
26+
maskError: (err) => {
27+
if (
28+
err instanceof GraphQLError &&
29+
isFastStoreError(err.originalError)
30+
) {
31+
return err
32+
}
33+
34+
console.error(err)
35+
36+
return new GraphQLError(`Sorry, something went wrong. ${err}`)
37+
},
38+
}),
39+
useGraphQlJit(),
40+
useValidationCache(),
41+
useParserCache(),
42+
useLogger({
43+
logFn: (eventName, { args }) =>
44+
console.log(
45+
`${eventName}(${args?.operationName ?? 'unknown_operation_name'}): ${JSON.stringify(args?.variableValues)}`
46+
),
47+
}),
48+
],
49+
})
50+
const server = createServer(yoga)
51+
52+
// Start the server and you're done!
53+
server.listen(serverPort, () => {
54+
console.info(
55+
`🚀 GraphQL server ready at http://localhost:${serverPort}/graphql`
56+
)
57+
})

packages/api/local/server.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/api/package.json

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,70 @@
22
"name": "@faststore/api",
33
"version": "3.93.0-dev.1",
44
"license": "MIT",
5-
"main": "dist/cjs/src/index.js",
6-
"typings": "dist/esm/src/index.d.ts",
7-
"module": "dist/esm/src/index.js",
5+
"main": "dist/cjs/index.js",
6+
"typings": "dist/src/index.d.ts",
7+
"module": "dist/es/index.mjs",
88
"repository": "vtex/faststore",
99
"files": [
1010
"dist",
1111
"src"
1212
],
1313
"exports": {
1414
".": {
15-
"import": "./dist/esm/src/index.js",
16-
"require": "./dist/cjs/src/index.js",
17-
"types": "./dist/esm/src/index.d.ts",
18-
"default": "./dist/esm/src/index.js"
15+
"types": "./dist/src/index.d.ts",
16+
"import": "./dist/es/index.mjs",
17+
"require": "./dist/cjs/index.js",
18+
"default": "./dist/es/index.mjs"
1919
}
2020
},
21-
"browserslist": "node 18",
21+
"browserslist": "node 20",
2222
"engines": {
23-
"node": ">=18"
23+
"node": ">=20"
2424
},
2525
"scripts": {
26-
"dev": "concurrently \"pnpm run generate -w\" \"tsc --watch\" \"pnpm run dev:graphql\"",
27-
"dev:graphql": "nodemon --watch src --ext graphql --exec \"copyfiles \"src/**/*.graphql\" dist/esm\"",
28-
"dev:server": "tsx --no-cache ./local/server.ts",
29-
"build": "graphql-codegen --config codegen.yml && (pnpm build:cjs && pnpm build:esm)",
30-
"build:cjs": "tsc --module commonjs --moduleResolution node10 --outDir dist/cjs && copyfiles \"src/**/*.graphql\" dist/cjs",
31-
"build:esm": "tsc && copyfiles \"src/**/*.graphql\" dist/esm",
32-
"test:int": "jest --projects jest.int.config.js",
33-
"test:intc": "jest --projects jest.int.config.js --coverage",
34-
"test:unit": "jest --projects jest.unit.config.js --silent",
35-
"test:unitc": "jest --projects jest.unit.config.js --silent --coverage",
26+
"dev": "concurrently \"pnpm run generate -w\" \"vite build --watch\" \"pnpm run dev:server\"",
27+
"build": "vite build",
28+
"prebuild": "pnpm generate",
29+
"test:int": "vitest run ./test/integration",
30+
"test:intc": "pnpm run test:int --coverage",
31+
"test:unit": "vitest run ./test/unit",
32+
"test:unitc": "pnpm run test:unit --coverage",
3633
"test": "pnpm run test:unit && pnpm run test:int",
37-
"generate": "graphql-codegen --config codegen.yml"
34+
"generate": "graphql-codegen --config codegen.yml",
35+
"dev:server": "pnpm build && node ./local/server.mjs"
3836
},
3937
"dependencies": {
4038
"@graphql-tools/load-files": "^7.0.0",
41-
"@graphql-tools/schema": "^9.0.0",
42-
"@graphql-tools/utils": "^10.2.0",
43-
"@rollup/plugin-graphql": "^1.0.0",
44-
"cookie": "^0.7.0",
39+
"@graphql-tools/merge": "catalog:",
40+
"@graphql-tools/schema": "catalog:",
41+
"@graphql-tools/utils": "catalog:",
42+
"cookie": "catalog:",
4543
"dataloader": "^2.1.0",
46-
"fast-deep-equal": "^3.1.3",
44+
"fast-deep-equal": "catalog:",
4745
"isomorphic-unfetch": "^3.1.0",
4846
"p-limit": "^3.1.0",
4947
"sanitize-html": "^2.11.0"
5048
},
5149
"devDependencies": {
52-
"@graphql-codegen/cli": "2.2.0",
53-
"@graphql-codegen/typescript": "2.2.2",
54-
"@parcel/watcher": "^2.4.0",
50+
"@envelop/core": "catalog:",
51+
"@envelop/graphql-jit": "catalog:",
52+
"@envelop/parser-cache": "catalog:",
53+
"@envelop/validation-cache": "catalog:",
54+
"@graphql-codegen/cli": "catalog:",
55+
"@graphql-codegen/typescript": "catalog:",
5556
"@types/cookie": "^0.6.0",
5657
"@types/express": "^4.17.16",
57-
"@types/jest": "29.1.0",
5858
"@types/sanitize-html": "^2.9.1",
5959
"concurrently": "^6.2.1",
6060
"copyfiles": "^2.4.1",
61-
"express": "^4.17.3",
62-
"express-graphql": "^0.12.0",
63-
"graphql": "^15.6.0",
64-
"jest": "^29.7.0",
65-
"nodemon": "^3.0.2",
66-
"ts-jest": "29.1.1",
67-
"tslib": "^2.3.1",
68-
"tsx": "^4.6.2"
61+
"graphql": "catalog:",
62+
"graphql-yoga": "^5.16.1",
63+
"tslib": "catalog:",
64+
"vite": "catalog:",
65+
"vite-plugin-dts": "catalog:",
66+
"vitest": "^4.0.7"
6967
},
7068
"peerDependencies": {
71-
"graphql": "^15.6.0"
72-
},
73-
"volta": {
74-
"extends": "../../package.json"
69+
"graphql": "catalog:"
7570
}
7671
}

0 commit comments

Comments
 (0)