Generate/include an oclif.manifest.json when packaging

This saves ~220ms for me when running oclif commands

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-06-26 16:05:16 +01:00 committed by Balena CI
parent c95568b5a4
commit d0a4ff0d6b
3 changed files with 12 additions and 8 deletions

1
.gitignore vendored
View File

@ -44,3 +44,4 @@ dist/
# Ignore fast-boot cache file
**/.fast-boot.json
/oclif.manifest.json

View File

@ -17,7 +17,8 @@
"patches0/",
"patches/",
"*.md",
"npm-shrinkwrap.json"
"npm-shrinkwrap.json",
"oclif.manifest.json"
],
"bin": {
"balena": "./bin/balena"
@ -40,7 +41,8 @@
"node_modules/opn/xdg-open",
"node_modules/open/xdg-open",
"node_modules/windosu/*.bat",
"node_modules/windosu/*.cmd"
"node_modules/windosu/*.cmd",
"oclif.manifest.json"
]
},
"scripts": {
@ -48,7 +50,7 @@
"prebuild": "rimraf build/ build-bin/",
"build": "npm run build:src && npm run catch-uncommitted",
"build:src": "npm run lint && npm run build:fast && npm run build:test && npm run build:doc",
"build:fast": "gulp pages && tsc",
"build:fast": "gulp pages && tsc && npx oclif-dev manifest",
"build:test": "tsc -P ./tsconfig.dev.json --noEmit && tsc -P ./tsconfig.js.json --noEmit",
"build:doc": "mkdirp doc/ && ts-node --transpile-only automation/capitanodoc/index.ts > doc/cli.markdown",
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",

View File

@ -62,7 +62,7 @@ index a9d4276..4ac508f 100644
File /r bin
File /r client
diff --git a/node_modules/@oclif/dev-cli/lib/tarballs/build.js b/node_modules/@oclif/dev-cli/lib/tarballs/build.js
index 3e613e0..8c8f698 100644
index 3e613e0..18a9b1a 100644
--- a/node_modules/@oclif/dev-cli/lib/tarballs/build.js
+++ b/node_modules/@oclif/dev-cli/lib/tarballs/build.js
@@ -17,8 +17,11 @@ const pack = async (from, to) => {
@ -78,7 +78,7 @@ index 3e613e0..8c8f698 100644
const packCLI = async () => {
const stdout = await qq.x.stdout('npm', ['pack', '--unsafe-perm'], { cwd: c.root });
return path.join(c.root, stdout.split('\n').pop());
@@ -34,6 +37,44 @@ async function build(c, options = {}) {
@@ -34,6 +37,45 @@ async function build(c, options = {}) {
await qq.mv(f, '.');
await qq.rm('package', tarball, 'bin/run.cmd');
};
@ -100,6 +100,7 @@ index 3e613e0..8c8f698 100644
+ 'patches',
+ 'patches0',
+ 'typings',
+ 'oclif.manifest.json',
+ ];
+ for (const source of sources) {
+ let destDir = ws;
@ -123,7 +124,7 @@ index 3e613e0..8c8f698 100644
const updatePJSON = async () => {
qq.cd(c.workspace());
const pjson = await qq.readJSON('package.json');
@@ -56,7 +97,13 @@ async function build(c, options = {}) {
@@ -56,7 +98,13 @@ async function build(c, options = {}) {
lockpath = qq.join(c.root, 'npm-shrinkwrap.json');
}
await qq.cp(lockpath, '.');
@ -138,7 +139,7 @@ index 3e613e0..8c8f698 100644
}
};
const buildTarget = async (target) => {
@@ -71,7 +118,8 @@ async function build(c, options = {}) {
@@ -71,7 +119,8 @@ async function build(c, options = {}) {
output: path.join(workspace, 'bin', 'node'),
platform: target.platform,
arch: target.arch,
@ -148,7 +149,7 @@ index 3e613e0..8c8f698 100644
});
if (options.pack === false)
return;
@@ -124,7 +172,8 @@ async function build(c, options = {}) {
@@ -124,7 +173,8 @@ async function build(c, options = {}) {
await qq.writeJSON(c.dist(config.s3Key('manifest')), manifest);
};
log_1.log(`gathering workspace for ${config.bin} to ${c.workspace()}`);