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

Commit f64b1f5

Browse files
feat: move IC canisters and providers to Papyrs (#1513)
* refactor: move canisters to papyrs Signed-off-by: peterpeterparker <[email protected]> * feat: deploy script Signed-off-by: peterpeterparker <[email protected]> * feat: use papyrs ic providers Signed-off-by: peterpeterparker <[email protected]> * feat: types move to papyrs Signed-off-by: peterpeterparker <[email protected]> * refactor: move ic providers to papyrs Signed-off-by: peterpeterparker <[email protected]> * docs: ic moved to papyrs Signed-off-by: peterpeterparker <[email protected]>
1 parent 245f9c5 commit f64b1f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+77
-6353
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ config.prod.json
5050
storybook-static/
5151

5252
webcomponents/monaco-editor/workers
53+
54+
canisters/canisters

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
### Providers
1111

1212
- firebase: v4.1.3 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/providers/firebase/CHANGELOG.md))
13-
- ic: v7.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/providers/ic/CHANGELOG.md))
13+
14+
### Providers: Deprecated and integrated into `papyrs`
15+
16+
- ic
1417

1518
### Web Components: New
1619

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ If you like the project, you can become a sponsor at [Open Collective](https://o
128128
| **AWS (Backend)** | ![version](https://img.shields.io/static/v1.svg?label=production&message=v2.0.0&color=success) | [`README`](backend/README.md) | [`CHANGELOG`](backend/CHANGELOG.md) |
129129
| **AWS (Infra)** | ![version](https://img.shields.io/static/v1.svg?label=production&message=up&color=success) | [`README`](infra/README.md) | |
130130
| **Firebase (Cloud)** | ![version](https://img.shields.io/static/v1.svg?label=production&message=v2.2.1&color=success) | [`README`](cloud/README.md) | [`CHANGELOG`](cloud/CHANGELOG.md) |
131-
| **Internet Computer** | ![version](https://img.shields.io/static/v1.svg?label=alpha&message=up&color=blueviolet) | [`README`](canisters/README.md) | [`CHANGELOG`](canisters/CHANGELOG.md) |
132131

133132
## Providers
134133

canisters/CHANGELOG.md

-5
This file was deleted.

canisters/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# DeckDeckGo - Canisters
77

8-
The canisters on the Internet Computer of [DeckDeckGo].
8+
Deploy script and environment variables of the (backend) canisters on the Internet Computer of [DeckDeckGo].
99

1010
## License
1111

canisters/scripts/ic.types.js

+2-71
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,10 @@
11
#!/usr/bin/env node
22

3-
const prettier = require('prettier');
4-
5-
const {join, extname, basename} = require('path');
6-
const {existsSync, readdirSync, writeFileSync, lstatSync, copyFileSync, readFileSync} = require('fs');
7-
8-
const copyTypes = async ({src, dest = `./providers/ic/src/canisters`}) => {
9-
const promises = readdirSync(src)
10-
.filter((subFolder) => !['assets', 'idl'].includes(subFolder))
11-
.map(
12-
(dirent) =>
13-
new Promise(async (resolve) => {
14-
const [srcPath, destPath] = [src, dest].map((dirPath) => join(dirPath, dirent));
15-
16-
const stat = lstatSync(srcPath);
17-
18-
if (stat.isDirectory()) {
19-
await copyTypes({src: srcPath, dest: destPath});
20-
} else if (stat.isFile()) {
21-
await copyFile({srcPath, destPath});
22-
}
23-
24-
resolve();
25-
})
26-
);
27-
28-
await Promise.all(promises);
29-
};
30-
31-
const copyFile = async ({srcPath, destPath}) => {
32-
if (extname(srcPath) === '.wasm') {
33-
return;
34-
}
35-
36-
if (basename(srcPath) === 'index.js') {
37-
return;
38-
}
39-
40-
if (basename(srcPath).indexOf('.old.') > -1) {
41-
return;
42-
}
43-
44-
if (['.did', '.most'].includes(extname(srcPath))) {
45-
copyFileSync(srcPath, destPath);
46-
return;
47-
}
48-
49-
if (extname(srcPath) === '.mjs') {
50-
return;
51-
}
52-
53-
const buffer = readFileSync(srcPath);
54-
const config = await prettier.resolveConfig('./prettierrc');
55-
const output = prettier.format(buffer.toString('utf-8'), {parser: 'babel', ...config});
56-
57-
writeFileSync(destPath.replace('.did.js', '.utils.did.js'), output);
58-
};
3+
const {writeFileSync, readFileSync} = require('fs');
594

605
const copyAdminManagerMjs = ({src}) => {
616
const buffer = readFileSync(`${src}manager/manager.did.js`);
627
writeFileSync(`${src}manager/manager.did.mjs`, buffer.toString('utf-8'));
638
};
649

65-
(async () => {
66-
try {
67-
if (existsSync('.dfx/local/canisters/')) {
68-
await copyTypes({src: `.dfx/local/canisters/`});
69-
} else if (existsSync('.dfx/ic/canisters/')) {
70-
await copyTypes({src: `.dfx/ic/canisters/`});
71-
}
72-
73-
copyAdminManagerMjs({src: '.dfx/local/canisters/'});
74-
75-
console.log(`Internet Computer types declarations generated!`);
76-
} catch (err) {
77-
console.error(`Error while generating the types for the Internet Computer.`, err);
78-
}
79-
})();
10+
copyAdminManagerMjs({src: '.dfx/local/canisters/'});

canisters/src/data/data.filter.mo

-32
This file was deleted.

canisters/src/data/data.mo

-93
This file was deleted.

canisters/src/data/data.store.mo

-69
This file was deleted.

canisters/src/data/data.types.mo

-16
This file was deleted.

0 commit comments

Comments
 (0)