Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] update Holochain-related client deps to latest versions #6

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
49efffe
update Holochain-related client deps to latest versions to fix duplic…
pospi Jan 21, 2023
30ca40e
update @holochain/client integrations to use updated APIs (first pass…
pospi Jan 24, 2023
8322093
continue WIP on type / parameter updates. Needs checking!
pospi Jan 24, 2023
5cc93c7
update more types for @holochain lib updates
pospi Jan 24, 2023
735a203
fix Rollup build configs not locating build artifacts from tsc for bu…
pospi Jan 24, 2023
399a0c8
fix TS build config
pospi Jan 24, 2023
37787bf
remove tsbuildinfo files when building as they appear to cause partia…
pospi Jan 24, 2023
b38b2f1
fix more Rollup & tsc configs to get a working build
pospi Jan 24, 2023
9fffbf5
revise init logic for WeApplet for new @holochain module versions
pospi Jan 24, 2023
83e530e
updated happ installation process for running tests
weswalla Jan 24, 2023
769a314
added script to build ui module in workspace, and run when packaging …
weswalla Jan 24, 2023
8bf64b7
add common dependencies to workspace root package.json and specify ho…
weswalla Jan 24, 2023
260ba76
use hc launch to run app in tauri window in dev mode and fetch up to …
weswalla Jan 24, 2023
ce7e6e0
fix live reloading in dev mode
weswalla Jan 24, 2023
65953a8
move async We Applet init logic into generator function to return syn…
pospi Jan 24, 2023
5ee9003
Revert "add common dependencies to workspace root package.json and sp…
pospi Jan 24, 2023
2c7a823
specify .13 as @holochain/client minver for Beta.RC2 compat
pospi Jan 24, 2023
48bc802
initialize sensemaker store, only works with client 0.11.9
weswalla Jan 25, 2023
67d168f
pin dependency to holochain client 0.11.9, otherwise there are breaki…
weswalla Jan 25, 2023
00cc55f
update config to beta-rc.2
weswalla Jan 25, 2023
57a97c6
revise firstUpdated() logic for app test harness, avoid recursion
pospi Jan 25, 2023
1dadce1
persist any HC_* connection env vars if defined at `ui` package build…
pospi Jan 26, 2023
c2f337f
update constructor params for HC libs changes
pospi Jan 26, 2023
6490b0a
rethrow any Holochain init errors in test harness component
pospi Jan 26, 2023
5a534b4
fix missed type on providerStore
pospi Jan 26, 2023
b1967f9
fully compile UI code to run typechecks before passing to (non-typech…
pospi Jan 26, 2023
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
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
"we-applet"
],
"scripts": {
"start": "npm run network 2",
"network": "hc s clean && npm run build:test-happ && concurrently-repeat \"npm run start:agent\"",
"start": "AGENTS=1 npm run network",
"network": "hc s clean && npm run build:test-happ && concurrently \"npm run build:watch -w ui\" \"npm run launch:happ\"",
"start:agent": "cross-env HC_PORT=$(port) HC_ADMIN_PORT=$(port) concurrently -k \"npm run start:happ\" \"sleep 5 && npm run start -w ui\"",
"launch:happ": "RUST_LOG=warn echo \"pass\" | hc launch --piped -n $AGENTS ./workdir/sensemaker-enabled/provider-sensemaker.happ -w --ui-path ui/dist network mdns",
"test": "npm run build:happ && npm t -w tests",
"start:happ": "concurrently \"RUST_LOG=warn echo \"pass\" | hc s --piped -f=$HC_ADMIN_PORT generate ./workdir/sensemaker-enabled/provider-sensemaker.happ --run=$HC_PORT -a provider network mdns\" \"npm run playground\"",
"package": "npm run build:happ && npm run package:ui -w we-applet && hc web-app pack workdir",
"package": "npm run build:happ && npm run build:ui && npm run package:ui -w we-applet && hc web-app pack workdir",
"build:happ": "npm run build:dnas && hc app pack ./workdir",
"build:test-happ": "npm run build:dnas && hc app pack ./workdir/sensemaker-enabled",
"build:dnas": "npm run build:zomes && hc dna pack ./dna/workdir",
"build:zomes": "CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown",
"build:ui": "npm run ts-build -w ui",
"playground": "run-singleton \"holochain-playground\"",
"download-sensemaker": "rimraf workdir/sensemaker.dna && curl -L --output workdir/sensemaker.dna https://github.com/neighbour-hoods/sensemaker-lite/releases/download/v0.0.2-alpha/sensemaker.dna",
"download-sensemaker": "rimraf workdir/sensemaker.dna && curl -L --output workdir/sensemaker.dna https://github.com/neighbour-hoods/sensemaker-lite/releases/download/v0.0.3-alpha/sensemaker.dna",
"start:ui": "npm run start -w ui"
},
"devDependencies": {
Expand Down
7 changes: 3 additions & 4 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
"uuidv4": "^6.2.11"
},
"devDependencies": {
"@holochain/client": "0.8.0",
"@holochain/tryorama": "0.7.0",
"@holochain/client": "0.11.9",
"@holochain/tryorama": "^0.10.4",
"@types/lodash": "^4.14.158",
"@types/node": "^14.0.14",
"tape-promise": "^4.0.0",
"@holochain-open-dev/utils": "^0.4.3"
"tape-promise": "^4.0.0"
},
"type": "module"
}
9 changes: 4 additions & 5 deletions tests/src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

import { DnaSource, Record, ActionHash, EntryHash } from "@holochain/client";
import { AppBundleSource } from "@holochain/client";
import { pause, runScenario } from "@holochain/tryorama";
import { decode } from '@msgpack/msgpack';
import pkg from 'tape-promise/tape';
const { test } = pkg;
import { providerDna } from "./utils";
import { serializeHash } from "@holochain-open-dev/utils";
import { providerHapp } from "./utils";


export default () => test("provider CRUD tests", async (t) => {
await runScenario(async scenario => {

const dnas: DnaSource[] = [{ path: providerDna }];
const appBundleSource: AppBundleSource = { path: providerHapp };

const [alice, bob] = await scenario.addPlayersWithHapps([dnas, dnas]);
const [alice, bob] = await scenario.addPlayersWithApps([{ appBundleSource }, { appBundleSource }]);

await scenario.shareAllAgents();
});
Expand Down
2 changes: 1 addition & 1 deletion tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export const providerDna = path.join(__dirname, "../../dna/workdir/provider.dna");
export const providerHapp = path.join(__dirname, "../../dna/workdir/provider.happ");



6 changes: 1 addition & 5 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

<body>
<provider-app-test-harness></provider-app-test-harness>
<script type="module">
import { ProviderAppTestHarness } from './dist/provider-app-test-harness.js'

customElements.define('provider-app-test-harness', ProviderAppTestHarness);
</script>
<script type="module" src="./dist/provider-app-test-harness.js"></script>
</body>
</html>
11 changes: 5 additions & 6 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
"scripts": {
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
"build": "rimraf dist && tsc && rollup -c rollup.config.js",
"build": "rimraf dist && rimraf tsconfig.tsbuildinfo && tsc && rollup -c rollup.config.js",
"ts-build": "tsc",
"build:watch": "run-singleton \"tsc --watch --preserveWatchOutput\"",
"build:watch": "rimraf dist && rimraf tsconfig.tsbuildinfo && tsc && rollup -c rollup.config.js -w",
"start": "tsc && concurrently -r \"npm run build:watch\" \"wds\"",
"package": "npm run build && cd dist && bestzip ../dist.zip *"
},
"dependencies": {
"@holochain-open-dev/cell-client": "^0.8.0",
"@holochain-open-dev/utils": "^0.5.6",
"@holochain/client": "^0.9.2",
"@holochain/client": "0.11.9",
"@lit-labs/context": "^0.1.2",
"@material/mwc-button": "^0.25.3",
"@material/mwc-circular-progress": "^0.25.3",
"@msgpack/msgpack": "^2.7.2",
"@neighbourhoods/sensemaker-lite-types": "0.0.3",
"@neighbourhoods/sensemaker-lite-types": "0.1.0",
"@type-craft/content": "^0.0.7",
"@type-craft/title": "^0.0.8",
"lit": "^2.0.2"
Expand All @@ -39,6 +37,7 @@
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"@web/dev-server": "0.1.21",
Expand Down
84 changes: 35 additions & 49 deletions ui/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,83 +1,69 @@
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import html from '@web/rollup-plugin-html';
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace";

import babel from "@rollup/plugin-babel";
import html from "@web/rollup-plugin-html";
import { importMetaAssets } from "@web/rollup-plugin-import-meta-assets";
import { terser } from "rollup-plugin-terser";
import typescript from '@rollup/plugin-typescript';

const production = !process.env.ROLLUP_WATCH;

export default {
input: 'index.html',
input: "index.html",
output: {
entryFileNames: '[hash].js',
chunkFileNames: '[hash].js',
assetFileNames: '[hash][extname]',
format: 'es',
dir: 'dist',
entryFileNames: "[hash].js",
chunkFileNames: "[hash].js",
assetFileNames: "[hash][extname]",
format: "es",
dir: "dist",
},
preserveEntrySignatures: false,

watch: {
clearScreen: false,
},

plugins: [
/** Enable using HTML as rollup entrypoint */
replace({
'process.env.HC_PORT': '8888',
delimiters: ['', ''],
}),
html({
minify: true,
injectServiceWorker: true,
serviceWorkerPath: 'dist/sw.js',
}),
/** Resolve bare module imports */
nodeResolve({
browser: true,
preferBuiltins: false,
}),
replace({
"process.env.NODE_ENV": '"production"',
"process.env.ENV": `"${process.env.ENV}"`, // :TODO: this seems like a possible security issue, should we be sending this?
"process.env.HC_PORT": JSON.stringify(process.env.HC_PORT) || `undefined`,
"process.env.ADMIN_PORT": JSON.stringify(process.env.ADMIN_PORT) || `undefined`,
}),
commonjs({}),
typescript({
sourceMap: !production,
inlineSources: !production,
}),
commonjs(),
/** Minify JS */
terser(),
/** Bundle assets references via import.meta.url */
importMetaAssets(),
/** Compile JS to a lower language target */
babel({
babelHelpers: 'bundled',
exclude: /node_modules/,

babelHelpers: "bundled",
presets: [
[
require.resolve('@babel/preset-env'),
require.resolve("@babel/preset-env"),
{
targets: [
'last 3 Chrome major versions',
'last 3 Firefox major versions',
'last 3 Edge major versions',
'last 3 Safari major versions',
],
targets: ['defaults', 'not IE 11', 'safari >13', 'not op_mini all', 'last 3 Chrome versions'],
modules: false,
bugfixes: true,
},
],
],
plugins: [
[
require.resolve('babel-plugin-template-html-minifier'),
{
modules: {
lit: ['html', { name: 'css', encapsulation: 'style' }],
},
failOnError: false,
strictCSS: true,
htmlMinifier: {
collapseWhitespace: true,
conservativeCollapse: true,
removeComments: true,
caseSensitive: true,
minifyCSS: true,
},
},
],
],
plugins: [],
}),
],
};
2 changes: 1 addition & 1 deletion ui/src/appletConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const totalImportanceDimension = {

const taskItemResourceType: ConfigResourceType = {
"name": "task_item",
"base_types": [{ "id": 0, "zome_id": 0, "visibility": { "Public": null } }],
"base_types": [{ "entry_index": 0, "zome_index": 0, "visibility": { "Public": null } }],
"dimensions": [importanceDimension]
}

Expand Down
Loading