mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 13:26:24 +00:00
Update all references of lib to src
Change-type: patch
This commit is contained in:
parent
2b044348e0
commit
4760866c77
@ -115,9 +115,9 @@ The content sources for the auto generation of `docs/balena-cli.md` are:
|
||||
* [Selected
|
||||
sections](https://github.com/balena-io/balena-cli/blob/v12.23.0/automation/capitanodoc/capitanodoc.ts#L199-L204)
|
||||
of the README file.
|
||||
* The CLI's command documentation in source code (`lib/commands/` folder), for example:
|
||||
* `lib/commands/push.ts`
|
||||
* `lib/commands/env/add.ts`
|
||||
* The CLI's command documentation in source code (`src/commands/` folder), for example:
|
||||
* `src/commands/push.ts`
|
||||
* `src/commands/env/add.ts`
|
||||
|
||||
The README file is manually edited, but subsections are automatically extracted for inclusion in
|
||||
`docs/balena-cli.md` by the `getCapitanoDoc()` function in
|
||||
@ -224,7 +224,7 @@ command, or by manually editing or copying files to the `node_modules` folder.
|
||||
|
||||
Unexpected behavior may then be observed because of the CLI's use of the
|
||||
[fast-boot2](https://www.npmjs.com/package/fast-boot2) package that caches module resolution.
|
||||
`fast-boot2` is configured in `lib/fast-boot.ts` to automatically invalidate the cache if
|
||||
`fast-boot2` is configured in `src/fast-boot.ts` to automatically invalidate the cache if
|
||||
changes are made to the `package.json` or `npm-shrinkwrap.json` files, but the cache won't
|
||||
be automatically invalidated if `npm link` is used or if manual modifications are made to the
|
||||
`node_modules` folder. In this situation:
|
||||
|
@ -40,7 +40,7 @@ By default, the CLI is installed to the following folders:
|
||||
OS | Folders
|
||||
--- | ---
|
||||
Windows: | `C:\Program Files\balena-cli\`
|
||||
macOS: | `/usr/local/lib/balena-cli/` <br> `/usr/local/bin/balena`
|
||||
macOS: | `/usr/local/src/balena-cli/` <br> `/usr/local/bin/balena`
|
||||
|
||||
## Standalone Zip Package
|
||||
|
||||
|
@ -27,7 +27,7 @@ To update the balena CLI, repeat the steps above for the new version.
|
||||
To uninstall it, run the following command on a terminal prompt:
|
||||
|
||||
```text
|
||||
sudo /usr/local/lib/balena-cli/bin/uninstall
|
||||
sudo /usr/local/src/balena-cli/bin/uninstall
|
||||
```
|
||||
|
||||
## Additional Dependencies
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { JsonVersions } from '../lib/commands/version/index';
|
||||
import type { JsonVersions } from '../src/commands/version/index';
|
||||
|
||||
import { run as oclifRun } from '@oclif/core';
|
||||
import * as archiver from 'archiver';
|
||||
|
@ -28,7 +28,7 @@ import { GlobSync } from 'glob';
|
||||
*
|
||||
* IMPORTANT
|
||||
*
|
||||
* All commands need to be stored under a folder in lib/commands to maintain uniformity
|
||||
* All commands need to be stored under a folder in src/commands to maintain uniformity
|
||||
* Generating docs will error out if directive not followed
|
||||
* To add a custom heading for command docs, add the heading next to the folder name
|
||||
* in the `commandHeadings` dictionary.
|
||||
|
@ -18,7 +18,7 @@ import * as path from 'path';
|
||||
import { getCapitanoDoc } from './capitanodoc';
|
||||
import type { Category, Document, OclifCommand } from './doc-types';
|
||||
import * as markdown from './markdown';
|
||||
import { stripIndent } from '../../lib/utils/lazy';
|
||||
import { stripIndent } from '../../src/utils/lazy';
|
||||
|
||||
/**
|
||||
* Generates the markdown document (as a string) for the CLI documentation
|
||||
|
@ -18,8 +18,8 @@ import { Parser } from '@oclif/core';
|
||||
import * as ent from 'ent';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { getManualSortCompareFunction } from '../../lib/utils/helpers';
|
||||
import { capitanoizeOclifUsage } from '../../lib/utils/oclif-utils';
|
||||
import { getManualSortCompareFunction } from '../../src/utils/helpers';
|
||||
import { capitanoizeOclifUsage } from '../../src/utils/oclif-utils';
|
||||
import type { Category, Document, OclifCommand } from './doc-types';
|
||||
|
||||
function renderOclifCommand(command: OclifCommand): string[] {
|
||||
|
@ -43,8 +43,8 @@ async function checkBuildTimestamps() {
|
||||
...gitStatus.staged,
|
||||
...gitStatus.renamed.map((o) => o.to),
|
||||
])
|
||||
// select only staged files that start with lib/ or typings/
|
||||
.filter((f) => f.match(/^(lib|typings)[/\\]/))
|
||||
// select only staged files that start with src/ or typings/
|
||||
.filter((f) => f.match(/^(src|typings)[/\\]/))
|
||||
.map((f) => path.join(ROOT, f));
|
||||
|
||||
const fStats = await Promise.all(stagedFiles.map((f) => fs.stat(f)));
|
||||
|
10
bin/dev.js
10
bin/dev.js
@ -29,7 +29,7 @@ const path = require('path');
|
||||
const rootDir = path.join(__dirname, '..');
|
||||
|
||||
// Allow balena-dev to work with oclif by temporarily
|
||||
// pointing oclif config options to lib/ instead of build/
|
||||
// pointing oclif config options to src/ instead of build/
|
||||
modifyOclifPaths();
|
||||
// Undo changes on exit
|
||||
process.on('exit', function () {
|
||||
@ -57,9 +57,9 @@ require('ts-node').register({
|
||||
project: path.join(rootDir, 'tsconfig.json'),
|
||||
transpileOnly: true,
|
||||
});
|
||||
require('../lib/app').run(undefined, { dir: __dirname, development: true });
|
||||
require('../src/app').run(undefined, { dir: __dirname, development: true });
|
||||
|
||||
// Modify package.json oclif paths from build/ -> lib/, or vice versa
|
||||
// Modify package.json oclif paths from build/ -> src/, or vice versa
|
||||
function modifyOclifPaths(revert) {
|
||||
const fs = require('fs');
|
||||
const packageJsonPath = path.join(rootDir, 'package.json');
|
||||
@ -73,9 +73,9 @@ function modifyOclifPaths(revert) {
|
||||
|
||||
let oclifSectionText = JSON.stringify(packageObj.oclif);
|
||||
if (!revert) {
|
||||
oclifSectionText = oclifSectionText.replace(/\/build\//g, '/lib/');
|
||||
oclifSectionText = oclifSectionText.replace(/\/build\//g, '/src/');
|
||||
} else {
|
||||
oclifSectionText = oclifSectionText.replace(/\/lib\//g, '/build/');
|
||||
oclifSectionText = oclifSectionText.replace(/\/src\//g, '/build/');
|
||||
}
|
||||
|
||||
packageObj.oclif = JSON.parse(oclifSectionText);
|
||||
|
@ -14,7 +14,7 @@
|
||||
"bin/",
|
||||
"build/",
|
||||
"doc/",
|
||||
"lib/",
|
||||
"src/",
|
||||
"patches/",
|
||||
"!patches/**/**.dev.patch",
|
||||
"*.md",
|
||||
@ -51,7 +51,7 @@
|
||||
"build": "npm run build:src && npm run catch-uncommitted",
|
||||
"build:t": "npm run lint && npm run build:fast && npm run build:test",
|
||||
"build:src": "npm run lint && npm run build:fast && npm run build:test && npm run build:doc && npm run build:completion",
|
||||
"build:pages": "mkdirp ./build/auth/pages/&& inline-source --compress ./lib/auth/pages/error.ejs ./build/auth/pages/error.ejs && inline-source --compress ./lib/auth/pages/success.ejs ./build/auth/pages/success.ejs",
|
||||
"build:pages": "mkdirp ./build/auth/pages/&& inline-source --compress ./src/auth/pages/error.ejs ./build/auth/pages/error.ejs && inline-source --compress ./src/auth/pages/success.ejs ./build/auth/pages/success.ejs",
|
||||
"build:fast": "npm run build:pages && tsc && npx oclif manifest",
|
||||
"build:test": "tsc -P ./tsconfig.dev.json --noEmit",
|
||||
"build:doc": "ts-node --transpile-only automation/capitanodoc/index.ts > docs/balena-cli.md",
|
||||
@ -73,7 +73,7 @@
|
||||
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
|
||||
"ci": "npm run test && npm run catch-uncommitted",
|
||||
"lint": "npm run lint-tsconfig && npm run lint-other",
|
||||
"lint-tsconfig": "balena-lint -e ts -e js -t tsconfig.dev.json --fix automation/ lib/ tests/ typings/",
|
||||
"lint-tsconfig": "balena-lint -e ts -e js -t tsconfig.dev.json --fix automation/ src/ tests/ typings/",
|
||||
"lint-other": "balena-lint -e ts -e js --fix bin/run.js bin/dev.js completion/ .mocharc.js .mocharc-standalone.js",
|
||||
"update": "ts-node --transpile-only ./automation/update-module.ts",
|
||||
"prepare": "echo {} > bin/.fast-boot.json",
|
||||
|
@ -30,7 +30,7 @@ import { stripIndent } from './utils/lazy';
|
||||
*
|
||||
* The username and command signature are also added as extra context
|
||||
* information in Sentry.io error reporting, for CLI debugging purposes
|
||||
* (mainly unexpected/unhandled exceptions -- see also `lib/errors.ts`).
|
||||
* (mainly unexpected/unhandled exceptions -- see also `src/errors.ts`).
|
||||
*
|
||||
* For more details on the data collected by balena generally, check this page:
|
||||
* https://www.balena.io/docs/learn/more/collected-data/
|
||||
|
@ -20,7 +20,7 @@
|
||||
* we have permissions over the cache file before even attempting to load
|
||||
* fast boot.
|
||||
* DON'T IMPORT BALENA-CLI MODULES HERE, as this module is loaded directly
|
||||
* from `bin/run.js`, before the CLI's entrypoint in `lib/app.ts`.
|
||||
* from `bin/run.js`, before the CLI's entrypoint in `src/app.ts`.
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
@ -63,7 +63,7 @@ async function $start() {
|
||||
process.env.BALENARC_DATA_DIRECTORY || path.join(os.homedir(), dotBalena),
|
||||
);
|
||||
// Consider that the CLI may be installed to a folder owned by root
|
||||
// such as `/usr[/local]/lib/balena-cli`, while being executed by
|
||||
// such as `/usr[/local]/src/balena-cli`, while being executed by
|
||||
// a regular user account.
|
||||
const cacheFile = path.join(dataDir, 'cli-module-cache.json');
|
||||
const root = path.join(__dirname, '..');
|
||||
|
@ -130,8 +130,8 @@ let cachedUsername: CachedUsername | undefined;
|
||||
/**
|
||||
* Return the parsed contents of the `~/.balena/cachedUsername` file. If the file
|
||||
* does not exist, create it with the details from the cloud. If not connected
|
||||
* to the internet, return undefined. This function is used by `lib/events.ts`
|
||||
* (event tracking) and `lib/utils/device/ssh.ts` and needs to gracefully handle
|
||||
* to the internet, return undefined. This function is used by `src/events.ts`
|
||||
* (event tracking) and `src/utils/device/ssh.ts` and needs to gracefully handle
|
||||
* the scenario of not being connected to the internet.
|
||||
*/
|
||||
export async function getCachedUsername(): Promise<CachedUsername | undefined> {
|
||||
|
@ -21,7 +21,7 @@ import { promises as fs } from 'fs';
|
||||
import * as path from 'path';
|
||||
import { promisify } from 'util';
|
||||
|
||||
import { LivepushManager } from '../../../lib/utils/device/live';
|
||||
import { LivepushManager } from '../../../src/utils/device/live';
|
||||
import { resetDockerignoreCache } from '../../docker-build';
|
||||
import { setupDockerignoreTestData } from '../../projects';
|
||||
|
||||
@ -42,11 +42,11 @@ class MockLivepushManager extends LivepushManager {
|
||||
composition: { version: '2.1', services: {} },
|
||||
buildTasks: [],
|
||||
docker: {} as import('dockerode'),
|
||||
api: {} as import('../../../lib/utils/device/api').DeviceAPI,
|
||||
logger: {} as import('../../../lib/utils/logger'),
|
||||
api: {} as import('../../../src/utils/device/api').DeviceAPI,
|
||||
logger: {} as import('../../../src/utils/logger'),
|
||||
imageIds: {},
|
||||
deployOpts:
|
||||
{} as import('../../../lib/utils/device/deploy').DeviceDeployOptions,
|
||||
{} as import('../../../src/utils/device/deploy').DeviceDeployOptions,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
},
|
||||
"include": [
|
||||
"./automation/**/*",
|
||||
"./lib/**/*",
|
||||
"./src/**/*",
|
||||
"./patches/*",
|
||||
"./tests/**/*",
|
||||
"./typings/**/*"
|
||||
|
@ -20,5 +20,5 @@
|
||||
],
|
||||
"preserveSymlinks": true
|
||||
},
|
||||
"include": ["./lib/**/*", "./typings/**/*"]
|
||||
"include": ["./src/**/*", "./typings/**/*"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user