Thanks to visit codestin.com
Credit goes to Github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import ora from 'ora';
import updateNotifier from 'update-notifier';
import dayjs from 'dayjs';
import pkg from '../package.json' assert { type: 'json' };
import { pkg } from './pkg.js';

function exit(e: any) {

Check warning on line 10 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

Check warning on line 10 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (e.message) {
ora().fail(e.message);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/metering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import fs from 'fs';
import path from 'path';
import { type APIResponse, Session } from '../lib/index.js';
import pkg from '../package.json' assert { type: 'json' };
import { pkg } from './pkg.js';

export type Format = 'pretty' | 'json' | 'csv';

Expand Down Expand Up @@ -74,7 +74,7 @@
try {
await mkdirp(path.dirname(this.flags.output));
fs.writeFileSync(this.flags.output, rendered);
} catch (e: any) {

Check warning on line 77 in bin/metering.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

Check warning on line 77 in bin/metering.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
ora().fail(`Impossible d'écrire dans ${this.flags.output}`);
if (e.message) {
ora().fail('Erreur : ' + e.message);
Expand Down
17 changes: 17 additions & 0 deletions bin/pkg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

const packageJSONPaths = ['../../package.json', '../package.json'].map((p) =>
join(dirname(fileURLToPath(import.meta.url)), p)
);

let packageJSONContent = 'package.json not found';

try {
packageJSONContent = fs.readFileSync(packageJSONPaths[0], 'utf8');
} catch (err) {
packageJSONContent = fs.readFileSync(packageJSONPaths[1], 'utf8');
}

export const pkg = JSON.parse(packageJSONContent);
2 changes: 1 addition & 1 deletion bin/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conf from 'conf';
import pkg from '../package.json' assert { type: 'json' };
import { pkg } from './pkg.js';

const TOKEN = 'token';

Expand All @@ -7,7 +7,7 @@
projectName: 'linky',
projectVersion: pkg.version,
migrations: {
'>=2.0.0': (store: any) => {

Check warning on line 10 in bin/store.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

Check warning on line 10 in bin/store.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
store.clear();
},
},
Expand Down
Loading