Skip to content

Commit

Permalink
Add terminal package
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 7, 2024
1 parent 1bd4954 commit f003f5f
Show file tree
Hide file tree
Showing 20 changed files with 503 additions and 38 deletions.
6 changes: 1 addition & 5 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"files": [
"dist"
],
"bin": {
"cojourney": "./terminal.mjs"
},
"exports": {
".": {
"import": "./dist/index.esm.js",
Expand All @@ -29,7 +26,6 @@
"sideEffects": false,
"scripts": {
"dev": "rollup -c -w",
"dev:terminal": "node terminal.mjs",
"build": "rollup -c && tsc --declaration --emitDeclarationOnly --declarationDir dist",
"build:types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
"test": "jest",
Expand Down Expand Up @@ -104,6 +100,6 @@
"yarn": ">= 1.20.x"
},
"buildOptions": {
"name": "TypeScriptStarterLibrary"
"name": "cojourney-agent"
}
}
1 change: 1 addition & 0 deletions packages/terminal/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SERVER_URL = "https://cojourney.shawmakesmagic.workers.dev"
4 changes: 4 additions & 0 deletions packages/terminal/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules/*
**/coverage/*
**/dist/*
**/types/*
18 changes: 18 additions & 0 deletions packages/terminal/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"env": {
"node": true,
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"]
}
13 changes: 13 additions & 0 deletions packages/terminal/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Set the default behavior for text file attributes.
# - Treat them as text.
# - Ensure no CRLF line-endings, neither on checkout nor on checkin.
* text=auto eol=lf

# Denote JSON configuration files that include comments
*.json linguist-language=JSON-with-Comments

# Denote all files that are truly binary and should not be modified.
*.gif binary
*.png binary
*.jpg binary
*.jpeg binary
32 changes: 32 additions & 0 deletions packages/terminal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.DS_Store

# production
dist

.env.local

# dependencies
node_modules
.pnp
.pnp.js

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# temporary files
temp
types

# code coverage directories
coverage
.nyc_output

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
31 changes: 31 additions & 0 deletions packages/terminal/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO.

# Ignore all files by default, to avoid accidentally publishing unintended files.
*

# Use negative patterns to bring back the specific things we want to publish.
!/bin/**
!/lib/**
!/lib-*/**
!/dist/**
!ThirdPartyNotice.txt

# Ignore certain patterns that should not get published.
/dist/*.stats.*
/lib/**/test/
/lib-*/**/test/
*.test.js
*-metadata.json

# NOTE: These don't need to be specified, because NPM includes them automatically.
#
# package.json
# README (and its variants)
# CHANGELOG (and its variants)
# LICENSE / LICENCE

#--------------------------------------------
# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE
#--------------------------------------------

# (Add your project-specific overrides here)
7 changes: 7 additions & 0 deletions packages/terminal/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/node_modules/*
**/coverage/*
**/dist/*
**/docs/*
**/temp/*
tsconfig.json
CHANGELOG.md
9 changes: 9 additions & 0 deletions packages/terminal/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "es5",
"semi": false,
"printWidth": 80,
"importOrder": ["<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[~/]", "^[./]"],
"importOrderSortSpecifiers": true
}
11 changes: 11 additions & 0 deletions packages/terminal/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/github",
"@semantic-release/npm",
"@semantic-release/git"
]
}
18 changes: 18 additions & 0 deletions packages/terminal/api-documenter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Config file for API Documenter. For more info, please visit: https://api-extractor.com
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-documenter.schema.json",

/**
* Configures how the documentation will be generated.
*/
"outputTarget": "markdown",

/**
* Specifies what type of newlines API Extractor should use when writing output files.
*
* DEFAULT VALUE: "crlf"
*/
"newlineKind": "lf"
}
108 changes: 108 additions & 0 deletions packages/terminal/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

/**
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
* analyzes the symbols exported by this module.
*/
"mainEntryPointFilePath": "<projectFolder>/types/index.d.ts",

/**
* A list of NPM package names whose exports should be treated as part of this package.
*/
"bundledPackages": [],

/**
* Configures how the API report file (*.api.md) will be generated.
*/
"apiReport": {
/**
* (REQUIRED) Whether to generate an API report.
*/
"enabled": true,

/**
* Specifies the folder where the API report file is written.
* The file name portion is determined by the \"reportFileName\" setting.
* The API report file is normally tracked by Git.
* Changes to it can be used to trigger a branch policy, e.g. for an API review.
* The path is resolved relative to the folder of the config file that contains
* the setting; to change this, prepend a folder token such as \"<projectFolder>\".
*/
"reportFolder": "<projectFolder>/temp/"
},

/**
* Configures how the doc model file (*.api.json) will be generated.
*/
"docModel": {
/**
* (REQUIRED) Whether to generate a doc model file.
*/
"enabled": true
},

/**
* Configures how the .d.ts rollup file will be generated.
*/
"dtsRollup": {
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": true,

/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
* This file will include all declarations that are exported by the main entry point.
*
* If the path is an empty string, then this file will not be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
"untrimmedFilePath": "<projectFolder>/dist/index.d.ts"
},

/**
* Configures how the tsdoc-metadata.json file will be generated.
*/
"tsdocMetadata": {
/**
* Whether to generate the tsdoc-metadata.json file.
*/
"enabled": false
},

/**
* Specifies what type of newlines API Extractor should use when writing output files.
*
* DEFAULT VALUE: "crlf"
*/
"newlineKind": "lf",

/**
* Configures how API Extractor reports error and warning messages produced during analysis.
*/
"messages": {
/**
* Configures handling of messages from the TSDoc parser (i.e. code comment syntax)
*/
"tsdocMessageReporting": {
// By default, errors are shown on the console and will break a production build
"default": {"logLevel": "warning"},

// Write unsupported and undefined tags into the API review file
"tsdoc-undefined-tag": {"logLevel": "none", "addToApiReportFile": true},
"tsdoc-unsupported-tag": {"logLevel": "none", "addToApiReportFile": true},

// "The `}` character should be escaped using a backslash to avoid confusion
// with a TSDoc inline tag."
"tsdoc-escape-right-brace": {"logLevel": "none"}
}
}
}
12 changes: 12 additions & 0 deletions packages/terminal/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md)

## API Reference

## Packages

| Package | Description |
| --- | --- |
| [typeScript-starter-lib](./typescript-starter-lib.md) | |

17 changes: 17 additions & 0 deletions packages/terminal/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const pkg = require('./package.json')

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['/node_modules/', '/types/'],
globals: {
__DEV__: true,
__TEST__: true,
__VERSION__: pkg.version,
},
moduleNameMapper: {
'^@/(.*)': '<rootDir>/src/$1',
},
}
Loading

0 comments on commit f003f5f

Please sign in to comment.