@ciderjs/gasnuki 0.2.1 → 0.2.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/README.md CHANGED
@@ -26,11 +26,22 @@ pnpm add @ciderjs/gasnuki
26
26
  npx @ciderjs/gasnuki
27
27
  ```
28
28
 
29
+ ... or, add project's npm-script in `package.json`:
30
+
31
+ ```jsonc
32
+ {
33
+ // others...
34
+ "scripts": {
35
+ "gas": "gasnuki"
36
+ }
37
+ }
38
+ ```
39
+
29
40
  This will generate type definition files in the `types` directory by default.
30
41
 
31
42
  2. Make sure the generated directory (default: `types`) is included in your `tsconfig.json`:
32
43
 
33
- ```json
44
+ ```jsonc
34
45
  {
35
46
  "compilerOptions": {
36
47
  // ... your options ...
@@ -65,4 +76,4 @@ Bug reports and pull requests are welcome. Please use the `issues` or `pull requ
65
76
 
66
77
  ## License
67
78
 
68
- MIT
79
+ MIT
package/dist/cli.cjs CHANGED
@@ -24,7 +24,7 @@ function _interopNamespaceCompat(e) {
24
24
 
25
25
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
26
26
 
27
- const version = "0.2.1";
27
+ const version = "0.2.2";
28
28
 
29
29
  const parseArgs = async (command) => {
30
30
  const cliOpts = command.opts();
package/dist/cli.mjs CHANGED
@@ -8,7 +8,7 @@ import 'node:fs';
8
8
  import 'ts-morph';
9
9
  import 'jiti';
10
10
 
11
- const version = "0.2.1";
11
+ const version = "0.2.2";
12
12
 
13
13
  const parseArgs = async (command) => {
14
14
  const cliOpts = command.opts();
package/dist/promise.cjs CHANGED
@@ -4,7 +4,7 @@ const getPromisedServerScripts = (mockupFunctions = {}) => {
4
4
  const serverScripts = {
5
5
  ...mockupFunctions
6
6
  };
7
- if (!("google" in globalThis)) {
7
+ if (!("google" in globalThis) || !google?.script?.run) {
8
8
  return serverScripts;
9
9
  }
10
10
  for (const method of Object.keys(google.script.run)) {
package/dist/promise.mjs CHANGED
@@ -2,7 +2,7 @@ const getPromisedServerScripts = (mockupFunctions = {}) => {
2
2
  const serverScripts = {
3
3
  ...mockupFunctions
4
4
  };
5
- if (!("google" in globalThis)) {
5
+ if (!("google" in globalThis) || !google?.script?.run) {
6
6
  return serverScripts;
7
7
  }
8
8
  for (const method of Object.keys(google.script.run)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciderjs/gasnuki",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Type definitions and utilities for Google Apps Script client-side API",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -20,13 +20,13 @@
20
20
  }
21
21
  },
22
22
  "scripts": {
23
- "prebuild": "jiti bin/generate.ts",
23
+ "generate": "jiti .bin/generate.ts",
24
24
  "dev": "pnpm prebuild && jiti src/cli.ts -p playground/react -s src/server",
25
25
  "start": "node dist/cli.mjs -p playground/react -s src/server",
26
26
  "check": "biome check --write",
27
27
  "build": "unbuild",
28
28
  "test": "vitest run",
29
- "prepare": "pnpm run check && pnpm run build",
29
+ "prepare": "pnpm run generate && pnpm run check && pnpm run test && pnpm run build",
30
30
  "pg:react": "pnpm -C playground/react",
31
31
  "pg:vue": "pnpm -C playground/vue3"
32
32
  },
@@ -52,6 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@biomejs/biome": "^1.9.4",
54
54
  "@types/node": "^22.15.29",
55
+ "@vitest/coverage-v8": "3.2.1",
55
56
  "typescript": "^5.8.3",
56
57
  "unbuild": "^3.5.0",
57
58
  "vitest": "^3.2.1"
@@ -4,7 +4,7 @@ export type RemoveReturnType<T> = {
4
4
  : T[P];
5
5
  };
6
6
 
7
- type _AppsScriptRun = RemoveReturnType<ServerScripts> & {
7
+ type _AppsScriptRun = {
8
8
  [key: string]: (...args: any[]) => any;
9
9
  withSuccessHandler: <T = string | number | boolean | undefined, U = any>(
10
10
  callback: (returnValues: T, userObject?: U) => void,
package/bin/generate.ts DELETED
@@ -1,11 +0,0 @@
1
- import * as fs from 'node:fs/promises';
2
-
3
- (async () => {
4
- const file = await fs.readFile('./bin/typedef/clientside.d.ts', 'utf-8');
5
- await fs.writeFile(
6
- './src/modules/clientside.json',
7
- JSON.stringify({
8
- text: file,
9
- }),
10
- );
11
- })();