Skip to content

Commit

Permalink
chore: support import attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Jul 24, 2023
1 parent 73a5172 commit 45cf95e
Show file tree
Hide file tree
Showing 67 changed files with 1,656 additions and 1,549 deletions.
37 changes: 22 additions & 15 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
const path = require('path');
const jsConfig = require('./jsconfig.json');

module.exports = {
include: [/src/, /node_modules/],
presets: ['@babel/preset-env'],
plugins: [
[
'module-resolver',
{
root: [path.resolve(jsConfig.compilerOptions.baseUrl)],
},
],
],
};
const path = require('path');
const jsConfig = require('./jsconfig.json');

module.exports = {
include: [/src/, /node_modules/],
presets: ['@babel/preset-env'],
plugins: [
[
'@babel/plugin-syntax-import-attributes',
{
// Enable the deprecatedAssertSyntax option
deprecatedAssertSyntax: true,
},
],
[
'module-resolver',
{
root: [path.resolve(jsConfig.compilerOptions.baseUrl)],
},
],
],
};
13 changes: 11 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
},
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
"sourceType": "module",
"requireConfigFile": false
},
"parser": "@babel/eslint-parser",
"rules": {
"es/no-dynamic-import": "error"
},
"plugins": ["mocha", "es"],
"extends": ["eslint:recommended", "plugin:mocha/recommended"]
"extends": ["eslint:recommended", "plugin:mocha/recommended"],
"settings": {
"es": {
"deprecatedAssertSyntax": true,
"allowImportExportEverywhere": true,
"importAssertions": true
}
}
}
12 changes: 3 additions & 9 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{
"*.+(js|ts|tsx)": [
"eslint",
"prettier --write"
],
"**/*.+(js|json|ts|tsx)": [
"prettier --write"
]
}
{
"*.+(js|ts|tsx)": ["eslint", "prettier --write 'src/**/*.(js|ts|tsx)'"]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13
18.16
82 changes: 76 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"bin": "build/server.js",
"type": "module",
"engines": {
"node": ">=16.13"
"node": ">=18.16"
},
"scripts": {
"requirements-check": "node --experimental-json-modules check_node_version.js",
"requirements-check": "node --experimental-json-modules --experimental-import-assertions check_node_version.js",
"start": "npx cross-env NODE_ENV=local node --experimental-specifier-resolution=node --no-warnings ./src/server.js",
"test": "npm run resetTestDb && npx cross-env NODE_ENV=test USE_SIMULATOR=true mocha tests/**/*.spec.js --reporter spec --exit --timeout 300000",
"release": "npx standard-version",
Expand All @@ -21,10 +21,10 @@
"build": "babel src --keep-file-extension --out-dir build --copy-files && cp package.json ./build",
"build-migrations": "babel migrations --keep-file-extension --out-dir dist/migrations --copy-files",
"prepare-binary": "rm -rf dist && mkdir dist",
"create-win-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-win-x64 --out-path dist",
"create-mac-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-macos-x64 --out-path dist",
"create-linux-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-linux-x64 --out-path dist",
"create-linux-arm64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-linux-arm64 --out-path dist"
"create-win-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node18-win-x64 --out-path dist",
"create-mac-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node18-macos-x64 --out-path dist",
"create-linux-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node18-linux-x64 --out-path dist",
"create-linux-arm64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node18-linux-arm64 --out-path dist"
},
"pkg": {
"scripts": "package.json",
Expand Down Expand Up @@ -59,7 +59,10 @@
"devDependencies": {
"@babel/cli": "^7.22.5",
"@babel/core": "^7.22.5",
"@babel/eslint-parser": "^7.22.9",
"@babel/plugin-syntax-import-attributes": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/runtime": "^7.22.6",
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"babel-plugin-module-resolver": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/governance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from '../utils/data-assertions';

import { getConfig } from '../utils/config-loader';
import glossary from '../models/governance/glossary.stub.json';
import pickList from '../models/governance/governance.stub.json';
import glossary from '../models/governance/glossary.stub.js';
import pickList from '../models/governance/governance.stub.js';

const CONFIG = getConfig().APP;

Expand Down
14 changes: 7 additions & 7 deletions src/database/seeders/20211209204301-add-projects.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

import ProjectStub from '../../models/projects/projects.stub.json';
import CoBenifetStub from '../../models/co-benefits/co-benefits.stub.json';
import RelatedProjectStub from '../../models/related-projects/related-projects.stub.json';
import LabelStub from '../../models/labels/labels.stub.json';
import RatingsStub from '../../models/ratings/ratings.stub.json';
import IssuanceStub from '../../models/issuances/issuances.stub.json';
import LocationsStub from '../../models/locations/locations.stub.json';
import ProjectStub from '../../models/projects/projects.stub.js';
import CoBenifetStub from '../../models/co-benefits/co-benefits.stub.js';
import RelatedProjectStub from '../../models/related-projects/related-projects.stub.js/index.js';
import LabelStub from '../../models/labels/labels.stub.js';
import RatingsStub from '../../models/ratings/ratings.stub.js/index.js';
import IssuanceStub from '../../models/issuances/issuances.stub.js';
import LocationsStub from '../../models/locations/locations.stub.js';

export default {
// eslint-disable-next-line no-unused-vars
Expand Down
4 changes: 2 additions & 2 deletions src/database/seeders/20211209205139-add-units.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import UnitStub from '../../models/units/units.stub.json';
import LabelUnitStub from '../../models/labelUnits/labelUnits.stub.json';
import UnitStub from '../../models/units/units.stub.js';
import LabelUnitStub from '../../models/labelUnits/labelUnits.stub.js';

export default {
// eslint-disable-next-line no-unused-vars
Expand Down
3 changes: 1 addition & 2 deletions src/database/seeders/20220121232631-add-test-organization.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

import OrganizationStub from '../../models/organizations/organizations.stub.json';

import OrganizationStub from '../../models/organizations/organizations.stub.js';
export default {
up: async (queryInterface) => {
await queryInterface.bulkInsert('organizations', OrganizationStub, {});
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
assertDataLayerAvailable,
assertWalletIsAvailable,
} from './utils/data-assertions';
import packageJson from '../package.json';
import packageJson from '../package.json' assert { type: 'json' };
import datalayer from './datalayer';

const { CADT_API_KEY, READ_ONLY, IS_GOVERNANCE_BODY, USE_SIMULATOR } =
Expand Down
2 changes: 1 addition & 1 deletion src/models/audit/audit.mock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import stub from './audit.stub.json';
import stub from './audit.stub.js';

export const AuditMock = {
findAll: () => stub,
Expand Down
1 change: 1 addition & 0 deletions src/models/audit/audit.stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default [];
1 change: 0 additions & 1 deletion src/models/audit/audit.stub.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/models/co-benefits/co-benefits.mock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import stub from './co-benefits.stub.json';
import stub from './co-benefits.stub.js';

export const CoBenefitsMock = {
findAll: () => stub,
Expand Down
70 changes: 70 additions & 0 deletions src/models/co-benefits/co-benefits.stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
export default [
{
id: '404dcb94-3df9-4773-99a3-1a2228726282',
orgUid: 'a807e453-6524-49df-a32d-785e56cf560e',
cobenefit: 'Biodiversity - species diversity',
warehouseProjectId: '751ad8a7-7066-4f5d-ac84-9dc41f360643',
},
{
id: 'e0b32432-3aa1-40fe-bb36-8e508f7e70d5',
orgUid: 'a807e453-6524-49df-a32d-785e56cf560e',
cobenefit:
'K12 Education - program includes educating Arcata city schools on the importance of forests in combating climate change.',
warehouseProjectId: '751ad8a7-7066-4f5d-ac84-9dc41f360643',
},
{
id: 'a05cb933-4ca1-484c-b7b2-21d3d2a472e3',
orgUid: 'a807e453-6524-49df-a32d-785e56cf560e',
cobenefit:
'Small business benefits - program includes sourcing materials from local businesses.',
warehouseProjectId: '751ad8a7-7066-4f5d-ac84-9dc41f360643',
},
{
id: '988f05ac-a917-482d-a4c2-7a5826326c22',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Oceanic quality improvements - reduction in foreign plastic materials damaging ocean species.',
warehouseProjectId: '8fb7906b-b09f-426e-adf9-63273e0f7f50',
},
{
id: 'd1f4ad9a-f463-477f-942a-87a9a2832fe1',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Job creation - adminstrative and coordinator jobs created to manage certain aspects of the program.',
warehouseProjectId: '8fb7906b-b09f-426e-adf9-63273e0f7f50',
},
{
id: '18dec44e-02d0-42bd-8bc0-2dfa8b2eb976',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Local education - educating communities on the negative impacts of plastic pollution in the ocean and how to help prevent pollution.',
warehouseProjectId: '8fb7906b-b09f-426e-adf9-63273e0f7f50',
},
{
id: '94592705-5b65-4639-bd8f-7e6e34ce98c5',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Promoting gender equality - program asserts 50% of management positions are filled by women.',
warehouseProjectId: 'd39494d6-fb55-4741-b127-75a9fae5294a',
},
{
id: '02bcab7d-5fe9-4907-9e53-1f664e39a4a8',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Promoting gender equality - provides households with tools to reduce cooking time, which is generally performed by women in the family. This enables women more time to participate in wage earning activities.',
warehouseProjectId: 'e074bf77-e154-4f70-824e-093fa72cd066',
},
{
id: '78b58617-1875-4bbf-985e-9a3b5ade6da4',
orgUid: 'ca1e1619-d073-4283-bdbc-4ad58838f727',
cobenefit:
'Air quality improvement - stovetop improvements emit much less GHG, which in turn improves air quality.',
warehouseProjectId: 'e074bf77-e154-4f70-824e-093fa72cd066',
},
{
id: 'c22258b3-48a0-4d3c-9b08-22b1a455298e',
orgUid: '64ea3703-ced3-4e44-aa1f-03ac1a7533da',
cobenefit: 'Biodiversity - genetic biodiversity of existing species.',
warehouseProjectId: '688007ed-8163-4f63-8a57-1d49d6e50fd8',
},
];
Loading

0 comments on commit 45cf95e

Please sign in to comment.