GithubHelp home page GithubHelp logo

prismic-cli's Introduction

prismic-cli

Command line tool to bootstrap Prismic projects.

oclif Version Downloads/week License

Usage

$ npm install -g prismic-cli
$ prismic COMMAND
running command...
$ prismic (-v|--version|version)
prismic-cli/4.2.3 darwin-x64 node-v18.0.0
$ prismic --help [COMMAND]
USAGE
  $ prismic COMMAND
...

Commands

prismic help [COMMAND]

display help for prismic

USAGE
  $ prismic help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

prismic list

List all the available project template generators.

USAGE
  $ prismic list

OPTIONS
  -h, --help  show CLI help

See code: src/commands/list.ts

prismic login

Log in to Prismic.

USAGE
  $ prismic login

OPTIONS
  -h, --help   show CLI help
  --port=port  [default: 5555] Port to start the local login server.

See code: src/commands/login.ts

prismic logout

Log out of Prismic.

USAGE
  $ prismic logout

OPTIONS
  -h, --help  show CLI help

See code: src/commands/logout.ts

prismic new

Create a project with a new Prismic repository.

USAGE
  $ prismic new

OPTIONS
  -d, --domain=domain      Name of the Prismic repository. For example: repo-name, becomes https://repo-name.prismic.io.
  -f, --folder=folder      Name of the project folder.
  -h, --help               show CLI help
  -t, --template=template  Prismic template for the project.
  --existing-repo          Connect to an existing Prismic repository.
  --force                  Overwrite local files.
  --skip-install           Prevent running install command after generating project.

See code: src/commands/new.ts

prismic signup

Create a Prismic account.

USAGE
  $ prismic signup

OPTIONS
  -h, --help   show CLI help
  --port=port  [default: 5555] Port to start the local login server.

See code: src/commands/signup.ts

prismic slicemachine

Slice Machine commands

USAGE
  $ prismic slicemachine

OPTIONS
  -d, --domain=domain    Prismic repo to create.
  -f, --folder=folder    Output directory.
  -h, --help             show CLI help
  --add-storybook        Add Storybook to a Slice Machine project.
  --bootstrap            Reconfigure a Slice Machine project.
  --create-slice         Add a Slice to a Slice Machine project.
  --develop              Run Slice Machine.
  --existing-repo        Connect to an existing Prismic repository when running --setup or --bootstrap
  --force                Overwrite local files.
  --framework=framework  framework to use, see list for options
  --library=library      Name of the Slice library.
  --list                 List local Slices.
  --setup                Setup Slice Machine in an already existing project.
  --skip-install         Prevent npm install from running.
  --sliceName=sliceName  Name of the Slice.

ALIASES
  $ prismic sm

See code: src/commands/slicemachine.ts

prismic theme [SOURCE]

Create a project from a ZIP file or a GitHub repository URL and a new Prismic repository.

USAGE
  $ prismic theme [SOURCE]

ARGUMENTS
  SOURCE  Path or URL to a ZIP file, or a GitHub repository for the theme.

OPTIONS
  -c, --conf=conf            [default: prismic-configuration.js] Path to Prismic configuration file.

  -d, --domain=domain        Name of the new Prismic repository. For example, repo-name becomes
                             https://repo-name.prismic.io.

  -f, --folder=folder        Name of the project folder.

  -h, --help                 show CLI help

  -t, --theme-url=theme-url  GitHub URL or path to the theme file.

  --customTypes=customTypes  [default: custom_types] Path to the Custom Types directory in the theme.

  --documents=documents      [default: documents] Path to the documents in the theme.

  --existing-repo            Connect to an existing Prismic repository.

  --force                    Overwrite local files.

  --skip-install             Prevent running install command after generating project.

See code: src/commands/theme.ts

prismic whoami

Shows the email of the current user.

USAGE
  $ prismic whoami

OPTIONS
  -h, --help  show CLI help

See code: src/commands/whoami.ts

Development

Running Locally

  • Clone this repository git clone https://github.com/prismic.io/prismic-cli
  • go to the root folder cd prismic-cli
  • install and/or link the dependencies with or yarn (uses workspaces)
  • Commands can be executed from the packages/prismic-cli/bin/run file i.e: ./bin/run --help

Testing

Run tests with npm test or yarn test The main testing libary used is @oclif/test the documentation on how to use the testing library can be found here https://github.com/oclif/fancy-test. Mocking/stubbing dependencies can be tricky due package versions for nested dependencies, and native modules being used else where.

Linting

eslint is automatically run after the test script, but it can also be invoked by running npm run posttest or yarn posttest, optionally with a --fix flag.

Deployment

lerna is used for managing versions and publishing. update versions with lerna version [semantic-version] --exact Publish with lerna publish [--dist-tag alpha]

Built With

prismic-cli's People

Contributors

angeloashmore avatar arnaudlewis avatar debiasio avatar dependabot[bot] avatar erwan avatar evolve2k avatar gholgot avatar heyrows avatar hypervillain avatar lihbr avatar marcmcintosh avatar phillysnow avatar pvpg avatar raph22 avatar samuelhorn avatar srenault avatar veloce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prismic-cli's Issues

[RFC] Ask for login again when token expires

Version

  • Prismic CLI version (know it by running prismic --version): 3.8.0-beta.0

Reproduction

  1. Login with the CLI
  2. Let the token expire (with time?)
  3. Attempt a command that requires you to be logged in

What is expected?

It'll be nice for the CLI to understand 401 responses as "your token expired, please login again", ask for credentials then try to perform again the previous request in order to not break the flow.

What is actually happening?

401 responses are thrown:

image

Any additional information

Seems to happen to me more on Windows than on Mac ๐Ÿค”

`prismic init` prompts to name a repository

prismic init prompts the user to name a repository, suggesting that it's creating a new repo. If the user enters a name for a new repo, it throws an error. The prompt should say something like, "Enter the name of the Prismic repo you would like to use."
Screen Shot 2021-01-14 at 1 51 39 PM

Question - How to practice configuration as code with prismic?

Hello,
we switched from Ghost to Prismic to be more flexible. I didn't expect that there is no way to import data except the manual import on the medium plan. For me, this is a deal-breaker because I can't migrate schema updates or store the schema as code next to my application code. In the past, I used contentful and commercetools. They both provided at least a CLI to do that. Some even shipped terraform support https://github.com/labd/terraform-provider-commercetools.

According to https://prismic.io/docs/technologies/does-prismic-have-a-write-api there isn't a write API. This also blocks innovations from the community. What's the long term vision of prismic here? Thank you!

Related #11

Module not found: Can't resolve 'prismic.io'

in Preview.js when using the React template.

Changing import Prismic from 'prismic.io'; to import Prismic from 'prismic-react'; fixed the issue, but I've not been able to find where exactly this import comes from.

CLI fails to refresh token, not throwing on repository creation fail

Version

  • Prismic CLI version (know it by running prismic --version): 3.8.3-beta.0

Reproduction

  1. Login with the CLI: $ prismic login
  2. Create a new repo: $ prismic new
  3. Create a second repo: $ prismic new

What is expected?

Both repositories should be created.

What is actually happening?

Only the first repository is created and the CLI does not throw when 2nd repository creation fails.

It also happens with other commands in charge of creating a repository: $ prismic sm --setup, $ prismic sm --bootstrap, etc.

Any additional information

@arnaudlewis you mentioned one day that there's a need to refresh a token now, could it be something linked to that? Since there are two authentication methods now: https://github.com/prismicio/prismic-cli/blob/mm/meta-2020/lib/commands/repository.js#L55-L59

How to login to prismic-cli via GitHub account?

I recently signed up for an account on prismic.io via my GitHub account.

After running prismic login I am getting stuck at the requested password step as I never created a password since I am using the GitHub oAuth.

I am usingprismic-cli: 3.8.13.

Cannot login or initialize new projects

Hello,

I'm trying to start a new project using a theme, for example:
prismic theme https://github.com/prismicio/nextjs-blog

First of all, it does not detect the theme I entered. It asks:
URL of your theme (zip/github):

Fine, I manually enter it.

Then I get to the login step, asks me for my password. I enter it and submit, and I get the following error:

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: Cannot read property 'split' of undefined
    at /usr/local/lib/node_modules/prismic-cli/bin/services/communication/index.js:42:42
    at post (/usr/local/lib/node_modules/prismic-cli/bin/services/communication/index.js:48:4)
    at Object.postForm (/usr/local/lib/node_modules/prismic-cli/bin/services/communication/index.js:90:12)
    at /usr/local/lib/node_modules/prismic-cli/bin/commands/login.js:55:40
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is Prismic CLI deprecated or not the recommended way to setup Prismic? If so, please guide me in the right direction.

I'm using NodeJS v12.17.0, Prismic-CLI 3.7.9.

Unable to login

im currently trying to initialise a new prismic project and integrating it with my next js app. when running the following command

npx @slicemachine/init --repository tridentlabs && npm run slicemachine
i am shown this error
Screenshot 2022-09-14 at 11 55 58

a similar thing happens when trying to login

im using this version:
Screenshot 2022-09-14 at 11 56 55

Unable to check if repository exists

I created prismic repo and tried to go next, but your cli tool can't create anything. What I do wrong?

$ prismic init alendorffs-test
Let's get to it!
Unable to check if alendorffs-test exists.
Either the repository doesn't exists or you don't have access to it.
? Name your prismic repository:  alendorffs-test
Unable to check if alendorffs-test exists.
Either the repository doesn't exists or you don't have access to it.

[RFC] Error message to alert users that they need to be on Slicemachine cluster

When running commands like --create-slice or --pull you will receive a 404 error, it would be more helpful if this error message indicated that you were not on a Slicemachine group and could request to be moved, here on the forum.

Forum threads of users experiencing this:
https://community.prismic.io/t/error-when-creating-a-slice-through-de-command-line-in-a-nuxt-project/2323
https://community.prismic.io/t/404ing-on-prismic-sm-pull-customtypes-endpoint/1726

prismic-cli fails to login inside a docker container

I usually work in a dockerized development environment and, it seems it's not possible to make prismic-cli working inside a nodejs docker container.

The problem seems that it fails to open the browser (for obvious reasons, since containers cannot open dialogs of the host). I get this error:

Prismic: Press any key to open up the browser to login or q to exit: 
Opening browser to https://prismic.io/dashboard/cli/login?port=5555
Prismic: Logging in... done
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [ 'https://prismic.io/dashboard/cli/login?port=5555' ]
}

Are you going to make this tool compatible with dockerized environments?
Instead of opening the browser, it could ask the developer to click the link. I don't know if that would be enough, but at least the CLI login won't fail before attempting to login. After that I guess I need to expose port 5555 ?

Without this I cannot make slicemachine work unless it's installed in the host, which I'd rather avoid.

I tried using a text-based browser, like proposed here, but it does not work.

Could not resolve https://github.com/prismicio/vuejs-blog.git/archive/main.zip

Following the Run the theme command step from the docs, I see the following error:

$ npx prismic-cli theme --theme-url https://github.com/prismicio/vuejs-blog.git --conf public/index.html
Need to install the following packages:
  prismic-cli
Ok to proceed? (y) y
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
Prismic: Press any key to open up the browser to login or q to exit: 
Opening browser to https://prismic.io/dashboard/cli/login?port=5555
Prismic: Logging in... Logged in as [email protected]
? Name your prismic repository:  https://blog-demo2.prismic.io
project folder [blog-demo2]: 
    Error: Could not resolve 
    https://github.com/prismicio/vuejs-blog.git/archive/main.zip or 
    https://github.com/prismicio/vuejs-blog.git/archive/master.zip

SliceMachine 'next steps' links 404

Version

3.8.7

Reproduction

Bring prismic sm --setup to completion.
You are then presented this screen:
image

What is expected?

That the links in this section take me to live documentation so I can continue to build my SliceMachine site.

What is actually happening?

Some of the links 404.

When you complete the SliceMachine setup you are given "Next Steps" which comes from this file:
https://github.com/prismicio/prismic-cli/blob/34b6b4b0c04be2041186b28d027e4033ccc95be3/lib/commands/slicemachine/misc/recap.mustache

These links need to be updated to account for the migration from docs living on slicemachine.dev.

const vars = {
quickStartDocsUrl: 'https://slicemachine.dev/documentation/getting-started',
addSlicesDocsUrl: 'https://slicemachine.dev/documentation/creating-your-own-components-slices',
createSliceCommand: '$> npx prismic-cli sm --create-slice',
writingRoomUrl: info.apiEndpoint ? `${info.apiEndpoint.split('/api')[0].replace('cdn.', '')}/documents` : 'https://prismic.io/dahboard',
sliceZoneReadmeUrl: 'https://slicemachine.dev/documentation/slicezone',
communityForumUrl: 'https://community.prismic.io',
};

We can't just swap out the links for updated ones, because it seems there is no generic "Add Slice Zone" doc anymore.
image

It's either a Nuxt or a Next Slice Zone link, so the CLI needs to either link to both, or conditionally show one or the other.

Commands fail due to wrong path

Starting completely anew with Prismic, on a Windows 10 machine. Trying to run this example: https://prismic.io/docs/technologies/configure-your-project-nextjs

When I run this specific command:
prismic theme --theme-url https://github.com/prismicio-community/slice-library-starter-next --conf sm.json

I get this error: Error: ENOENT: no such file or directory, scandir 'C:\Users\jacob\AppData\Roaming\nvm\v17.0.1\node_modules\prismic-cli\node_modules\generator-prismic-angular2\lib\generators'

It's not surprising; when I navigate to 'C:\Users\jacob\AppData\Roaming\nvm\v17.0.1\node_modules\prismic-cli\node_modules\generator-prismic-angular2\, I see that the generators folder is directly in this folder, not in an intermediate lib folder.

Same results when running prismic list.

I've also tried running this in a WSL2 Ubuntu environment to see if Windows was the culprit. Same issue.

[bug] `--no-prismic` flag disappeared with v4

v3 of the CLI included a --no-prismic flag to skip repo creation with prismic sm --setup. It looks like that flag is gone now, and it looks like some users are still trying to use it but getting an error:

image

Update repo-name anywhere

For some technologies we can't create a theme as they don't use the necessary prismic-configuration.js file. Can we update the cli to search all documents for the 'apiendpoint' to update it?

Prismic CLI does not work under WSL2

Just a reminder that the Prismic login feature doesn't work under WSL2.

Preparation

$ sudo npm install -g prismic-cli
...

Any browser would likely do:

$ sudo apt install firefox
...

Steps

$ prismic login
Prismic: Press any key to open up the browser to login or q to exit:
Opening browser to https://prismic.io/dashboard/cli/login?port=5555
Prismic: Logging in... done
node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
          ^

Error: spawn EIO
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:761:9)
    at Object.open (/usr/lib/node_modules/prismic-cli/node_modules/cli-ux/lib/open.js:64:29)
    at /usr/lib/node_modules/prismic-cli/lib/utils/server.js:77:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -5,
  code: 'EIO',
  syscall: 'spawn'
}

Node.js v20.12.2

The error message doesn't really reveal much. Spawning fails, but why?

Expected

Since I am running Linux, and there is a browser, I can log in to my Prismic account, in order to do development.

Actual

The command fails.

Note: If you try the same with sudo, the error message is different - but weirder.

 syscall: 'spawn cmd.exe',
 path: 'cmd.exe',
 spawnargs: [
   '/c',
   'start',
   '""',
   '/b',
   'https://prismic.io/dashboard/cli/login?port=5555'
 ]

I would really like to give Prismic a go, but since it's not compatible with either WSL or a headless Linux sandbox, I might need to pass.

Versions

$ uname -a
Linux [...]5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux`
$ node --version
v20.12.2
$ npm --version
10.5.2

error when running prismic sm --setup with npm

I was running Node 15 which comes with npm version 7. Npm version 7 has changed the way that it handles peer dependency checks and failed to install most of the slice machine lnstall.
Once I figured out the issue was from the changes to npm I downgraded to node 14 and npm 6 and was able to get the prismic sm โ€”setup to work for me. I submitted a pr to the libraries that seemed to be failing the dependency checks to update the versions allowed in the package.json. If there is a way to update the docs I would be happy to add info about the issues with node 15/npm 7 to them.
Related:
#77
prismicio/slice-machine#77
prismicio/slice-machine@c527a24

https://community.prismic.io/t/prismic-sm-setup-error/3515 forum link

Registry configuration is being overwritten

Tracking down an issue we have been having relating to using Prismic behind a JFrog AF instance. The issue we had was that the package always tries to use the npmjs registry to look for newer available versions. Since this url is blocked by our network, that was always causing an issue.

A fix was implemented as part of 21e05bb which added libnpmconfig to source the registry from the config, but it looks like the package is not functioning correctly as the following line will ALWAYS override the config with the 'default' registry.

const config = libnpmconfig.read({ registry: 'https://registry.npmjs.org/' });

The next hurdle we had to overcome was authenticating with the private registry. Typical authentication uses a config variable named _auth to store a token applied to the Authorization header using Basic auth. To overcome this, I had to make the following modifications.

var token = '<PUT YOUR TOKEN HERE>';

return (0, _nodeFetch["default"])(addr.toString(), {
  headers: {
    Accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
    'Accept-Encoding': 'gzip,deflate',
    Authorization: 'Basic ' + token,
    'Content-Type': 'application/json',
    'Connection': 'keep-alive',
  }
}).then(function (res) {
  console.log("Successfully fetched".concat(packageName, " from ").concat(addr));
  return res.json();
}).catch(function (err) {
  console.error("Failed to fetch ".concat(packageName, " from ").concat(addr));
  throw err;
});

EDIT: One last thing to mention, I also had to update the strategy for specifying the URL of the package. JFrog AF registries have a trailing path name to specify the virtual before the package name, so updating the pathname directly was causing issue. This was my workaround:

var addr = new URL(config.registry.concat(packageName));

Obviously this is specific to my use case, and does not source the _auth token from the config (libnpmconfig does not return it).

Any chance we could get these fixes worked appropriately and implemented? This issue is directly related to the community post at https://community.prismic.io/t/cannot-login-to-prismic-cli/4830.

[Alpha] "Invalid content signature" error on theme

In the alpha, I was getting this error:

Sams-MBP:2021 samlittlefair$ prismic theme --theme-url https://github.com/prismicio/nextjs-blog --conf prismic-configuration.js
Email: [email protected]
Password: ******
Successfully logged in to https://prismic.io
? Name your prismic repository:  https://sam-210714-next-fl.prismic.io
project folder [sam-210714-next-fl]:
Downloading starter project... Download complete
? package manager npm
creating prismic repository... Invalid content signature for your theme.
Email: [email protected]
Password: ******
creating prismic repository... Invalid content signature for your theme.
Email: [email protected]
Password: ******
creating prismic repository... Invalid content signature for your theme.
Email: ^C

I switched to @latest and the theme command worked fine.

[RFC] Dynamically update slice function name in generate template.

It would be nice that when a new Slice template in Next.js is created, that the Slice function name is also update from MySlice to what ever name was entered in the CLI prompt:
https://github.com/prismicio/prismic-cli/blob/master/lib/commands/slicemachine/templates/next/index.js

The same could be said for the Nuxt.js template to have the field name: 'SliceName' added to the script section of the component as well:
https://github.com/prismicio/prismic-cli/blob/master/lib/commands/slicemachine/templates/nuxt/index.vue

Default Route Resolver causes bugs with `prismic sm --setup --no-prismic`

Users can run prismic sm --setup --no-prismic to build out a project. In Nuxt, the command adds a Route Resolver to nuxt.config.js. However, the Route Resolver references custom types that don't necessarily exist. So, when the user makes a query, they get an error. It would be good if --no-prismic didn't create a Route Resolver.

Error: Cannot find module 'next-transpile-modules'

Following the documentation, but encountering the same error on multiple attempts.

Encounter this hang during installation:

~/Code/prismic-slicemachine-2 ๎‚ฐ prismic sm --setup
โœ” Downloading files from server
โ ‹ Installing dependencies
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.13.1" from [email protected]
npm ERR! node_modules/next-slicezone
npm ERR!   next-slicezone@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/daz/.npm/eresolve-report.txt for a full report.

Eventually passes, however attempting to run the project produces:

~/Code/prismic-slicemachine-2 ๎‚ฐ npm run dev                               

> [email protected] dev
> next dev

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Error: Cannot find module 'next-transpile-modules'
Require stack:
- /Users/daz/Code/prismic-slicemachine-2/next.config.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/config.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/next-server.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/next.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/lib/start-server.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/cli/next-dev.js
- /Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/daz/Code/prismic-slicemachine-2/next.config.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at loadConfig (/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/config.js:8:94)
    at new Server (/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/next-server.js:1:4533)
    at new DevServer (/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/next-dev-server.js:1:2964)
    at createServer (/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/next.js:2:607)
    at start (/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/lib/start-server.js:1:323) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/daz/Code/prismic-slicemachine-2/next.config.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/config.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/next-server/server/next-server.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/next.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/server/lib/start-server.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/cli/next-dev.js',
    '/Users/daz/Code/prismic-slicemachine-2/node_modules/next/dist/bin/next'
  ]
}
npm ERR! code 1
npm ERR! path /Users/daz/Code/prismic-slicemachine-2
npm ERR! command failed
npm ERR! command sh -c next dev

Manually installing with npm install next-transpile-modules doesn't resolve the issue.

Appreciate any support in unblocking.

Update custom-type schema from CLI

Feature Request

Currently, we are able to create an entirely new repository with the prismic theme command, using a custom_types/index.json file as the custom-types schema. In order to source-control your schema there needs to be a workflow to programmatically update an existing schema.

Something along the lines of:

prismic theme --update http://foo.bar

Benefits:

  • Ability to source-control our schema.
  • Ability to update 'dev' or 'staging' repos and immediately push to the 'production' repo once we're satisfied with changes.

Support for oauth authentication

Hi!

Been trying to use prismic-cli on our cluster with OAuth, but the login step does not work.
Looks like the /authentication/signin?email=..&password=... does not work with oauth.

As oauth servers can have different login strategies (we use login + password + one time code) it may be best to have the access_token directly sent to the /authentication/signin endpoint.

Of course the access_token should be validated. Most oauth2 systems generate JWT tokens that can be validated using a simple public key.

I would be happy to help testing it!

Thanks!

Syncing custom_types and slices from the CLI

As I wanted to have my types managed in code (and only in code), I hacked together a sync command in a fork. The code is not that good. I didn't feel like spending time on refactoring properly after getting it to work (as I desired at the moment of writing). I can imagine Prismic has their own views of how to add these type of functionality. This fork will hopefully become redundant.

I added these sync methods as the API and Prismic CLI were capable already. Besides, it didn't take to long to implement ๐Ÿ˜„ I am hoping for a clean out of the box way of Prismic to offer this functionality. Feel free to use this fork as you desire.

I would not recommend using this fork in production. I worked with very little insights and just copied what was already implemented in one of prismic's it's repo's and adjusted it to make it work (slice-machine-ui, prismic-cli).

For demoing purposes only. I'm not responsible if you destroy your production environment or any other environment: https://github.com/Bram-Zijp/prismic-cli/pull/1

prismic sm --setup failed on src directory

As you may know, Next.js now support the src/ directory structure to heberge all the other sources and mainly : pages/
@see https://nextjs.org/docs/advanced-features/src-directory
In this situation (where the page folder is in fact located inside src/pages/) the sm --setup command will fail with the following message :

 ERROR  ENOENT: no such file or directory, open 'pages/_app.js'                                               18:22:49

  at Object.openSync (fs.js:476:3)
  at Object.writeFileSync (fs.js:1467:35)
  at Object.write (/home/zipang/.config/yarn/global/node_modules/prismic-cli/bin/common/utils/files.js:26:20)
  at /home/zipang/.config/yarn/global/node_modules/prismic-cli/bin/commands/slicemachine/commands/setup.js:105:18
  at Array.forEach (<anonymous>)
  at createFiles (/home/zipang/.config/yarn/global/node_modules/prismic-cli/bin/commands/slicemachine/commands/setup.js:100:9)
  at _callee3$ (/home/zipang/.config/yarn/global/node_modules/prismic-cli/bin/commands/slicemachine/commands/setup.js:283:13)
  at tryCatch (/home/zipang/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:63:40)
  at Generator.invoke [as _invoke] (/home/zipang/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:293:22)
  at Generator.next (/home/zipang/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:118:21)

`prismic theme` with content, doesn't work for SM repos

When trying to creating a prismic repo with pre-generated content from a documents folder, none of the Shared Slices from Slice Machine are added to the custom types, and therefore the documents can't add the data to these non-existing Slices.

The custom types editor for these custom types using shared slices also breaks.

[RFC] Add 'whoami' command

We have a prismic login and prismic logout, but no way to tell what my current user is. In order to make sure I'm on the right account before I start running Prismic commands I need to logout and log back in.

So something like prismic whoami that would return either the current user's email address or a "you are not logged in" response.

[[email protected] & [email protected]] Error: Cannot find module '../common/Frameworks'

Any command throws the following error.

internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '../common/Frameworks'
Require stack:
- /home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/commands/pull.js
- /home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/commands/index.js
- /home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/index.js
- /home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/index.js
- /home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/prismic.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/commands/pull.js:57:42)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/commands/pull.js',
    '/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/commands/index.js',
    '/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/slicemachine/index.js',
    '/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/commands/index.js',
    '/home/tobimori/.nvm/versions/node/v12.17.0/lib/node_modules/prismic-cli/bin/prismic.js'
  ]
}

Cannot login

Hi.
There is a "Nuxt.js Sample multi-page website with navigation" sample on your website that I'm trying to follow. Unfortunately, running
prismic theme https://github.com/prismicio/nuxtjs-website.git --conf prismic.config.js,
I couldn't pass the account login step. No error displayed, just always back to asking my username and password again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.