chore: only publish changes
This commit is contained in:
parent
607a1a83da
commit
e424b7a0d7
|
@ -1,3 +1,4 @@
|
|||
const {exec} = require('child_process');
|
||||
const {join} = require('path');
|
||||
|
||||
const {processCode, spawnWith} = require('@flecks/core/src/server');
|
||||
|
@ -7,7 +8,7 @@ const {
|
|||
FLECKS_CORE_ROOT = process.cwd(),
|
||||
} = process.env;
|
||||
|
||||
const args = ['npm', 'publish', '--provenance'];
|
||||
const args = ['echo', 'npm', 'publish', '--provenance'];
|
||||
const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
||||
|
||||
(async () => {
|
||||
|
@ -17,9 +18,26 @@ const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
|||
paths.forEach((cwd, i) => {
|
||||
// then= :)
|
||||
cpus[i % cpus.length] = cpus[i % cpus.length]
|
||||
.then(async (code) => (
|
||||
(await processCode(spawnWith(args, {cwd: join(cwd, 'dist', 'fleck')}))) || code
|
||||
));
|
||||
.then(async (code) => {
|
||||
const {name, version} = require(join(cwd, 'package.json'));
|
||||
const [localVersion, remoteVersion] = await Promise.all([
|
||||
version,
|
||||
new Promise((resolve, reject) => {
|
||||
exec(`npm view ${name} version`, (error, stdout) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
return;
|
||||
}
|
||||
resolve(stdout.trim());
|
||||
});
|
||||
}),
|
||||
]);
|
||||
if (localVersion === remoteVersion) {
|
||||
return code;
|
||||
}
|
||||
const publishCode = await processCode(spawnWith(args, {cwd: join(cwd, 'dist', 'fleck')}));
|
||||
return publishCode || code;
|
||||
});
|
||||
});
|
||||
process.exitCode = (await Promise.all(cpus)).find((code) => code !== 0) || 0;
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue
Block a user