@clerk/dev-cli 0.0.9 → 0.0.10-canary.v20241206200145

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerk/dev-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10-canary.v20241206200145",
4
4
  "description": "CLI tool designed to simplify the process of iterating on packages within the clerk/javascript repository",
5
5
  "homepage": "https://clerk.com/",
6
6
  "bugs": {
@@ -113,6 +113,49 @@ async function mergeEnvFiles(filename, config) {
113
113
  );
114
114
  }
115
115
 
116
+ /**
117
+ * Checks if the current working directory contains a lockfile that can be imported with `pnpm import`
118
+ * @returns {boolean}
119
+ */
120
+ function hasSupportedLockfile() {
121
+ const SUPPORTED_LOCKFILES = ['package-lock.json', 'yarn.lock'];
122
+ for (const lockfile of SUPPORTED_LOCKFILES) {
123
+ if (existsSync(join(process.cwd(), lockfile))) {
124
+ return true;
125
+ }
126
+ }
127
+
128
+ return false;
129
+ }
130
+
131
+ /**
132
+ * Imports a compatible lockfile with `pnpm import` if present.
133
+ * @returns {Promise<void>}
134
+ */
135
+ async function importPackageLock() {
136
+ return new Promise((resolve, reject) => {
137
+ if (!hasSupportedLockfile()) {
138
+ resolve();
139
+ }
140
+ console.log('Supported non-pnpm lockfile detected, importing with `pnpm import`...');
141
+
142
+ const child = spawn('pnpm', ['import'], {
143
+ stdio: 'inherit',
144
+ env: {
145
+ ...process.env,
146
+ },
147
+ });
148
+
149
+ child.on('close', code => {
150
+ if (code !== 0) {
151
+ reject();
152
+ return;
153
+ }
154
+ resolve();
155
+ });
156
+ });
157
+ }
158
+
116
159
  /**
117
160
  * Installs the monorepo versions of the Clerk dependencies listed in the `package.json` file of the cwd.
118
161
  * @returns {Promise<void>}
@@ -128,15 +171,13 @@ async function linkDependencies() {
128
171
  .filter(dep => dep in clerkPackages)
129
172
  .map(clerkDep => clerkPackages[clerkDep]);
130
173
 
131
- const args = ['install', '--no-audit', '--no-fund', ...dependenciesToBeInstalled];
174
+ const args = ['add', ...dependenciesToBeInstalled];
132
175
 
133
176
  return new Promise((resolve, reject) => {
134
- const child = spawn('npm', args, {
177
+ const child = spawn('pnpm', args, {
135
178
  stdio: 'inherit',
136
179
  env: {
137
180
  ...process.env,
138
- ADBLOCK: '1',
139
- DISABLE_OPENCOLLECTIVE: '1',
140
181
  },
141
182
  });
142
183
 
@@ -160,6 +201,7 @@ async function linkDependencies() {
160
201
  export async function setup({ js = true, skipInstall = false }) {
161
202
  if (!skipInstall) {
162
203
  console.log('Installing monorepo versions of Clerk packages from package.json...');
204
+ await importPackageLock();
163
205
  await linkDependencies();
164
206
  }
165
207