Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 7baaaf2

Browse files
authored
fix(dev-env/basic): building and running development (#1646)
1 parent d2ab7c3 commit 7baaaf2

File tree

5 files changed

+147
-294
lines changed

5 files changed

+147
-294
lines changed

core/docz-rollup/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"rollup-plugin-node-resolve": "^5.2.0",
2929
"rollup-plugin-peer-deps-external": "^2.2.0",
3030
"rollup-plugin-postcss": "^2.0.3",
31-
"rollup-plugin-progress": "^1.1.1",
31+
"rollup-plugin-progress": "^1.1.2",
3232
"rollup-plugin-typescript2": "^0.22.0"
3333
},
3434
"devDependencies": {

dev-env/basic/dev.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const watchPackage = async (name, outputDir) => {
4545
const destinationPath = getDestinationPath(name, outputDir)
4646
const sourceRootPath = path.join(rootPath, `core/${name}/`)
4747
const dev = runCommand(`yarn run dev`, { cwd: sourceRootPath })
48+
4849
try {
4950
await runCommand(`yarn run build`, { cwd: sourceRootPath })
5051
} catch (err) {
@@ -65,8 +66,7 @@ const watchPackage = async (name, outputDir) => {
6566
cpx.watch(`${sourcePath}/lib/**/*`, getDestinationPath(name, 'lib'))
6667
)
6768
} else {
68-
const sync = cpx.watch(`${sourcePath}/**/*`, destinationPath)
69-
fileWatchers.push(sync)
69+
fileWatchers.push(cpx.watch(`${sourcePath}/**/*`, destinationPath))
7070
}
7171

7272
const unsubscribers = fileWatchers.map(fileWatcher => {
@@ -81,12 +81,15 @@ const watchPackage = async (name, outputDir) => {
8181
}
8282
return stop
8383
})
84+
8485
const stop = () => {
8586
dev.cancel()
8687
unsubscribers.forEach(unsub => {
8788
unsub()
8889
})
8990
}
91+
92+
console.log('watching package: ', name)
9093
return stop
9194
}
9295

@@ -97,20 +100,21 @@ const main = async () => {
97100
for (let stopWatching of watchStoppers) {
98101
stopWatching()
99102
}
103+
100104
console.log(`\nTerminated ${watchStoppers.length} running processes\n`)
101105
process.exit(0)
102106
})
107+
103108
const build = runCommand(`yarn packages:build`, { cwd: rootPath })
109+
104110
watchStoppers.push(() => build.cancel())
111+
105112
await build
106-
for (let package of packages) {
107-
const stopWatchingPackage = await watchPackage(
108-
package.name,
109-
package.outputDir
110-
)
111-
console.log('watching package ', package.name)
112-
watchStoppers.push(stopWatchingPackage)
113+
114+
for (const package of packages) {
115+
watchStoppers.push(await watchPackage(package.name, package.outputDir))
113116
}
117+
114118
const dev = runCommand(`yarn docz dev`, { cwd: __dirname })
115119
watchStoppers.push(() => dev.cancel())
116120
}

dev-env/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"cpx": "^1.5.0",
18-
"docz": "next",
18+
"docz": "../../core/docz",
1919
"execa": "^2.0.4",
2020
"prop-types": "^15.7.2",
2121
"react": "^16.8.6",

0 commit comments

Comments
 (0)