esm-styles 0.3.2 → 0.3.3
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/dist/watch.d.ts +2 -0
- package/dist/watch.js +24 -0
- package/package.json +1 -1
package/dist/watch.d.ts
ADDED
package/dist/watch.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import process from 'process';
|
|
5
|
+
const configPath = process.argv[2] || 'esm-styles.config.js';
|
|
6
|
+
const configModule = await import(path.isAbsolute(configPath)
|
|
7
|
+
? configPath
|
|
8
|
+
: path.resolve(process.cwd(), configPath));
|
|
9
|
+
const config = configModule.default;
|
|
10
|
+
const basePath = path.resolve(process.cwd(), config.basePath || '.');
|
|
11
|
+
const sourcePath = path.join(basePath, config.sourcePath || '');
|
|
12
|
+
const nodemonArgs = [
|
|
13
|
+
'--watch',
|
|
14
|
+
sourcePath,
|
|
15
|
+
'--ext',
|
|
16
|
+
'mjs',
|
|
17
|
+
'--ignore',
|
|
18
|
+
path.join(sourcePath, '$*.mjs'),
|
|
19
|
+
'--exec',
|
|
20
|
+
`node dist/build.js ${configPath}`,
|
|
21
|
+
];
|
|
22
|
+
console.log('[esm-styles] Running:', 'nodemon', ...nodemonArgs);
|
|
23
|
+
const nodemon = spawn('nodemon', nodemonArgs, { stdio: 'inherit' });
|
|
24
|
+
nodemon.on('exit', (code) => process.exit(code));
|