create-nube-app 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biome.json +12 -0
- package/index.js +3 -0
- package/package.json +27 -0
- package/src/index.ts +81 -0
- package/templates/minimal/README.md +11 -0
- package/templates/minimal/package-lock.json +1860 -0
- package/templates/minimal/package.json +13 -0
- package/templates/minimal/src/main.ts +7 -0
- package/templates/minimal/tsconfig.json +10 -0
- package/templates/minimal/tsup.config.js +14 -0
- package/templates/minimal-ui/README.md +11 -0
- package/templates/minimal-ui/package-lock.json +1042 -0
- package/templates/minimal-ui/package.json +17 -0
- package/templates/minimal-ui/src/main.ts +28 -0
- package/templates/minimal-ui/tsconfig.json +11 -0
- package/templates/minimal-ui/tsup.config.js +18 -0
- package/templates/minimal-ui-jsx/README.md +12 -0
- package/templates/minimal-ui-jsx/package-lock.json +1883 -0
- package/templates/minimal-ui-jsx/package.json +16 -0
- package/templates/minimal-ui-jsx/src/main.tsx +28 -0
- package/templates/minimal-ui-jsx/tsconfig.json +14 -0
- package/templates/minimal-ui-jsx/tsup.config.js +21 -0
- package/tsconfig.json +14 -0
- package/tsup.config.js +13 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "minimal-ui-app",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsup"
|
|
7
|
+
},
|
|
8
|
+
"author": "Tiendanube / Nuvemshop",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@tiendanube/nube-sdk-ui": "0.1.3-alpha"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@tiendanube/nube-sdk-types": "0.2.5-alpha",
|
|
14
|
+
"tsup": "^8.3.0",
|
|
15
|
+
"typescript": "^5.6.2"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { NubeSDK } from "@tiendanube/nube-sdk-types";
|
|
2
|
+
import { box, field } from "@tiendanube/nube-sdk-ui";
|
|
3
|
+
|
|
4
|
+
export function App(nube: NubeSDK) {
|
|
5
|
+
nube.on("cart:update", ({ cart }) => {
|
|
6
|
+
console.log(cart);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
nube.send("ui:slot:set", () => ({
|
|
10
|
+
ui: {
|
|
11
|
+
slots: {
|
|
12
|
+
after_line_items:
|
|
13
|
+
box({
|
|
14
|
+
width: 100, height: 200, children: [
|
|
15
|
+
field({
|
|
16
|
+
id: "myField",
|
|
17
|
+
label: "Name",
|
|
18
|
+
name: "Name",
|
|
19
|
+
onChange: (e) => {
|
|
20
|
+
console.log("User name: " + e.value)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ["./src/main.ts"],
|
|
5
|
+
clean: true,
|
|
6
|
+
format: ["esm"],
|
|
7
|
+
dts: false,
|
|
8
|
+
outDir: "./dist",
|
|
9
|
+
minify: true,
|
|
10
|
+
sourcemap: false,
|
|
11
|
+
noExternal: [
|
|
12
|
+
"@tiendanube/nube-sdk-ui",
|
|
13
|
+
],
|
|
14
|
+
outExtension: ({ options }) => ({
|
|
15
|
+
js: options.minify ? ".min.js" : ".js"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Minimum setup for UI app development with NubeSDK using JSX
|
|
2
|
+
|
|
3
|
+
This project uses the type package in version `0.1.2-alpha` and `tsup` to compile typescript to javascript
|
|
4
|
+
|
|
5
|
+
# How to use
|
|
6
|
+
|
|
7
|
+
- install the development dependencies with the `npm install` command.
|
|
8
|
+
- Then start the development changing the `src/main.tsx` file.
|
|
9
|
+
- To compile the project use the `npm run build` command.
|
|
10
|
+
- The contents of the `src/jsx` is required for JSX support, in the future we will provide a new `npm` package with the JSX support embedded.
|
|
11
|
+
|
|
12
|
+
The final script is created in the `dist` folder.
|