@cognite/dune 0.3.0 → 0.3.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.
Files changed (46) hide show
  1. package/_templates/app/new/config/eslint.config.mjs.ejs.t +96 -0
  2. package/_templates/app/new/config/tailwind.config.js.ejs.t +1 -5
  3. package/_templates/app/new/config/vite.config.ts.ejs.t +9 -10
  4. package/_templates/app/new/config/vitest.config.ts.ejs.t +4 -5
  5. package/_templates/app/new/config/vitest.setup.ts.ejs.t +1 -2
  6. package/_templates/app/new/cursor/mcp.json.ejs.t +0 -5
  7. package/_templates/app/new/cursor/rules.mdc.ejs.t +1 -2
  8. package/_templates/app/new/prompt.js +29 -29
  9. package/_templates/app/new/root/index.html.ejs.t +3 -3
  10. package/_templates/app/new/root/package.json.ejs.t +11 -5
  11. package/_templates/app/new/src/App.test.tsx.ejs.t +32 -20
  12. package/_templates/app/new/src/App.tsx.ejs.t +118 -7
  13. package/_templates/app/new/src/lib/utils.ts.ejs.t +2 -3
  14. package/_templates/app/new/src/main.tsx.ejs.t +8 -8
  15. package/_templates/app/new/src/styles.css.ejs.t +5 -19
  16. package/bin/auth/authentication-flow.js +16 -14
  17. package/bin/auth/callback-server.js +23 -23
  18. package/bin/auth/certificate-manager.js +13 -13
  19. package/bin/auth/client-credentials.js +31 -32
  20. package/bin/auth/oauth-client.js +7 -7
  21. package/bin/cli.js +31 -30
  22. package/bin/deploy-command.js +32 -32
  23. package/bin/deploy-interactive-command.js +73 -73
  24. package/bin/skills-command.js +43 -26
  25. package/bin/utils/crypto.js +7 -8
  26. package/dist/auth/index.d.ts +10 -13
  27. package/dist/auth/index.js +1 -1
  28. package/dist/{chunk-VIBN7U5H.js → chunk-53VTKDSC.js} +1 -2
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +1 -1
  31. package/package.json +1 -1
  32. package/src/auth/dune-auth-provider.tsx +17 -16
  33. package/src/auth/index.ts +5 -5
  34. package/src/auth/use-dune.ts +5 -4
  35. package/src/auth/utils.ts +18 -18
  36. package/src/deploy/application-deployer.ts +12 -11
  37. package/src/deploy/application-packager.ts +11 -10
  38. package/src/deploy/deploy.ts +7 -6
  39. package/src/deploy/get-sdk.ts +4 -3
  40. package/src/deploy/index.ts +6 -6
  41. package/src/deploy/login.ts +7 -7
  42. package/src/index.ts +1 -1
  43. package/src/vite/fusion-open-plugin.ts +12 -12
  44. package/src/vite/index.ts +1 -1
  45. package/_templates/app/new/config/biome.json.ejs.t +0 -54
  46. package/_templates/app/new/config/components.json.ejs.t +0 -28
@@ -1,6 +1,7 @@
1
- import { CogniteClient } from "@cognite/sdk";
2
- import { getToken } from "./login";
3
- import type { Deployment } from "./types";
1
+ import { CogniteClient } from '@cognite/sdk';
2
+
3
+ import { getToken } from './login';
4
+ import type { Deployment } from './types';
4
5
 
5
6
  export const getSdk = async (deployment: Deployment, folder: string) => {
6
7
  const token = await getToken(deployment.deployClientId, deployment.deploySecretName);
@@ -1,9 +1,9 @@
1
1
  // Deploy exports for CI/CD and programmatic deployment
2
- export { deploy } from "./deploy";
3
- export { CdfApplicationDeployer } from "./application-deployer";
4
- export { ApplicationPackager } from "./application-packager";
5
- export { getSdk } from "./get-sdk";
6
- export { getToken } from "./login";
2
+ export { deploy } from './deploy';
3
+ export { CdfApplicationDeployer } from './application-deployer';
4
+ export { ApplicationPackager } from './application-packager';
5
+ export { getSdk } from './get-sdk';
6
+ export { getToken } from './login';
7
7
 
8
8
  // Type exports
9
- export type { Deployment, App } from "./types";
9
+ export type { Deployment, App } from './types';
@@ -13,16 +13,16 @@ const loadSecretsFromEnv = (): Record<string, string> => {
13
13
  const normalizedSecrets: Record<string, string> = {};
14
14
 
15
15
  for (const [key, value] of Object.entries(secrets)) {
16
- if (typeof value === "string") {
16
+ if (typeof value === 'string') {
17
17
  // Convert UPPER_CASE to lower-case-with-dashes
18
- const normalizedKey = key.toLowerCase().replace(/_/g, "-");
18
+ const normalizedKey = key.toLowerCase().replace(/_/g, '-');
19
19
  normalizedSecrets[normalizedKey] = value;
20
20
  }
21
21
  }
22
22
 
23
23
  return normalizedSecrets;
24
24
  } catch (error) {
25
- console.error("Error parsing DEPLOYMENT_SECRETS:", error);
25
+ console.error('Error parsing DEPLOYMENT_SECRETS:', error);
26
26
  return {};
27
27
  }
28
28
  };
@@ -51,13 +51,13 @@ export const getToken = async (deployClientId: string, deploySecretName: string)
51
51
  }
52
52
 
53
53
  const header = `Basic ${btoa(`${deployClientId}:${deploySecret}`)}`;
54
- const response = await fetch("https://auth.cognite.com/oauth2/token", {
55
- method: "POST",
54
+ const response = await fetch('https://auth.cognite.com/oauth2/token', {
55
+ method: 'POST',
56
56
  headers: {
57
57
  Authorization: header,
58
- "Content-Type": "application/x-www-form-urlencoded",
58
+ 'Content-Type': 'application/x-www-form-urlencoded',
59
59
  },
60
- body: new URLSearchParams({ grant_type: "client_credentials" }),
60
+ body: new URLSearchParams({ grant_type: 'client_credentials' }),
61
61
  });
62
62
 
63
63
  if (!response.ok) {
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Main entry point - re-exports auth for convenience
2
- export * from "./auth";
2
+ export * from './auth';
@@ -1,11 +1,11 @@
1
- import { exec } from "node:child_process";
2
- import fs from "node:fs";
3
- import path from "node:path";
1
+ import { exec } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
4
 
5
5
  const openUrl = (url: string) => {
6
6
  const start =
7
- process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
8
- if (process.platform === "win32") {
7
+ process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
8
+ if (process.platform === 'win32') {
9
9
  exec(`start "" "${url}"`);
10
10
  } else {
11
11
  exec(`${start} "${url}"`);
@@ -21,20 +21,20 @@ interface ViteDevServer {
21
21
 
22
22
  export const fusionOpenPlugin = () => {
23
23
  return {
24
- name: "fusion-open",
24
+ name: 'fusion-open',
25
25
  configureServer(server: ViteDevServer) {
26
- server.httpServer?.on("listening", () => {
26
+ server.httpServer?.on('listening', () => {
27
27
  const address = server.httpServer?.address();
28
- const port = address && typeof address === "object" ? address.port : 3001;
28
+ const port = address && typeof address === 'object' ? address.port : 3001;
29
29
 
30
- const appJsonPath = path.join(process.cwd(), "app.json");
30
+ const appJsonPath = path.join(process.cwd(), 'app.json');
31
31
  if (fs.existsSync(appJsonPath)) {
32
32
  try {
33
- const appJson = JSON.parse(fs.readFileSync(appJsonPath, "utf-8"));
33
+ const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'));
34
34
  const firstDeployment = appJson.deployments?.[0];
35
35
  const { org, project, baseUrl } = firstDeployment || {};
36
36
 
37
- const parsedBaseUrl = baseUrl?.split("//")[1];
37
+ const parsedBaseUrl = baseUrl?.split('//')[1];
38
38
 
39
39
  if (org && project && baseUrl) {
40
40
  const fusionUrl = `https://${org}.fusion.cognite.com/${project}/streamlit-apps/dune/development/${port}?cluster=${parsedBaseUrl}&workspace=industrial-tools`;
@@ -42,7 +42,7 @@ export const fusionOpenPlugin = () => {
42
42
  openUrl(fusionUrl);
43
43
  }
44
44
  } catch (error) {
45
- console.warn("Failed to read app.json for Fusion URL", error);
45
+ console.warn('Failed to read app.json for Fusion URL', error);
46
46
  }
47
47
  }
48
48
  });
package/src/vite/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Vite plugin exports
2
- export { fusionOpenPlugin } from "./fusion-open-plugin";
2
+ export { fusionOpenPlugin } from './fusion-open-plugin';
@@ -1,54 +0,0 @@
1
- ---
2
- to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>biome.json'
3
- ---
4
- {
5
- "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
6
- "organizeImports": {
7
- "enabled": true
8
- },
9
- "linter": {
10
- "enabled": true,
11
- "rules": {
12
- "recommended": true,
13
- "suspicious": {
14
- "noExplicitAny": "off"
15
- },
16
- "style": {
17
- "noNonNullAssertion": "off"
18
- },
19
- "complexity": {
20
- "noForEach": "off"
21
- }
22
- }
23
- },
24
- "formatter": {
25
- "enabled": true,
26
- "indentStyle": "space",
27
- "indentWidth": 2,
28
- "lineWidth": 100
29
- },
30
- "javascript": {
31
- "formatter": {
32
- "quoteStyle": "double",
33
- "trailingCommas": "es5",
34
- "semicolons": "always"
35
- }
36
- },
37
- "json": {
38
- "formatter": {
39
- "enabled": true
40
- }
41
- },
42
- "files": {
43
- "ignore": [
44
- "node_modules",
45
- "dist",
46
- "build",
47
- ".next",
48
- "coverage",
49
- "*.min.js",
50
- "pnpm-lock.yaml"
51
- ]
52
- }
53
- }
54
-
@@ -1,28 +0,0 @@
1
- ---
2
- to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>components.json'
3
- ---
4
- {
5
- "$schema": "https://ui.shadcn.com/schema.json",
6
- "style": "new-york",
7
- "rsc": false,
8
- "tsx": true,
9
- "tailwind": {
10
- "config": "tailwind.config.js",
11
- "css": "src/styles.css",
12
- "baseColor": "zinc",
13
- "cssVariables": true,
14
- "prefix": ""
15
- },
16
- "iconLibrary": "lucide",
17
- "aliases": {
18
- "components": "@/components",
19
- "utils": "@/lib/utils",
20
- "ui": "@/components/ui",
21
- "lib": "@/lib",
22
- "hooks": "@/hooks"
23
- },
24
- "registries": {
25
- "@aura": "https://cognitedata.github.io/aura/r/{name}.json"
26
- }
27
- }
28
-