consentify-migrate 1.0.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +104 -63
  2. package/dist/index.js +15733 -14517
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # consentify-migrate
2
2
 
3
- Migrate from Cookiebot to [Consentify](https://consentify.app) in one command. The tool scans your codebase, removes Cookiebot scripts, detects your existing tracking integrations, sets up your domain on Consentify, and updates your files automatically.
3
+ Set up [Consentify](https://consentify.app) across your projects in one command. The tool detects your framework, removes whatever consent tool you have today (Cookiebot, OneTrust, CookieYes, Iubenda, Usercentrics, and many more, or nothing at all) along with any tracking scripts, detects your existing integrations, creates your domain on Consentify, wires the script into the right place, and commits the changes to git.
4
+
5
+ It works on a single project, or on a whole folder of client sites at once (bulk mode), which is built for agencies and teams managing many websites.
4
6
 
5
7
  ```bash
8
+ # Single project (run from the project root)
6
9
  npx consentify-migrate
10
+
11
+ # A whole folder of sites
12
+ npx consentify-migrate bulk ./clients
7
13
  ```
8
14
 
9
15
  No installation needed.
@@ -12,97 +18,131 @@ No installation needed.
12
18
 
13
19
  ## Before you start
14
20
 
15
- You need a free Consentify account. Create one at [consentify.app](https://consentify.app), it only takes a minute.
21
+ You need a Consentify account. Create one at [consentify.app](https://consentify.app). For bulk runs across many domains, make sure your plan has enough domain capacity.
16
22
 
17
23
  ---
18
24
 
19
- ## What it does
25
+ ## Single project mode
20
26
 
21
- Run the command from your project root and it will walk you through the following steps:
27
+ Run the command from your project root. It walks you through:
22
28
 
23
- **1. Detects your framework**
24
- Supports Next.js, React (CRA/Vite), and vanilla HTML.
29
+ 1. **Detects your framework** and the exact entry point to use for it.
30
+ 2. **Finds your existing consent tool and tracking scripts** in your source and removes them. It recognizes the common CMPs (Cookiebot, OneTrust, CookieYes, CookieFirst, Termly, Osano, Iubenda, Usercentrics, Didomi, TrustArc, Civic, Cookie Script, Klaro, Complianz, Borlabs, Quantcast, Sourcepoint, vanilla Cookie Consent). If the site has no CMP yet, it just sets Consentify up fresh. Trackers get re-injected by Consentify after consent.
31
+ 3. **Detects integrations** the same way the dashboard onboarding does: it runs Consentify's live GDPR scanner against your domain and picks up the tools we support (Google Analytics, GTM, Facebook Pixel, PostHog, TikTok, LinkedIn, Snapchat, HubSpot, Contentsquare, Intercom), including ones loaded through GTM. If the site isn't reachable, it falls back to scanning your source code. Paid integrations are only enabled if your plan includes them.
32
+ 4. **Finds your privacy policy** by looking for a policy route in the project (`privacy`, `privacy-policy`, `personvern`, `cookies`, and more, across languages), and uses `https://{domain}/{that-path}`.
33
+ 5. **Logs you in** to Consentify (credentials are used once and never stored).
34
+ 6. **Creates your domain** and configures the detected integrations via the API.
35
+ 7. **Injects the Consentify script** at the correct location for your framework.
36
+ 8. **Commits the change** to git (see git modes below).
25
37
 
26
- **2. Finds Cookiebot in your code**
27
- Scans all source files and reports exactly where Cookiebot references live.
38
+ Use `--no-scan` to skip the live scanner and rely on source-code detection only.
28
39
 
29
- **3. Detects your tracking integrations**
30
- Automatically finds Google Analytics, Google Tag Manager, Facebook Pixel, PostHog, TikTok Pixel, LinkedIn Insight Tag, Snapchat Pixel, HubSpot, Contentsquare, and Intercom — and extracts their IDs directly from your code.
40
+ ---
31
41
 
32
- **4. Logs you in to Consentify**
33
- You enter your email and password once. Your credentials are used only to authenticate and are never stored.
42
+ ## Bulk mode
34
43
 
35
- **5. Creates your domain on Consentify**
36
- Picks the right team, creates the domain, and configures your detected integrations automatically via the Consentify API.
44
+ Point the tool at a folder whose immediate subfolders are individual sites:
37
45
 
38
- **6. Updates your files**
39
- Removes Cookiebot script tags and inserts the Consentify script tag in the right place.
46
+ ```bash
47
+ npx consentify-migrate bulk ./clients
48
+ ```
40
49
 
41
- At the end you get your script tag and a link to the dashboard where you can customize your banner.
50
+ ```
51
+ clients/
52
+ acme.com/ → Next.js (App Router)
53
+ bergen-cafe/ → WordPress
54
+ nordic-shop.no/ → Vue
55
+ ...
56
+ ```
42
57
 
43
- ---
58
+ For each project it detects the framework, resolves the domain, scans for integrations, sets up Consentify, strips trackers, injects the script, and commits + pushes on a dedicated branch. Failures on one project never stop the rest of the batch. At the end you get a `consentify-migration-report.md` (and `.json`) in the folder with every domain, token, and anything that needs manual follow-up.
44
59
 
45
- ## Example output
60
+ Before it starts, the run checks your plan's domain capacity. If the folder has more sites than you have room for, it tells you up front and (with your confirmation) sets up as many as fit, rather than failing partway through. The rest are listed in the report as skipped for capacity.
46
61
 
47
- ```
48
- 🍪 Consentify Migration Tool
49
- ──────────────────────────────────────────────────
62
+ ### Resolving domains
50
63
 
51
- Detected Next.js project
64
+ Each site needs a domain. The tool resolves it in this order:
52
65
 
53
- Scanning for Cookiebot…
54
- • app/layout.tsx line 12
66
+ 1. **Manifest file** (recommended for large batches), matched by folder name.
67
+ 2. **Folder name**, if the folder is itself a domain (e.g. `acme.com`).
68
+ 3. **Git remote**, if the repo name is a domain.
69
+ 4. **Prompt**, for anything still unresolved (unless `--yes`).
55
70
 
56
- Detecting existing tracking integrations…
57
- • Google Analytics (G-ABC1234DEF)
58
- • Google Tag Manager (GTM-XXXXXX)
71
+ Manifest as CSV:
59
72
 
60
- ──────────────────────────────────────────────────
61
- Log in to Consentify
62
- ──────────────────────────────────────────────────
63
- ? Email: you@example.com
64
- ? Password: ••••••••
73
+ ```csv
74
+ folder,domain,policyUrl
75
+ acme-site,acme.com,https://acme.com/privacy
76
+ bergen-cafe,bergen-cafe.no,
77
+ ```
65
78
 
66
- Logged in as Your Name
67
- ✓ Using team: Acme Corp
79
+ or JSON:
68
80
 
69
- ? Your domain: example.com
70
- ? Privacy policy URL (optional):
81
+ ```json
82
+ { "acme-site": "acme.com", "bergen-cafe": "bergen-cafe.no" }
83
+ ```
71
84
 
72
- The following integrations will be configured on Consentify:
73
- Google Analytics: G-ABC1234DEF
74
- • Google Tag Manager: GTM-XXXXXX
85
+ ```bash
86
+ npx consentify-migrate bulk ./clients --manifest ./domains.csv --yes
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Git modes
75
92
 
76
- ? Configure these integrations automatically? Yes
93
+ By default every project is committed on a dedicated `consentify-setup` branch and pushed, so nothing lands on `main` without review. Only the files the tool changed are staged, so any pre-existing uncommitted work is left alone.
77
94
 
78
- ──────────────────────────────────────────────────
79
- Setting up Consentify…
80
- ──────────────────────────────────────────────────
81
- Domain example.com created
82
- Integrations configured: Google Analytics, Google Tag Manager
95
+ | Flag | Behavior |
96
+ | ---------------- | --------------------------------------------------------------- |
97
+ | `--git=branch` | Create `consentify-setup` branch, commit, push (default). |
98
+ | `--git=push` | Commit on the current branch and push. |
99
+ | `--git=commit` | Commit only, no push. |
100
+ | `--git=none` | Make file changes only, no git. |
83
101
 
84
- ──────────────────────────────────────────────────
85
- Updating files…
86
- ──────────────────────────────────────────────────
87
- ✓ app/layout.tsx | Removed Cookiebot, added Consentify <Script>
102
+ ---
103
+
104
+ ## Options
88
105
 
89
- Migration complete!
106
+ | Flag | Description |
107
+ | --------------------------- | ---------------------------------------------------------------- |
108
+ | `bulk [dir]` / `--all` | Bulk mode over a folder of projects (default dir: cwd). |
109
+ | `--manifest <file>` | CSV or JSON folder to domain mapping. |
110
+ | `--policy-pattern "<p>"` | Fallback privacy policy URL if none detected, `{domain}` substituted. |
111
+ | `--git=<mode>` | Git behavior (see above). |
112
+ | `--no-scan` | Skip the live scanner; detect integrations from source only. |
113
+ | `--dry-run` | Detect and report only. No API calls, file writes, or git. |
114
+ | `--yes` / `-y` | Skip confirmation prompts (requires resolvable domains). |
90
115
 
91
- Your Consentify script tag:
116
+ Example, non-interactive agency run:
92
117
 
93
- <script src="https://consentify.app/api/gateway?token=your-token"></script>
118
+ ```bash
119
+ npx consentify-migrate bulk ./clients \
120
+ --manifest ./domains.csv \
121
+ --policy-pattern "https://{domain}/personvern" \
122
+ --git=branch --yes
94
123
  ```
95
124
 
96
125
  ---
97
126
 
98
127
  ## Supported frameworks
99
128
 
100
- | Framework | Entry file(s) detected |
101
- | ---------------------- | ------------------------------ |
102
- | Next.js (App Router) | `app/layout.tsx` |
103
- | Next.js (Pages Router) | `pages/_document.tsx` |
104
- | React (CRA / Vite) | `public/index.html` |
105
- | Vanilla HTML | `index.html`, any `.html` file |
129
+ Each framework gets the script placed where it actually belongs, not just anywhere.
130
+
131
+ | Framework | Where the script goes |
132
+ | ---------------------- | ------------------------------------------------------- |
133
+ | Next.js (App Router) | Root layout `<body>` via `next/script` |
134
+ | Next.js (Pages Router) | `pages/_document` (created if missing) |
135
+ | React (CRA / Vite) | `index.html` before `</body>` |
136
+ | Vue | `index.html` before `</head>` |
137
+ | Nuxt | Generated client plugin using `useHead` |
138
+ | SvelteKit | `src/app.html` |
139
+ | Svelte (Vite) | `index.html` |
140
+ | Astro | Base layout `<head>` |
141
+ | Angular | `src/index.html` |
142
+ | WordPress | Theme `header.php` before `wp_head()` |
143
+ | Vanilla HTML | `index.html` before `</body>` |
144
+
145
+ Re-running is safe: if Consentify is already present in a project, it is skipped.
106
146
 
107
147
  ---
108
148
 
@@ -110,19 +150,20 @@ Your Consentify script tag:
110
150
 
111
151
  Google Analytics, Google Tag Manager, Facebook Pixel, PostHog, TikTok Pixel, LinkedIn Insight Tag, Snapchat Pixel, HubSpot, Contentsquare, Intercom.
112
152
 
113
- Integrations that are detected but whose ID could not be extracted automatically will be flagged with a note to configure them manually in the dashboard.
153
+ Integrations that are detected but whose ID could not be extracted are flagged in the report to configure manually in the dashboard.
114
154
 
115
155
  ---
116
156
 
117
157
  ## After the migration
118
158
 
119
- - Review the file changes in your editor before deploying
120
- - Customize your consent banner at [consentify.app/dashboard/banner](https://consentify.app/dashboard/banner)
121
- - Deploy your site and Consentify is live
159
+ - Review the branch and file changes before merging.
160
+ - Customize your banners at [consentify.app/dashboard/banner](https://consentify.app/dashboard/banner).
161
+ - Deploy and Consentify is live.
122
162
 
123
163
  ---
124
164
 
125
165
  ## Requirements
126
166
 
127
167
  - Node.js 18 or later
168
+ - Git (for commit/push modes)
128
169
  - A [Consentify account](https://consentify.app)