Can I create an ionic v4 project with the latest CLI

I would like to replicate an ionic 4 project without most of the dependencies to do some tests. So I need to create a blank Ionic 4 project with @ionic/angular v4.11.8.

How can I do this with the latest ionic CLI, or any other version?

By manually editing package.json once the project has been spawned.

@rapropos, here are my concerns about that solution :
Even if I follow my existing project’s package.json, I wouldn’t end up with all the generated files the same way they were generated for an Ionic v4 project.
Would that not matter?

Pushing the question further (not my exact use case) : the current Ionic CLi generates an Angular 8 project while I might need an Ionic 4 project with Angular 7.

I don’t believe “the way they were generated for an Ionic v4 project” is as static of a thing as you apparently do. Node dependencies are a quite complex snarl of many moving targets, so…

You can edit package.json to pin whatever version of dependencies you desire. Agreed, it’s going to be some work to get a set that’s all internally compatible from scratch, but I thought from your OP that you had some sort of archetypal project you were trying to “replicate”, so you could use that package.json as a reference.

1 Like

@sebastienguillon1 you are misunderstanding the purpose of framework versions.

You can’t start a new project with v4 because it’s not the stable release version.
You should update your projects deps to use the latest versions of packages.

@mhartington
Here is the long version:

I have a project (not all done by me, by a team) with Authentication, somewhat complex routing and a lot of native code (Capacitor project).

I wanted to test some basic Angular components using animations and the Ionic 4 Gestures which are available in our Ionic v4 project.

To do that I thought it would be much quicker to work in a lightweight Ionic project, but I also wanted to make sure I’m not using Ionic 5 Gestures or Anything different from our project.

So as I understand from @rapropos 's answer, I need to create a new project with the current CLI and update all the relevant dependencies from the package.json.

You don’t understand. Ionic 4 didnt expose the gesture API, so you can’t really use it.
In V5, the gesture API is the same as V4, just publicly exposed.

@mhartington
I might be missing something, but this works fine :

import { createGesture, Gesture, GestureDetail } from '@ionic/core';

...


const bannerGesture: Gesture = createGesture({
    el: this.bannerRef.nativeElement,
    disableScroll: true,
    direction: 'y',
    gesturePriority: 10,
    threshold: 1,
    gestureName: 'banner-gesture',
    onMove: this.onGestureMoveHandler.bind(this),
});
bannerGesture.setDisabled(false);

Using @ionic/angular@4.11.8