-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Include TypeScript .d.ts file with the npm package #128
Comments
It will be possible when #68 is merged. |
I tried rebasing it myself as the only conflict was the README.md but I could not get it to work easily. The example imports are also referring to It seems to me the developer is not planning to rebase the PR as the PR seems to have evolved into a forked tool: https://github.com/watermarkchurch/migration-cli |
Hey @ristomatti, Best, |
@Khaledgarbaya Thanks! I'll give it a shot when I get the chance. I'm currently using Contentful within a customer project so probing around with new tools needs to be when things aren't that busy. |
I believe I got this working on a custom project directory using Maybe a more future proof documentation would mention the TypeScript migration scripts would first need to be transpiled to JavaScript? |
Hey @ristomatti That sounds promising can you share the project somewhere and I will try to have an example based on that in the docs |
Sorry it's not in a state to be shared, I just experimented with using a tsconfig.json, type annotated JavaScript files etc. I decided to leave the experimentation for now until the typings are part of the npm package. I'm designing/creating a migration script development workflow and deployment that will be used by multiple developers already and I doubt the PR will be merged before I'm done. It's not an option in this case to use a forked branch. The most important goal is to find the Contentful tool/library for the purpose that would most likely be supported in the future. |
@Khaledgarbaya I ended up doing some more testing on this today after all. What I did was just take the The typings seem to not cover everything though. To get no errors from the script I had exported from our production system I had to add to export interface ContentType {
/** Change field editor interface. */
changeEditorInterface(fieldId: string, widgetId: string, settings: Object): void
} and change export interface IValidation {
/** Takes an array of values and validates that the field value is in this array. */
in?: string[] | number[],
} |
Hey @ristomatti, Best, |
Where are we at with this? I'm looking to start using this tool and Typescript would be great! |
I've been using the typings file in a project using ts-node and It works great! The repo is unfortunately private so I cannot link to it. I have though done some more additions/improvements on the typings file after testing it with a migration script dump from an existing system. I can create a pull request once this is merged. |
Hey @ristomatti @joshmedeski, |
Ok, so I followed the updated README:
But I'm getting the base content when you type
And the following error at the bottom:
It seems like the contentful-migration script isn't taking the arguments. |
@joshmedeski I'm not at the computer right now but try adding -- before the -s parameter. We're using this with the "use as a library" method. I have created a .ts file which imports the cli module similarly as in the JavaScript example. The parameter handling is done by the script though. I'm pretty sure though I did the initial test with the command from the new documentation though... @Khaledgarbaya I noticed the changes being applied through commits today. I'll try to find time tomorrow to do a PR on the improvements on the typings file. |
Hey @ristomatti, |
@Khaledgarbaya it seems all but one of the changes I've done have been added there meanwhile. I don't bother making a PR from that. The only change missing was adding export interface IValidation {
in?: string[] | number[], |
Expected Behavior
As the project is written in TypeScript, I would expect it to also allow using the tool with it's typings and to benefit from the defined types when writing migration scripts.
Actual Behavior
The npm package includes only the transpiled code so no types are available.
Possible Solution
Create a separate
.d.ts
file for the API calls used in the documentation and include it in the npm package.The text was updated successfully, but these errors were encountered: