@pikku/cli 0.6.8 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/bin/pikku-fetch.ts +2 -2
- package/bin/pikku-websocket.ts +5 -2
- package/dist/bin/pikku-fetch.js +2 -2
- package/dist/bin/pikku-websocket.js +5 -2
- package/dist/src/utils.js +8 -5
- package/package.json +1 -1
- package/src/utils.ts +12 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pikku/cli
|
|
2
2
|
|
|
3
|
+
## 0.6.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 06e71be: fix: use readFile instead of import for json file
|
|
8
|
+
|
|
9
|
+
## 0.6.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7e7ec0c: chore: show packageVersion in cli header
|
|
14
|
+
|
|
3
15
|
## 0.6.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/bin/pikku-fetch.ts
CHANGED
|
@@ -17,10 +17,10 @@ export const pikkuFetch = async ({
|
|
|
17
17
|
await logCommandInfoAndTime(
|
|
18
18
|
'Generating fetch wrapper',
|
|
19
19
|
'Generated fetch wrapper',
|
|
20
|
-
[fetchFile === undefined,
|
|
20
|
+
[fetchFile === undefined, "fetchFile isn't set in the pikku config"],
|
|
21
21
|
async () => {
|
|
22
22
|
if (!fetchFile) {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error("fetchFile is isn't set in the pikku config")
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const routesMapDeclarationPath = getFileImportRelativePath(
|
package/bin/pikku-websocket.ts
CHANGED
|
@@ -17,10 +17,13 @@ export const pikkuWebSocket = async ({
|
|
|
17
17
|
await logCommandInfoAndTime(
|
|
18
18
|
'Generating websocket wrapper',
|
|
19
19
|
'Generated websocket wrapper',
|
|
20
|
-
[
|
|
20
|
+
[
|
|
21
|
+
websocketFile === undefined,
|
|
22
|
+
"websocketFile isn't set in the pikku config",
|
|
23
|
+
],
|
|
21
24
|
async () => {
|
|
22
25
|
if (!websocketFile) {
|
|
23
|
-
throw new Error(
|
|
26
|
+
throw new Error("fetchFile is isn't set in the pikku config")
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const channelsMapDeclarationPath = getFileImportRelativePath(
|
package/dist/bin/pikku-fetch.js
CHANGED
|
@@ -2,9 +2,9 @@ import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFi
|
|
|
2
2
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
3
|
import { serializeFetchWrapper } from '../src/http/serialize-fetch-wrapper.js';
|
|
4
4
|
export const pikkuFetch = async ({ fetchFile, routesMapDeclarationFile, packageMappings, }) => {
|
|
5
|
-
await logCommandInfoAndTime('Generating fetch wrapper', 'Generated fetch wrapper', [fetchFile === undefined,
|
|
5
|
+
await logCommandInfoAndTime('Generating fetch wrapper', 'Generated fetch wrapper', [fetchFile === undefined, "fetchFile isn't set in the pikku config"], async () => {
|
|
6
6
|
if (!fetchFile) {
|
|
7
|
-
throw new Error(
|
|
7
|
+
throw new Error("fetchFile is isn't set in the pikku config");
|
|
8
8
|
}
|
|
9
9
|
const routesMapDeclarationPath = getFileImportRelativePath(fetchFile, routesMapDeclarationFile, packageMappings);
|
|
10
10
|
const content = [serializeFetchWrapper(routesMapDeclarationPath)];
|
|
@@ -2,9 +2,12 @@ import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFi
|
|
|
2
2
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
3
|
import { serializeWebsocketWrapper } from '../src/channels/serialize-websocket-wrapper.js';
|
|
4
4
|
export const pikkuWebSocket = async ({ websocketFile, channelsMapDeclarationFile, packageMappings, }) => {
|
|
5
|
-
await logCommandInfoAndTime('Generating websocket wrapper', 'Generated websocket wrapper', [
|
|
5
|
+
await logCommandInfoAndTime('Generating websocket wrapper', 'Generated websocket wrapper', [
|
|
6
|
+
websocketFile === undefined,
|
|
7
|
+
"websocketFile isn't set in the pikku config",
|
|
8
|
+
], async () => {
|
|
6
9
|
if (!websocketFile) {
|
|
7
|
-
throw new Error(
|
|
10
|
+
throw new Error("fetchFile is isn't set in the pikku config");
|
|
8
11
|
}
|
|
9
12
|
const channelsMapDeclarationPath = getFileImportRelativePath(websocketFile, channelsMapDeclarationFile, packageMappings);
|
|
10
13
|
const content = [serializeWebsocketWrapper(channelsMapDeclarationPath)];
|
package/dist/src/utils.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
// import packageInfo from '../package.json'
|
|
2
1
|
import { relative, dirname } from 'path';
|
|
3
2
|
import { mkdir, writeFile } from 'fs/promises';
|
|
4
3
|
import chalk from 'chalk';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
7
|
export const logPrimary = (message) => {
|
|
6
|
-
console.log(chalk.green(
|
|
8
|
+
console.log(chalk.green(message));
|
|
7
9
|
};
|
|
8
10
|
export const logSuccess = (message) => {
|
|
9
|
-
console.log(chalk.green(
|
|
11
|
+
console.log(chalk.green(message));
|
|
10
12
|
};
|
|
11
13
|
export const logInfo = (message) => {
|
|
12
|
-
console.log(chalk.blue(
|
|
14
|
+
console.log(chalk.blue(message));
|
|
13
15
|
};
|
|
14
16
|
export const getFileImportRelativePath = (from, to, packageMappings) => {
|
|
15
17
|
let filePath = relative(dirname(from), to);
|
|
@@ -119,7 +121,8 @@ const logo = `
|
|
|
119
121
|
`;
|
|
120
122
|
export const logPikkuLogo = () => {
|
|
121
123
|
logPrimary(logo);
|
|
122
|
-
|
|
124
|
+
const packageJson = JSON.parse(readFileSync(`${dirname(__filename)}/../../package.json`, 'utf-8'));
|
|
125
|
+
logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson.version})\n`);
|
|
123
126
|
};
|
|
124
127
|
// TODO: add version back in once the ESM dust settles
|
|
125
128
|
export const DO_NOT_MODIFY_COMMENT = `/**
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
// import packageInfo from '../package.json'
|
|
2
1
|
import { relative, dirname } from 'path'
|
|
3
2
|
import { PathToNameAndType, InspectorState } from '@pikku/inspector'
|
|
4
3
|
import { mkdir, writeFile } from 'fs/promises'
|
|
5
4
|
import chalk from 'chalk'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { readFileSync } from 'fs'
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
6
9
|
|
|
7
10
|
export const logPrimary = (message: string) => {
|
|
8
|
-
console.log(chalk.green(
|
|
11
|
+
console.log(chalk.green(message))
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export const logSuccess = (message: string) => {
|
|
12
|
-
console.log(chalk.green(
|
|
15
|
+
console.log(chalk.green(message))
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export const logInfo = (message: string) => {
|
|
16
|
-
console.log(chalk.blue(
|
|
19
|
+
console.log(chalk.blue(message))
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export const getFileImportRelativePath = (
|
|
@@ -230,7 +233,11 @@ const logo = `
|
|
|
230
233
|
|
|
231
234
|
export const logPikkuLogo = () => {
|
|
232
235
|
logPrimary(logo)
|
|
233
|
-
|
|
236
|
+
|
|
237
|
+
const packageJson = JSON.parse(
|
|
238
|
+
readFileSync(`${dirname(__filename)}/../../package.json`, 'utf-8')
|
|
239
|
+
)
|
|
240
|
+
logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson.version})\n`)
|
|
234
241
|
}
|
|
235
242
|
|
|
236
243
|
// TODO: add version back in once the ESM dust settles
|