diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6855415eeadca..027417c51a9a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -291,6 +291,21 @@ importers: specifier: 4.9.1 version: 4.9.1(webpack@5.94.0) + projects/js-packages/charts: + devDependencies: + jest: + specifier: 29.7.0 + version: 29.7.0 + jest-environment-jsdom: + specifier: 29.7.0 + version: 29.7.0 + jest-extended: + specifier: 4.0.2 + version: 4.0.2(jest@29.7.0) + typescript: + specifier: 5.0.4 + version: 5.0.4 + projects/js-packages/components: dependencies: '@automattic/format-currency': diff --git a/projects/js-packages/charts/.gitattributes b/projects/js-packages/charts/.gitattributes new file mode 100644 index 0000000000000..7e44bd96454e9 --- /dev/null +++ b/projects/js-packages/charts/.gitattributes @@ -0,0 +1,7 @@ +# Files not needed to be distributed in the package. +.gitattributes export-ignore +node_modules export-ignore + +# Files to exclude from the mirror repo +/changelog/** production-exclude +/.eslintrc.cjs production-exclude diff --git a/projects/js-packages/charts/.gitignore b/projects/js-packages/charts/.gitignore new file mode 100644 index 0000000000000..140fd587d2d52 --- /dev/null +++ b/projects/js-packages/charts/.gitignore @@ -0,0 +1,2 @@ +vendor/ +node_modules/ diff --git a/projects/js-packages/charts/CHANGELOG.md b/projects/js-packages/charts/CHANGELOG.md new file mode 100644 index 0000000000000..721294abd00ad --- /dev/null +++ b/projects/js-packages/charts/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + diff --git a/projects/js-packages/charts/README.md b/projects/js-packages/charts/README.md new file mode 100644 index 0000000000000..91add458062f6 --- /dev/null +++ b/projects/js-packages/charts/README.md @@ -0,0 +1,24 @@ +# charts + +Display charts within Automattic products. + +## How to install charts + +### Installation From Git Repo + +## Contribute + +## Get Help + +## Using this package in your WordPress plugin + +If you plan on using this package in your WordPress plugin, we would recommend that you use [Jetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well. + +## Security + +Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic). + +## License + +charts is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt) + diff --git a/projects/js-packages/charts/changelog/.gitkeep b/projects/js-packages/charts/changelog/.gitkeep new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/projects/js-packages/charts/changelog/initial-version b/projects/js-packages/charts/changelog/initial-version new file mode 100644 index 0000000000000..fb1837c901e51 --- /dev/null +++ b/projects/js-packages/charts/changelog/initial-version @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Initial version. diff --git a/projects/js-packages/charts/composer.json b/projects/js-packages/charts/composer.json new file mode 100644 index 0000000000000..8fc45449250b7 --- /dev/null +++ b/projects/js-packages/charts/composer.json @@ -0,0 +1,42 @@ +{ + "name": "automattic/charts", + "description": "Display charts within Automattic products.", + "type": "library", + "license": "GPL-2.0-or-later", + "require": {}, + "require-dev": { + "automattic/jetpack-changelogger": "@dev" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "test-coverage": [ + "pnpm run test-coverage" + ], + "test-js": [ + "pnpm run test" + ] + }, + "repositories": [ + { + "type": "path", + "url": "../../packages/*", + "options": { + "monorepo": true + } + } + ], + "minimum-stability": "dev", + "prefer-stable": true, + "extra": { + "autotagger": true, + "npmjs-autopublish": true, + "changelogger": { + "link-template": "https://github.com/Automattic/charts/compare/v${old}...v${new}" + }, + "mirror-repo": "Automattic/charts" + } +} diff --git a/projects/js-packages/charts/package.json b/projects/js-packages/charts/package.json new file mode 100644 index 0000000000000..82b515ffa287d --- /dev/null +++ b/projects/js-packages/charts/package.json @@ -0,0 +1,31 @@ +{ + "name": "@automattic/charts", + "version": "0.1.0-alpha", + "description": "Display charts within Automattic products.", + "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/charts/#readme", + "bugs": { + "url": "https://github.com/Automattic/jetpack/labels/[JS Package] Charts" + }, + "repository": { + "type": "git", + "url": "https://github.com/Automattic/jetpack.git", + "directory": "projects/js-packages/charts" + }, + "license": "GPL-2.0-or-later", + "author": "Automattic", + "scripts": { + "test": "jest --config=tests/jest.config.cjs", + "test-coverage": "pnpm run test --coverage" + }, + "devDependencies": { + "jest": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "jest-extended": "4.0.2", + "typescript": "5.0.4" + }, + "exports": { + ".": "./src/index.ts", + "./state": "./src/state", + "./action-types": "./src/state/action-types" + } +} diff --git a/projects/js-packages/charts/src/index.ts b/projects/js-packages/charts/src/index.ts new file mode 100644 index 0000000000000..9ad1e06860e5c --- /dev/null +++ b/projects/js-packages/charts/src/index.ts @@ -0,0 +1,2 @@ +// Put your code in this `src/` folder! +// Feel free to delete or rename this file. diff --git a/projects/js-packages/charts/tests/index.test.js b/projects/js-packages/charts/tests/index.test.js new file mode 100644 index 0000000000000..5a3ba2ed0ddaa --- /dev/null +++ b/projects/js-packages/charts/tests/index.test.js @@ -0,0 +1,18 @@ +// We recommend using `jest` for testing. If you're testing React code, we recommend `@testing-library/react` and related packages. +// Please match the versions used elsewhere in the monorepo. +// +// Please don't add new uses of `mocha`, `chai`, `sinon`, `enzyme`, and so on. We're trying to standardize on one testing framework. +// +// The default setup is to have files named like "name.test.js" (or .jsx, .ts, or .tsx) in this `tests/` directory. +// But you could instead put them in `src/`, or put files like "name.js" (or .jsx, .ts, or .tsx) in `test` or `__tests__` directories somewhere. + +// This is a placeholder test, new tests will be added soon +const placeholderFunction = () => { + return true; +}; + +describe( 'placeholderTest', () => { + it( 'should be a function', () => { + expect( typeof placeholderFunction ).toBe( 'function' ); + } ); +} ); diff --git a/projects/js-packages/charts/tests/jest.config.cjs b/projects/js-packages/charts/tests/jest.config.cjs new file mode 100644 index 0000000000000..b5ceacda1f7e0 --- /dev/null +++ b/projects/js-packages/charts/tests/jest.config.cjs @@ -0,0 +1,7 @@ +const path = require( 'path' ); +const baseConfig = require( 'jetpack-js-tools/jest/config.base.js' ); + +module.exports = { + ...baseConfig, + rootDir: path.join( __dirname, '..' ), +}; diff --git a/projects/js-packages/charts/tsconfig.json b/projects/js-packages/charts/tsconfig.json new file mode 100644 index 0000000000000..0e1116eec9836 --- /dev/null +++ b/projects/js-packages/charts/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "jetpack-js-tools/tsconfig.base.json", + "compilerOptions": { + "typeRoots": [ "./node_modules/@types/", "src/*" ], + "outDir": "./build/" + }, + // List all sources and source-containing subdirs. + "include": [ "./src" ] +}