@process.co/element-types 0.0.1-docs-3 → 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,62 +1,39 @@
1
- # @process.co/element-types
1
+ # Process.co Element Types
2
2
 
3
- [<img src="https://img.shields.io/npm/v/%40process.co%2Felement-types" />](https://www.npmjs.com/package/@process.co/element-types)
4
- [<img src="https://img.shields.io/github/v/release/process-co/npm-element-types" />](https://github.com/process-co/npm-element-types/releases/latest)
5
- [<img alt="GitHub package.json version (branch)" src="https://img.shields.io/github/package-json/v/process-co/npm-element-types/main?color=%23AA00AA" />
6
- ](https://github.com/process-co/npm-element-types#main)
7
-
8
-
9
- TypeScript types and utilities for defining Process.co Elements.
3
+ This repository contains the bundled version of the Process.co Element Types.
10
4
 
11
5
  ## Installation
12
6
 
13
7
  ```bash
8
+ # Install
14
9
  npm install @process.co/element-types
15
10
  ```
16
11
 
17
- ### Pinned Version
18
- ```bash
19
- npm install git+https://github.com/process-co/npm-element-types.git#v0.0.1
20
- ```
12
+ ## Usage
13
+
14
+ ### Command Line Interface
21
15
 
22
- ### Latest Development Version
23
16
  ```bash
24
- npm install git+https://github.com/process-co/npm-element-types.git#main
17
+ process-element ./path/to/element
25
18
  ```
26
19
 
27
- ## Usage
20
+ ### Programmatic Usage (CommonJS)
21
+
22
+ ```javascript
23
+ const { loadElement } = require('@process.co/element-types');
28
24
 
29
- ```typescript
30
- import { defineApp } from '@process.co/element-types';
31
-
32
- // Define the app
33
- const exampleApp = defineApp({
34
- type: "app",
35
- app: "example_app",
36
- props: {
37
- someProp: {
38
- label: "Some Prop",
39
- description: "This is some prop",
40
- type: "string",
41
- },
42
- } as const,
43
- methods: {
44
- async doSomthing(this: DeriveAppInstance<ExampleApp>, $: any, switchExpression: string, cases: Record<string, unknown>) {
45
- // Implementation
46
- return {};
47
- },
48
- // ... other methods
49
- },
25
+ // Use the library
26
+ loadElement('./path/to/element').then(result => {
27
+ console.log(result);
50
28
  });
29
+ ```
51
30
 
52
- // Derive types from the implementation
53
- export type ExampleApp = typeof exampleApp;
54
- export type ExampleAppInstance = DeriveAppInstance<ExampleApp>;
31
+ ### Programmatic Usage (ESM)
55
32
 
56
- export default processInternalApp;
33
+ ```javascript
34
+ import { loadElement } from '@process.co/element-types';
57
35
 
36
+ // Use the library
37
+ const result = await loadElement('./path/to/element');
38
+ console.log(result);
58
39
  ```
59
-
60
- ## License
61
-
62
- MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@process.co/element-types",
3
- "version": "0.0.1-docs-3",
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
+ }