@process.co/element-types 0.0.1-docs-2 → 0.0.1

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,71 @@
1
+ name: Publish Element Types
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ registry:
9
+ description: 'NPM Registry URL'
10
+ required: false
11
+ type: string
12
+ default: 'https://registry.npmjs.org'
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v3
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v3
26
+ with:
27
+ node-version: 18
28
+ registry-url: ${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}
29
+
30
+ - name: Install pnpm
31
+ uses: pnpm/action-setup@v2
32
+ with:
33
+ version: 10
34
+
35
+ - name: Install dependencies
36
+ run: pnpm install --no-frozen-lockfile
37
+
38
+ - name: Get version from tag
39
+ id: get_version
40
+ run: |
41
+ if [[ "${{ github.event_name }}" == "release" ]]; then
42
+ VERSION=${GITHUB_REF#refs/tags/}
43
+ VERSION=${VERSION#v}
44
+ else
45
+ VERSION=$(node -p "require('./package.json').version")
46
+ fi
47
+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
48
+ echo "Using version: $VERSION"
49
+
50
+ - name: Update version in package.json
51
+ run: |
52
+ sed -i 's/"version": "[^"]*"/"version": "${{ steps.get_version.outputs.VERSION }}"/' package.json
53
+ REGISTRY="${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}"
54
+ jq --arg reg "$REGISTRY" '.publishConfig.registry = $reg | .registry = $reg' package.json > package.json.tmp && mv package.json.tmp package.json
55
+ jq '.publishConfig.access = "public"' package.json > package.json.tmp && mv package.json.tmp package.json
56
+
57
+ - name: Verify package structure
58
+ run: |
59
+ echo "Checking package structure..."
60
+ [ -d "dist" ] || (echo "Error: dist directory missing!" && exit 1)
61
+ [ -f "dist/index.js" ] || (echo "Error: dist/index.js missing!" && exit 1)
62
+ [ -f "dist/index.d.ts" ] || (echo "Error: dist/index.d.ts missing!" && exit 1)
63
+ echo "dist/index.js and dist/index.d.ts found."
64
+ echo "Final package.json:"
65
+ cat package.json
66
+
67
+ - name: Publish to npm
68
+ run: pnpm publish --access=public --no-git-checks
69
+ env:
70
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71
+ NPM_REGISTRY: ${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}
package/README.md CHANGED
@@ -1,60 +1,39 @@
1
- # @process.co/element-types ![NPM Version](https://img.shields.io/npm/v/%40process.co%2Felement-types) ![GitHub Release](https://img.shields.io/github/v/release/process-co/npm-element-types) ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/process-co/npm-element-types/main?color=%23AA00AA)
1
+ # Process.co Element Types
2
2
 
3
-
4
-
5
-
6
-
7
- TypeScript types and utilities for defining Process.co Elements.
3
+ This repository contains the bundled version of the Process.co Element Types.
8
4
 
9
5
  ## Installation
10
6
 
11
7
  ```bash
8
+ # Install
12
9
  npm install @process.co/element-types
13
10
  ```
14
11
 
15
- ### Pinned Version
16
- ```bash
17
- npm install git+https://github.com/process-co/npm-element-types.git#v0.0.1
18
- ```
12
+ ## Usage
13
+
14
+ ### Command Line Interface
19
15
 
20
- ### Latest Development Version
21
16
  ```bash
22
- npm install git+https://github.com/process-co/npm-element-types.git#main
17
+ process-element ./path/to/element
23
18
  ```
24
19
 
25
- ## Usage
20
+ ### Programmatic Usage (CommonJS)
21
+
22
+ ```javascript
23
+ const { loadElement } = require('@process.co/element-types');
26
24
 
27
- ```typescript
28
- import { defineApp } from '@process.co/element-types';
29
-
30
- // Define the app
31
- const exampleApp = defineApp({
32
- type: "app",
33
- app: "example_app",
34
- props: {
35
- someProp: {
36
- label: "Some Prop",
37
- description: "This is some prop",
38
- type: "string",
39
- },
40
- } as const,
41
- methods: {
42
- async doSomthing(this: DeriveAppInstance<ExampleApp>, $: any, switchExpression: string, cases: Record<string, unknown>) {
43
- // Implementation
44
- return {};
45
- },
46
- // ... other methods
47
- },
25
+ // Use the library
26
+ loadElement('./path/to/element').then(result => {
27
+ console.log(result);
48
28
  });
29
+ ```
49
30
 
50
- // Derive types from the implementation
51
- export type ExampleApp = typeof exampleApp;
52
- export type ExampleAppInstance = DeriveAppInstance<ExampleApp>;
31
+ ### Programmatic Usage (ESM)
53
32
 
54
- export default processInternalApp;
33
+ ```javascript
34
+ import { loadElement } from '@process.co/element-types';
55
35
 
36
+ // Use the library
37
+ const result = await loadElement('./path/to/element');
38
+ console.log(result);
56
39
  ```
57
-
58
- ## License
59
-
60
- MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@process.co/element-types",
3
- "version": "0.0.1-docs-2",
3
+ "version": "0.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@repo/config-typescript/library.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "src",
5
+ "incremental": false,
6
+ "outDir": "dist",
7
+ "noImplicitAny": false,
8
+ "esModuleInterop": true
9
+ },
10
+ "include": ["./src"],
11
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
12
+ }