@tobiastengler/create-relay-app
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
import { getPackageManger, inferPackageManager, } from "./misc/packageManagers/index.js"; | ||
import { GenerateArtifactDirectoryTask, GenerateRelayEnvironmentTask, GenerateGraphQlSchemaFileTask, TaskRunner, ConfigureRelayCompilerTask, Cra_AddBabelMacroTypeDefinitionsTask, InstallNpmDependenciesTask, InstallNpmDevDependenciesTask, Vite_ConfigureVitePluginRelayTask, Next_ConfigureNextCompilerTask, Cra_AddRelayEnvironmentProvider, Vite_AddRelayEnvironmentProvider, Next_AddRelayEnvironmentProvider, ConfigureEolOfArtifactsTask, HTTP_ENDPOINT, WEBSOCKET_ENDPOINT, } from "./tasks/index.js"; | ||
import { GenerateArtifactDirectoryTask, GenerateRelayEnvironmentTask, GenerateGraphQlSchemaFileTask, TaskRunner, ConfigureRelayCompilerTask, Cra_AddBabelMacroTypeDefinitionsTask, InstallNpmDependenciesTask, InstallNpmDevDependenciesTask, Next_ConfigureNextCompilerTask, Cra_AddRelayEnvironmentProvider, Vite_AddRelayEnvironmentProvider, Next_AddRelayEnvironmentProvider, ConfigureEolOfArtifactsTask, HTTP_ENDPOINT, WEBSOCKET_ENDPOINT, } from "./tasks/index.js"; | ||
import { headline, h, importantHeadline, printError } from "./utils/index.js"; | ||
@@ -117,3 +117,4 @@ import { ProjectContext } from "./misc/ProjectContext.js"; | ||
new Cra_AddRelayEnvironmentProvider(context), | ||
new Vite_ConfigureVitePluginRelayTask(context), | ||
// todo: re-add once vite-plugin-relay is fixed | ||
// new Vite_ConfigureVitePluginRelayTask(context), | ||
new Vite_AddRelayEnvironmentProvider(context), | ||
@@ -164,3 +165,3 @@ new Next_ConfigureNextCompilerTask(context), | ||
} | ||
// todo: remove once the vite-plugin-relay PR is merged | ||
// todo: remove once vite-plugin-relay is fixed | ||
if (context.is("vite")) { | ||
@@ -171,5 +172,7 @@ console.log(); | ||
// prettier-ignore | ||
console.log(`We currently depend on an experimental version of the ${h("vite-plugin-relay")}:`); | ||
console.log(`${h("vite-plugin-relay")} is not functional at the moment.`); | ||
// prettier-ignore | ||
console.log("https://github.com/oscartbeaumont/vite-plugin-relay/pull/424"); | ||
console.log(`You need to setup the Vite plugin yourself, by following this guide:`); | ||
// prettier-ignore | ||
console.log("https://github.com/tobias-tengler/create-relay-app/blob/main/docs/vite-plugin-setup.md"); | ||
} | ||
@@ -176,0 +179,0 @@ if (context.is("next")) { |
@@ -8,5 +8,4 @@ export const TS_CONFIG_FILE = "tsconfig.json"; | ||
export const GRAPHQL_WS_PACKAGE = "graphql-ws"; | ||
// todo: remove branch, once released | ||
export const VITE_RELAY_PACKAGE = "vite-plugin-relay@https://github.com/tobias-tengler/vite-plugin-relay#tte/fix-plugin"; | ||
export const VITE_RELAY_PACKAGE = "vite-plugin-relay"; | ||
export const RELAY_ENV_PROVIDER = "RelayEnvironmentProvider"; | ||
export const RELAY_ENV = "RelayEnvironment"; |
import { TaskBase } from "./TaskBase.js"; | ||
import { BABEL_RELAY_PACKAGE, VITE_RELAY_PACKAGE } from "../consts.js"; | ||
import { BABEL_RELAY_PACKAGE } from "../consts.js"; | ||
import { h } from "../utils/cli.js"; | ||
@@ -32,7 +32,8 @@ export class InstallNpmDevDependenciesTask extends TaskBase { | ||
} | ||
if (this.context.is("vite")) { | ||
relayDevDep.push(VITE_RELAY_PACKAGE); | ||
} | ||
// todo: re-add once vite-plugin-relay is fixed | ||
// if (this.context.is("vite")) { | ||
// relayDevDep.push(VITE_RELAY_PACKAGE); | ||
// } | ||
return relayDevDep; | ||
} | ||
} |
import traverse from "@babel/traverse"; | ||
import t from "@babel/types"; | ||
import { VITE_RELAY_PACKAGE } from "../../consts.js"; | ||
import { parseAst, insertDefaultImport, printAst } from "../../utils/ast.js"; | ||
@@ -10,4 +11,3 @@ import { h } from "../../utils/cli.js"; | ||
this.context = context; | ||
// todo: use VITE_PLUGIN_RELAY, once suffix is dropped | ||
this.message = `Configure ${h("vite-plugin-relay")}`; | ||
this.message = `Configure ${h(VITE_RELAY_PACKAGE)}`; | ||
} | ||
@@ -25,6 +25,3 @@ isEnabled() { | ||
ExportDefaultDeclaration: (path) => { | ||
const relayImportId = insertDefaultImport(path, "relay", | ||
// todo: replace with VITE_RELAY_PACKAGE, | ||
// once it no longer has the explict version | ||
"vite-plugin-relay"); | ||
const relayImportId = insertDefaultImport(path, "relay", VITE_RELAY_PACKAGE); | ||
const node = path.node; | ||
@@ -31,0 +28,0 @@ // Find export default defineConfig(???) |
{ | ||
"name": "@tobiastengler/create-relay-app", | ||
"version": "v0.0.5", | ||
"version": "v0.0.6", | ||
"description": "Easy configuration of Relay for existing projects", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/tobias-tengler/create-relay-app#readme", |
@@ -35,5 +35,5 @@ <h1 align="center" style="font-size: 30px;">create-relay-app</h1> | ||
1. Scaffold a new project using the toolchain of your choice (as long as [it's supported](#supported-toolchains)) | ||
- Next.js: `yarn create next-app --typescript` | ||
- Vite.js: `yarn create vite --template react-ts` | ||
- Create React App: `yarn create react-app <new-project-directory> --template typescript` | ||
- Next.js: `npm/yarn/pnpm create next-app --typescript` | ||
- Vite.js: `npm/yarn/pnpm create vite --template react-ts` | ||
- Create React App: `npm/yarn/pnpm create react-app <new-project-directory> --template typescript` | ||
2. If you are inside a Git repository, ensure your working directory is clean, by commiting or discarding any changes. | ||
@@ -46,6 +46,13 @@ 3. Run the script inside of the scaffolded directory: | ||
This will prompt you for a bunch of questions around your project setup. If you do not want to specify these options interactively, you can also specify them through the [CLI arguments](./docs/cli-arguments.md). Passing `-y` will [infer all arguments](./docs/default-values.md) based on your project. | ||
4. Follow the displayed _Next steps_ to complete the setup (You can also find them [here](./docs/steps-after-setup.md)) | ||
> Note: We are working on getting the `create-relay-app` name! | ||
## Documentation | ||
This will prompt you for a bunch of questions around your project setup. If you do not want to specify these options interactively, you can also specify them through the [CLI arguments](./docs/cli-arguments.md). Passing `-y` will [infer all arguments](./docs/default-values.md) based on your project. | ||
- [Available CLI arguments](./docs/cli-arguments.md) | ||
- [Learn how defaults for arguments are inferred](./docs/default-values.md) | ||
- [Manual steps after running the script](./docs/steps-after-setup.md) | ||
- [Setting up the Vite plugin for Vite 3](./docs/vite-plugin-setup.md) | ||
- [Server-side data fetching with Next.js](./docs/next-server-data-fetching.md) | ||
- [babel-plugin-relay in combination with Create-React-App](./docs/cra-babel-setup.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
81819
57