Skip to content

Commit

Permalink
0.0.520
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansglazunov committed Sep 16, 2024
1 parent 753a30b commit 0cfd727
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions imports/packages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { DeepClient } from "./client";
import { Id, Link } from "./minilinks";
import { DeepClient } from "./client.js";
import { Id, Link } from "./minilinks.js";
import fs from 'fs';
import path from 'path';
import { Package } from "./packager";
import { Package } from "./packager.js";
import _ from 'lodash';;

export class Packages {
deep: DeepClient<Link<Id>>;
Expand All @@ -27,7 +28,7 @@ export class Packages {
console.log('export package', `${p.id} ${p?.value?.value}`);
const pckg = await packager.export({ packageLinkId: p.id });
console.log('exported package', `${pckg.package.name} ${pckg.package.version}`);
results[`${pckg.package.name}@${pckg.package.version}`] = pckg;
results[_.camelCase(`${pckg.package.name}@${pckg.package.version}`)] = pckg;
}
return results;
}
Expand All @@ -38,11 +39,11 @@ export class Packages {
for (let i = 0; i < packages.length; i++) {
const p = packages[i];
fs.writeFileSync(
path.join(address, `${p?.package?.name}@${p.package.version}.json`.replace('/','@')),
path.join(address, _.camelCase(`${p?.package?.name}@${p.package.version}.json`)),
JSON.stringify(p, null, 2),
{ encoding: 'utf-8' },
);
console.log('writeed package', `${path.join(address, `${p?.package?.name}@${p.package.version}`)}`);
console.log('writeed package', `${path.join(address, _.camelCase(`${p?.package?.name}@${p.package.version}`))}`);
}
}
async read(address: string): Promise<{ [name: string]: Package }> {
Expand All @@ -57,7 +58,7 @@ export class Packages {
const json = fs.readFileSync(path.join(address, pckgs[i]), { encoding: 'utf-8' });
try {
const pckg = JSON.parse(json);
results[`${pckg.package.name}@${pckg.package.version}`] = pckg;
results[_.camelCase(`${pckg.package.name}@${pckg.package.version}`)] = pckg;
} catch(e) {
console.log('error read package', e);
}
Expand All @@ -73,8 +74,8 @@ export class Packages {
const results = {};
for (let i = 0; i < packages.length; i++) {
const p = packages[i];
console.log(`import package ${p.package.name}@${p.package.version}`);
results[`${p.package.name}@${p.package.version}`] = await packager.import(p);
console.log(`import package ${_.camelCase(`${p.package.name}@${p.package.version}`)}`);
results[_.camelCase(`${p.package.name}@${p.package.version}`)] = await packager.import(p);
}
return results;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deep-foundation/deeplinks",
"version": "0.0.519",
"version": "0.0.520",
"license": "Unlicense",
"type": "module",
"main": "import.js",
Expand Down

0 comments on commit 0cfd727

Please sign in to comment.