@junobuild/cli-tools 0.0.10 → 0.0.11

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.
@@ -0,0 +1,12 @@
1
+ import type { CliConfig } from '@junobuild/config';
2
+ import type { FileDetails, ListAssets, UploadFile } from '../types/deploy';
3
+ export declare const deploy: ({ assertMemory, uploadFile, ...rest }: {
4
+ config: CliConfig;
5
+ listAssets: ListAssets;
6
+ assertSourceDirExists?: (source: string) => void;
7
+ assertMemory: () => Promise<void>;
8
+ uploadFile: UploadFile;
9
+ }) => Promise<{
10
+ sourceFiles: FileDetails[];
11
+ sourceAbsolutePath: string;
12
+ }>;
@@ -0,0 +1,7 @@
1
+ export declare const DEPLOY_DEFAULT_SOURCE = "build";
2
+ export declare const DEPLOY_DEFAULT_IGNORE: never[];
3
+ export declare const DEPLOY_DEFAULT_ENCODING: never[];
4
+ export declare const DEPLOY_DEFAULT_GZIP = "**/*.+(css|js|mjs)";
5
+ export declare const IGNORE_OS_FILES: string[];
6
+ export declare const COLLECTION_DAPP = "#dapp";
7
+ export declare const UPLOAD_BATCH_SIZE = 20;
@@ -1,5 +1,6 @@
1
- export * from './configs/juno.config';
2
- export type * from './types/config';
1
+ export * from './commands/deploy';
2
+ export * from './constants/deploy.constants';
3
+ export type * from './types/deploy';
3
4
  export * from './utils/args.utils';
4
5
  export * from './utils/cmd.utils';
5
6
  export * from './utils/compress.utils';
@@ -0,0 +1,10 @@
1
+ import type { CliConfig } from '@junobuild/config';
2
+ import type { FileDetails, ListAssets } from '../types/deploy';
3
+ export declare const prepareDeploy: ({ config, listAssets, assertSourceDirExists }: {
4
+ config: CliConfig;
5
+ listAssets: ListAssets;
6
+ assertSourceDirExists?: (source: string) => void;
7
+ }) => Promise<{
8
+ files: FileDetails[];
9
+ sourceAbsolutePath: string;
10
+ }>;
@@ -0,0 +1,6 @@
1
+ import type { FileDetails, UploadFile } from '../types/deploy';
2
+ export declare const upload: ({ files: sourceFiles, sourceAbsolutePath, uploadFile }: {
3
+ files: FileDetails[];
4
+ sourceAbsolutePath: string;
5
+ uploadFile: UploadFile;
6
+ }) => Promise<void>;
@@ -0,0 +1,31 @@
1
+ /// <reference types="node" />
2
+ import type { ENCODING_TYPE } from '@junobuild/config';
3
+ import type { Blob } from 'buffer';
4
+ import type { MimeType } from 'file-type';
5
+ export interface FileDetails {
6
+ file: string;
7
+ alternateFile?: string;
8
+ encoding?: ENCODING_TYPE;
9
+ mime?: MimeType;
10
+ }
11
+ export interface AssetEncoding {
12
+ sha256: string;
13
+ }
14
+ export interface Asset {
15
+ fullPath: string;
16
+ encodings: Record<ENCODING_TYPE, AssetEncoding>;
17
+ }
18
+ export type ListAssets = ({ startAfter }: {
19
+ startAfter?: string;
20
+ }) => Promise<Asset[]>;
21
+ export interface UploadFileStorage {
22
+ filename: string;
23
+ data: Blob;
24
+ collection: string;
25
+ fullPath?: string;
26
+ headers?: [string, string][];
27
+ token?: string;
28
+ encoding?: ENCODING_TYPE;
29
+ description?: string;
30
+ }
31
+ export type UploadFile = (params: UploadFileStorage) => Promise<void>;
@@ -1,4 +1,13 @@
1
1
  /// <reference types="node" />
2
+ import type { SatelliteConfig } from '@junobuild/config';
2
3
  export declare const gunzipFile: ({ source }: {
3
4
  source: Buffer;
4
5
  }) => Promise<Buffer>;
6
+ export declare const gzipFiles: ({ sourceFiles, gzip }: {
7
+ sourceFiles: string[];
8
+ } & Required<Pick<SatelliteConfig, 'gzip'>>) => Promise<string[]>;
9
+ export declare const gzipFile: ({ source, destination }: {
10
+ source: string;
11
+ destination?: string;
12
+ }) => Promise<string>;
13
+ export declare const isGzip: (buffer: Buffer) => boolean;
@@ -0,0 +1,8 @@
1
+ import type { SatelliteConfig } from '@junobuild/config';
2
+ export declare const fullPath: ({ file, sourceAbsolutePath }: {
3
+ file: string;
4
+ sourceAbsolutePath: string;
5
+ }) => string;
6
+ export declare const listSourceFiles: ({ sourceAbsolutePath, ignore }: {
7
+ sourceAbsolutePath: string;
8
+ } & Required<Pick<SatelliteConfig, 'ignore'>>) => string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/cli-tools",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "A collection of tools for Juno CLIs and Plugins.",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -57,8 +57,14 @@
57
57
  "@junobuild/utils": "*"
58
58
  },
59
59
  "dependencies": {
60
- "@babel/core": "^7.24.6",
61
- "@babel/plugin-transform-modules-commonjs": "^7.24.6",
62
- "@babel/preset-typescript": "^7.24.6"
60
+ "file-type": "^19.0.0",
61
+ "listr": "^0.14.3",
62
+ "mime-types": "^2.1.35",
63
+ "minimatch": "^9.0.4"
64
+ },
65
+ "devDependencies": {
66
+ "@types/listr": "^0.14.9",
67
+ "@types/mime-types": "^2.1.4",
68
+ "@types/minimatch": "^5.1.2"
63
69
  }
64
70
  }
@@ -1,15 +0,0 @@
1
- import type { JunoConfig, JunoConfigFnOrObject, JunoDevConfig, JunoDevConfigFnOrObject } from '@junobuild/config';
2
- import type { ConfigFilename, ConfigType } from '../types/config';
3
- export declare const junoConfigExist: (params: {
4
- filename: ConfigFilename;
5
- }) => Promise<boolean>;
6
- export declare const junoConfigFile: ({ filename }: {
7
- filename: ConfigFilename;
8
- }) => {
9
- configPath: string;
10
- configType: ConfigType;
11
- };
12
- export declare const readJunoConfig: <ConfigFnOrObject extends JunoConfigFnOrObject | JunoDevConfigFnOrObject, Config extends JunoConfig | JunoDevConfig>({ config, ...rest }: {
13
- filename: ConfigFilename;
14
- config: (userConfig: ConfigFnOrObject) => Config;
15
- }) => Promise<Config>;
@@ -1,2 +0,0 @@
1
- export type ConfigType = 'ts' | 'js' | 'json';
2
- export type ConfigFilename = `${'juno.'}${'' | 'dev.'}${'config'}`;
@@ -1,9 +0,0 @@
1
- /**
2
- * Adapted source from Stencil (https://github.com/ionic-team/stencil/blob/main/src/compiler/sys/node-require.ts)
3
- */
4
- export declare const nodeRequire: <T>({ id, extension }: {
5
- id: string;
6
- extension: string;
7
- }) => {
8
- default: T;
9
- };