Skip to content

Commit

Permalink
Merge pull request #20 from LucaFinancial/releases/1.0.7
Browse files Browse the repository at this point in the history
Sync dev with 1.0.7
  • Loading branch information
jwaspin authored May 1, 2024
2 parents c80686a + fab21ff commit 7305598
Show file tree
Hide file tree
Showing 8 changed files with 582 additions and 69 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# LucaSchema

Schema for the Luca Ledger application
37 changes: 37 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import prettierPlugin from 'eslint-plugin-prettier';
import jsonPlugin from 'eslint-plugin-json';

export default [
{
languageOptions: {
globals: globals.browser,
ecmaVersion: 2023,
sourceType: 'module'
},
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-env']
}
}
},
pluginJs.configs.recommended,
prettierPlugin.configs.recommended,
jsonPlugin.configs.recommended,
{
settings: {
jest: {
version: 29
}
},
plugins: {
prettier: prettierPlugin,
json: jsonPlugin
},
rules: {
'prettier/prettier': ['error'],
}
}
];
34 changes: 20 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luca-financial/luca-schema",
"version": "1.0.7-beta.4",
"version": "1.0.7",
"description": "Schemas for the Luca Ledger application",
"author": "Johnathan Aspinwall",
"main": "dist/index.js",
Expand Down Expand Up @@ -31,18 +31,6 @@
"publish-beta": "yarn && yarn build && yarn publish --tag beta --access public",
"test": "yarn build && jest"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"babel-jest": "^29.7.0",
"fs-extra": "^11.2.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5"
},
"exports": {
".": {
"import": "./dist/esm/index.js",
Expand All @@ -57,5 +45,23 @@
"dist/",
"LICENSE",
"README.md"
]
],
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"@eslint/js": "^9.1.1",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"babel-jest": "^29.7.0",
"eslint": "^9.1.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-prettier": "^5.1.3",
"fs-extra": "^11.2.0",
"globals": "^15.1.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5"
}
}
14 changes: 7 additions & 7 deletions scripts/buildEsm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ const config = require('./config.cjs');

const {
schemasSrc,
constantsSrc,
enumsSrc,
indexSrc,
validatorSrc,
esmConstantsDst,
esmEnumsDst,
esmIndexDst,
esmValidatorDst,
esmSchemasDst
} = config;

const copyConstants = async () => {
const copyEnums = async () => {
return fs
.copy(constantsSrc, esmConstantsDst)
.then(() => console.log('Copy constants.js completed!'))
.copy(enumsSrc, esmEnumsDst)
.then(() => console.log('Copy enums.js completed!'))
.catch(err =>
console.error('An error occurred while copying constants.js', err)
console.error('An error occurred while copying enums.js', err)
);
};

Expand Down Expand Up @@ -50,7 +50,7 @@ const copySchemas = async () => {
};

const buildEsm = async () => {
await copyConstants();
await copyEnums();
await copyIndex();
await copyValidator();
await copySchemas();
Expand Down
8 changes: 4 additions & 4 deletions scripts/config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');

const srcPath = path.join(__dirname, '..', 'src');
const constantsSrc = path.join(srcPath, 'constants.js');
const enumsSrc = path.join(srcPath, 'enums.js');
const examplesSrc = path.join(srcPath, 'examples');
const indexSrc = path.join(srcPath, 'index.js');
const schemasSrc = path.join(srcPath, 'schemas');
Expand All @@ -14,7 +14,7 @@ const cjsExamplesDst = path.join(cjsPath, 'examples');
const cjsSchemasDst = path.join(cjsPath, 'schemas');

const esmPath = path.join(distPath, 'esm');
const esmConstantsDst = path.join(esmPath, 'constants.js');
const esmEnumsDst = path.join(esmPath, 'enums.js');
const esmIndexDst = path.join(esmPath, 'index.js');
const esmSchemasDst = path.join(esmPath, 'schemas');
const esmValidatorDst = path.join(esmPath, 'lucaValidator.js');
Expand All @@ -25,12 +25,12 @@ module.exports = {
esmPath,
cjsExamplesDst,
cjsSchemasDst,
esmConstantsDst,
esmEnumsDst,
esmIndexDst,
esmValidatorDst,
esmSchemasDst,
srcPath,
constantsSrc,
enumsSrc,
examplesSrc,
indexSrc,
schemasSrc,
Expand Down
26 changes: 18 additions & 8 deletions src/constants.js → src/enums.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
const SchemasEnum = Object.freeze({
CATEGORY: 'category',
ENTITY: 'entity',
LUCASCHEMA: 'lucaSchema',
RECURRING_TRANSACTION: 'recurringTransaction',
RECURRING_TRANSACTION_EVENT: 'recurringTransactionEvent',
SCHEMA: 'schema',
TRANSACTION: 'transaction'
});

const TransactionStateEnum = Object.freeze({
PLANNED: 'PLANNED',
SCHEDULED: 'SCHEDULED',
Expand Down Expand Up @@ -35,33 +45,33 @@ const EntityStatusEnum = Object.freeze({
CLOSED: 'CLOSED'
});

const RepeatedTransactionFrequencyEnum = Object.freeze({
const RecurringTransactionFrequencyEnum = Object.freeze({
DAY: 'DAY',
WEEK: 'WEEK',
MONTH: 'MONTH',
YEAR: 'YEAR'
});

const RepeatedTransactionStateEnum = Object.freeze({
const RecurringTransactionStateEnum = Object.freeze({
ACTIVE: 'ACTIVE',
PAUSED: 'PAUSED',
COMPLETED: 'COMPLETED',
CANCELLED: 'CANCELLED'
});

const RepeatedTransactionOccurrenceStatusEnum = Object.freeze({
const RecurringTransactionEventStatusEnum = Object.freeze({
MODIFIED: 'MODIFIED',
DELETED: 'DELETED'
});

const constants = {
const enums = {
TransactionStateEnum,
CategoryTypeEnum,
EntityTypeEnum,
EntityStatusEnum,
RepeatedTransactionFrequencyEnum,
RepeatedTransactionStateEnum,
RepeatedTransactionOccurrenceStatusEnum
RecurringTransactionFrequencyEnum,
RecurringTransactionStateEnum,
RecurringTransactionEventStatusEnum
};

export default constants;
export default enums;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import constants from './constants';
import enums from './enums';
import lucaValidator from './lucaValidator';
import schemas from './schemas';

export { constants,lucaValidator, schemas };
export { enums, lucaValidator, schemas };
Loading

0 comments on commit 7305598

Please sign in to comment.