@clerk/dev-cli 0.0.4 → 0.0.5-canary.v0993f57
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/README.md +1 -8
- package/package.json +2 -1
- package/src/commands/watch.js +28 -46
package/README.md
CHANGED
|
@@ -74,14 +74,7 @@ clerk-dev watch
|
|
|
74
74
|
|
|
75
75
|
This will run the `build` task for any `@clerk/*` packages in the `package.json` of the current working directory, including any of their dependencies.
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
> On macOS, this command will automatically spawn a new Terminal.app window running the dev task for `clerk-js`. On other operating systems, you will need to run the following command in a new terminal:
|
|
79
|
-
>
|
|
80
|
-
> ```sh
|
|
81
|
-
> clerk-dev watch --js
|
|
82
|
-
> ```
|
|
83
|
-
|
|
84
|
-
If you do not want to spawn the watcher for `@clerk/clerk-js`, you can instead pass `--no-js`.
|
|
77
|
+
If you do not want to start the watcher for `@clerk/clerk-js`, you can instead pass `--no-js`.
|
|
85
78
|
|
|
86
79
|
```sh
|
|
87
80
|
clerk-dev watch --no-js
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerk/dev-cli",
|
|
3
3
|
"description": "CLI tool designed to simplify the process of iterating on packages within the clerk/javascript repository",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5-canary.v0993f57",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Clerk",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"commander": "^12.1.0",
|
|
29
|
+
"concurrently": "^8.2.2",
|
|
29
30
|
"dotenv": "^16.4.5",
|
|
30
31
|
"globby": "^14.0.2",
|
|
31
32
|
"jscodeshift": "^0.16.1"
|
package/src/commands/watch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import { join } from 'node:path';
|
|
3
2
|
|
|
3
|
+
import concurrently from 'concurrently';
|
|
4
|
+
|
|
4
5
|
import { getClerkPackages } from '../utils/getClerkPackages.js';
|
|
5
6
|
import { getDependencies } from '../utils/getDependencies.js';
|
|
6
7
|
import { getMonorepoRoot } from '../utils/getMonorepoRoot.js';
|
|
@@ -9,7 +10,7 @@ import { getMonorepoRoot } from '../utils/getMonorepoRoot.js';
|
|
|
9
10
|
* Starts long-running watchers for Clerk dependencies.
|
|
10
11
|
* @param {object} args
|
|
11
12
|
* @param {boolean | undefined} args.js If `true`, only spawn the builder for `@clerk/clerk-js`.
|
|
12
|
-
* @returns {Promise<
|
|
13
|
+
* @returns {Promise<import('concurrently').CloseEvent[]>}
|
|
13
14
|
*/
|
|
14
15
|
export async function watch({ js }) {
|
|
15
16
|
const { dependencies, devDependencies } = await getDependencies(join(process.cwd(), 'package.json'));
|
|
@@ -24,54 +25,35 @@ export async function watch({ js }) {
|
|
|
24
25
|
|
|
25
26
|
const cwd = await getMonorepoRoot();
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
/** @type {import('concurrently').ConcurrentlyCommandInput} */
|
|
29
|
+
const clerkJsCommand = {
|
|
30
|
+
name: 'clerk-js',
|
|
31
|
+
command: 'turbo run dev --filter=@clerk/clerk-js -- --env devOrigin=http://localhost:4000',
|
|
32
|
+
cwd,
|
|
33
|
+
env: { TURBO_UI: '0', ...process.env },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @type {import('concurrently').ConcurrentlyCommandInput} */
|
|
37
|
+
const packagesCommand = {
|
|
38
|
+
name: 'packages',
|
|
39
|
+
command: `turbo ${args.join(' ')}`,
|
|
40
|
+
cwd,
|
|
41
|
+
env: { TURBO_UI: '0', ...process.env },
|
|
42
|
+
};
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
resolve();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
44
|
+
if (js) {
|
|
45
|
+
//@ts-expect-error The TypeScript types for the ESM version of concurrently are wrong. https://github.com/open-cli-tools/concurrently/issues/494
|
|
46
|
+
const { result } = concurrently([clerkJsCommand], { prefixColors: 'auto' });
|
|
47
|
+
return result;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
/** @type {import('concurrently').ConcurrentlyCommandInput[]} */
|
|
51
|
+
const commands = [packagesCommand];
|
|
49
52
|
if (typeof js === 'undefined') {
|
|
50
|
-
|
|
51
|
-
// not declared as a dependency for any other packages, so Turborepo is unable to automatically start it.
|
|
52
|
-
if (process.platform === 'darwin') {
|
|
53
|
-
spawn('osascript', [
|
|
54
|
-
'-e',
|
|
55
|
-
`tell app "Terminal" to do script "cd ${cwd} && turbo run dev --filter=@clerk/clerk-js -- --env devOrigin=http://localhost:4000"`,
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
53
|
+
commands.push(clerkJsCommand);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
stdio: 'inherit',
|
|
64
|
-
env: {
|
|
65
|
-
...process.env,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
child.on('close', code => {
|
|
70
|
-
if (code !== 0) {
|
|
71
|
-
reject();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
resolve();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
56
|
+
//@ts-expect-error The TypeScript types for the ESM version of concurrently are wrong. https://github.com/open-cli-tools/concurrently/issues/494
|
|
57
|
+
const { result } = concurrently(commands, { prefixColors: 'auto' });
|
|
58
|
+
return result;
|
|
77
59
|
}
|