-
Notifications
You must be signed in to change notification settings - Fork 5
WIP: (refactor): Templates management and workflows #6
Conversation
Added authToken instead of session token
add package manager detection
fix suggestions
package.json
Outdated
@@ -6,33 +6,34 @@ | |||
"repository": "[email protected]:webstudio-is/webstudio-cli.git", | |||
"homepage": "https://webstudio.is", | |||
"scripts": { | |||
"dev": "pnpm build --watch", | |||
"prebuild": "tsx ./lib/prebuild.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the prebuild
script is needed for building the project. But this way, this is going to go as a project script instead of running inside users project. So, this need to be run as a build step inside users project folder.
package.json
Outdated
"format": "prettier --write \"**/*.{ts,tsx,md}\"", | ||
"build": "pnpm format && pnpm clean && esbuild ./src/* --outdir=./lib --platform=node", | ||
"clean": "rm -fr ./lib" | ||
}, | ||
"type": "module", | ||
"bin": { | ||
"webstudio": "./bin/cli.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bin/cli.js
is enough, the cli don't need to have .sh
script
@@ -1,4 +1,4 @@ | |||
#!/usr/bin/env node | |||
#!/usr/bin/env node --experimental-specifier-resolution=node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cli
is written in ecam modules. And they are being disctributed without any build step. But after node@18
node needs .js
extension to resolve any file. Because they introduced support for .mjs
extension. This works fine when the project is not using any deps. But in this case we have many dependencies for the cli which don't use .js
. This flag let's the node that it can resolve them without using .js
extension.
@@ -0,0 +1,84 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use __generated__
folder like we do in the builder repo
@@ -1,51 +1,39 @@ | |||
import { loadProject } from "@webstudio-is/http-client"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it being removed? the idea is that http-client is ALWAYS used to access the API from both: saas deployment and CLI ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue, got this from my upstream branch
Having this repo out of main repo would cause same issues we permanently have in SaaS repo. So the plan is to move the cli into the main monorepo under the I see move steps like.
|
please use node native |
@TrySound and @istarkov right now the cli is using the same from |
ah, good. keep it |
Just to inform: we decided this PR can't be merged and we will rewrite this PR in small chunks as part of the builder monorepo package. One PR at a time Follow progress here https://github.com/webstudio-is/webstudio-builder/pulls?q=is%3Apr+label%3Aarea%3Acli+ |
## Description This PR moves the cli from `apps/cli` into `packages` folder. It was initially started under `app/cli` from this [comment](webstudio-is/webstudio-cli#6 (comment)). But looks like, `packages` is the good place for it.
closes #5
Now, the cli has three commands,
sync
,link
,build
. Here is the workflow that this aims to solve.Creating a new project
webstudio link <url>
links the project and adds to the global configuration.webstudio build <projectId> clone the project locally by creating a folder
webstudio-projectand then saves the project data as
webstudio.json` inside the project.Managing the existing project
link
steps is not needed anymore.webstudio sync
inside the project. If the users want to decide to just sync the data.webstudio buil
builds the project once again. The above stepwebstudio sync
is not mandatory. Since during thewebstudio build
command the cli sync's the project anyways with the latest data.TODO:
executeComputingExpressions
is needed forInstace
component. But currently we are not sending it now. Need to see why it is needed.