Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 667aa5b

Browse files
build: utils esm chunks (#1460)
* build: utils esm chunks Signed-off-by: peterpeterparker <[email protected]> * chore: release utils v5 Signed-off-by: peterpeterparker <[email protected]>
1 parent b9dcf33 commit 667aa5b

File tree

15 files changed

+41
-23
lines changed

15 files changed

+41
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
### Others
2424

25-
- utils: v4.10.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/utils/utils/CHANGELOG.md))
25+
- utils: v5.0.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/utils/utils/CHANGELOG.md))
2626

2727
<a name="5.2.0"></a>
2828

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/ic/src/canisters/manager/manager.did

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
type UserId__1 = principal;
21
type UserId = principal;
32
type BucketId = principal;
43
type Bucket =
@@ -13,6 +12,6 @@ service : {
1312
getStorage: () -> (opt Bucket) query;
1413
initData: () -> (Bucket);
1514
initStorage: () -> (Bucket);
16-
installCode: (principal, UserId__1, blob) -> ();
15+
installCode: (principal, blob, blob) -> ();
1716
list: (text) -> (vec Bucket) query;
1817
}

providers/ic/src/canisters/manager/manager.did.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ export interface Bucket {
55
}
66
export type BucketId = Principal;
77
export type UserId = Principal;
8-
export type UserId__1 = Principal;
98
export interface _SERVICE {
109
delData: () => Promise<boolean>;
1110
delStorage: () => Promise<boolean>;
1211
getData: () => Promise<[] | [Bucket]>;
1312
getStorage: () => Promise<[] | [Bucket]>;
1413
initData: () => Promise<Bucket>;
1514
initStorage: () => Promise<Bucket>;
16-
installCode: (arg_0: Principal, arg_1: UserId__1, arg_2: Array<number>) => Promise<undefined>;
15+
installCode: (arg_0: Principal, arg_1: Array<number>, arg_2: Array<number>) => Promise<undefined>;
1716
list: (arg_0: string) => Promise<Array<Bucket>>;
1817
}

providers/ic/src/canisters/manager/manager.utils.did.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ export const idlFactory = ({IDL}) => {
55
owner: UserId,
66
bucketId: IDL.Opt(BucketId)
77
});
8-
const UserId__1 = IDL.Principal;
98
return IDL.Service({
109
delData: IDL.Func([], [IDL.Bool], []),
1110
delStorage: IDL.Func([], [IDL.Bool], []),
1211
getData: IDL.Func([], [IDL.Opt(Bucket)], ['query']),
1312
getStorage: IDL.Func([], [IDL.Opt(Bucket)], ['query']),
1413
initData: IDL.Func([], [Bucket], []),
1514
initStorage: IDL.Func([], [Bucket], []),
16-
installCode: IDL.Func([IDL.Principal, UserId__1, IDL.Vec(IDL.Nat8)], [], []),
15+
installCode: IDL.Func([IDL.Principal, IDL.Vec(IDL.Nat8), IDL.Vec(IDL.Nat8)], [], []),
1716
list: IDL.Func([IDL.Text], [IDL.Vec(Bucket)], ['query'])
1817
});
1918
};

utils/utils/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 5.0.0 (2022-01-08)
2+
3+
### Build
4+
5+
- output esm chunks
6+
- re-organize bundle structure in separate folders
7+
18
# 4.0.0 (2022-01-08)
29

310
### Build

utils/utils/esbuild.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
const esbuild = require('esbuild');
2+
const {readdirSync, existsSync, mkdirSync, writeFileSync} = require('fs');
3+
const {join} = require('path');
4+
5+
const lib = join(process.cwd(), 'lib');
6+
7+
if (!existsSync(lib)) {
8+
mkdirSync(lib);
9+
}
10+
11+
const entryPoints = readdirSync(join(process.cwd(), 'src')).map((file) => `src/${file}`);
212

313
esbuild
414
.build({
5-
entryPoints: ['src/index.ts'],
6-
outdir: 'lib',
15+
entryPoints,
16+
outdir: 'lib/esm',
717
bundle: true,
818
sourcemap: true,
919
minify: true,
@@ -16,11 +26,15 @@ esbuild
1626
esbuild
1727
.build({
1828
entryPoints: ['src/index.ts'],
19-
outfile: 'lib/index.cjs.js',
29+
outfile: 'lib/cjs/index.cjs.js',
2030
bundle: true,
2131
sourcemap: true,
2232
minify: true,
2333
platform: 'node',
2434
target: ['node16']
2535
})
2636
.catch(() => process.exit(1));
37+
38+
writeFileSync(join(lib, 'index.js'), "export * from './esm/index.js';");
39+
40+
writeFileSync(join(lib, 'index.cjs.js'), "module.exports = require('./cjs/index.cjs.js');");

utils/utils/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deckdeckgo/utils",
3-
"version": "4.0.0",
3+
"version": "5.0.0",
44
"author": "David Dal Busco",
55
"description": "A collection of utils methods and functions developed for DeckDeckGo",
66
"license": "MIT",
@@ -13,11 +13,11 @@
1313
"devDependencies": {
1414
"@types/node": "^16.9.0"
1515
},
16-
"main": "lib/index.cjs.js",
17-
"module": "lib/index.js",
18-
"types": "lib/index.d.ts",
16+
"main": "lib/cjs/index.cjs.js",
17+
"module": "lib/esm/index.js",
18+
"types": "lib/types/index.d.ts",
1919
"scripts": {
20-
"ts-declaration": " tsc --emitDeclarationOnly --outDir lib",
20+
"ts-declaration": " tsc --emitDeclarationOnly --outDir lib/types",
2121
"build": "rimraf lib && node ./esbuild.js && npm run ts-declaration"
2222
},
2323
"files": [
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)