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 {join} = require('path');
|
||||||
|
|
||||||
const {processCode, spawnWith} = require('@flecks/core/src/server');
|
const {processCode, spawnWith} = require('@flecks/core/src/server');
|
||||||
|
@ -7,7 +8,7 @@ const {
|
||||||
FLECKS_CORE_ROOT = process.cwd(),
|
FLECKS_CORE_ROOT = process.cwd(),
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
const args = ['npm', 'publish', '--provenance'];
|
const args = ['echo', 'npm', 'publish', '--provenance'];
|
||||||
const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -17,9 +18,26 @@ const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
||||||
paths.forEach((cwd, i) => {
|
paths.forEach((cwd, i) => {
|
||||||
// then= :)
|
// then= :)
|
||||||
cpus[i % cpus.length] = cpus[i % cpus.length]
|
cpus[i % cpus.length] = cpus[i % cpus.length]
|
||||||
.then(async (code) => (
|
.then(async (code) => {
|
||||||
(await processCode(spawnWith(args, {cwd: join(cwd, 'dist', 'fleck')}))) || 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;
|
process.exitCode = (await Promise.all(cpus)).find((code) => code !== 0) || 0;
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user