Skip to content

Commit

Permalink
Name change & version & deps update
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Sep 11, 2024
1 parent 869cd21 commit 8a25afd
Show file tree
Hide file tree
Showing 13 changed files with 829 additions and 2,295 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright © 2021 Exact Realty Limited.
/* Copyright © 2021 Apeleg Limited.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js → .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright © 2021 Exact Realty Limited.
/* Copyright © 2021 Apeleg Limited.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2023 Exact Realty Limited
Copyright © 2023 Apeleg Limited

Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Below there are more concrete examples of these steps.
### Installing

```sh
npm i '@exact-realty/safeid'
npm i '@apeleghq/safeid'
```

### Getting started
Expand All @@ -45,13 +45,13 @@ npm i '@exact-realty/safeid'
In the file you have your configuration, first import this plugin

```js
const { SEncryptId, SDecryptId, UuidSafeId } = require('@exact-realty/safeid');
const { SEncryptId, SDecryptId, UuidSafeId } = require('@apeleghq/safeid');
```

Or using ES module syntax:

```js
import { SEncryptId, SDecryptId, UuidSafeId } from '@exact-realty/safeid';
import { SEncryptId, SDecryptId, UuidSafeId } from '@apeleghq/safeid';
```

#### Initialising an instance
Expand Down Expand Up @@ -92,7 +92,7 @@ Although only UUIDs are supported out of the box, it is possible to define custo
See the following example (TypeScript) for a custom ID type that consists of a 6-digit to 8-digit number:

```ts
import type { TIdHelper } from '@exact-realty/safeid';
import type { TIdHelper } from '@apeleghq/safeid';
import {
SFromBuffer,
setup,
Expand Down
2 changes: 1 addition & 1 deletion SECURITY
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vulnerabilities that you may discover.

If you believe you have found a security vulnerability in our software, please
let us know immediately. You may find our contact information at
<https://exact.realty/.well-known/security.txt>. Please include the following
<https://apeleg.com/.well-known/security.txt>. Please include the following
information in your report:

* A brief description of the vulnerability
Expand Down
33 changes: 32 additions & 1 deletion esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

/* Copyright © 2021 Exact Realty Limited.
/* Copyright © 2021 Apeleg Limited.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand All @@ -16,6 +16,8 @@
*/

import esbuild from 'esbuild';
import { readdir, readFile, writeFile } from 'node:fs/promises';
import { join } from 'node:path';

await esbuild.build({
entryPoints: ['./src/index.ts'],
Expand All @@ -26,6 +28,9 @@ await esbuild.build({
entryNames: '[name]',
platform: 'node',
external: ['esbuild'],
outExtension: {
'.js': '.cjs',
},
});

await esbuild.build({
Expand All @@ -41,3 +46,29 @@ await esbuild.build({
'.js': '.mjs',
},
});

const cjsDeclarationFiles = async (directoryPath) => {
const entries = await readdir(directoryPath, {
withFileTypes: true,
recursive: true,
});

await Promise.all(
entries
.filter((entry) => {
return entry.isFile() && entry.name.endsWith('.d.ts');
})
.map(async (file) => {
const name = join(file.path, file.name);
const newName = name.slice(0, -2) + 'cts';

const contents = await readFile(name, { encoding: 'utf-8' });
await writeFile(
newName,
contents.replace(/(?<=\.)js(?=['"])/g, 'cjs'),
);
}),
);
};

await cjsDeclarationFiles('dist');
Loading

0 comments on commit 8a25afd

Please sign in to comment.